private void processError() throws IOException, QueryResultParseException { byte errTypeFlag = in.readByte(); QueryErrorType errType = null; if (errTypeFlag == MALFORMED_QUERY_ERROR) { errType = QueryErrorType.MALFORMED_QUERY_ERROR; } else if (errTypeFlag == QUERY_EVALUATION_ERROR) { errType = QueryErrorType.QUERY_EVALUATION_ERROR; } else { throw new QueryResultParseException("Unkown error type: " + errTypeFlag); } String msg = readString(); // FIXME: is this the right thing to do upon encountering an error? throw new QueryResultParseException(errType + ": " + msg); }
private void processError() throws IOException, QueryResultParseException { byte errTypeFlag = in.readByte(); QueryErrorType errType = null; if (errTypeFlag == MALFORMED_QUERY_ERROR) { errType = QueryErrorType.MALFORMED_QUERY_ERROR; } else if (errTypeFlag == QUERY_EVALUATION_ERROR) { errType = QueryErrorType.QUERY_EVALUATION_ERROR; } else { throw new QueryResultParseException("Unkown error type: " + errTypeFlag); } String msg = readString(); // FIXME: is this the right thing to do upon encountering an error? throw new QueryResultParseException(errType + ": " + msg); }
private void processError() throws IOException, QueryResultParseException { byte errTypeFlag = in.readByte(); QueryErrorType errType = null; if (errTypeFlag == MALFORMED_QUERY_ERROR) { errType = QueryErrorType.MALFORMED_QUERY_ERROR; } else if (errTypeFlag == QUERY_EVALUATION_ERROR) { errType = QueryErrorType.QUERY_EVALUATION_ERROR; } else { throw new QueryResultParseException("Unkown error type: " + errTypeFlag); } String msg = readString(); // FIXME: is this the right thing to do upon encountering an error? throw new QueryResultParseException(errType + ": " + msg); }
@Override public synchronized void parseQueryResult(InputStream in) throws IOException, QueryResultParseException { try { parseQueryResultInternal(in, true, false); } catch (QueryResultHandlerException e) { throw new QueryResultParseException(e); } }
@Override public synchronized void parseQueryResult(InputStream in) throws IOException, QueryResultParseException { try { parseQueryResultInternal(in, true, false); } catch (QueryResultHandlerException e) { throw new QueryResultParseException(e); } }
@Override @Deprecated public boolean parse(InputStream in) throws IOException, QueryResultParseException { try { return parseQueryResultInternal(in, true, false); } catch (QueryResultHandlerException e) { throw new QueryResultParseException(e); } }
@Override @Deprecated public boolean parse(InputStream in) throws IOException, QueryResultParseException { try { return parseQueryResultInternal(in, true, false); } catch (QueryResultHandlerException e) { throw new QueryResultParseException(e); } }
@Override public synchronized void parseQueryResult(InputStream in) throws IOException, QueryResultParseException { try { parseQueryResultInternal(in, true, false); } catch (QueryResultHandlerException e) { throw new QueryResultParseException(e); } }
@Override @Deprecated public boolean parse(InputStream in) throws IOException, QueryResultParseException { try { return parseQueryResultInternal(in, true, false); } catch (QueryResultHandlerException e) { throw new QueryResultParseException(e); } } }
@Override @Deprecated public boolean parse(InputStream in) throws IOException, QueryResultParseException { try { return parseQueryResultInternal(in, true, false); } catch (QueryResultHandlerException e) { throw new QueryResultParseException(e); } } }
@Override @Deprecated public boolean parse(InputStream in) throws IOException, QueryResultParseException { try { return parseQueryResultInternal(in, true, false); } catch (QueryResultHandlerException e) { throw new QueryResultParseException(e); } } }
@Override public void startTag(String tagName, Map<String, String> atts, String text) throws SAXException { if (BOOLEAN_TAG.equals(tagName)) { if (BOOLEAN_TRUE.equalsIgnoreCase(text)) { value = true; } else if (BOOLEAN_FALSE.equalsIgnoreCase(text)) { value = false; } else { throw new SAXException("Illegal value for element " + BOOLEAN_TAG + ": " + text); } } else if (RESULT_SET_TAG.equals(tagName) || RESULT_TAG.equals(tagName)) { QueryResultParseException realException = new QueryResultParseException( "Found tuple results in boolean parser"); throw new SAXException(realException); } }
@Override public void startTag(String tagName, Map<String, String> atts, String text) throws SAXException { if (BOOLEAN_TAG.equals(tagName)) { if (BOOLEAN_TRUE.equalsIgnoreCase(text)) { value = true; } else if (BOOLEAN_FALSE.equalsIgnoreCase(text)) { value = false; } else { throw new SAXException("Illegal value for element " + BOOLEAN_TAG + ": " + text); } } else if (RESULT_SET_TAG.equals(tagName) || RESULT_TAG.equals(tagName)) { QueryResultParseException realException = new QueryResultParseException( "Found tuple results in boolean parser"); throw new SAXException(realException); } }
@Override public void startTag(String tagName, Map<String, String> atts, String text) throws SAXException { if (BOOLEAN_TAG.equals(tagName)) { if (BOOLEAN_TRUE.equalsIgnoreCase(text)) { value = true; } else if (BOOLEAN_FALSE.equalsIgnoreCase(text)) { value = false; } else { throw new SAXException("Illegal value for element " + BOOLEAN_TAG + ": " + text); } } else if (RESULT_SET_TAG.equals(tagName) || RESULT_TAG.equals(tagName)) { QueryResultParseException realException = new QueryResultParseException( "Found tuple results in boolean parser"); throw new SAXException(realException); } }
@Override public void fatalError(SAXParseException exception) throws SAXException { if (getParseErrorListener() != null) { getParseErrorListener().fatalError(exception.getMessage(), internalSAXParser.getLocator().getLineNumber(), internalSAXParser.getLocator().getColumnNumber()); } throw new SAXParseException(exception.getMessage(), internalSAXParser.getLocator(), new QueryResultParseException(exception, internalSAXParser.getLocator().getLineNumber(), internalSAXParser.getLocator().getColumnNumber())); }
@Override public void fatalError(SAXParseException exception) throws SAXException { if (getParseErrorListener() != null) { getParseErrorListener().fatalError(exception.getMessage(), internalSAXParser.getLocator().getLineNumber(), internalSAXParser.getLocator().getColumnNumber()); } throw new SAXParseException(exception.getMessage(), internalSAXParser.getLocator(), new QueryResultParseException(exception, internalSAXParser.getLocator().getLineNumber(), internalSAXParser.getLocator().getColumnNumber())); }
@Override public void fatalError(SAXParseException exception) throws SAXException { if (getParseErrorListener() != null) { getParseErrorListener().fatalError(exception.getMessage(), internalSAXParser.getLocator().getLineNumber(), internalSAXParser.getLocator().getColumnNumber()); } throw new SAXParseException(exception.getMessage(), internalSAXParser.getLocator(), new QueryResultParseException(exception, internalSAXParser.getLocator().getLineNumber(), internalSAXParser.getLocator().getColumnNumber())); }
throw new QueryResultParseException("Invalid value: " + value); throw new QueryResultParseException("Found an issue with the query result handler", e);
throw new QueryResultParseException("Invalid value: " + value); throw new QueryResultParseException("Found an issue with the query result handler", e);
private void parseBindingNames() throws IOException { if (bindingNames == null) { while (jp.nextToken() != JsonToken.END_OBJECT) { String baseStr = jp.getCurrentName(); if (baseStr != null && baseStr.equals("head")) { if (jp.nextToken() != JsonToken.START_OBJECT) { throw new QueryResultParseException("Did not find object under " + baseStr + " field", (long) jp.getCurrentLocation().getLineNr(), (long) jp.getCurrentLocation().getColumnNr()); } if (jp.nextToken() == JsonToken.END_OBJECT) { break; } bindingNames = new ArrayList<>(); String headStr = jp.getCurrentName(); if (headStr.equals("vars")) { if (jp.nextToken() != JsonToken.START_ARRAY) { throw new QueryResultParseException("Expected variable labels to be an array", (long) jp.getCurrentLocation().getLineNr(), (long) jp.getCurrentLocation().getColumnNr()); } while (jp.nextToken() != JsonToken.END_ARRAY) { bindingNames.add(jp.getText()); } } else { throw new QueryResultParseException("Found unexpected object in head field: " + headStr, (long) jp.getCurrentLocation().getLineNr(), (long) jp.getCurrentLocation().getColumnNr()); } } } } }