Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

patch for deprecation warnings #84

Open
GoogleCodeExporter opened this issue Apr 22, 2015 · 0 comments
Open

patch for deprecation warnings #84

GoogleCodeExporter opened this issue Apr 22, 2015 · 0 comments

Comments

@GoogleCodeExporter
Copy link

can't think off hand what to do about set caret....
but these few trivial changes remove deprecation warnings.

Index: src/bsh/Remote.java
===================================================================
--- src/bsh/Remote.java (revision 124)
+++ src/bsh/Remote.java (working copy)
@@ -149,15 +149,15 @@
        StringBuilder sb = new StringBuilder();
        sb.append( "bsh.client=Remote" );
        sb.append( "&bsh.script=" );
-       sb.append( URLEncoder.encode( text ) );
-       /*
-       // This requires Java 1.3
+       //sb.append( URLEncoder.encode( text ) );
+       
+       // This requires Java 1.3 -- also needed in latest Java to avoid deprecation
        try {
            sb.append( URLEncoder.encode( text, "8859_1" ) );
        } catch ( UnsupportedEncodingException e ) {
            e.printStackTrace();
        }
-       */
+       
        String formData = sb.toString(  );

        try {
Index: src/bsh/classpath/BshClassPath.java
===================================================================
--- src/bsh/classpath/BshClassPath.java (revision 124)
+++ src/bsh/classpath/BshClassPath.java (working copy)
@@ -590,7 +590,7 @@
                // Java deals with relative paths for it's bootstrap loader
                // but JARClassLoader doesn't.
                urls[i] = new File( 
-                   new File(paths[i]).getCanonicalPath() ).toURL();
+                   new File(paths[i]).getCanonicalPath() ).toURI().toURL();
        } catch ( IOException e ) {
            throw new ClassPathException("can't parse class path: "+e);
        }
@@ -662,7 +662,7 @@
            {
                //String rtjar = System.getProperty("java.home")+"/lib/rt.jar";
                String rtjar = getRTJarPath();
-               URL url = new File( rtjar ).toURL();
+               URL url = new File( rtjar ).toURI().toURL();
                bootClassPath = new BshClassPath( 
                    "Boot Class Path", new URL[] { url } );
            } catch ( MalformedURLException e ) {
@@ -754,7 +754,7 @@
    public static void main( String [] args ) throws Exception {
        URL [] urls = new URL [ args.length ];
        for(int i=0; i< args.length; i++)
-           urls[i] =  new File(args[i]).toURL();
+           urls[i] =  new File(args[i]).toURI().toURL();
        BshClassPath bcp = new BshClassPath( "Test", urls );
    }

Index: src/bsh/util/AWTConsole.java
===================================================================
--- src/bsh/util/AWTConsole.java    (revision 124)
+++ src/bsh/util/AWTConsole.java    (working copy)
@@ -325,7 +325,7 @@
        final Frame f = new Frame("Bsh Console");
        f.add(console, "Center");
        f.pack();
-       f.show();
+       f.setVisible(true);
        f.addWindowListener( new WindowAdapter() {
            public void windowClosing( WindowEvent e ) {
                f.dispose();


Original issue reported on code.google.com by codifies on 12 Feb 2013 at 12:48

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant