summaryrefslogtreecommitdiffstats
path: root/src/main/java/org/openslx/filetransfer/Downloader.java
diff options
context:
space:
mode:
authorBjörn Hagemeister2014-07-10 15:52:27 +0200
committerBjörn Hagemeister2014-07-10 15:52:27 +0200
commit60df6d9e884163f4eeb2d60b0ec0ccf20600825b (patch)
tree6139c280f63e914739ee0d6fa61f46e581687af4 /src/main/java/org/openslx/filetransfer/Downloader.java
parentChecking if socket is null before closing. (diff)
downloadmaster-sync-shared-60df6d9e884163f4eeb2d60b0ec0ccf20600825b.tar.gz
master-sync-shared-60df6d9e884163f4eeb2d60b0ec0ccf20600825b.tar.xz
master-sync-shared-60df6d9e884163f4eeb2d60b0ec0ccf20600825b.zip
Removed unnessecary TODOs and comments.
Diffstat (limited to 'src/main/java/org/openslx/filetransfer/Downloader.java')
-rw-r--r--src/main/java/org/openslx/filetransfer/Downloader.java28
1 files changed, 14 insertions, 14 deletions
diff --git a/src/main/java/org/openslx/filetransfer/Downloader.java b/src/main/java/org/openslx/filetransfer/Downloader.java
index 2d99c2a..b34401b 100644
--- a/src/main/java/org/openslx/filetransfer/Downloader.java
+++ b/src/main/java/org/openslx/filetransfer/Downloader.java
@@ -25,7 +25,7 @@ public class Downloader
private String RANGE = null;
private String outputFilename = null;
private String ERROR = null;
-
+
private static Logger log = Logger.getLogger( Downloader.class );
/***********************************************************************/
@@ -39,7 +39,6 @@ public class Downloader
public Downloader( String ip, int port, SSLContext context )
{
try {
- // TODO: Remove old code, that's why we have git.. ;)
// create socket.
sslSocketFactory = context.getSocketFactory();
@@ -115,8 +114,8 @@ public class Downloader
} catch ( IOException e ) {
e.printStackTrace();
readMetaData();
- if (ERROR != null) {
- if (ERROR == "timeout") {
+ if ( ERROR != null ) {
+ if ( ERROR == "timeout" ) {
log.info( "Socket timeout occured ... close connection." );
this.close();
}
@@ -151,8 +150,8 @@ public class Downloader
} catch ( IOException e ) {
e.printStackTrace();
readMetaData();
- if (ERROR != null) {
- if (ERROR == "timeout") {
+ if ( ERROR != null ) {
+ if ( ERROR == "timeout" ) {
log.info( "Socket timeout occured ... close connection." );
this.close();
}
@@ -283,9 +282,9 @@ public class Downloader
return false;
}
}
- } catch (SocketTimeoutException ste) {
+ } catch ( SocketTimeoutException ste ) {
ste.printStackTrace();
- sendErrorCode("timeout");
+ sendErrorCode( "timeout" );
log.info( "Socket Timeout occured in Downloader." );
this.close();
} catch ( Exception e ) {
@@ -306,8 +305,7 @@ public class Downloader
RandomAccessFile file = null;
try {
int length = getDiffOfRange();
- byte[] incoming = new byte[ 4000 ]; // TODO: größe Problematisch, abchecken.
-
+ byte[] incoming = new byte[ 4000 ];
int hasRead = 0;
file = new RandomAccessFile( new File( outputFilename ), "rw" );
file.seek( getStartOfRange() );
@@ -334,7 +332,7 @@ public class Downloader
this.close();
return false;
} finally {
- if (file != null) {
+ if ( file != null ) {
try {
file.close();
} catch ( IOException e ) {
@@ -374,12 +372,14 @@ public class Downloader
public void close()
{
try {
- if (satelliteSocket != null) {
+ if ( satelliteSocket != null ) {
this.satelliteSocket.close();
satelliteSocket = null;
}
- if (dataFromServer != null) dataFromServer.close();
- if (dataToServer != null) dataToServer.close();
+ if ( dataFromServer != null )
+ dataFromServer.close();
+ if ( dataToServer != null )
+ dataToServer.close();
} catch ( IOException e ) {
e.printStackTrace();
}