manifoldcf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kwri...@apache.org
Subject svn commit: r1788418 [1/2] - in /manifoldcf/trunk: ./ connectors/amazons3/ connectors/confluence/ connectors/confluence/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/confluence/client/ connectors/confluence/connector/src/main/java/or...
Date Fri, 24 Mar 2017 11:55:00 GMT
Author: kwright
Date: Fri Mar 24 11:55:00 2017
New Revision: 1788418

URL: http://svn.apache.org/viewvc?rev=1788418&view=rev
Log:
Fix for CONNECTORS-1399.  Remove all dependencies on json.jar in our code.  Replaced with json-simple.

Modified:
    manifoldcf/trunk/   (props changed)
    manifoldcf/trunk/CHANGES.txt
    manifoldcf/trunk/build.xml
    manifoldcf/trunk/connectors/amazons3/build.xml
    manifoldcf/trunk/connectors/amazons3/pom.xml
    manifoldcf/trunk/connectors/confluence/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/confluence/client/ConfluenceClient.java
    manifoldcf/trunk/connectors/confluence/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/confluence/model/Attachment.java
    manifoldcf/trunk/connectors/confluence/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/confluence/model/ConfluenceResponse.java
    manifoldcf/trunk/connectors/confluence/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/confluence/model/Label.java
    manifoldcf/trunk/connectors/confluence/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/confluence/model/Page.java
    manifoldcf/trunk/connectors/confluence/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/confluence/model/Space.java
    manifoldcf/trunk/connectors/confluence/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/confluence/model/Spaces.java
    manifoldcf/trunk/connectors/confluence/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/confluence/model/builder/ConfluenceResourceBuilder.java
    manifoldcf/trunk/connectors/confluence/pom.xml
    manifoldcf/trunk/connectors/dropbox/build.xml
    manifoldcf/trunk/connectors/dropbox/pom.xml
    manifoldcf/trunk/connectors/elasticsearch/connector/src/main/java/org/apache/manifoldcf/agents/output/elasticsearch/ElasticSearchConnector.java
    manifoldcf/trunk/connectors/filesystem/connector/src/main/java/org/apache/manifoldcf/agents/output/filesystem/FileOutputConnector.java
    manifoldcf/trunk/connectors/hdfs/connector/src/main/java/org/apache/manifoldcf/agents/output/hdfs/HDFSOutputConnector.java
    manifoldcf/trunk/connectors/jira/pom.xml
    manifoldcf/trunk/connectors/opensearchserver/connector/src/main/java/org/apache/manifoldcf/agents/output/opensearchserver/OpenSearchServerConnector.java
    manifoldcf/trunk/connectors/searchblox/connector/src/main/java/org/apache/manifoldcf/agents/output/searchblox/SearchBloxDocument.java
    manifoldcf/trunk/connectors/searchblox/connector/src/test/java/org/apache/manifoldcf/agents/output/searchblox/SearchBloxDocumentTest.java
    manifoldcf/trunk/dist-license/LICENSE.txt
    manifoldcf/trunk/framework/build.xml
    manifoldcf/trunk/framework/buildfiles/connector-build.xml
    manifoldcf/trunk/framework/core/pom.xml
    manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/interfaces/Configuration.java
    manifoldcf/trunk/lib-license/LICENSE.txt
    manifoldcf/trunk/pom.xml

Propchange: manifoldcf/trunk/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Mar 24 11:55:00 2017
@@ -67,6 +67,7 @@
 /manifoldcf/branches/CONNECTORS-1308:1741766-1741789
 /manifoldcf/branches/CONNECTORS-1313:1742768-1743158
 /manifoldcf/branches/CONNECTORS-1344:1770553-1771642
+/manifoldcf/branches/CONNECTORS-1399:1788351-1788417
 /manifoldcf/branches/CONNECTORS-470:1349741-1360750,1360808
 /manifoldcf/branches/CONNECTORS-474:1349741-1353803
 /manifoldcf/branches/CONNECTORS-488:1363249-1364203

Modified: manifoldcf/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/CHANGES.txt?rev=1788418&r1=1788417&r2=1788418&view=diff
==============================================================================
--- manifoldcf/trunk/CHANGES.txt (original)
+++ manifoldcf/trunk/CHANGES.txt Fri Mar 24 11:55:00 2017
@@ -3,6 +3,10 @@ $Id$
 
 ======================= 2.7-dev =====================
 
+CONNECTORS_1399: Remove all dependencies on json.jar, as per
+Apache Legal advice.
+(Karl Wright)
+
 CONNECTORS-1398: Accept RDF feeds that use lowercase "rdf", even
 though that's not legal by the spec.
 (Joachim Butz, Karl Wright)

Modified: manifoldcf/trunk/build.xml
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/build.xml?rev=1788418&r1=1788417&r2=1788418&view=diff
==============================================================================
--- manifoldcf/trunk/build.xml (original)
+++ manifoldcf/trunk/build.xml Fri Mar 24 11:55:00 2017
@@ -37,7 +37,6 @@
     <property name="xerces.version" value="2.10.0"/>
     <property name="zookeeper.version" value="3.4.8"/>
     <property name="mongodb.version" value="2.11.3"/>
-    <property name="json.version" value="20160212"/>
     <property name="postgresql.version" value="9.1-901.jdbc4"/>
     <property name="axis.version" value="1.4"/>
     <property name="saaj-api.version" value="1.3"/>
@@ -930,17 +929,6 @@ Use Apache Forrest version forrest-0.9-d
         </antcall>
     </target>
 
-    <target name="download-json">
-        <mkdir dir="lib"/>
-        <antcall target="download-via-maven">
-            <param name="project-path" value="org/json"/>
-            <param name="artifact-version" value="${json.version}"/>
-            <param name="target" value="lib"/>
-            <param name="artifact-name" value="json"/>
-            <param name="artifact-type" value="jar"/>
-        </antcall>
-    </target>
-    
     <target name="download-hsqldb">
         <mkdir dir="lib"/>
         <antcall target="download-via-maven">
@@ -1782,6 +1770,16 @@ Use Apache Forrest version forrest-0.9-d
         </antcall>
     </target>
     
+    <target name="download-json-simple">
+        <antcall target="download-via-maven">
+            <param name="target" value="lib"/>
+            <param name="project-path" value="com/googlecode/json-simple"/>
+            <param name="artifact-version" value="${json-simple.version}"/>
+            <param name="artifact-name" value="json-simple"/>
+            <param name="artifact-type" value="jar"/>
+        </antcall>
+    </target>
+
    <target name="download-dropbox-client">
         <mkdir dir="lib"/>
         <antcall target="download-via-maven">
@@ -1791,13 +1789,6 @@ Use Apache Forrest version forrest-0.9-d
             <param name="artifact-name" value="dropbox-client"/>
             <param name="artifact-type" value="jar"/>
         </antcall>
-        <antcall target="download-via-maven">
-            <param name="target" value="lib"/>
-            <param name="project-path" value="com/googlecode/json-simple"/>
-            <param name="artifact-version" value="${json-simple.version}"/>
-            <param name="artifact-name" value="json-simple"/>
-            <param name="artifact-type" value="jar"/>
-        </antcall>
     </target>
   
     <target name="download-jira-client">
@@ -2523,7 +2514,7 @@ Use Apache Forrest version forrest-0.9-d
         </antcall>
     </target>
 
-    <target name="make-core-deps" depends="download-forbidden-checks,download-kafka-client,download-joda-time,download-aws-sdk,download-resteasy,download-jsoup,download-mockito,download-alfresco-webscript-plugin,download-alfresco-indexer-client,download-mongo-java-driver,download-jira-client,download-google-api-client,download-dropbox-client,download-solrj,download-zookeeper,download-httpcomponents,download-json,download-hsqldb,download-xerces,download-commons,download-elasticsearch-plugin,download-solr-plugins,download-sharepoint-plugins,download-jstl,download-xmlgraphics-commons,download-woodstox,download-xmlsec,download-xml-apis,download-wss4j,download-velocity,download-streambuffer,download-stax,download-servlet-api,download-xml-resolver,download-osgi,download-opensaml,download-mimepull,download-mail,download-log4j,download-junit,download-jaxws,download-glassfish,download-jaxb,download-tomcat,download-h2,download-h2-support,download-geronimo-specs,download-fop,download-postgresq
 l,download-axis,download-saaj,download-wsdl4j,download-castor,download-jetty,download-slf4j,download-xalan,download-activation,download-avalon-framework,download-poi,download-chemistry,download-ecj,download-hadoop,download-htrace,download-protobuf,download-tika,download-jackson">
+    <target name="make-core-deps" depends="download-forbidden-checks,download-json-simple,download-kafka-client,download-joda-time,download-aws-sdk,download-resteasy,download-jsoup,download-mockito,download-alfresco-webscript-plugin,download-alfresco-indexer-client,download-mongo-java-driver,download-jira-client,download-google-api-client,download-dropbox-client,download-solrj,download-zookeeper,download-httpcomponents,download-hsqldb,download-xerces,download-commons,download-elasticsearch-plugin,download-solr-plugins,download-sharepoint-plugins,download-jstl,download-xmlgraphics-commons,download-woodstox,download-xmlsec,download-xml-apis,download-wss4j,download-velocity,download-streambuffer,download-stax,download-servlet-api,download-xml-resolver,download-osgi,download-opensaml,download-mimepull,download-mail,download-log4j,download-junit,download-jaxws,download-glassfish,download-jaxb,download-tomcat,download-h2,download-h2-support,download-geronimo-specs,download-fop,download-po
 stgresql,download-axis,download-saaj,download-wsdl4j,download-castor,download-jetty,download-slf4j,download-xalan,download-activation,download-avalon-framework,download-poi,download-chemistry,download-ecj,download-hadoop,download-htrace,download-protobuf,download-tika,download-jackson">
         <copy todir="lib">
             <fileset dir="lib-license" includes="*.txt"/>
         </copy>

Modified: manifoldcf/trunk/connectors/amazons3/build.xml
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/connectors/amazons3/build.xml?rev=1788418&r1=1788417&r2=1788418&view=diff
==============================================================================
--- manifoldcf/trunk/connectors/amazons3/build.xml (original)
+++ manifoldcf/trunk/connectors/amazons3/build.xml Fri Mar 24 11:55:00 2017
@@ -39,7 +39,6 @@
             <include name="jackson-databind*.jar"/>
             <include name="jackson-annotations*.jar"/>
             <include name="joda-time*.jar"/>
-            <include name="json-simple*.jar"/>
         </fileset>
     </path>
 
@@ -53,7 +52,6 @@
               <include name="jackson-databind*.jar"/>
               <include name="jackson-annotations*.jar"/>
               <include name="joda-time*.jar"/>
-              <include name="json-simple*.jar"/>
             </fileset>
         </copy>
     </target>

Modified: manifoldcf/trunk/connectors/amazons3/pom.xml
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/connectors/amazons3/pom.xml?rev=1788418&r1=1788417&r2=1788418&view=diff
==============================================================================
--- manifoldcf/trunk/connectors/amazons3/pom.xml (original)
+++ manifoldcf/trunk/connectors/amazons3/pom.xml Fri Mar 24 11:55:00 2017
@@ -392,11 +392,6 @@
       <version>${log4j.version}</version>
     </dependency>
     <dependency>
-      <groupId>com.googlecode.json-simple</groupId>
-      <artifactId>json-simple</artifactId>
-      <version>${json.simple.version}</version>
-    </dependency>
-    <dependency>
       <groupId>commons-codec</groupId>
       <artifactId>commons-codec</artifactId>
       <version>${commons-codec.version}</version>

Modified: manifoldcf/trunk/connectors/confluence/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/confluence/client/ConfluenceClient.java
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/connectors/confluence/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/confluence/client/ConfluenceClient.java?rev=1788418&r1=1788417&r2=1788418&view=diff
==============================================================================
--- manifoldcf/trunk/connectors/confluence/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/confluence/client/ConfluenceClient.java (original)
+++ manifoldcf/trunk/connectors/confluence/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/confluence/client/ConfluenceClient.java Fri Mar 24 11:55:00 2017
@@ -19,6 +19,7 @@ package org.apache.manifoldcf.crawler.co
 
 import java.io.ByteArrayInputStream;
 import java.io.IOException;
+import java.io.StringReader;
 import java.nio.charset.Charset;
 import java.util.List;
 import java.util.Locale;
@@ -60,9 +61,10 @@ import org.apache.manifoldcf.crawler.con
 import org.apache.manifoldcf.crawler.connectors.confluence.model.Space;
 import org.apache.manifoldcf.crawler.connectors.confluence.model.Spaces;
 import org.apache.manifoldcf.crawler.connectors.confluence.model.builder.ConfluenceResourceBuilder;
-import org.json.JSONArray;
-import org.json.JSONException;
-import org.json.JSONObject;
+import org.json.simple.JSONArray;
+import org.json.simple.JSONObject;
+import org.json.simple.parser.JSONParser;
+import org.json.simple.parser.ParseException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -337,21 +339,15 @@ public class ConfluenceClient {
       throws Exception {
     String stringEntity = EntityUtils.toString(entity);
 
-    JSONObject responseObject;
-    try {
-      responseObject = new JSONObject(stringEntity);
-      ConfluenceResponse<T> response = ConfluenceResponse
-          .fromJson(responseObject, builder);
-      if (response.getResults().size() == 0) {
-        logger.debug("[Processing] No {} found in the Confluence response", builder.getType().getSimpleName());
-      }
-
-      return response;
-    } catch (JSONException e) {
-      logger.debug("Error parsing JSON response");
-      throw new Exception();
+    final JSONParser parser = new JSONParser();
+    final JSONObject responseObject = (JSONObject)parser.parse(new StringReader(stringEntity));
+    ConfluenceResponse<T> response = ConfluenceResponse
+        .fromJson(responseObject, builder);
+    if (response.getResults().size() == 0) {
+      logger.debug("[Processing] No {} found in the Confluence response", builder.getType().getSimpleName());
     }
 
+    return response;
   }
   
   /**
@@ -590,16 +586,11 @@ public class ConfluenceClient {
   private MutablePage pageFromHttpEntity(HttpEntity entity) throws Exception {
     String stringEntity = EntityUtils.toString(entity);
 
-    JSONObject responseObject;
-    try {
-      responseObject = new JSONObject(stringEntity);
-      @SuppressWarnings("unchecked")
-      MutablePage response = ((ConfluenceResourceBuilder<MutablePage>)MutablePage.builder()).fromJson(responseObject, new MutablePage());
-      return response;
-    } catch (JSONException e) {
-      logger.debug("Error parsing JSON page response data");
-      throw new Exception("Error parsing JSON page response data");
-    }
+    final JSONParser parser = new JSONParser();
+    final JSONObject responseObject = (JSONObject)parser.parse(new StringReader(stringEntity));
+    @SuppressWarnings("unchecked")
+    MutablePage response = ((ConfluenceResourceBuilder<MutablePage>)MutablePage.builder()).fromJson(responseObject, new MutablePage());
+    return response;
   }
 
   /**
@@ -611,17 +602,12 @@ public class ConfluenceClient {
   private MutableAttachment attachmentFromHttpEntity(HttpEntity entity)
       throws Exception {
     String stringEntity = EntityUtils.toString(entity);
-    JSONObject responseObject;
-    try {
-      responseObject = new JSONObject(stringEntity);
-      MutableAttachment response = (MutableAttachment) Attachment
-          .builder()
-          .fromJson(responseObject, new MutableAttachment());
-      return response;
-    } catch (JSONException e) {
-      logger.debug("Error parsing JSON page response data");
-      throw new Exception("Error parsing JSON page response data");
-    }
+    final JSONParser parser = new JSONParser();
+    final JSONObject responseObject = (JSONObject)parser.parse(new StringReader(stringEntity));;
+    MutableAttachment response = (MutableAttachment) Attachment
+        .builder()
+        .fromJson(responseObject, new MutableAttachment());
+    return response;
   }
 
   /**
@@ -681,10 +667,10 @@ public class ConfluenceClient {
         url, username, space.getKey());
 
     HttpPost httpPost = createPostRequest(url);
-    JSONArray jsonArray = new JSONArray();
-    jsonArray.put(space.getKey());
-    jsonArray.put(username);
-    StringEntity stringEntity = new StringEntity(jsonArray.toString());
+    final JSONArray jsonArray = new JSONArray();
+    jsonArray.add(space.getKey());
+    jsonArray.add(username);
+    StringEntity stringEntity = new StringEntity(jsonArray.toJSONString());
     httpPost.setEntity(stringEntity);
     HttpResponse response = httpClient.execute(httpPost);
     if (response.getStatusLine().getStatusCode() != 200) {
@@ -700,36 +686,22 @@ public class ConfluenceClient {
 
   private Spaces spacesFromHttpEntity(HttpEntity entity) throws Exception {
     String stringEntity = EntityUtils.toString(entity);
+    final JSONParser parser = new JSONParser();
+    final JSONArray responseObject = (JSONArray)parser.parse(new StringReader(stringEntity));
+    Spaces response = Spaces.fromJson(responseObject);
 
-    JSONArray responseObject;
-    try {
-      responseObject = new JSONArray(stringEntity);
-      Spaces response = Spaces.fromJson(responseObject);
-
-      return response;
-    } catch (JSONException e) {
-      logger.debug("Error parsing JSON spaces response data");
-      throw new Exception("Error parsing JSON spaces response data");
-    }
-
+    return response;
   }
   
   private List<String> permissionsFromHttpEntity(HttpEntity entity) throws Exception {
     String stringEntity = EntityUtils.toString(entity);
-
-    JSONArray responseObject;
-    List<String> permissions = Lists.newArrayList();
-    try {
-      responseObject = new JSONArray(stringEntity);
-      for(int i=0,len=responseObject.length();i<len;i++) {
-        permissions.add(responseObject.getString(i));
-      }
-
-      return permissions;
-    } catch (JSONException e) {
-      logger.debug("Error parsing JSON space permissions response data");
-      throw new Exception("Error parsing JSON space permissions respnse data");
+    final JSONParser parser = new JSONParser();
+    final JSONArray responseObject = (JSONArray)parser.parse(new StringReader(stringEntity));
+    final List<String> permissions = Lists.newArrayList();
+    for(int i=0,len=responseObject.size();i<len;i++) {
+      permissions.add(responseObject.get(i).toString());
     }
 
+    return permissions;
   }
 }

Modified: manifoldcf/trunk/connectors/confluence/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/confluence/model/Attachment.java
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/connectors/confluence/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/confluence/model/Attachment.java?rev=1788418&r1=1788417&r2=1788418&view=diff
==============================================================================
--- manifoldcf/trunk/connectors/confluence/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/confluence/model/Attachment.java (original)
+++ manifoldcf/trunk/connectors/confluence/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/confluence/model/Attachment.java Fri Mar 24 11:55:00 2017
@@ -21,8 +21,10 @@ import java.io.InputStream;
 import java.util.Map;
 
 import org.apache.manifoldcf.crawler.connectors.confluence.model.builder.ConfluenceResourceBuilder;
-import org.json.JSONException;
-import org.json.JSONObject;
+import org.json.simple.JSONArray;
+import org.json.simple.JSONObject;
+import org.json.simple.parser.JSONParser;
+import org.json.simple.parser.ParseException;
 
 /**
  * <p>
@@ -95,27 +97,23 @@ public class Attachment extends Page {
     public Attachment fromJson(JSONObject jsonPage, Attachment attachment) {
       ((ConfluenceResourceBuilder<Page>) Page.builder()).fromJson(jsonPage, attachment);
 
-      try {
-        /*
-         * Download URL
-         */
-
-        JSONObject links = (JSONObject) jsonPage.get(Page.KEY_LINKS);
-        if (links != null) {
-          attachment.downloadUrl = links.optString(KEY_DOWNLOAD, "");
-        }
-
-        /*
-         * Extensions
-         */
-        JSONObject extensions = (JSONObject) jsonPage
-            .get(KEY_EXTENSIONS);
-        if (extensions != null) {
-          attachment.mediaType = extensions.optString(
-              Page.KEY_MEDIATYPE, "");
-        }
-      } catch (JSONException e) {
-        e.printStackTrace();
+      /*
+        * Download URL
+        */
+
+      JSONObject links = (JSONObject) jsonPage.get(Page.KEY_LINKS);
+      if (links != null) {
+        attachment.downloadUrl = (links.get(KEY_DOWNLOAD)==null)?"":links.get(KEY_DOWNLOAD).toString();
+      }
+
+      /*
+        * Extensions
+        */
+      JSONObject extensions = (JSONObject) jsonPage
+          .get(KEY_EXTENSIONS);
+      if (extensions != null) {
+        final Object o = extensions.get(Page.KEY_MEDIATYPE);
+        attachment.mediaType = (o==null)?"":o.toString();
       }
 
       return attachment;

Modified: manifoldcf/trunk/connectors/confluence/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/confluence/model/ConfluenceResponse.java
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/connectors/confluence/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/confluence/model/ConfluenceResponse.java?rev=1788418&r1=1788417&r2=1788418&view=diff
==============================================================================
--- manifoldcf/trunk/connectors/confluence/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/confluence/model/ConfluenceResponse.java (original)
+++ manifoldcf/trunk/connectors/confluence/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/confluence/model/ConfluenceResponse.java Fri Mar 24 11:55:00 2017
@@ -21,9 +21,8 @@ import java.util.ArrayList;
 import java.util.List;
 
 import org.apache.manifoldcf.crawler.connectors.confluence.model.builder.ConfluenceResourceBuilder;
-import org.json.JSONArray;
-import org.json.JSONException;
-import org.json.JSONObject;
+import org.json.simple.JSONArray;
+import org.json.simple.JSONObject;
 
 public class ConfluenceResponse<T extends ConfluenceResource> {
 
@@ -57,29 +56,21 @@ public class ConfluenceResponse<T extend
   
   public static <T extends ConfluenceResource> ConfluenceResponse<T> fromJson(JSONObject response, ConfluenceResourceBuilder<T> builder) {
     List<T> resources = new ArrayList<T>();
-    try {
-      JSONArray jsonArray = response.getJSONArray("results");
-      for(int i=0,size=jsonArray.length(); i<size;i++) {
-        JSONObject jsonPage = jsonArray.getJSONObject(i);
-        T resource = (T) builder.fromJson(jsonPage);
-        resources.add(resource);
-      }
-      
-      int limit = response.getInt("limit");
-      int start = response.getInt("start");
-      Boolean isLast = false;
-      JSONObject links = response.getJSONObject("_links");
-      if(links != null) {
-        isLast = links.optString("next", "undefined").equalsIgnoreCase("undefined");
-      }
-      
-      return new ConfluenceResponse<T>(resources, start, limit, isLast);
+    JSONArray jsonArray = (JSONArray)response.get("results");
+    for(int i=0,size=jsonArray.size(); i<size;i++) {
+      JSONObject jsonPage = (JSONObject)jsonArray.get(i);
+      T resource = (T) builder.fromJson(jsonPage);
+      resources.add(resource);
+    }
       
-    } catch (JSONException e) {
-      // TODO Auto-generated catch block
-      e.printStackTrace();
+    int limit = ((Long)response.get("limit")).intValue();
+    int start = ((Long)response.get("start")).intValue();
+    Boolean isLast = false;
+    JSONObject links = (JSONObject)response.get("_links");
+    if(links != null) {
+      isLast = (links.get("next")==null);
     }
-    
-    return new ConfluenceResponse<T>(new ArrayList<T>(), 0,0,false);
+      
+    return new ConfluenceResponse<T>(resources, start, limit, isLast);
   }
 }

Modified: manifoldcf/trunk/connectors/confluence/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/confluence/model/Label.java
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/connectors/confluence/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/confluence/model/Label.java?rev=1788418&r1=1788417&r2=1788418&view=diff
==============================================================================
--- manifoldcf/trunk/connectors/confluence/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/confluence/model/Label.java (original)
+++ manifoldcf/trunk/connectors/confluence/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/confluence/model/Label.java Fri Mar 24 11:55:00 2017
@@ -18,7 +18,7 @@
 package org.apache.manifoldcf.crawler.connectors.confluence.model;
 
 import org.apache.manifoldcf.crawler.connectors.confluence.model.builder.ConfluenceResourceBuilder;
-import org.json.JSONObject;
+import org.json.simple.JSONObject;
 
 /**
  * <p>
@@ -84,9 +84,9 @@ public class Label extends ConfluenceRes
 
     public Label fromJson(JSONObject jsonPage, Label label) {
 
-      label.id = jsonPage.optString(KEY_ID, "");
-      label.prefix = jsonPage.optString(KEY_PREFIX, "");
-      label.name = jsonPage.optString(KEY_NAME, "");
+      label.id = (jsonPage.get(KEY_ID)==null)?"":jsonPage.get(KEY_ID).toString();
+      label.prefix = (jsonPage.get(KEY_PREFIX)==null)?"":jsonPage.get(KEY_PREFIX).toString();
+      label.name = (jsonPage.get(KEY_NAME)==null)?"":jsonPage.get(KEY_NAME).toString();
 
       label.delegated = jsonPage;
 

Modified: manifoldcf/trunk/connectors/confluence/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/confluence/model/Page.java
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/connectors/confluence/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/confluence/model/Page.java?rev=1788418&r1=1788417&r2=1788418&view=diff
==============================================================================
--- manifoldcf/trunk/connectors/confluence/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/confluence/model/Page.java (original)
+++ manifoldcf/trunk/connectors/confluence/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/confluence/model/Page.java Fri Mar 24 11:55:00 2017
@@ -26,8 +26,8 @@ import java.util.Map;
 
 import org.apache.manifoldcf.core.common.DateParser;
 import org.apache.manifoldcf.crawler.connectors.confluence.model.builder.ConfluenceResourceBuilder;
-import org.json.JSONException;
-import org.json.JSONObject;
+import org.json.simple.JSONArray;
+import org.json.simple.JSONObject;
 
 import com.google.common.base.Function;
 import com.google.common.collect.Iterables;
@@ -268,101 +268,81 @@ public class Page extends ConfluenceReso
     
     public Page fromJson(JSONObject jsonPage, Page page) {
 
-      try {
-        String id = jsonPage.getString(KEY_ID);
-        String type = jsonPage.getString(KEY_TYPE);
-        String title = jsonPage.getString(KEY_TITLE);
-
-        page.delegated = jsonPage;
-
-        /* Init Page fields */
-        page.id = id;
-        page.type = PageType.fromName(type);
-        page.title = title;
-
-        page.space = processSpace(jsonPage);
-
-        /*
-         * Url & WebUrl
-         */
-        JSONObject links = (JSONObject) jsonPage.get(KEY_LINKS);
-        if (links != null) {
-          page.url = links.optString(KEY_SELF, "");
-          String webUrl = (String) links.optString(KEY_WEBUI, "");
-          page.urlContext = (String) links.optString(KEY_CONTEXT, "");
-          page.baseUrl = (String) links.optString(KEY_BASE, "");
-          page.webUrl = page.baseUrl + webUrl;
+      String id = jsonPage.get(KEY_ID).toString();
+      String type = jsonPage.get(KEY_TYPE).toString();
+      String title = jsonPage.get(KEY_TITLE).toString();
+
+      page.delegated = jsonPage;
+
+      /* Init Page fields */
+      page.id = id;
+      page.type = PageType.fromName(type);
+      page.title = title;
+
+      page.space = processSpace(jsonPage);
+
+      /*
+        * Url & WebUrl
+        */
+      JSONObject links = (JSONObject) jsonPage.get(KEY_LINKS);
+      if (links != null) {
+        page.url = (links.get(KEY_SELF)==null)?"":links.get(KEY_SELF).toString();
+        String webUrl = (links.get(KEY_WEBUI)==null)?"":links.get(KEY_WEBUI).toString();
+        page.urlContext = (links.get(KEY_CONTEXT)==null)?"":links.get(KEY_CONTEXT).toString();
+        page.baseUrl = (links.get(KEY_BASE)==null)?"":links.get(KEY_BASE).toString();
+        page.webUrl = page.baseUrl + webUrl;
 
-        }
-
-        /*
-         * Created By and created Date
-         */
-        JSONObject history = (JSONObject) jsonPage
-            .optJSONObject(KEY_HISTORY);
-        if (history != null) {
-
-          page.createdDate = DateParser.parseISO8601Date(history
-              .optString(KEY_CREATED_DATE, ""));
-          JSONObject createdBy = (JSONObject) history
-              .optJSONObject(KEY_CREATED_BY);
-          if (createdBy != null) {
-            page.creator = createdBy
-                .optString(KEY_DISPLAY_NAME, "");
-            page.creatorUsername = createdBy.optString(
-                KEY_USER_NAME, "");
-          }
+      }
 
+      /*
+        * Created By and created Date
+        */
+      JSONObject history = (JSONObject) jsonPage.get(KEY_HISTORY);
+      if (history != null) {
+
+        page.createdDate = DateParser.parseISO8601Date((history.get(KEY_CREATED_DATE)==null)?"":history.get(KEY_CREATED_DATE).toString());
+        JSONObject createdBy = (JSONObject) history.get(KEY_CREATED_BY);
+        if (createdBy != null) {
+          page.creator = (createdBy.get(KEY_DISPLAY_NAME)==null)?"":createdBy.get(KEY_DISPLAY_NAME).toString();
+          page.creatorUsername = (createdBy.get(KEY_USER_NAME)==null)?"":createdBy.get(KEY_USER_NAME).toString();
         }
 
-        /*
-         * Last modifier and Last modified date
-         */
-        JSONObject version = (JSONObject) jsonPage
-            .optJSONObject(KEY_VERSION);
-        if (version != null) {
-          JSONObject by = version.getJSONObject(KEY_BY);
-          if (by != null) {
-            page.lastModifier = by.optString(KEY_DISPLAY_NAME);
-            page.lastModifierUsername = by.optString(KEY_USER_NAME,
-                "");
-          }
-
-          page.lastModified = DateParser.parseISO8601Date(version
-              .optString(KEY_WHEN, ""));
-        }
+      }
 
-        /*
-         * Page Content
-         */
-        JSONObject body = (JSONObject) jsonPage.optJSONObject(KEY_BODY);
-        if (body != null) {
-          JSONObject view = (JSONObject) body.optJSONObject(KEY_VIEW);
-          if (view != null) {
-            page.content = view.optString(KEY_VALUE, null);
-            page.length = page.content.getBytes(StandardCharsets.UTF_8).length;
-          }
+      /*
+        * Last modifier and Last modified date
+        */
+      JSONObject version = (JSONObject) jsonPage.get(KEY_VERSION);
+      if (version != null) {
+        JSONObject by = (JSONObject) version.get(KEY_BY);
+        if (by != null) {
+          page.lastModifier = (by.get(KEY_DISPLAY_NAME)==null)?"":by.get(KEY_DISPLAY_NAME).toString();
+          page.lastModifierUsername = (by.get(KEY_USER_NAME)==null)?"":by.get(KEY_USER_NAME).toString();
         }
 
-        return page;
-
-      } catch (JSONException e) {
-        e.printStackTrace();
+        page.lastModified = DateParser.parseISO8601Date((version.get(KEY_WHEN)==null)?"":version.get(KEY_WHEN).toString());
       }
 
-      return new Page();
+      /*
+        * Page Content
+        */
+      JSONObject body = (JSONObject) jsonPage.get(KEY_BODY);
+      if (body != null) {
+        JSONObject view = (JSONObject) body.get(KEY_VIEW);
+        if (view != null) {
+          page.content = (view.get(KEY_VALUE)==null)?"":view.get(KEY_VALUE).toString();
+          page.length = page.content.getBytes(StandardCharsets.UTF_8).length;
+        }
+      }
 
+      return page;
     }
 
     private static String processSpace(JSONObject page) {
       /* Page */
-      try {
-        JSONObject space = (JSONObject) page.get(KEY_SPACE);
-        if (space != null)
-          return space.optString(KEY_KEY, "");
-      } catch (JSONException e) {
-        return "";
-      }
+      JSONObject space = (JSONObject) page.get(KEY_SPACE);
+      if (space != null)
+        return (space.get(KEY_KEY)==null)?"":space.get(KEY_KEY).toString();
       return "";
     }
 

Modified: manifoldcf/trunk/connectors/confluence/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/confluence/model/Space.java
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/connectors/confluence/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/confluence/model/Space.java?rev=1788418&r1=1788417&r2=1788418&view=diff
==============================================================================
--- manifoldcf/trunk/connectors/confluence/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/confluence/model/Space.java (original)
+++ manifoldcf/trunk/connectors/confluence/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/confluence/model/Space.java Fri Mar 24 11:55:00 2017
@@ -17,7 +17,7 @@
 
 package org.apache.manifoldcf.crawler.connectors.confluence.model;
 
-import org.json.JSONObject;
+import org.json.simple.JSONObject;
 
 public class Space {
 
@@ -62,10 +62,10 @@ public class Space {
   
   public static Space fromJson(JSONObject spaceJson) {
     Space space = new Space();
-    space.key = spaceJson.optString(KEY_KEY, "");
-    space.name = spaceJson.optString(KEY_NAME, "");
-    space.type = spaceJson.optString(KEY_TYPE, "");
-    space.url = spaceJson.optString(KEY_URL, "");
+    space.key = (spaceJson.get(KEY_KEY)==null)?"":spaceJson.get(KEY_KEY).toString();
+    space.name = (spaceJson.get(KEY_NAME)==null)?"":spaceJson.get(KEY_NAME).toString();
+    space.type = (spaceJson.get(KEY_TYPE)==null)?"":spaceJson.get(KEY_TYPE).toString();
+    space.url = (spaceJson.get(KEY_URL)==null)?"":spaceJson.get(KEY_URL).toString();
     return space;
   }
   

Modified: manifoldcf/trunk/connectors/confluence/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/confluence/model/Spaces.java
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/connectors/confluence/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/confluence/model/Spaces.java?rev=1788418&r1=1788417&r2=1788418&view=diff
==============================================================================
--- manifoldcf/trunk/connectors/confluence/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/confluence/model/Spaces.java (original)
+++ manifoldcf/trunk/connectors/confluence/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/confluence/model/Spaces.java Fri Mar 24 11:55:00 2017
@@ -19,9 +19,8 @@ package org.apache.manifoldcf.crawler.co
 
 import java.util.ArrayList;
 
-import org.json.JSONArray;
-import org.json.JSONException;
-import org.json.JSONObject;
+import org.json.simple.JSONArray;
+import org.json.simple.JSONObject;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -36,16 +35,10 @@ public class Spaces extends ArrayList<Sp
   
   public static Spaces fromJson(JSONArray jsonSpaces) {
     Spaces spaces = new Spaces();
-    for(int i=0,len=jsonSpaces.length();i<len;i++) {
-      try {
-        JSONObject spaceJson = jsonSpaces.getJSONObject(i);
-        Space space = Space.fromJson(spaceJson);
-        spaces.add(space);
-      } catch (JSONException e) {
-        logger.debug("Error obtaining JSON item from spaces. Item {} is not a JSON Object", i);
-        e.printStackTrace();
-        continue;
-      }
+    for(int i=0,len=jsonSpaces.size();i<len;i++) {
+      JSONObject spaceJson = (JSONObject)jsonSpaces.get(i);
+      Space space = Space.fromJson(spaceJson);
+      spaces.add(space);
     }
     
     return spaces;

Modified: manifoldcf/trunk/connectors/confluence/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/confluence/model/builder/ConfluenceResourceBuilder.java
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/connectors/confluence/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/confluence/model/builder/ConfluenceResourceBuilder.java?rev=1788418&r1=1788417&r2=1788418&view=diff
==============================================================================
--- manifoldcf/trunk/connectors/confluence/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/confluence/model/builder/ConfluenceResourceBuilder.java (original)
+++ manifoldcf/trunk/connectors/confluence/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/confluence/model/builder/ConfluenceResourceBuilder.java Fri Mar 24 11:55:00 2017
@@ -18,7 +18,7 @@
 package org.apache.manifoldcf.crawler.connectors.confluence.model.builder;
 
 import org.apache.manifoldcf.crawler.connectors.confluence.model.ConfluenceResource;
-import org.json.JSONObject;
+import org.json.simple.JSONObject;
 
 /**
  * <p>ConfluenceResourceBuilder interface</p>

Modified: manifoldcf/trunk/connectors/confluence/pom.xml
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/connectors/confluence/pom.xml?rev=1788418&r1=1788417&r2=1788418&view=diff
==============================================================================
--- manifoldcf/trunk/connectors/confluence/pom.xml (original)
+++ manifoldcf/trunk/connectors/confluence/pom.xml Fri Mar 24 11:55:00 2017
@@ -358,11 +358,6 @@
       <type>jar</type>
     </dependency>
     <dependency>
-      <groupId>com.googlecode.json-simple</groupId>
-      <artifactId>json-simple</artifactId>
-      <version>1.1</version>
-    </dependency>
-    <dependency>
       <groupId>commons-codec</groupId>
       <artifactId>commons-codec</artifactId>
       <version>1.8</version>

Modified: manifoldcf/trunk/connectors/dropbox/build.xml
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/connectors/dropbox/build.xml?rev=1788418&r1=1788417&r2=1788418&view=diff
==============================================================================
--- manifoldcf/trunk/connectors/dropbox/build.xml (original)
+++ manifoldcf/trunk/connectors/dropbox/build.xml Fri Mar 24 11:55:00 2017
@@ -34,7 +34,6 @@
         <path refid="mcf-connector-build.connector-classpath"/>
         <fileset dir="../../lib">
             <include name="dropbox-client*.jar"/>
-            <include name="json-simple*.jar"/>
         </fileset>
     </path>
 
@@ -43,7 +42,6 @@
         <copy todir="dist/lib">
             <fileset dir="../../lib">
                 <include name="dropbox*.jar"/>
-                <include name="json-simple*.jar"/>
             </fileset>
         </copy>
     </target>

Modified: manifoldcf/trunk/connectors/dropbox/pom.xml
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/connectors/dropbox/pom.xml?rev=1788418&r1=1788417&r2=1788418&view=diff
==============================================================================
--- manifoldcf/trunk/connectors/dropbox/pom.xml (original)
+++ manifoldcf/trunk/connectors/dropbox/pom.xml Fri Mar 24 11:55:00 2017
@@ -231,12 +231,6 @@
             <type>jar</type>
         </dependency>
         <dependency>
-            <groupId>com.googlecode.json-simple</groupId>
-            <artifactId>json-simple</artifactId>
-            <version>1.1</version>
-            <type>jar</type>
-        </dependency>
-        <dependency>
             <groupId>commons-logging</groupId>
             <artifactId>commons-logging</artifactId>
             <version>${commons-logging.version}</version>

Modified: manifoldcf/trunk/connectors/elasticsearch/connector/src/main/java/org/apache/manifoldcf/agents/output/elasticsearch/ElasticSearchConnector.java
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/connectors/elasticsearch/connector/src/main/java/org/apache/manifoldcf/agents/output/elasticsearch/ElasticSearchConnector.java?rev=1788418&r1=1788417&r2=1788418&view=diff
==============================================================================
--- manifoldcf/trunk/connectors/elasticsearch/connector/src/main/java/org/apache/manifoldcf/agents/output/elasticsearch/ElasticSearchConnector.java (original)
+++ manifoldcf/trunk/connectors/elasticsearch/connector/src/main/java/org/apache/manifoldcf/agents/output/elasticsearch/ElasticSearchConnector.java Fri Mar 24 11:55:00 2017
@@ -61,8 +61,6 @@ import org.apache.manifoldcf.core.interf
 import org.apache.manifoldcf.core.interfaces.ManifoldCFException;
 import org.apache.manifoldcf.core.interfaces.SpecificationNode;
 import org.apache.manifoldcf.core.interfaces.VersionContext;
-import org.json.JSONException;
-import org.json.JSONObject;
 
 /**
  * This is the "output connector" for elasticsearch.

Modified: manifoldcf/trunk/connectors/filesystem/connector/src/main/java/org/apache/manifoldcf/agents/output/filesystem/FileOutputConnector.java
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/connectors/filesystem/connector/src/main/java/org/apache/manifoldcf/agents/output/filesystem/FileOutputConnector.java?rev=1788418&r1=1788417&r2=1788418&view=diff
==============================================================================
--- manifoldcf/trunk/connectors/filesystem/connector/src/main/java/org/apache/manifoldcf/agents/output/filesystem/FileOutputConnector.java (original)
+++ manifoldcf/trunk/connectors/filesystem/connector/src/main/java/org/apache/manifoldcf/agents/output/filesystem/FileOutputConnector.java Fri Mar 24 11:55:00 2017
@@ -54,7 +54,6 @@ import org.apache.manifoldcf.core.interf
 import org.apache.manifoldcf.core.interfaces.ManifoldCFException;
 import org.apache.manifoldcf.core.interfaces.SpecificationNode;
 import org.apache.manifoldcf.core.interfaces.VersionContext;
-import org.json.JSONException;
 
 public class FileOutputConnector extends BaseOutputConnector {
 
@@ -331,12 +330,6 @@ public class FileOutputConnector extends
     return DOCUMENTSTATUS_ACCEPTED;
   }
 
-  protected static void handleJSONException(JSONException e)
-    throws ManifoldCFException, ServiceInterruption {
-    Logging.agents.error("FileSystem: JSONException: "+e.getMessage(),e);
-    throw new ManifoldCFException(e.getMessage(),e);
-  }
-
   protected static void handleURISyntaxException(URISyntaxException e)
     throws ManifoldCFException, ServiceInterruption {
     Logging.agents.error("FileSystem: URISyntaxException: "+e.getMessage(),e);

Modified: manifoldcf/trunk/connectors/hdfs/connector/src/main/java/org/apache/manifoldcf/agents/output/hdfs/HDFSOutputConnector.java
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/connectors/hdfs/connector/src/main/java/org/apache/manifoldcf/agents/output/hdfs/HDFSOutputConnector.java?rev=1788418&r1=1788417&r2=1788418&view=diff
==============================================================================
--- manifoldcf/trunk/connectors/hdfs/connector/src/main/java/org/apache/manifoldcf/agents/output/hdfs/HDFSOutputConnector.java (original)
+++ manifoldcf/trunk/connectors/hdfs/connector/src/main/java/org/apache/manifoldcf/agents/output/hdfs/HDFSOutputConnector.java Fri Mar 24 11:55:00 2017
@@ -56,7 +56,6 @@ import org.apache.manifoldcf.core.interf
 import org.apache.manifoldcf.core.interfaces.ManifoldCFException;
 import org.apache.manifoldcf.core.interfaces.SpecificationNode;
 import org.apache.manifoldcf.core.interfaces.VersionContext;
-import org.json.JSONException;
 
 public class HDFSOutputConnector extends BaseOutputConnector {
 
@@ -598,14 +597,6 @@ public class HDFSOutputConnector extends
     throw new ManifoldCFException("Namenode URI is malformed: "+e.getMessage(),e);
   }
   
-  /** Handle JSONException */
-  protected static void handleJSONException(JSONException e)
-    throws ManifoldCFException, ServiceInterruption
-  {
-    Logging.agents.error("JSON parsing error: "+e.getMessage(),e);
-    throw new ManifoldCFException("JSON parsing error: "+e.getMessage(),e);
-  }
-  
   /** Handle IOException */
   protected static void handleIOException(IOException e)
     throws ManifoldCFException, ServiceInterruption

Modified: manifoldcf/trunk/connectors/jira/pom.xml
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/connectors/jira/pom.xml?rev=1788418&r1=1788417&r2=1788418&view=diff
==============================================================================
--- manifoldcf/trunk/connectors/jira/pom.xml (original)
+++ manifoldcf/trunk/connectors/jira/pom.xml Fri Mar 24 11:55:00 2017
@@ -392,11 +392,6 @@
             <type>jar</type>
         </dependency>
         <dependency>
-            <groupId>com.googlecode.json-simple</groupId>
-            <artifactId>json-simple</artifactId>
-            <version>1.1</version>
-        </dependency>
-        <dependency>
             <groupId>commons-codec</groupId>
             <artifactId>commons-codec</artifactId>
             <version>1.8</version>

Modified: manifoldcf/trunk/connectors/opensearchserver/connector/src/main/java/org/apache/manifoldcf/agents/output/opensearchserver/OpenSearchServerConnector.java
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/connectors/opensearchserver/connector/src/main/java/org/apache/manifoldcf/agents/output/opensearchserver/OpenSearchServerConnector.java?rev=1788418&r1=1788417&r2=1788418&view=diff
==============================================================================
--- manifoldcf/trunk/connectors/opensearchserver/connector/src/main/java/org/apache/manifoldcf/agents/output/opensearchserver/OpenSearchServerConnector.java (original)
+++ manifoldcf/trunk/connectors/opensearchserver/connector/src/main/java/org/apache/manifoldcf/agents/output/opensearchserver/OpenSearchServerConnector.java Fri Mar 24 11:55:00 2017
@@ -51,8 +51,6 @@ import org.apache.manifoldcf.core.interf
 import org.apache.manifoldcf.core.interfaces.Specification;
 import org.apache.manifoldcf.core.interfaces.SpecificationNode;
 import org.apache.manifoldcf.core.interfaces.VersionContext;
-import org.json.JSONException;
-import org.json.JSONObject;
 
 public class OpenSearchServerConnector extends BaseOutputConnector
 {

Modified: manifoldcf/trunk/connectors/searchblox/connector/src/main/java/org/apache/manifoldcf/agents/output/searchblox/SearchBloxDocument.java
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/connectors/searchblox/connector/src/main/java/org/apache/manifoldcf/agents/output/searchblox/SearchBloxDocument.java?rev=1788418&r1=1788417&r2=1788418&view=diff
==============================================================================
--- manifoldcf/trunk/connectors/searchblox/connector/src/main/java/org/apache/manifoldcf/agents/output/searchblox/SearchBloxDocument.java (original)
+++ manifoldcf/trunk/connectors/searchblox/connector/src/main/java/org/apache/manifoldcf/agents/output/searchblox/SearchBloxDocument.java Fri Mar 24 11:55:00 2017
@@ -23,9 +23,8 @@ import org.apache.commons.io.IOUtils;
 import org.apache.commons.lang.StringUtils;
 import org.apache.manifoldcf.agents.interfaces.RepositoryDocument;
 import org.apache.manifoldcf.crawler.system.Logging;
-import org.json.JSONArray;
-import org.json.JSONException;
-import org.json.JSONObject;
+import org.json.simple.JSONArray;
+import org.json.simple.JSONObject;
 import org.jsoup.Jsoup;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
@@ -206,60 +205,57 @@ public class SearchBloxDocument {
     if (apiKey == null)
       throw new SearchBloxException(
           "The API Key for accessing SearchBlox Server CAN'T be NULL");
-    try {
-      result.put(APIKEY_ATTRIBUTE, apiKey);
+    
+    result.put(APIKEY_ATTRIBUTE, apiKey);
 
-      JSONObject document = new JSONObject();
-      if (colName == null)
-        throw new SearchBloxException(
-            "The Collection Name of the SearchBlox Server CAN'T be NULL");
-      document.put(COLNAME_ATTRIBUTE, colName);
-      document.put(UID_ATTRIBUTE, uid);
-
-      if(action == DocumentAction.ADD_UPDATE){
-        for(String element:xmlElements){
-          if (!element.equals(xmlElements.get(12))) {
-            Collection<Object> values = data_fields.get(element);
-            if (values!=null && values.size()>0) {
-              Object next = values.iterator()
-                  .next();
-              String value =(String) next;
-              if (value != null && !value.isEmpty()) {
-                if(element.equals("keywords"))
-                  document.put(element, StringUtils.join(values, ','));
-                else
-                  document.put(element, value);
+    JSONObject document = new JSONObject();
+    if (colName == null)
+      throw new SearchBloxException(
+          "The Collection Name of the SearchBlox Server CAN'T be NULL");
+    document.put(COLNAME_ATTRIBUTE, colName);
+    document.put(UID_ATTRIBUTE, uid);
+
+    if(action == DocumentAction.ADD_UPDATE){
+      for(String element:xmlElements){
+        if (!element.equals(xmlElements.get(12))) {
+          Collection<Object> values = data_fields.get(element);
+          if (values!=null && values.size()>0) {
+            Object next = values.iterator()
+                .next();
+            String value =(String) next;
+            if (value != null && !value.isEmpty()) {
+              if(element.equals("keywords"))
+                document.put(element, StringUtils.join(values, ','));
+              else
+                document.put(element, value);
                 
-              }
             }
           }
         }
+      }
 
-        // Metadata
-        Collection<Object> metadataSet = data_fields
-            .get(xmlElements.get(12));
-        JSONObject metaObject = new JSONObject();
-        if(metadataSet!=null && metadataSet.size()>0){
-          Multimap<String, String> metadata = (Multimap<String, String>) metadataSet.iterator().next();
-          if (metadata != null && !metadata.isEmpty()) {
-            for (String name : metadata.keySet()){
-              JSONArray nextMetadata = new JSONArray();
-              for (String value : metadata.get(name)) {
-                nextMetadata.put(value);
-              }
-              metaObject.put(name, nextMetadata);
+      // Metadata
+      Collection<Object> metadataSet = data_fields
+          .get(xmlElements.get(12));
+      JSONObject metaObject = new JSONObject();
+      if(metadataSet!=null && metadataSet.size()>0){
+        Multimap<String, String> metadata = (Multimap<String, String>) metadataSet.iterator().next();
+        if (metadata != null && !metadata.isEmpty()) {
+          for (String name : metadata.keySet()){
+            JSONArray nextMetadata = new JSONArray();
+            for (String value : metadata.get(name)) {
+              nextMetadata.add(value);
             }
-          }  
-        }
-        document.put(xmlElements.get(12), metaObject);
+            metaObject.put(name, nextMetadata);
+          }
+        }  
       }
+      document.put(xmlElements.get(12), metaObject);
+    }
 
-      result.put(xmlElements.get(1), document);
+    result.put(xmlElements.get(1), document);
 
-    } catch (JSONException e) {
-      throw new SearchBloxException("Error while building Document JSON object", e);
-    }
-    return result.toString();
+    return result.toJSONString();
   }
 
   private String toStringXML(DocumentAction action) throws SearchBloxException{

Modified: manifoldcf/trunk/connectors/searchblox/connector/src/test/java/org/apache/manifoldcf/agents/output/searchblox/SearchBloxDocumentTest.java
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/connectors/searchblox/connector/src/test/java/org/apache/manifoldcf/agents/output/searchblox/SearchBloxDocumentTest.java?rev=1788418&r1=1788417&r2=1788418&view=diff
==============================================================================
--- manifoldcf/trunk/connectors/searchblox/connector/src/test/java/org/apache/manifoldcf/agents/output/searchblox/SearchBloxDocumentTest.java (original)
+++ manifoldcf/trunk/connectors/searchblox/connector/src/test/java/org/apache/manifoldcf/agents/output/searchblox/SearchBloxDocumentTest.java Fri Mar 24 11:55:00 2017
@@ -20,9 +20,9 @@ import org.apache.manifoldcf.agents.inte
 import org.apache.manifoldcf.agents.output.searchblox.SearchBloxDocument.DocumentAction;
 import org.apache.manifoldcf.agents.output.searchblox.SearchBloxDocument.IndexingFormat;
 import org.apache.manifoldcf.core.interfaces.ManifoldCFException;
-import org.json.JSONArray;
-import org.json.JSONException;
-import org.json.JSONObject;
+import org.json.simple.JSONArray;
+import org.json.simple.JSONObject;
+import org.json.simple.parser.JSONParser;
 import org.junit.Before;
 import org.junit.Test;
 import org.w3c.dom.Document;
@@ -152,13 +152,15 @@ public class SearchBloxDocumentTest {
     }
 
     @Test
-    public void updateJsonString() throws SearchBloxException, JSONException {
+    public void updateJsonString() throws Exception {
 
         String jsonGenerated = toTest.toString(IndexingFormat.JSON, DocumentAction.ADD_UPDATE);
 
-        JSONObject json = new JSONObject(jsonGenerated);
-        assertTrue(json.has(APIKEY_ATTRIBUTE));
-        assertTrue(json.has("document"));
+        final JSONParser parser = new JSONParser();
+        JSONObject json = (JSONObject)parser.parse(new java.io.StringReader(jsonGenerated));
+
+        assertTrue(json.get(APIKEY_ATTRIBUTE) != null);
+        assertTrue(json.get("document") != null);
 
         Object apiObject = json.get(APIKEY_ATTRIBUTE);
         assertTrue(apiObject instanceof String);
@@ -168,25 +170,25 @@ public class SearchBloxDocumentTest {
         assertTrue(documentObject instanceof JSONObject);
         JSONObject document = (JSONObject) documentObject;
 
-        assertTrue(document.has(UID_ATTRIBUTE));
+        assertTrue(document.get(UID_ATTRIBUTE) != null);
         assertTrue(document.get(UID_ATTRIBUTE) instanceof String);
         assertEquals("URI", document.get(UID_ATTRIBUTE));
 
 
-        assertTrue(document.has(COLNAME_ATTRIBUTE));
+        assertTrue(document.get(COLNAME_ATTRIBUTE)  != null);
         assertTrue(document.get(COLNAME_ATTRIBUTE) instanceof String);
         assertEquals("collection1", document.get(COLNAME_ATTRIBUTE));
 
 
-        assertTrue(document.has("size"));
+        assertTrue(document.get("size") != null);
         assertTrue(document.get("size") instanceof String);
         assertEquals("100", document.get("size"));
 
-        assertTrue(document.has("meta"));
+        assertTrue(document.get("meta") != null);
         Object metaObject = document.get("meta");
         assertTrue(metaObject instanceof JSONObject);
         JSONObject meta = (JSONObject) metaObject;
-        assertEquals(6, meta.length());
+        assertEquals(6, meta.size());
 
         assertTrue(find(meta, "meta2", "I am META2!", 1));
         assertTrue(find(meta, "meta1", "I am META1!", 1));
@@ -206,45 +208,47 @@ public class SearchBloxDocumentTest {
         assertTrue(find(meta, "document_allow", "user12", 3));
 
 
-        assertTrue(document.has("description"));
+        assertTrue(document.get("description") != null);
         assertTrue(document.get("description") instanceof String);
         assertEquals("I am a little tiny description", document.get("description"));
 
 
-        assertTrue(document.has("title"));
+        assertTrue(document.get("title") != null);
         assertTrue(document.get("title") instanceof String);
         assertEquals("I am a nice title", document.get("title"));
 
-        assertTrue(document.has("content"));
+        assertTrue(document.get("content") != null);
         assertTrue(document.get("content") instanceof String);
         assertEquals("I am a nice content in english!", document.get("content"));
 
-        assertTrue(document.has("contenttype"));
+        assertTrue(document.get("contenttype") != null);
         assertTrue(document.get("contenttype") instanceof String);
         assertEquals("html", document.get("contenttype"));
     }
 
     private boolean find(JSONObject meta, String name, String textContent, int size) {
 
-        assertTrue(meta.has(name));
+        assertTrue(meta.get(name) != null);
         assertTrue(meta.get(name) instanceof JSONArray);
 
-        assertEquals(size, ((JSONArray) meta.get(name)).length());
+        assertEquals(size, ((JSONArray) meta.get(name)).size());
 
         for (int i = 0; i < size; i++) {
-            if (textContent.equals(((JSONArray) meta.get(name)).getString(i)))
+            if (textContent.equals(((JSONArray) meta.get(name)).get(i).toString()))
                 return true;
         }
         return false;
     }
 
     @Test
-    public void deleteJsonString() throws SearchBloxException, JSONException {
+    public void deleteJsonString() throws Exception {
         String jsonGenerated=toTest.toString(IndexingFormat.JSON, DocumentAction.DELETE);
 
-        JSONObject json = new JSONObject(jsonGenerated);
-        assertTrue(json.has(APIKEY_ATTRIBUTE));
-        assertTrue(json.has("document"));
+        final JSONParser parser = new JSONParser();
+        JSONObject json = (JSONObject)parser.parse(new java.io.StringReader(jsonGenerated));
+
+        assertTrue(json.get(APIKEY_ATTRIBUTE) != null);
+        assertTrue(json.get("document") != null);
 
         Object apiObject = json.get(APIKEY_ATTRIBUTE);
         assertTrue(apiObject instanceof String);
@@ -254,8 +258,8 @@ public class SearchBloxDocumentTest {
         assertTrue(documentObject instanceof JSONObject);
         JSONObject document = (JSONObject) documentObject;
 
-        assertTrue(document.has(UID_ATTRIBUTE));
-        assertTrue(document.has(COLNAME_ATTRIBUTE));
+        assertTrue(document.get(UID_ATTRIBUTE) != null);
+        assertTrue(document.get(COLNAME_ATTRIBUTE) != null);
 
         Object uidObject = document.get(UID_ATTRIBUTE);
         assertTrue(uidObject instanceof String);

Modified: manifoldcf/trunk/dist-license/LICENSE.txt
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/dist-license/LICENSE.txt?rev=1788418&r1=1788417&r2=1788418&view=diff
==============================================================================
--- manifoldcf/trunk/dist-license/LICENSE.txt (original)
+++ manifoldcf/trunk/dist-license/LICENSE.txt Fri Mar 24 11:55:00 2017
@@ -489,33 +489,6 @@ This product includes a curvesapi.jar: h
 License: BSD License (http://opensource.org/licenses/BSD-3-Clause)
 
 ==========================================================================
-The following license applies to json.jar, which is generated from the json
-sources from http://www.json.org/java/index.html
---------------------------------------------------------------------------
-Copyright (c) 2002 JSON.org
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to
-deal in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-The Software shall be used for Good, not Evil.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-OTHER DEALINGS IN THE SOFTWARE. 
-
-==========================================================================
 The following license applies to postgresql.jar, which is available from
 http://jdbc.postgresql.org
 --------------------------------------------------------------------------

Modified: manifoldcf/trunk/framework/build.xml
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/framework/build.xml?rev=1788418&r1=1788417&r2=1788418&view=diff
==============================================================================
--- manifoldcf/trunk/framework/build.xml (original)
+++ manifoldcf/trunk/framework/build.xml Fri Mar 24 11:55:00 2017
@@ -32,7 +32,7 @@
     <path id="framework-classpath">
         <fileset dir="../lib">
             <include name="zookeeper*.jar"/>
-            <include name="json*.jar"/>
+            <include name="json-simple*.jar"/>
             <include name="commons-codec*.jar"/>
             <include name="commons-collections-*.jar"/>
             <include name="commons-el*.jar"/>
@@ -439,7 +439,7 @@
         <copy todir="build/webapp/authority-service/WEB-INF/lib">
             <fileset dir="../lib">
                 <include name="zookeeper*.jar"/>
-                <include name="json*.jar"/>
+                <include name="json-simple*.jar"/>
                 <include name="commons-codec*.jar"/>
                 <include name="commons-collections*.jar"/>
                 <include name="commons-el*.jar"/>
@@ -478,7 +478,7 @@
         <copy todir="build/webapp/authority-service-proprietary/WEB-INF/lib">
             <fileset dir="../lib">
                 <include name="zookeeper*.jar"/>
-                <include name="json*.jar"/>
+                <include name="json-simple*.jar"/>
                 <include name="commons-codec*.jar"/>
                 <include name="commons-collections*.jar"/>
                 <include name="commons-el*.jar"/>
@@ -523,7 +523,7 @@
         <copy todir="build/webapp/api-service/WEB-INF/lib">
             <fileset dir="../lib">
                 <include name="zookeeper*.jar"/>
-                <include name="json*.jar"/>
+                <include name="json-simple*.jar"/>
                 <include name="commons-codec*.jar"/>
                 <include name="commons-collections*.jar"/>
                 <include name="commons-el*.jar"/>
@@ -563,7 +563,7 @@
         <copy todir="build/webapp/api-service-proprietary/WEB-INF/lib">
             <fileset dir="../lib">
                 <include name="zookeeper*.jar"/>
-                <include name="json*.jar"/>
+                <include name="json-simple*.jar"/>
                 <include name="commons-codec*.jar"/>
                 <include name="commons-collections*.jar"/>
                 <include name="commons-el*.jar"/>
@@ -610,7 +610,7 @@
             <fileset dir="../lib">
                 <include name="jstl*.jar"/>
                 <include name="zookeeper*.jar"/>
-                <include name="json*.jar"/>
+                <include name="json-simple*.jar"/>
                 <include name="commons-codec*.jar"/>
                 <include name="commons-collections*.jar"/>
                 <include name="commons-el*.jar"/>
@@ -658,7 +658,7 @@
             <fileset dir="../lib">
                 <include name="jstl*.jar"/>
                 <include name="zookeeper*.jar"/>
-                <include name="json*.jar"/>
+                <include name="json-simple*.jar"/>
                 <include name="commons-codec*.jar"/>
                 <include name="commons-collections*.jar"/>
                 <include name="commons-el*.jar"/>
@@ -714,7 +714,7 @@
             <fileset dir="../lib">
                 <include name="jstl*.jar"/>
                 <include name="zookeeper*.jar"/>
-                <include name="json*.jar"/>
+                <include name="json-simple*.jar"/>
                 <include name="commons-codec*.jar"/>
                 <include name="commons-collections*.jar"/>
                 <include name="commons-el*.jar"/>
@@ -764,7 +764,7 @@
             <fileset dir="../lib">
                 <include name="jstl*.jar"/>
                 <include name="zookeeper*.jar"/>
-                <include name="json*.jar"/>
+                <include name="json-simple*.jar"/>
                 <include name="commons-codec*.jar"/>
                 <include name="commons-collections*.jar"/>
                 <include name="commons-el*.jar"/>
@@ -883,7 +883,7 @@
         <copy todir="dist/lib">
             <fileset dir="../lib">
                 <include name="zookeeper*.jar"/>
-                <include name="json*.jar"/>
+                <include name="json-simple*.jar"/>
                 <include name="commons-codec*.jar"/>
                 <include name="commons-collections*.jar"/>
                 <include name="commons-el*.jar"/>
@@ -1131,7 +1131,7 @@
             <include name="commons-discovery*.jar"/>
             <include name="jasper*.jar"/>
             <include name="jsp-api-2.1-glassfish*.jar"/>
-            <include name="json*.jar"/>
+            <include name="json-simple*.jar"/>
             <include name="log4j*.jar"/>
             <include name="serializer*.jar"/>
             <include name="javax.servlet-api*.jar"/>
@@ -1166,7 +1166,7 @@
             <include name="commons-collections*.jar"/>
             <include name="commons-io*.jar"/>
             <include name="commons-logging*.jar"/>
-            <include name="json*.jar"/>
+            <include name="json-simple*.jar"/>
             <include name="httpcore*.jar"/>
             <include name="httpclient*.jar"/>
         </fileset>

Modified: manifoldcf/trunk/framework/buildfiles/connector-build.xml
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/framework/buildfiles/connector-build.xml?rev=1788418&r1=1788417&r2=1788418&view=diff
==============================================================================
--- manifoldcf/trunk/framework/buildfiles/connector-build.xml (original)
+++ manifoldcf/trunk/framework/buildfiles/connector-build.xml Fri Mar 24 11:55:00 2017
@@ -116,7 +116,7 @@
         </fileset>
         <fileset dir="${mcf-dist}/lib">
             <include name="mail*.jar"/>
-            <include name="json*.jar"/>
+            <include name="json-simple*.jar"/>
             <include name="commons-codec*.jar"/>
             <include name="commons-collections*.jar"/>
             <include name="commons-el*.jar"/>

Modified: manifoldcf/trunk/framework/core/pom.xml
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/framework/core/pom.xml?rev=1788418&r1=1788417&r2=1788418&view=diff
==============================================================================
--- manifoldcf/trunk/framework/core/pom.xml (original)
+++ manifoldcf/trunk/framework/core/pom.xml Fri Mar 24 11:55:00 2017
@@ -57,6 +57,11 @@
 
   <dependencies>
     <dependency>
+      <groupId>com.googlecode.json-simple</groupId>
+      <artifactId>json-simple</artifactId>
+      <version>${json-simple.version}</version>
+    </dependency>
+    <dependency>
       <groupId>org.apache.httpcomponents</groupId>
       <artifactId>httpclient</artifactId>
       <version>${httpcomponent.httpclient.version}</version>
@@ -67,11 +72,6 @@
       <version>${log4j.version}</version>
     </dependency>
     <dependency>
-      <groupId>org.json</groupId>
-      <artifactId>json</artifactId>
-      <version>${json.version}</version>
-    </dependency>
-    <dependency>
       <groupId>org.apache.velocity</groupId>
       <artifactId>velocity</artifactId>
       <version>${velocity.version}</version>



Mime
View raw message