JAL-3026 fixes MigLayout, JSON parser
[jalview.git] / src / jalview / fts / service / pdb / PDBFTSRestClient.java
index a03cf14..d8ab7de 100644 (file)
@@ -83,7 +83,7 @@ public class PDBFTSRestClient extends FTSRestClient
    * @return the pdbResponse object for the given request
    * @throws Exception
    */
-  @SuppressWarnings("unused")
+  @SuppressWarnings({ "unused", "unchecked" })
   @Override
   public FTSRestResponse executeRequest(FTSRestRequest pdbRestRequest)
           throws Exception
@@ -133,16 +133,23 @@ public class PDBFTSRestClient extends FTSRestClient
               + (pdbRestRequest.isAllowUnpublishedEntries() ? ""
                       : " AND status:REL");
 
+      // Build request parameters for the REST Request
+
+      // BH 2018 the trick here is to coerce the classes in Javascript to be 
+      // different from the ones in Java yet still allow this to be correct for Java
+      Class<ClientResponse> clientResponseClass;
       if (/** @j2sNative true || */
       false)
       {
+        // JavaScript only -- coerce types to Java types for Java
         client = (Client) (Object) new jalview.javascript.web.Client();
+        clientResponseClass = (Class<ClientResponse>) (Object) jalview.javascript.web.ClientResponse.class;
       }
       else
       {
-        // Build request parameters for the REST Request
-        ClientConfig clientConfig = new DefaultClientConfig();
-        client = Client.create(clientConfig);
+        // Java only
+        client = Client.create(new DefaultClientConfig());
+        clientResponseClass = ClientResponse.class;
       }
 
       if (pdbRestRequest.isFacet())
@@ -169,7 +176,7 @@ public class PDBFTSRestClient extends FTSRestClient
 
       // Execute the REST request
       ClientResponse clientResponse = webResource
-              .accept(MediaType.APPLICATION_JSON).get(ClientResponse.class);
+              .accept(MediaType.APPLICATION_JSON).get(clientResponseClass );
 
       // Get the JSON string from the response object
       String responseString = clientResponse.getEntity(String.class);
@@ -470,4 +477,30 @@ public class PDBFTSRestClient extends FTSRestClient
     }
     return allDefaultDisplayedStructureDataColumns;
   }
+  
+  public static void main(String[] args) {
+    
+
+    String s = "e";
+
+    
+    char c = 'c';
+    char f = 'f';
+    s += c | f; 
+    int x = c&f;
+    int y = 2 & c;
+    int z = c ^ 5;
+    JSONParser jsonParser = new JSONParser();
+    try
+    {
+      JSONObject jsonObj = (JSONObject) jsonParser.parse("{\"a\":3}");
+      System.out.println(jsonObj);
+    } catch (ParseException e)
+    {
+      e.printStackTrace();
+    }
+    
+  }
+  
+  
 }