Source:
<code>private void execute(String queryString, HttpAction action) { String queryStringLog = ServletOps.formatForLog(queryString) ; if ( action.verbose ) action.log.info(format("[%d] Query = \n%s", action.id, queryString)) ; else action.log.info(format("[%d] Query = %s", action.id, queryStringLog)) ; <START> Query query = null ; <END> try { query = QueryFactory.create(queryString, QueryParseBase, Syntax.syntaxARQ) ; queryStringLog = formatForLog(query) ; } catch (ActionErrorException ex) { throw ex ; } catch (QueryParseException ex) { ServletOps.errorBadRequest("Parse error: \n" + queryString + "\n\r" + messageForQueryException(ex)) ; } catch (QueryException ex) { ServletOps.errorBadRequest("Error: \n" + queryString + "\n\r" + ex.getMessage()) ; } try { String key = generateKey(action, query, queryString); CacheEntry cacheEntry = (CacheEntry) cache.getIfPresent(key); if(cacheEntry == null || !cacheEntry.isInitialized()) { log.info("Cache is null or cache data is not initialized"); ActionSPARQL queryServlet = new SPARQL_QueryDataset() ; queryServlet.executeLifecycle(action) ; }else { log.info("Cache is not null so read from cache"); SPARQLResult result = cacheEntry.getResult(); CacheAction cacheAction = new CacheAction(key,CacheAction.Type.READ_CACHE); sendResults(action, result, query.getPrologue(), cacheAction); } } catch (QueryParseException ex) { ServletOps.errorBadRequest("Query parse error: \n" + queryString + "\n\r" + messageForQueryException(ex)) ; } catch (QueryCancelledException ex) { incCounter(action.getEndpoint().getCounters(), QueryTimeouts) ; throw ex ; } finally { action.endRead() ; } }</code><technical_language>final Query query is clearer</technical_language>

Target:
protected void execute(String queryString, HttpAction action) { String queryStringLog = ServletOps.formatForLog(queryString) ; if ( action.verbose ) action.log.info(format("[%d] Query = \n%s", action.id, queryString)) ; else action.log.info(format("[%d] Query = %s", action.id, queryStringLog)) ; Query query = null ; try { query = QueryFactory.create(queryString, QueryParseBase, Syntax.syntaxARQ) ; queryStringLog = formatForLog(query) ; } catch (ActionErrorException ex) { throw ex ; } catch (QueryParseException ex) { ServletOps.errorBadRequest("Parse error: \n" + queryString + "\n\r" + messageForQueryException(ex)) ; } catch (QueryException ex) { ServletOps.errorBadRequest("Error: \n" + queryString + "\n\r" + ex.getMessage()) ; } try { Cache cache = getCache(SPARQL_Query_Cache.getDatasetUri(action)); String key = generateKey(action, query); CacheEntry cacheEntry = (CacheEntry) cache.getIfPresent(key); if(cacheEntry == null || !cacheEntry.isInitialized()) { log.debug("Cache is null or cache data is not initialized"); super.execute(queryString, action); }else { log.debug("Cache is not null so read from cache"); SPARQLResult result = cacheEntry.getResult(); CacheAction cacheAction = new CacheAction(key,CacheAction.Type.READ_CACHE); sendResults(action, result, query.getPrologue(), cacheAction); } } catch (QueryParseException ex) { ServletOps.errorBadRequest("Query parse error: \n" + queryString + "\n\r" + messageForQueryException(ex)) ; } catch (QueryCancelledException ex) { incCounter(action.getEndpoint().getCounters(), QueryTimeouts) ; throw ex ; } finally { action.endRead() ; } }