You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jena.apache.org by an...@apache.org on 2013/05/22 16:22:11 UTC

svn commit: r1485220 - /jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_Query.java

Author: andy
Date: Wed May 22 14:22:10 2013
New Revision: 1485220

URL: http://svn.apache.org/r1485220
Log:
Add counters.

Modified:
    jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_Query.java

Modified: jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_Query.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_Query.java?rev=1485220&r1=1485219&r2=1485220&view=diff
==============================================================================
--- jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_Query.java (original)
+++ jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_Query.java Wed May 22 14:22:10 2013
@@ -143,10 +143,12 @@ public abstract class SPARQL_Query exten
             warning("Service Description / SPARQL Query / "+action.request.getRequestURI()) ;
             errorNotFound("Service Description: "+action.request.getRequestURI()) ;
         }
-            
+        
         // Use of the dataset describing parameters is check later.
-        validate(action.request, allParams) ;
-        validateRequest(action) ;
+        try {
+            validate(action.request, allParams) ;
+            validateRequest(action) ; 
+        } catch (ActionErrorException ex) { inc(action.desc.countQueryBadSyntax) ; throw ex ; } 
     }
     
     /** Validate the request after checking HTTP method and HTTP Parameters */ 
@@ -244,11 +246,18 @@ public abstract class SPARQL_Query exten
             Dataset dataset = decideDataset(action, query, queryStringLog) ; 
             qExec = createQueryExecution(query, dataset) ;
             SPARQLResult result = executeQuery(action, qExec, query, queryStringLog) ;
+            
+            // Deals with exceptions itself.
             sendResults(action, result, query.getPrologue()) ;
-        } finally { 
+            inc(action.desc.countQueryOK) ;
+        } 
+        catch (QueryCancelledException ex) { inc(action.desc.countQueryTimeout) ; throw ex ; } 
+        catch (QueryExecException ex)      { inc(action.desc.countQueryBadExecution) ; throw ex ; } 
+        finally { 
             if ( qExec != null )
                 qExec.close() ;
-            action.endRead() ; }
+            action.endRead() ;
+        }
     }
 
     /** Check the query - if unacceptable, throw ActionErrorException or call super.error */