Downgrades class to Java 1.6, reduces logging
authorNiels Erik G. Nielsen <nielserik@indexdata.com>
Tue, 9 Apr 2013 21:20:01 +0000 (17:20 -0400)
committerNiels Erik G. Nielsen <nielserik@indexdata.com>
Tue, 9 Apr 2013 21:20:01 +0000 (17:20 -0400)
src/main/java/com/indexdata/pz2utils4jsf/pazpar2/sp/ServiceProxyClient.java

index b7c2944..61464db 100644 (file)
@@ -2,8 +2,10 @@ package com.indexdata.pz2utils4jsf.pazpar2.sp;
 \r
 import static com.indexdata.pz2utils4jsf.utils.Utils.nl;\r
 \r
+import java.io.BufferedReader;\r
 import java.io.ByteArrayOutputStream;\r
 import java.io.File;\r
+import java.io.FileReader;\r
 import java.io.IOException;\r
 import java.util.ArrayList;\r
 import java.util.HashMap;\r
@@ -235,25 +237,23 @@ public class ServiceProxyClient implements SearchClient {
     HttpPost post = new HttpPost(serviceUrl+"?command=init&includeDebug=yes");\r
     File initDoc = new File(filePath);\r
     logger.info("Posting to SP: ");\r
-    //Path path = Paths.get(filePath);\r
-    /*\r
     if (logger.isDebugEnabled()) {\r
-      try (Scanner scanner =  new Scanner(path, "UTF-8")){\r
-        while (scanner.hasNextLine()){\r
-          System.out.println(scanner.nextLine());\r
-        }      \r
-      }     \r
+      BufferedReader reader = new BufferedReader(new FileReader(initDoc));\r
+      String line;\r
+      while ( (line = reader.readLine()) != null) {\r
+        System.out.println(line);\r
+      }\r
+      reader.close();\r
     }\r
-    */\r
     post.setEntity(new FileEntity(initDoc));\r
     byte[] response = client.execute(post, handler);\r
-    logger.info("Response on POST was: " + new String(response,"UTF-8"));    \r
+    logger.debug("Response on POST was: " + new String(response,"UTF-8"));    \r
     return response;\r
   }\r
   \r
   public String[] getInitDocPaths () {\r
-    logger.info("Get init doc paths ");\r
-    logger.info("length: " + initDocPaths.length);\r
+    logger.debug("Get init doc paths ");\r
+    logger.debug("length: " + initDocPaths.length);\r
     return initDocPaths;\r
   }\r
   \r
@@ -261,7 +261,7 @@ public class ServiceProxyClient implements SearchClient {
     HttpPost post = new HttpPost(serviceUrl+"?command=init&includeDebug=yes");\r
     post.setEntity(new ByteArrayEntity(initDoc));\r
     byte[] response = client.execute(post, handler);\r
-    logger.info("Response on POST was: " + new String(response,"UTF-8"));    \r
+    logger.debug("Response on POST was: " + new String(response,"UTF-8"));    \r
     return response;\r
   }\r
   \r