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 2016/07/25 08:36:34 UTC
[2/9] jena git commit: Reformat
Reformat
Project: http://git-wip-us.apache.org/repos/asf/jena/repo
Commit: http://git-wip-us.apache.org/repos/asf/jena/commit/415d19b8
Tree: http://git-wip-us.apache.org/repos/asf/jena/tree/415d19b8
Diff: http://git-wip-us.apache.org/repos/asf/jena/diff/415d19b8
Branch: refs/heads/master
Commit: 415d19b895013072e14b751e2fff28ebe1392dca
Parents: a3d6514
Author: Andy Seaborne <an...@apache.org>
Authored: Sat Jul 23 10:54:10 2016 +0100
Committer: Andy Seaborne <an...@apache.org>
Committed: Sat Jul 23 10:54:10 2016 +0100
----------------------------------------------------------------------
.../jena/riot/checker/CheckerBlankNodes.java | 15 ++--
.../apache/jena/riot/checker/CheckerIRI.java | 88 ++++++++------------
2 files changed, 41 insertions(+), 62 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/jena/blob/415d19b8/jena-arq/src/main/java/org/apache/jena/riot/checker/CheckerBlankNodes.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/org/apache/jena/riot/checker/CheckerBlankNodes.java b/jena-arq/src/main/java/org/apache/jena/riot/checker/CheckerBlankNodes.java
index 4539a1e..ef72d3d 100644
--- a/jena-arq/src/main/java/org/apache/jena/riot/checker/CheckerBlankNodes.java
+++ b/jena-arq/src/main/java/org/apache/jena/riot/checker/CheckerBlankNodes.java
@@ -25,8 +25,7 @@ public class CheckerBlankNodes implements NodeChecker
{
private ErrorHandler handler ;
- public CheckerBlankNodes(ErrorHandler handler)
- {
+ public CheckerBlankNodes(ErrorHandler handler) {
this.handler = handler ;
}
@@ -34,13 +33,11 @@ public class CheckerBlankNodes implements NodeChecker
public boolean check(Node node, long line, long col)
{ return node.isBlank() && checkBlank(node, line, col) ; }
- public boolean checkBlank(Node node, long line, long col)
- {
- String x = node.getBlankNodeLabel() ;
- if ( x.indexOf(' ') >= 0 )
- {
- handler.error("Illegal blank node label (contains a space): "+node, line, col) ;
- return false ;
+ public boolean checkBlank(Node node, long line, long col) {
+ String x = node.getBlankNodeLabel() ;
+ if ( x.indexOf(' ') >= 0 ) {
+ handler.error("Illegal blank node label (contains a space): " + node, line, col) ;
+ return false ;
}
return true ;
}
http://git-wip-us.apache.org/repos/asf/jena/blob/415d19b8/jena-arq/src/main/java/org/apache/jena/riot/checker/CheckerIRI.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/org/apache/jena/riot/checker/CheckerIRI.java b/jena-arq/src/main/java/org/apache/jena/riot/checker/CheckerIRI.java
index 5060f3a..2ad61c2 100644
--- a/jena-arq/src/main/java/org/apache/jena/riot/checker/CheckerIRI.java
+++ b/jena-arq/src/main/java/org/apache/jena/riot/checker/CheckerIRI.java
@@ -37,13 +37,11 @@ public class CheckerIRI implements NodeChecker
private ErrorHandler handler ;
private IRIFactory iriFactory ;
- public CheckerIRI()
- {
+ public CheckerIRI() {
this(ErrorHandlerFactory.getDefaultErrorHandler(), IRIResolver.iriFactory) ;
}
-
- public CheckerIRI(ErrorHandler handler, IRIFactory iriFactory)
- {
+
+ public CheckerIRI(ErrorHandler handler, IRIFactory iriFactory) {
this.handler = handler ;
this.iriFactory = iriFactory ;
}
@@ -57,12 +55,11 @@ public class CheckerIRI implements NodeChecker
private final Cache<Node, IRI> cache = CacheFactory.createSimpleCache(5000) ;
// abstract
- public final boolean checkURI(Node node, long line, long col)
- {
+ public final boolean checkURI(Node node, long line, long col) {
if ( cache != null && cache.containsKey(node) )
return true ;
-
- IRI iri = iriFactory.create(node.getURI()); // always works - no exceptions.
+
+ IRI iri = iriFactory.create(node.getURI()) ; // always works - no exceptions.
boolean b = checkIRI(iri, line, col) ;
// If OK, put in cache.
if ( cache != null && b )
@@ -70,10 +67,9 @@ public class CheckerIRI implements NodeChecker
return b ;
}
- final public boolean checkIRI(IRI iri, long line, long col)
- {
+ final public boolean checkIRI(IRI iri, long line, long col) {
iriViolations(iri, handler, allowRelativeIRIs, true, line, col) ;
- return ! iri.hasViolation(true) ;
+ return !iri.hasViolation(true) ;
}
/** Process violations on an IRI
@@ -83,8 +79,7 @@ public class CheckerIRI implements NodeChecker
* @param errorHandler The error handler to call on each warning or error.
*
*/
- public static void iriViolations(IRI iri, ErrorHandler errorHandler)
- {
+ public static void iriViolations(IRI iri, ErrorHandler errorHandler) {
iriViolations(iri, errorHandler, -1L, -1L) ;
}
@@ -95,8 +90,7 @@ public class CheckerIRI implements NodeChecker
* @param errorHandler The error handler to call on each warning or error.
*
*/
- public static void iriViolations(IRI iri, ErrorHandler errorHandler, long line, long col)
- {
+ public static void iriViolations(IRI iri, ErrorHandler errorHandler, long line, long col) {
iriViolations(iri, errorHandler, false, true, line, col) ;
}
@@ -107,8 +101,7 @@ public class CheckerIRI implements NodeChecker
* @param errorHandler The error handler to call on each warning or error.
* @param allowRelativeIRIs Allow realtive URIs (discouraged)
*/
- private static void iriViolations(IRI iri, ErrorHandler errorHandler, boolean allowRelativeIRIs)
- {
+ private static void iriViolations(IRI iri, ErrorHandler errorHandler, boolean allowRelativeIRIs) {
iriViolations(iri, errorHandler, allowRelativeIRIs, -1, -1) ;
}
@@ -119,12 +112,10 @@ public class CheckerIRI implements NodeChecker
* @param errorHandler The error handler to call on each warning or error.
* @param allowRelativeIRIs Allow realtive URIs (discouraged)
*/
- private static void iriViolations(IRI iri, ErrorHandler errorHandler, boolean allowRelativeIRIs, long line, long col)
- {
+ private static void iriViolations(IRI iri, ErrorHandler errorHandler, boolean allowRelativeIRIs, long line, long col) {
iriViolations(iri, errorHandler, allowRelativeIRIs, true, line, col) ;
}
-
/** Process violations on an IRI
* Calls the errorhandler on all errors and warnings (as warning).
* Assumes error handler throws exceptions on errors if needbe
@@ -132,58 +123,49 @@ public class CheckerIRI implements NodeChecker
public static void iriViolations(IRI iri, ErrorHandler errorHandler,
boolean allowRelativeIRIs,
boolean includeIRIwarnings,
- long line, long col)
- {
- if ( ! allowRelativeIRIs && iri.isRelative() )
- errorHandler.error("Relative IRI: "+iri, line, col) ;
-
- if ( iri.hasViolation(includeIRIwarnings) )
- {
- Iterator<Violation> iter = iri.violations(includeIRIwarnings) ;
-
+ long line, long col) {
+ if ( !allowRelativeIRIs && iri.isRelative() )
+ errorHandler.error("Relative IRI: " + iri, line, col) ;
+
+ if ( iri.hasViolation(includeIRIwarnings) ) {
+ Iterator<Violation> iter = iri.violations(includeIRIwarnings) ;
+
boolean errorSeen = false ;
boolean warningSeen = false ;
-
+
// What to finally report.
Violation vError = null ;
Violation vWarning = null ;
Violation xvSub = null ;
-
- for ( ; iter.hasNext() ; )
- {
- Violation v = iter.next();
+
+ for ( ; iter.hasNext() ; ) {
+ Violation v = iter.next() ;
int code = v.getViolationCode() ;
boolean isError = v.isError() ;
-
+
// Ignore these.
- if ( code == Violation.LOWERCASE_PREFERRED
- ||
- code == Violation.PERCENT_ENCODING_SHOULD_BE_UPPERCASE
- ||
- code == Violation.SCHEME_PATTERN_MATCH_FAILED
- )
+ if ( code == Violation.LOWERCASE_PREFERRED
+ || code == Violation.PERCENT_ENCODING_SHOULD_BE_UPPERCASE
+ || code == Violation.SCHEME_PATTERN_MATCH_FAILED )
continue ;
// Anything we want to reprioritise?
// [nothing at present]
-
+
// Remember first error and first warning.
- if ( isError )
- {
+ if ( isError ) {
errorSeen = true ;
if ( vError == null )
- // Remember first error
- vError = v ;
- }
- else
- {
+ // Remember first error
+ vError = v ;
+ } else {
warningSeen = true ;
if ( vWarning == null )
vWarning = v ;
}
-
- String msg = v.getShortMessage();
- String iriStr = iri.toString();
+
+ String msg = v.getShortMessage() ;
+ String iriStr = iri.toString() ;
// Ideally, we might want to output all messages relating to this IRI
// then cause the error or continue.