You are viewing a plain text version of this content. The canonical link for it is here.
Posted to bsf-dev@jakarta.apache.org by Sanka Samaranayke <ss...@gmail.com> on 2006/09/02 20:57:22 UTC

Re: [patch]org.apache.bsf.Main - remove strange indenting, use static final strings where available

-----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: bsf-dev-unsubscribe@jakarta.apache.org For
> additional commands, e-mail: bsf-dev-help@jakarta.apache.org


- --
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: bsf-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: bsf-dev-help@jakarta.apache.org


Re: [patch]org.apache.bsf.Main - remove strange indenting, use static final strings where available

Posted by Kev Jackson <fo...@gmail.com>.
> Applied.
> 
> Thanks,
> Sanka

Thanks Sanka,

As mentioned previously, when you have alpha for bsf3 ready let me know
and I'll help with a quick Mac OSX sanity check (powerpc) - I think
Henning can probably do a test on Mac OSX (intel).

I probably won't have much time this week to sift through things, but if
I get a spare afternoon, I'll throw some more code your way ;)

Kev


---------------------------------------------------------------------
To unsubscribe, e-mail: bsf-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: bsf-dev-help@jakarta.apache.org