summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/isode')
-rw-r--r--src/com/isode/stroke/elements/TLSProceed.java3
-rw-r--r--src/com/isode/stroke/network/JavaConnection.java2
-rw-r--r--src/com/isode/stroke/network/JavaTLSConnectionFactory.java21
-rw-r--r--src/com/isode/stroke/tls/java/JSSEContext.java28
4 files changed, 14 insertions, 40 deletions
diff --git a/src/com/isode/stroke/elements/TLSProceed.java b/src/com/isode/stroke/elements/TLSProceed.java
index 4bebc64..a6f72fd 100644
--- a/src/com/isode/stroke/elements/TLSProceed.java
+++ b/src/com/isode/stroke/elements/TLSProceed.java
@@ -12,7 +12,6 @@ package com.isode.stroke.elements;
public class TLSProceed implements Element {
- public TLSProceed() {
- //
+ public TLSProceed() {
}
}
diff --git a/src/com/isode/stroke/network/JavaConnection.java b/src/com/isode/stroke/network/JavaConnection.java
index 9a3b5da..08cd497 100644
--- a/src/com/isode/stroke/network/JavaConnection.java
+++ b/src/com/isode/stroke/network/JavaConnection.java
@@ -103,7 +103,7 @@ public class JavaConnection extends Connection implements EventOwner {
private void handleConnected(final boolean error) {
eventLoop_.postEvent(new Callback() {
public void run() {
- onConnectFinished.emit(Boolean.valueOf(error));
+ onConnectFinished.emit(error);
}
});
}
diff --git a/src/com/isode/stroke/network/JavaTLSConnectionFactory.java b/src/com/isode/stroke/network/JavaTLSConnectionFactory.java
deleted file mode 100644
index 56ef917..0000000
--- a/src/com/isode/stroke/network/JavaTLSConnectionFactory.java
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * Copyright (c) 2012, Isode Limited, London, England.
- * All rights reserved.
- */
-
-package com.isode.stroke.network;
-
-import com.isode.stroke.eventloop.EventLoop;
-
-public class JavaTLSConnectionFactory implements ConnectionFactory {
-
- public JavaTLSConnectionFactory(EventLoop eventLoop) {
- this.eventLoop = eventLoop;
- }
-
- public Connection createConnection() {
- return JavaConnection.create(eventLoop);
- }
-
- private final EventLoop eventLoop;
-}
diff --git a/src/com/isode/stroke/tls/java/JSSEContext.java b/src/com/isode/stroke/tls/java/JSSEContext.java
index 1d8fba7..e052b19 100644
--- a/src/com/isode/stroke/tls/java/JSSEContext.java
+++ b/src/com/isode/stroke/tls/java/JSSEContext.java
@@ -43,22 +43,22 @@ import com.isode.stroke.tls.TLSContext;
public class JSSEContext extends TLSContext {
private static class JSSEContextError {
- public Throwable throwable;
- public String message;
+ public final Exception exception;
+ public final String message;
/**
* Create a new object
- * @param t throwable; may be null
+ * @param e exception; may be null
* @param m message; may be null
*/
- public JSSEContextError(Throwable t, String m) {
- throwable = t;
+ public JSSEContextError(Exception e, String m) {
+ exception = e;
message = m;
}
@Override
public String toString() {
return "JSSEContextError: " +
(message == null ? "No message" : message) + "; " +
- (throwable == null ? "No exception" : throwable.getMessage());
+ (exception == null ? "No exception" : exception.getMessage());
}
}
/**
@@ -83,11 +83,11 @@ public class JSSEContext extends TLSContext {
}
/**
* Emit an error, and keep track of which errors have been emitted
- * @param t the Throwable which caused this error (may be null)
+ * @param e the Exception which caused this error (may be null)
* @param m a String describing what caused this error (may be null)
*/
- private void emitError(Throwable t, String m) {
- JSSEContextError jsseContextError = new JSSEContextError(t,m);
+ private void emitError(Exception e, String m) {
+ JSSEContextError jsseContextError = new JSSEContextError(e, m);
errorsEmitted.add(jsseContextError);
onError.emit();
}
@@ -103,11 +103,8 @@ public class JSSEContext extends TLSContext {
}
private void doSetup() throws SSLException {
-
- // May throw NoSuchAlgorithmException
- SSLContext sslContext = null;
- sslContext = getSSLContext();
+ SSLContext sslContext = getSSLContext();
if (sslContext == null) {
throw new SSLException("Could not create SSLContext");
@@ -236,8 +233,7 @@ public class JSSEContext extends TLSContext {
if (bytesProduced > 0) {
unwrappedReceived.flip();
- byte[] result = new byte[0];
- result = new byte[unwrappedReceived.remaining()];
+ byte[] result = new byte[unwrappedReceived.remaining()];
unwrappedReceived.get(result);
unwrappedReceived.compact();
byteArray = new ByteArray(result);
@@ -599,7 +595,7 @@ public class JSSEContext extends TLSContext {
String errors = null;
if (hasError()) {
errors = "; errors emitted:";
- for (JSSEContextError e:errorsEmitted) {
+ for (JSSEContextError e : errorsEmitted) {
errors += "\n " + e;
}
}