commonsrdf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From st...@apache.org
Subject incubator-commonsrdf git commit: RDFParseException instead of ParseException
Date Wed, 13 Apr 2016 01:29:53 GMT
Repository: incubator-commonsrdf
Updated Branches:
  refs/heads/parser-writer-interface 1b5f3160f -> d153b4cb6


RDFParseException instead of ParseException

as ParseException requires location, and don't
support getCause()


Project: http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/commit/d153b4cb
Tree: http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/tree/d153b4cb
Diff: http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/diff/d153b4cb

Branch: refs/heads/parser-writer-interface
Commit: d153b4cb6837ba52b3a119bb3846bfc02bfb8ae9
Parents: 1b5f316
Author: Stian Soiland-Reyes <stain@apache.org>
Authored: Tue Apr 12 09:11:26 2016 +0100
Committer: Stian Soiland-Reyes <stain@apache.org>
Committed: Tue Apr 12 09:11:26 2016 +0100

----------------------------------------------------------------------
 .../rdf/simple/AbstractRDFParserBuilder.java    | 24 +++++++++++++++++---
 .../rdf/simple/DummyRDFParserBuilder.java       |  2 +-
 2 files changed, 22 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/d153b4cb/simple/src/main/java/org/apache/commons/rdf/simple/AbstractRDFParserBuilder.java
----------------------------------------------------------------------
diff --git a/simple/src/main/java/org/apache/commons/rdf/simple/AbstractRDFParserBuilder.java
b/simple/src/main/java/org/apache/commons/rdf/simple/AbstractRDFParserBuilder.java
index 98790ca..ab37eef 100644
--- a/simple/src/main/java/org/apache/commons/rdf/simple/AbstractRDFParserBuilder.java
+++ b/simple/src/main/java/org/apache/commons/rdf/simple/AbstractRDFParserBuilder.java
@@ -22,7 +22,6 @@ import java.io.InputStream;
 import java.net.URI;
 import java.nio.file.Files;
 import java.nio.file.Path;
-import java.text.ParseException;
 import java.util.Optional;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
@@ -55,6 +54,25 @@ import org.apache.commons.rdf.api.RDFTermFactory;
  */
 public abstract class AbstractRDFParserBuilder implements RDFParserBuilder, Cloneable {
 
+	public class RDFParseException extends Exception {		
+		private static final long serialVersionUID = 5427752643780702976L;
+		public RDFParseException() {
+			super();
+		}
+		public RDFParseException(String message, Throwable cause) {
+			super(message, cause);
+		}
+		public RDFParseException(String message) {
+			super(message);
+		}
+		public RDFParseException(Throwable cause) {
+			super(cause);
+		}
+		public RDFParserBuilder getRDFParserBuilder() {
+			return AbstractRDFParserBuilder.this;
+		}
+	}
+	
 	public static final ThreadGroup threadGroup = new ThreadGroup("Commons RDF parsers");
 	private static final ExecutorService threadpool = Executors.newCachedThreadPool(r ->
new Thread(threadGroup, r));
 
@@ -321,9 +339,9 @@ public abstract class AbstractRDFParserBuilder implements RDFParserBuilder,
Clon
 	 * <p>
 	 * 
 	 * @throws IOException If the source could not be read 
-	 * @throws ParseException If the source could not be parsed (e.g. a .ttl file was not valid
Turtle)
+	 * @throws RDFParseException If the source could not be parsed (e.g. a .ttl file was not
valid Turtle)
 	 */
-	protected abstract void parseSynchronusly() throws IOException, ParseException;
+	protected abstract void parseSynchronusly() throws IOException, RDFParseException;
 
 	/**
 	 * Prepare a clone of this RDFParserBuilder which have been checked and

http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/d153b4cb/simple/src/test/java/org/apache/commons/rdf/simple/DummyRDFParserBuilder.java
----------------------------------------------------------------------
diff --git a/simple/src/test/java/org/apache/commons/rdf/simple/DummyRDFParserBuilder.java
b/simple/src/test/java/org/apache/commons/rdf/simple/DummyRDFParserBuilder.java
index ddaf4ed..cc62f0c 100644
--- a/simple/src/test/java/org/apache/commons/rdf/simple/DummyRDFParserBuilder.java
+++ b/simple/src/test/java/org/apache/commons/rdf/simple/DummyRDFParserBuilder.java
@@ -46,7 +46,7 @@ import org.apache.commons.rdf.api.RDFTermFactory;
 public class DummyRDFParserBuilder extends AbstractRDFParserBuilder {
 	
 	@Override
-	protected void parseSynchronusly() throws IOException, IllegalStateException, ParseException
{		
+	protected void parseSynchronusly() throws IOException, IllegalStateException, RDFParseException
{		
 		// From parseSynchronusly both of these are always present
 		RDFTermFactory factory = getRdfTermFactory().get();
 		Graph graph = getIntoGraph().get();


Mime
View raw message