Marvin View applet: preventing stack trace window

User a2dc6ee36c

09-12-2009 03:04:56

Hello,


I need some help with Marvin View applet.


Is there a way to supress or prevent Marvin View from throwing exception stack trace (like MOLFormatException) in a popup window.


Following is the relevant part of the code used to display the chemical structure on my web page. When the MOL string is incorrect or incomplete, exception message pops up in a window. In such cases we don't want to display the stacktrace. In such cases, our requirement is to not to display any image or some message in the same applet or web page (not showing a popup window).


 <!--
mview_begin("/mavin", 200, 200);
mview_param("rows", "1");
mview_param("cols", "1");
mview_param("cell0_0",'\n-ISIS-  07160915302D\n\n ......');
mview_end();
//-->


Any help is much appreciated.


Thanks in advance.


Regards


Praveen


 

ChemAxon 7c2d26e5cf

09-12-2009 17:03:13

In current Marvin applet, there is no way to switch off displaying error message by incorrect molecule.


To prevent error message, I suggest to check the molecule before passing it to the applet. I recommend to send the molecule to the server to check its validity with the Marvin Beans API.

User a2dc6ee36c

09-12-2009 18:07:38

Thanks Tamas,


As you suggested I am planning to perform a validation (using following code snippet) before invoking the applet.


 StringBuffer StringBuffer1 = new StringBuffer("MOL String");


            ByteArrayInputStream Bis1 = new ByteArrayInputStream(StringBuffer1.toString().getBytes("UTF-8"));


           


            MolImporter importer;


            try {


            importer = new MolImporter(Bis1);


            Molecule mol = importer.read();


            } catch(MolFormatException mex) {


                  //incorrect MOL String


// So in case of MOL format exception we’ll not display the image.


                  System.out.println(mex);


            } catch(IOException ioex) {


                  System.out.println(ioex);


            }