summaryrefslogtreecommitdiffstats
path: root/src/main/java/org/openslx/satellitedaemon/ftp/ThriftConnection.java
diff options
context:
space:
mode:
authorMichael Petretti2014-06-04 15:01:27 +0200
committerMichael Petretti2014-06-04 15:01:27 +0200
commit79211fe8f5e15d326f50c90067d0bc82f1f75bda (patch)
tree6ec168291e7797323db8948e9ba80e8394fda3f5 /src/main/java/org/openslx/satellitedaemon/ftp/ThriftConnection.java
parentMore ToDos solved. (diff)
downloadsatellite-daemon-79211fe8f5e15d326f50c90067d0bc82f1f75bda.tar.gz
satellite-daemon-79211fe8f5e15d326f50c90067d0bc82f1f75bda.tar.xz
satellite-daemon-79211fe8f5e15d326f50c90067d0bc82f1f75bda.zip
Added log messages.
Diffstat (limited to 'src/main/java/org/openslx/satellitedaemon/ftp/ThriftConnection.java')
-rw-r--r--src/main/java/org/openslx/satellitedaemon/ftp/ThriftConnection.java31
1 files changed, 22 insertions, 9 deletions
diff --git a/src/main/java/org/openslx/satellitedaemon/ftp/ThriftConnection.java b/src/main/java/org/openslx/satellitedaemon/ftp/ThriftConnection.java
index e9ab3af..e7fe0b8 100644
--- a/src/main/java/org/openslx/satellitedaemon/ftp/ThriftConnection.java
+++ b/src/main/java/org/openslx/satellitedaemon/ftp/ThriftConnection.java
@@ -47,7 +47,7 @@ public class ThriftConnection
try {
client = getConnection();
if ( client == null ) {
- log.info( "Client was null!" );
+ log.error( "Client was null!" );
return null;
}
@@ -91,7 +91,7 @@ public class ThriftConnection
* @return returns the client if successful.
*/
private static ImageServer.Client getConnection()
- throws ServerAuthenticationException, TException, UnrecoverableKeyException, NoSuchAlgorithmException, CertificateException, FileNotFoundException, KeyStoreException,
+ throws UnrecoverableKeyException, NoSuchAlgorithmException, CertificateException, FileNotFoundException, KeyStoreException,
IOException, InvalidKeyException, SignatureException
{
ImageServer.Client theClient = null;
@@ -110,13 +110,25 @@ public class ThriftConnection
}
}
if ( !isAuthenticated ) {
- String toEncrypt = client.startServerAuthentication( "uni-freiburg.de" );
- // System.out.println( toEncrypt );
- EncryptWithServerIdPublicKey rse = new EncryptWithServerIdPublicKey( "serverid", "password",
- "/home/michael/satellite-daemon/config/serverid.jks" );
- byte[] byteArray = rse.encryptString( toEncrypt );
- sSD = client.serverAuthenticate(
- "uni-freiburg.de", ByteBuffer.wrap( byteArray ) );
+ log.info( "ThriftConnection: Client not yet Authenticated. Trying..." );
+ String toEncrypt;
+ try {
+ toEncrypt = client.startServerAuthentication( "uni-freiburg.de" );
+ // System.out.println( toEncrypt );
+ EncryptWithServerIdPublicKey rse = new EncryptWithServerIdPublicKey( "serverid", "password",
+ "/home/michael/satellite-daemon/config/serverid.jks" );
+ byte[] byteArray = rse.encryptString( toEncrypt );
+ sSD = client.serverAuthenticate(
+ "uni-freiburg.de", ByteBuffer.wrap( byteArray ) );
+ } catch ( ServerAuthenticationException e ) {
+ log.error( "ThriftConnection: Server Authetication was not sucessful." );
+ e.printStackTrace();
+ } catch ( TException e ) {
+ log.error( "ThriftConnection: Server Authetication was not sucessful." );
+ e.printStackTrace();
+ }
+ log.info( "is Authenticated." );
+
}
return theClient;
}
@@ -131,6 +143,7 @@ public class ThriftConnection
TProtocol protocol = new TBinaryProtocol( transport );
newClient = new ImageServer.Client( protocol );
} catch ( TException x ) {
+ log.error( "ThriftConnection coudn't create new client." );
x.printStackTrace();
return null;
}