Skip to content

Commit

Permalink
minor fix in my formatting settings
Browse files Browse the repository at this point in the history
Signed-off-by: Jeen Broekstra <jeen.broekstra@gmail.com>
  • Loading branch information
abrokenjester committed Aug 11, 2018
1 parent 02a5974 commit 5bcaaac
Showing 1 changed file with 27 additions and 78 deletions.
Expand Up @@ -107,9 +107,7 @@ public RDFFormat getRDFFormat() {
*/
@Override
public synchronized void parse(InputStream in, String baseURI)
throws IOException,
RDFParseException,
RDFHandlerException
throws IOException, RDFParseException, RDFHandlerException
{
if (in == null) {
throw new IllegalArgumentException("Input stream can not be 'null'");
Expand Down Expand Up @@ -143,9 +141,7 @@ public synchronized void parse(InputStream in, String baseURI)
*/
@Override
public synchronized void parse(Reader reader, String baseURI)
throws IOException,
RDFParseException,
RDFHandlerException
throws IOException, RDFParseException, RDFHandlerException
{
clear();

Expand Down Expand Up @@ -199,9 +195,7 @@ else if (c == '\r' || c == '\n') {
* Reads characters from reader until it finds a character that is not a space or tab, and returns this
* last character code point. In case the end of the character stream has been reached, -1 is returned.
*/
protected int skipWhitespace(int c)
throws IOException
{
protected int skipWhitespace(int c) throws IOException {
while (c == ' ' || c == '\t') {
c = readCodePoint();
}
Expand All @@ -212,10 +206,7 @@ protected int skipWhitespace(int c)
/**
* Verifies that there is only whitespace or comments until the end of the line.
*/
protected int assertLineTerminates(int c)
throws IOException,
RDFParseException
{
protected int assertLineTerminates(int c) throws IOException, RDFParseException {
c = readCodePoint();

c = skipWhitespace(c);
Expand All @@ -235,9 +226,7 @@ protected int assertLineTerminates(int c)
/**
* Reads characters from reader until the first EOL has been read. The EOL character or -1 is returned.
*/
protected int skipToEndOfLine(int c)
throws IOException
{
protected int skipToEndOfLine(int c) throws IOException {
while (c != -1 && c != '\r' && c != '\n') {
c = readCodePoint();
}
Expand All @@ -249,9 +238,7 @@ protected int skipToEndOfLine(int c)
* Reads characters from reader until the first EOL has been read. The first character after the EOL is
* returned. In case the end of the character stream has been reached, -1 is returned.
*/
protected int skipLine(int c)
throws IOException
{
protected int skipLine(int c) throws IOException {
while (c != -1 && c != '\r' && c != '\n') {
c = readCodePoint();
}
Expand Down Expand Up @@ -281,11 +268,7 @@ else if (c == '\r') {
return c;
}

private int parseTriple(int c)
throws IOException,
RDFParseException,
RDFHandlerException
{
private int parseTriple(int c) throws IOException, RDFParseException, RDFHandlerException {
boolean ignoredAnError = false;
try {
c = parseSubject(c);
Expand All @@ -311,8 +294,10 @@ else if (c != '.') {
c = assertLineTerminates(c);
}
catch (RDFParseException rdfpe) {
if (!getParserConfig().get(NTriplesParserSettings.FAIL_ON_NTRIPLES_INVALID_LINES) ||
getParserConfig().isNonFatalError(NTriplesParserSettings.FAIL_ON_NTRIPLES_INVALID_LINES)) {
if (!getParserConfig().get(NTriplesParserSettings.FAIL_ON_NTRIPLES_INVALID_LINES)
|| getParserConfig().isNonFatalError(
NTriplesParserSettings.FAIL_ON_NTRIPLES_INVALID_LINES))
{
reportError(rdfpe, NTriplesParserSettings.FAIL_ON_NTRIPLES_INVALID_LINES);
ignoredAnError = true;
}
Expand All @@ -337,10 +322,7 @@ else if (c != '.') {
return c;
}

protected int parseSubject(int c)
throws IOException,
RDFParseException
{
protected int parseSubject(int c) throws IOException, RDFParseException {
StringBuilder sb = new StringBuilder(100);

// subject is either an uriref (<foo://bar>) or a nodeID (_:node1)
Expand All @@ -365,10 +347,7 @@ else if (c == -1) {
return c;
}

protected int parsePredicate(int c)
throws IOException,
RDFParseException
{
protected int parsePredicate(int c) throws IOException, RDFParseException {
StringBuilder sb = new StringBuilder(100);

// predicate must be an uriref (<foo://bar>)
Expand All @@ -388,10 +367,7 @@ else if (c == -1) {
return c;
}

protected int parseObject(int c)
throws IOException,
RDFParseException
{
protected int parseObject(int c) throws IOException, RDFParseException {
StringBuilder sb = getBuffer();

// object is either an uriref (<foo://bar>), a nodeID (_:node1) or a
Expand Down Expand Up @@ -424,10 +400,7 @@ else if (c == -1) {
return c;
}

protected int parseUriRef(int c, StringBuilder uriRef)
throws IOException,
RDFParseException
{
protected int parseUriRef(int c, StringBuilder uriRef) throws IOException, RDFParseException {
if (c != '<') {
reportError("Supplied char should be a '<', is: " + new String(Character.toChars(c)),
NTriplesParserSettings.FAIL_ON_NTRIPLES_INVALID_LINES);
Expand Down Expand Up @@ -466,10 +439,7 @@ protected int parseUriRef(int c, StringBuilder uriRef)
return c;
}

protected int parseNodeID(int c, StringBuilder name)
throws IOException,
RDFParseException
{
protected int parseNodeID(int c, StringBuilder name) throws IOException, RDFParseException {
if (c != '_') {
reportError("Supplied char should be a '_', is: " + new String(Character.toChars(c)),
NTriplesParserSettings.FAIL_ON_NTRIPLES_INVALID_LINES);
Expand Down Expand Up @@ -514,9 +484,7 @@ else if (!NTriplesUtil.isLetterOrNumber(c) && !NTriplesUtil.isUnderscore(c)) {
* @return the next Unicode code point, or -1 if the end of the stream has been reached.
* @throws IOException
*/
protected int peekCodePoint()
throws IOException
{
protected int peekCodePoint() throws IOException {
int result = readCodePoint();
unread(result);
return result;
Expand All @@ -530,9 +498,7 @@ protected int peekCodePoint()
* a single Unicode code point.
* @throws IOException
*/
protected void unread(int codePoint)
throws IOException
{
protected void unread(int codePoint) throws IOException {
if (codePoint != -1) {
if (Character.isSupplementaryCodePoint(codePoint)) {
final char[] surrogatePair = Character.toChars(codePoint);
Expand All @@ -545,8 +511,7 @@ protected void unread(int codePoint)
}

private int parseLiteral(int c, StringBuilder value, StringBuilder lang, StringBuilder datatype)
throws IOException,
RDFParseException
throws IOException, RDFParseException
{
if (c != '"') {
reportError("Supplied char should be a '\"', is: " + c,
Expand Down Expand Up @@ -621,9 +586,7 @@ else if (c != '<') {
}

@Override
protected IRI createURI(String uri)
throws RDFParseException
{
protected IRI createURI(String uri) throws RDFParseException {
try {
uri = NTriplesUtil.unescapeString(uri);
}
Expand All @@ -640,19 +603,15 @@ protected IRI createURI(String uri)
* @return the next Unicode code point, or -1 if the end of the stream has been reached.
* @throws IOException
*/
protected int readCodePoint()
throws IOException
{
protected int readCodePoint() throws IOException {
int next = reader.read();
if (Character.isHighSurrogate((char)next)) {
next = Character.toCodePoint((char)next, (char)reader.read());
}
return next;
}

protected Literal createLiteral(String label, String lang, String datatype)
throws RDFParseException
{
protected Literal createLiteral(String label, String lang, String datatype) throws RDFParseException {
try {
label = NTriplesUtil.unescapeString(label);
}
Expand Down Expand Up @@ -689,15 +648,11 @@ protected void reportWarning(String msg) {
* the error.
*/
@Override
protected void reportError(String msg, RioSetting<Boolean> setting)
throws RDFParseException
{
protected void reportError(String msg, RioSetting<Boolean> setting) throws RDFParseException {
reportError(msg, lineNo, -1, setting);
}

protected void reportError(Exception e, RioSetting<Boolean> setting)
throws RDFParseException
{
protected void reportError(Exception e, RioSetting<Boolean> setting) throws RDFParseException {
reportError(e, lineNo, -1, setting);
}

Expand All @@ -706,9 +661,7 @@ protected void reportError(Exception e, RioSetting<Boolean> setting)
* error.
*/
@Override
protected void reportFatalError(String msg)
throws RDFParseException
{
protected void reportFatalError(String msg) throws RDFParseException {
reportFatalError(msg, lineNo, -1);
}

Expand All @@ -717,15 +670,11 @@ protected void reportFatalError(String msg)
* error.
*/
@Override
protected void reportFatalError(Exception e)
throws RDFParseException
{
protected void reportFatalError(Exception e) throws RDFParseException {
reportFatalError(e, lineNo, -1);
}

protected void throwEOFException()
throws RDFParseException
{
protected void throwEOFException() throws RDFParseException {
throw new RDFParseException("Unexpected end of file");
}

Expand Down

0 comments on commit 5bcaaac

Please sign in to comment.