summaryrefslogtreecommitdiffstats
path: root/src/main/java/org/openslx/satellitedaemon/filetransfer/ThriftConnection.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/org/openslx/satellitedaemon/filetransfer/ThriftConnection.java')
-rw-r--r--src/main/java/org/openslx/satellitedaemon/filetransfer/ThriftConnection.java32
1 files changed, 20 insertions, 12 deletions
diff --git a/src/main/java/org/openslx/satellitedaemon/filetransfer/ThriftConnection.java b/src/main/java/org/openslx/satellitedaemon/filetransfer/ThriftConnection.java
index 673be05..614fb24 100644
--- a/src/main/java/org/openslx/satellitedaemon/filetransfer/ThriftConnection.java
+++ b/src/main/java/org/openslx/satellitedaemon/filetransfer/ThriftConnection.java
@@ -62,24 +62,32 @@ public class ThriftConnection {
*
* @return returns 'null' if there is a problem.
*/
- public static UploadData getUploadInfos(ImageData imDat, String filename) {
+ public static UploadData getUploadInfos(ImageData imDat, String path) {
ImageServer.Client theClient = null;
+ String crcPath = path.concat(".crc");
try {
theClient = getConnection();
if (theClient == null) {
log.error("Client was null!");
return null;
}
-
- crc = new CrcFile(filename);
- log.info("Made CRCFile from " + filename);
- log.info("crc.getCrcSums( ).size = " + crc.getCrcSums().size());
- // log.info( "crc.getMasterSum() : " + crc.getMasterSum() );
- // for ( int i = 0; i < crc.getCrcSums().size() - 1; i++ ) {
- // log.info( "crc.getCRCSum() : " + crc.getCRCSum( i ) );
- // }
- return theClient
- .submitImage(sSD.sessionId, imDat, crc.getCrcSums());
+ List<Integer> crcSums = null;
+ try {
+ crc = new CrcFile(crcPath);
+ log.info("Made CRCFile from " + crcPath);
+ log.info("crc.getCrcSums( ).size = " + crc.getCrcSums().size());
+ // log.info( "crc.getMasterSum() : " + crc.getMasterSum() );
+ // for ( int i = 0; i < crc.getCrcSums().size() - 1; i++ ) {
+ // log.info( "crc.getCRCSum() : " + crc.getCRCSum( i ) );
+ // }
+ crcSums = crc.getCrcSums();
+ return theClient
+ .submitImage(sSD.sessionId, imDat, crcSums);
+ } catch (FileNotFoundException e) {
+ log.debug("crcFile " + crcPath + " not found.");
+ return theClient
+ .submitImage(sSD.sessionId, imDat, crcSums);
+ }
} catch (ImageDataException e) {
if (e.isSetNumber()
&& e.getNumber().equals(ImageDataError.INVALID_DATA)) {
@@ -97,7 +105,7 @@ public class ThriftConnection {
} else if (e.getNumber().equals(UploadError.INVALID_CRC)) {
// The CRC sum contained errors
try {
- crc = new CrcFile(filename);
+ crc = new CrcFile(crcPath);
} catch (IOException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();