diff options
Diffstat (limited to 'src/main/java/org/openslx/satellitedaemon/filetransfer/ThriftConnection.java')
-rw-r--r-- | src/main/java/org/openslx/satellitedaemon/filetransfer/ThriftConnection.java | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/src/main/java/org/openslx/satellitedaemon/filetransfer/ThriftConnection.java b/src/main/java/org/openslx/satellitedaemon/filetransfer/ThriftConnection.java index ab60d2f..da6c6df 100644 --- a/src/main/java/org/openslx/satellitedaemon/filetransfer/ThriftConnection.java +++ b/src/main/java/org/openslx/satellitedaemon/filetransfer/ThriftConnection.java @@ -18,10 +18,11 @@ import org.apache.thrift.protocol.TProtocol; import org.apache.thrift.transport.TFramedTransport; import org.apache.thrift.transport.TSocket; import org.apache.thrift.transport.TTransport; +import org.apache.thrift.transport.TTransportException; import org.openslx.imagemaster.crcchecker.CrcFile; import org.openslx.imagemaster.thrift.iface.AuthorizationError; import org.openslx.imagemaster.thrift.iface.AuthorizationException; -import org.openslx.imagemaster.thrift.iface.DownloadInfos; +import org.openslx.imagemaster.thrift.iface.DownloadData; import org.openslx.imagemaster.thrift.iface.ImageData; import org.openslx.imagemaster.thrift.iface.ImageDataError; import org.openslx.imagemaster.thrift.iface.ImageDataException; @@ -30,7 +31,7 @@ import org.openslx.imagemaster.thrift.iface.ServerAuthenticationException; import org.openslx.imagemaster.thrift.iface.ServerSessionData; import org.openslx.imagemaster.thrift.iface.UploadError; import org.openslx.imagemaster.thrift.iface.UploadException; -import org.openslx.imagemaster.thrift.iface.UploadInfos; +import org.openslx.imagemaster.thrift.iface.UploadData; import org.openslx.satellitedaemon.Globals; import org.openslx.satellitedaemon.db.DbImage; import org.openslx.satellitedaemon.db.DbImage.Status; @@ -60,7 +61,7 @@ public class ThriftConnection { * * @return returns 'null' if there is a problem. */ - public static UploadInfos getUploadInfos(ImageData imDat, String filename) { + public static UploadData getUploadInfos(ImageData imDat, String filename) { ImageServer.Client theClient = null; try { theClient = getConnection(); @@ -94,13 +95,14 @@ public class ThriftConnection { // TODO: Mark the Image as corrupted. } else if (e.getNumber().equals(UploadError.INVALID_CRC)) { // The CRC sum contained errors - crc = new CrcFile(filename); try { - if (!crc.isValid()) { - // TODO: Mark CRC-file as corrupted. - } + crc = new CrcFile(filename); } catch (IOException e1) { - log.error("IOERROR, while reading from CRC File" + filename); + // TODO Auto-generated catch block + e1.printStackTrace(); + } + if (!crc.isValid()) { + // TODO: Mark CRC-file as corrupted. } } else { e.printStackTrace(); @@ -155,7 +157,7 @@ public class ThriftConnection { * * @return returns 'null' if there is a problem. */ - public static DownloadInfos getDownloadInfos(DbImage imDat) { + public static DownloadData getDownloadInfos(DbImage imDat) { ImageServer.Client theClient = null; try { theClient = getConnection(); @@ -173,7 +175,7 @@ public class ThriftConnection { // The image requested is not known. // TODO: change field image_syncMode, so the image is not asked // for again. - // Now just changed status of image. Currently no possibility + // For now just changed status of image. Currently no possibility // for creating new useful state in DB. (Offenburg) log.info("Image not known. For skipping next time, mark as only_local."); imDat.updateStatus(Status.only_local); @@ -314,10 +316,9 @@ public class ThriftConnection { TProtocol protocol = new TBinaryProtocol(transport); newClient = new ImageServer.Client(protocol); log.debug("ThriftConnection: Made a new Client"); - } catch (TException x) { - // TODO: Exception handling - log.error("ThriftConnection coudn't create new client."); - x.printStackTrace(); + } catch (TTransportException tte) { + log.error("Transport could not be opened. Couldn't create new client."); + tte.printStackTrace(); return null; } return newClient; |