beanshell2
beanshell2 copied to clipboard
patch for deprecation warnings
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