manifoldcf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kwri...@apache.org
Subject svn commit: r1534194 - in /manifoldcf/branches/release-1.4-branch: ./ CHANGES.txt framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/jobs/JobManager.java
Date Mon, 21 Oct 2013 14:53:47 GMT
Author: kwright
Date: Mon Oct 21 14:53:46 2013
New Revision: 1534194

URL: http://svn.apache.org/r1534194
Log:
Pull up fix for CONNECTORS-791.

Modified:
    manifoldcf/branches/release-1.4-branch/   (props changed)
    manifoldcf/branches/release-1.4-branch/CHANGES.txt
    manifoldcf/branches/release-1.4-branch/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/jobs/JobManager.java

Propchange: manifoldcf/branches/release-1.4-branch/
------------------------------------------------------------------------------
  Merged /manifoldcf/trunk:r1534192

Modified: manifoldcf/branches/release-1.4-branch/CHANGES.txt
URL: http://svn.apache.org/viewvc/manifoldcf/branches/release-1.4-branch/CHANGES.txt?rev=1534194&r1=1534193&r2=1534194&view=diff
==============================================================================
--- manifoldcf/branches/release-1.4-branch/CHANGES.txt (original)
+++ manifoldcf/branches/release-1.4-branch/CHANGES.txt Mon Oct 21 14:53:46 2013
@@ -3,6 +3,9 @@ $Id$
 
 ======================= Release 1.4 =====================
 
+CONNECTORS-791: Broken WHERE clause in job status query.
+(Karl Wright)
+
 CONNECTORS-790: Fix NPE when reading job status via API.
 (Erlend Garåsen, Karl Wright)
 

Modified: manifoldcf/branches/release-1.4-branch/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/jobs/JobManager.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/release-1.4-branch/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/jobs/JobManager.java?rev=1534194&r1=1534193&r2=1534194&view=diff
==============================================================================
--- manifoldcf/branches/release-1.4-branch/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/jobs/JobManager.java
(original)
+++ manifoldcf/branches/release-1.4-branch/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/jobs/JobManager.java
Mon Oct 21 14:53:46 2013
@@ -7273,7 +7273,7 @@ public class JobManager implements IJobM
             
         sb.append(database.constructCountClause(JobQueue.docHashField)).append(" AS doccount")
           .append(" FROM ").append(jobQueue.getTableName()).append(" t1");
-        addWhereClause(sb,list,whereClause,whereParams);
+        addWhereClause(sb,list,whereClause,whereParams,false);
         sb.append(" ").append(database.constructOffsetLimitClause(0,maxCount+1,false));
         IResultSet countResult = database.performQuery(sb.toString(),list,null,null);
         if (countResult.getRowCount() > 0 && ((Long)countResult.getRow(0).getValue("doccount")).longValue()
> maxCount)
@@ -7550,7 +7550,7 @@ public class JobManager implements IJobM
     sb.append(JobQueue.jobIDField).append(",")
       .append(database.constructCountClause(JobQueue.docHashField)).append(" AS doccount")
       .append(" FROM ").append(jobQueue.getTableName()).append(" t1");
-    addWhereClause(sb,list,whereClause,whereParams);
+    addWhereClause(sb,list,whereClause,whereParams,false);
     sb.append(" GROUP BY ").append(JobQueue.jobIDField);
     
     IResultSet set2 = database.performQuery(sb.toString(),list,null,null);
@@ -7562,7 +7562,7 @@ public class JobManager implements IJobM
       .append(database.constructCountClause(JobQueue.docHashField)).append(" AS doccount")
       .append(" FROM ").append(jobQueue.getTableName()).append(" t1 WHERE ")
       .append(database.buildConjunctionClause(list,new ClauseDescription[]{buildOutstandingClause()}));
-    addWhereClause(sb,list,whereClause,whereParams);
+    addWhereClause(sb,list,whereClause,whereParams,true);
     sb.append(" GROUP BY ").append(JobQueue.jobIDField);
         
     IResultSet set3 = database.performQuery(sb.toString(),list,null,null);
@@ -7574,7 +7574,7 @@ public class JobManager implements IJobM
       .append(database.constructCountClause(JobQueue.docHashField)).append(" AS doccount")
       .append(" FROM ").append(jobQueue.getTableName()).append(" t1 WHERE ")
       .append(database.buildConjunctionClause(list,new ClauseDescription[]{buildProcessedClause()}));
-    addWhereClause(sb,list,whereClause,whereParams);
+    addWhereClause(sb,list,whereClause,whereParams,true);
     sb.append(" GROUP BY ").append(JobQueue.jobIDField);
         
     IResultSet set4 = database.performQuery(sb.toString(),list,null,null);
@@ -7602,11 +7602,16 @@ public class JobManager implements IJobM
     }
   }
 
-  protected void addWhereClause(StringBuilder sb, ArrayList list, String whereClause, ArrayList
whereParams)
+  protected void addWhereClause(StringBuilder sb, ArrayList list, String whereClause, ArrayList
whereParams, boolean wherePresent)
   {
     if (whereClause != null)
     {
-      sb.append(" WHERE EXISTS(SELECT 'x' FROM ").append(jobs.getTableName()).append(" t0
WHERE ")
+      if (wherePresent)
+        sb.append(" AND");
+      else
+        sb.append(" WHERE");
+      
+      sb.append(" EXISTS(SELECT 'x' FROM ").append(jobs.getTableName()).append(" t0 WHERE
")
         .append(database.buildConjunctionClause(list,new ClauseDescription[]{
           new JoinClause("t0."+Jobs.idField,"t1."+JobQueue.jobIDField)})).append(" AND ")
         .append(whereClause)



Mime
View raw message