[Remoterengine-commits] r202 - pkg/RemoteREngine/inst/java_src/src/server/org/rosuda/REngine/remote/server/files
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Sat Oct 3 05:53:53 CEST 2009
Author: ian_long
Date: 2009-10-03 05:53:52 +0200 (Sat, 03 Oct 2009)
New Revision: 202
Modified:
pkg/RemoteREngine/inst/java_src/src/server/org/rosuda/REngine/remote/server/files/RemoteFileInputStream_Server.java
pkg/RemoteREngine/inst/java_src/src/server/org/rosuda/REngine/remote/server/files/RemoteFileOutputStream_Server.java
Log:
Add logging messages for errors generated during the file transfer process
Modified: pkg/RemoteREngine/inst/java_src/src/server/org/rosuda/REngine/remote/server/files/RemoteFileInputStream_Server.java
===================================================================
--- pkg/RemoteREngine/inst/java_src/src/server/org/rosuda/REngine/remote/server/files/RemoteFileInputStream_Server.java 2009-10-03 03:52:50 UTC (rev 201)
+++ pkg/RemoteREngine/inst/java_src/src/server/org/rosuda/REngine/remote/server/files/RemoteFileInputStream_Server.java 2009-10-03 03:53:52 UTC (rev 202)
@@ -31,6 +31,8 @@
import org.rosuda.REngine.remote.common.exceptions.ServerSideIOException;
import org.rosuda.REngine.remote.common.files.FileChunk;
import org.rosuda.REngine.remote.common.files.RemoteFileInputStream;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* Default Remote File Input stream implementation, backed by an
@@ -45,7 +47,8 @@
*
*/
public class RemoteFileInputStream_Server implements RemoteFileInputStream {
-
+ private final Logger logger = LoggerFactory.getLogger(org.rosuda.REngine.remote.server.files.RemoteFileInputStream_Server.class);
+
/**
* The default size of the buffer
*/
@@ -77,6 +80,7 @@
try{
stream = new BufferedInputStream( new FileInputStream( file ) );
} catch( IOException ioe ){
+ logger.error(ioe.getClass().getName() + ": " + ioe.getMessage(),ioe);
throw new ServerSideIOException( ioe ) ;
}
}
@@ -96,6 +100,7 @@
try{
res = stream.available() ;
} catch( IOException ioe){
+ logger.error(ioe.getClass().getName() + ": " + ioe.getMessage(),ioe);
throw new ServerSideIOException( ioe ) ;
}
return res;
@@ -105,7 +110,10 @@
try{
stream.close() ;
} catch( IOException ioe){
+ logger.error(ioe.getClass().getName() + ": " + ioe.getMessage(),ioe);
throw new ServerSideIOException( ioe ) ;
+ } finally {
+ stream = null;
}
}
@@ -121,6 +129,7 @@
try{
stream.reset() ;
} catch(IOException ioe){
+ logger.error(ioe.getClass().getName() + ": " + ioe.getMessage(),ioe);
throw new ServerSideIOException( ioe ) ;
}
}
@@ -130,6 +139,7 @@
try{
res = stream.skip( n ) ;
} catch( IOException ioe){
+ logger.error(ioe.getClass().getName() + ": " + ioe.getMessage(),ioe);
throw new ServerSideIOException( ioe ) ;
}
return res;
@@ -144,6 +154,7 @@
try{
c = stream.read( buffer ) ;
} catch( IOException ioe){
+ logger.error(ioe.getClass().getName() + ": " + ioe.getMessage(),ioe);
throw new ServerSideIOException( ioe ) ;
}
@@ -159,7 +170,13 @@
}
public boolean delete() throws RemoteException {
- return file.delete() ;
+ boolean success = file.delete();
+ if (!success) {
+ logger.error("Failed to delete: " + file.getAbsolutePath());
+ } else {
+ if (logger.isDebugEnabled()) logger.debug("Successfully deleted {}",file.getAbsoluteFile());
+ }
+ return success ;
}
}
Modified: pkg/RemoteREngine/inst/java_src/src/server/org/rosuda/REngine/remote/server/files/RemoteFileOutputStream_Server.java
===================================================================
--- pkg/RemoteREngine/inst/java_src/src/server/org/rosuda/REngine/remote/server/files/RemoteFileOutputStream_Server.java 2009-10-03 03:52:50 UTC (rev 201)
+++ pkg/RemoteREngine/inst/java_src/src/server/org/rosuda/REngine/remote/server/files/RemoteFileOutputStream_Server.java 2009-10-03 03:53:52 UTC (rev 202)
@@ -26,6 +26,8 @@
import org.rosuda.REngine.remote.common.exceptions.ServerSideIOException;
import org.rosuda.REngine.remote.common.files.RemoteFileOutputStream;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* Implementation of {@link RemoteFileOutputStream} backed by
@@ -36,6 +38,8 @@
*/
public class RemoteFileOutputStream_Server implements RemoteFileOutputStream {
+ private final Logger logger = LoggerFactory.getLogger(org.rosuda.REngine.remote.server.files.RemoteFileOutputStream_Server.class);
+
/**
* The back end {@link FileOutputStream}
*/
@@ -50,6 +54,7 @@
try{
stream = new FileOutputStream( file ) ;
} catch( IOException ioe){
+ logger.error(ioe.getClass().getName() + ": " + ioe.getMessage(),ioe);
throw new ServerSideIOException( ioe ) ;
}
}
@@ -67,7 +72,10 @@
try{
stream.close() ;
} catch( IOException ioe){
+ logger.error(ioe.getClass().getName() + ": " + ioe.getMessage(),ioe);
throw new ServerSideIOException( ioe ) ;
+ } finally {
+ stream = null;
}
}
@@ -75,6 +83,7 @@
try{
stream.flush();
} catch( IOException ioe){
+ logger.error(ioe.getClass().getName() + ": " + ioe.getMessage(),ioe);
throw new ServerSideIOException( ioe ) ;
}
}
@@ -83,6 +92,7 @@
try{
stream.write( b ) ;
} catch( IOException ioe){
+ logger.error(ioe.getClass().getName() + ": " + ioe.getMessage(),ioe);
throw new ServerSideIOException( ioe );
}
}
@@ -91,6 +101,7 @@
try{
stream.write( b, off, len) ;
} catch( IOException ioe){
+ logger.error(ioe.getClass().getName() + ": " + ioe.getMessage(),ioe);
throw new ServerSideIOException( ioe ) ;
}
}
More information about the Remoterengine-commits
mailing list