manifoldcf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kwri...@apache.org
Subject svn commit: r1823461 - in /manifoldcf/trunk/connectors/jira/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/jira: JiraSession.java JiraUserQueryResults.java
Date Wed, 07 Feb 2018 12:34:11 GMT
Author: kwright
Date: Wed Feb  7 12:34:11 2018
New Revision: 1823461

URL: http://svn.apache.org/viewvc?rev=1823461&view=rev
Log:
Modify user info query and user unpacking to adhere to newer spec.

Modified:
    manifoldcf/trunk/connectors/jira/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/jira/JiraSession.java
    manifoldcf/trunk/connectors/jira/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/jira/JiraUserQueryResults.java

Modified: manifoldcf/trunk/connectors/jira/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/jira/JiraSession.java
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/connectors/jira/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/jira/JiraSession.java?rev=1823461&r1=1823460&r2=1823461&view=diff
==============================================================================
--- manifoldcf/trunk/connectors/jira/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/jira/JiraSession.java
(original)
+++ manifoldcf/trunk/connectors/jira/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/jira/JiraSession.java
Wed Feb  7 12:34:11 2018
@@ -296,7 +296,7 @@ public class JiraSession {
   public Map<String, String> getRepositoryInfo() throws IOException, ResponseException
{
     HashMap<String, String> statistics = new HashMap<String, String>();
     JiraUserQueryResults qr = new JiraUserQueryResults();
-    getRest("user/search?username=&maxResults=1&startAt=0", qr);
+    getRest("user/search?username=%27%27&maxResults=1&startAt=0", qr);
     return statistics;
   }
 
@@ -304,7 +304,7 @@ public class JiraSession {
   */
   public boolean checkUserExists(String userName) throws IOException, ResponseException,
ManifoldCFException {
     JiraUserQueryResults qr = new JiraUserQueryResults();
-    getRest("user/search?username="+URLEncoder.encode(userName)+"&maxResults=1&startAt=0",
qr);
+    getRest("user?username="+URLEncoder.encode(userName)+"&maxResults=1&startAt=0",
qr);
     List<String> values = new ArrayList<String>();
     qr.getNames(values);
     if (values.size() == 0)

Modified: manifoldcf/trunk/connectors/jira/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/jira/JiraUserQueryResults.java
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/connectors/jira/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/jira/JiraUserQueryResults.java?rev=1823461&r1=1823460&r2=1823461&view=diff
==============================================================================
--- manifoldcf/trunk/connectors/jira/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/jira/JiraUserQueryResults.java
(original)
+++ manifoldcf/trunk/connectors/jira/connector/src/main/java/org/apache/manifoldcf/authorities/authorities/jira/JiraUserQueryResults.java
Wed Feb  7 12:34:11 2018
@@ -41,12 +41,20 @@ public class JiraUserQueryResults extend
   }
 
   public void getNames(List<String> nameBuffer) {
-    JSONArray users = (JSONArray)object;
-    for (Object user : users) {
-      if (user instanceof JSONObject) {
-        JSONObject jo = (JSONObject)user;
-        nameBuffer.add(jo.get(KEY_NAME).toString());
+    if (object instanceof JSONArray) {
+      JSONArray users = (JSONArray)object;
+      for (Object user : users) {
+        addName(user, nameBuffer);
       }
+    } else {
+      addName(object, nameBuffer);
+    }
+  }
+
+  private void addName(Object object, List<String> nameBuffer) {
+    if (object instanceof JSONObject) {
+      JSONObject jo = (JSONObject)object;
+      nameBuffer.add(jo.get(KEY_NAME).toString());
     }
   }
   



Mime
View raw message