-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Applied. Thanks, Sanka Kev Jackson wrote: > Hi, > > Today (after fixing a heinous memory leak on my machine), I have > time to go through the BSF code. I'll be posting a few patches > which 'tighten up' the source a little and make it a tad cleaner. > Here's the first. > > Enjoy, Kev > > ---------------------------------------------------------------------- > > > Index: . > =================================================================== > --- . (revision 438751) +++ . (working copy) @@ -92,7 +92,7 @@ in > = new FileReader(inFileName); } else { in = new > InputStreamReader(System.in); - inFileName = "<STDIN>"; + > inFileName = DEFAULT_IN_FILE_NAME; } > > BSFManager mgr = new BSFManager(); @@ -114,45 +114,41 @@ cb); > cb.print(pw, true); out.close(); - } else + } else { if > (mode.equals(ARG_VAL_EXEC)) { mgr.exec(language, inFileName, 0, 0, > IOUtils.getStringFromReader(in)); - } else /* eval */ { - > Object obj = - > mgr.eval(language, inFileName, 0, 0, > IOUtils.getStringFromReader(in)); - > + } else { /* eval */ + Object obj = mgr.eval(language, > inFileName, 0, 0, IOUtils.getStringFromReader(in)); // Try to > display the result. - if (obj instanceof java.awt.Component) { - > Frame f; - - if (obj > instanceof Frame) { - f = (Frame) obj; - > } else { - f = new Frame ("BSF Result: " + inFileName); - > f.add ((java.awt.Component) obj); - > } - - // Add a window > listener to quit on closing. - > f.addWindowListener( - > new WindowAdapter () { - > public void windowClosing (WindowEvent e) { - > System.exit (0); - > } - > }); - f.pack (); - > f.show (); + Frame f; + if (obj > instanceof Frame) { + f = (Frame) obj; + > } else { + f = new Frame ("BSF Result: " > + inFileName); + f.add > ((java.awt.Component) obj); + } + > // Add a window listener to quit on closing. + > f.addWindowListener( + new > WindowAdapter () { + public void > windowClosing (WindowEvent e) { + > System.exit (0); + } + > } + ); + f.pack (); + > f.show (); } else { - > System.err.println("Result: " + - > obj); + System.err.println("Result: " + > obj); } - System.err.println("Result: " + obj); } + } } > catch (BSFException e) { - e.printStackTrace(); > + e.printStackTrace(); } } + private static void printHelp() { > System.err.println("Usage:"); System.err.println(); @@ -183,4 > +179,4 @@ System.err.println( " [-out className] > default: " + DEFAULT_CLASS_NAME); } -} +} \ No newline at end of > file > > > ---------------------------------------------------------------------- > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] For > additional commands, e-mail: [EMAIL PROTECTED] - -- Sanka Samaranayake WSO2 Inc. T:+94-77-3506382 F:+94-11-2424304 http://sankas.blogspot.com/ http://www.wso2.net/ -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.2.1 (GNU/Linux) iD8DBQFE+dQS/Hd0ETKdgNIRAgppAJ9wcIIIaC+Ht8SNkXjCFT6pGpjMSQCfcUAw uoLTlBImvGh0GvRmXvcSruo= =OLdq -----END PGP SIGNATURE----- --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]