fix lib
[fanfix.git] / src / be / nikiroo / fanfix / library / RemoteLibrary.java
index e7b98282b422786eb95a077056a987039984cbfd..f1ff214d5671f3cf52bc4a82e1472a2d9b9e414f 100644 (file)
@@ -81,12 +81,12 @@ public class RemoteLibrary extends BasicLibrary {
        public RemoteLibrary(String key, String host, int port) {
                int index = -1;
                if (key != null) {
-                       key.indexOf('|');
+                       index = key.indexOf('|');
                }
 
                if (index >= 0) {
-                       this.key = key.substring(index + 1);
-                       this.subkey = key.substring(0, index);
+                       this.key = key.substring(0, index);
+                       this.subkey = key.substring(index + 1);
                } else {
                        this.key = key;
                        this.subkey = "";
@@ -143,11 +143,11 @@ public class RemoteLibrary extends BasicLibrary {
 
                                @Override
                                protected void onError(Exception e) {
-                                       // if (e instanceof SSLException) {
-                                       result[0] = Status.UNAUTHORIZED;
-                                       // } else {
-                                       // result[0] = Status.UNAVAILABLE;
-                                       // }
+                                       if (e instanceof SSLException) {
+                                               result[0] = Status.UNAUTHORIZED;
+                                       } else {
+                                               result[0] = Status.UNAVAILABLE;
+                                       }
                                }
                        }.connect();
                } catch (UnknownHostException e) {