[Remoterengine-commits] r164 - pkg/RemoteREngine/inst/java_src/src/client/org/rosuda/REngine/remote/client
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Mon Sep 21 12:15:12 CEST 2009
Author: ian_long
Date: 2009-09-21 12:15:12 +0200 (Mon, 21 Sep 2009)
New Revision: 164
Modified:
pkg/RemoteREngine/inst/java_src/src/client/org/rosuda/REngine/remote/client/RemoteREngine.java
Log:
Prevent null pointer exceptions after problems with the file transfer
Modified: pkg/RemoteREngine/inst/java_src/src/client/org/rosuda/REngine/remote/client/RemoteREngine.java
===================================================================
--- pkg/RemoteREngine/inst/java_src/src/client/org/rosuda/REngine/remote/client/RemoteREngine.java 2009-09-21 03:37:04 UTC (rev 163)
+++ pkg/RemoteREngine/inst/java_src/src/client/org/rosuda/REngine/remote/client/RemoteREngine.java 2009-09-21 10:15:12 UTC (rev 164)
@@ -369,13 +369,16 @@
byte [] b = new byte[ RemoteREngineConstants.CHUNKSIZE ];
/* typical java IO stuff */
- int c = client_in.read(b) ;
- while( c >= 0 ){
- server_out.write( b, 0, c ) ;
- c = client_in.read(b) ;
+ try {
+ int c = client_in.read(b) ;
+ while( c >= 0 ){
+ server_out.write( b, 0, c ) ;
+ c = client_in.read(b) ;
+ }
+ } finally {
+ if (server_out != null) server_out.close();
+ if (client_in != null) client_in.close();
}
- server_out.close();
- client_in.close();
}
/**
@@ -403,13 +406,13 @@
success = true;
} finally {
try {
- server_in.close() ;
+ if (server_in != null) server_in.close() ;
} catch (Exception e) {}
try {
- client_out.close();
+ if (client_out != null) client_out.close();
} catch (Exception e) {}
if( delete ){
- server_in.delete();
+ if (server_in != null) server_in.delete();
}
server_in = null;
client_out = null;
More information about the Remoterengine-commits
mailing list