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 2017/08/22 13:27:36 UTC
[2/3] jena git commit: Improve handling of bad character encoding.
Improve handling of bad character encoding.
Project: http://git-wip-us.apache.org/repos/asf/jena/repo
Commit: http://git-wip-us.apache.org/repos/asf/jena/commit/9f545d3a
Tree: http://git-wip-us.apache.org/repos/asf/jena/tree/9f545d3a
Diff: http://git-wip-us.apache.org/repos/asf/jena/diff/9f545d3a
Branch: refs/heads/master
Commit: 9f545d3a17cdc105e3b78726412b163385d9ccce
Parents: 98db314
Author: Andy Seaborne <an...@apache.org>
Authored: Sun Aug 20 15:34:27 2017 +0100
Committer: Andy Seaborne <an...@apache.org>
Committed: Sun Aug 20 15:34:27 2017 +0100
----------------------------------------------------------------------
jena-base/src/main/java/org/apache/jena/atlas/io/IO.java | 6 +++---
.../java/org/apache/jena/fuseki/servlets/ActionSPARQL.java | 7 ++++++-
.../java/org/apache/jena/fuseki/servlets/SPARQL_GSP_RW.java | 6 +++++-
3 files changed, 14 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/jena/blob/9f545d3a/jena-base/src/main/java/org/apache/jena/atlas/io/IO.java
----------------------------------------------------------------------
diff --git a/jena-base/src/main/java/org/apache/jena/atlas/io/IO.java b/jena-base/src/main/java/org/apache/jena/atlas/io/IO.java
index a1006b0..fea37ac 100644
--- a/jena-base/src/main/java/org/apache/jena/atlas/io/IO.java
+++ b/jena-base/src/main/java/org/apache/jena/atlas/io/IO.java
@@ -223,17 +223,17 @@ public class IO
try { resource.close(); } catch (Exception ex) { }
}
- /** Throw a RuntimeIOException - this function is guaraentted not to return normally */
+ /** Throw a RuntimeIOException - this function is guaranteed not to return normally */
public static void exception(String message) {
throw new RuntimeIOException(message) ;
}
- /** Throw a RuntimeIOException - this function is guaraentted not to return normally */
+ /** Throw a RuntimeIOException - this function is guaranteed not to return normally */
public static void exception(IOException ex) {
throw new RuntimeIOException(ex) ;
}
- /** Throw a RuntimeIOException - this function is guaraentted not to return normally */
+ /** Throw a RuntimeIOException - this function is guaranteed not to return normally */
public static void exception(String msg, IOException ex) {
throw new RuntimeIOException(msg, ex) ;
}
http://git-wip-us.apache.org/repos/asf/jena/blob/9f545d3a/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/servlets/ActionSPARQL.java
----------------------------------------------------------------------
diff --git a/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/servlets/ActionSPARQL.java b/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/servlets/ActionSPARQL.java
index fda35eb..93cdbfa 100644
--- a/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/servlets/ActionSPARQL.java
+++ b/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/servlets/ActionSPARQL.java
@@ -23,6 +23,7 @@ import static org.apache.jena.fuseki.server.CounterName.RequestsBad ;
import static org.apache.jena.fuseki.server.CounterName.RequestsGood ;
import java.io.InputStream ;
+import java.nio.charset.CharacterCodingException;
import org.apache.jena.atlas.RuntimeIOException ;
import org.apache.jena.fuseki.Fuseki ;
@@ -205,7 +206,11 @@ public abstract class ActionSPARQL extends ActionBase
.lang(lang)
.base(base)
.parse(dest);
- }
+ } catch (RuntimeIOException ex) {
+ if ( ex.getCause() instanceof CharacterCodingException )
+ throw new RiotException("Character Coding Error: "+ex.getMessage());
+ throw ex;
+ }
catch (RiotException ex) { ServletOps.errorBadRequest("Parse error: "+ex.getMessage()) ; }
}
}
http://git-wip-us.apache.org/repos/asf/jena/blob/9f545d3a/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_GSP_RW.java
----------------------------------------------------------------------
diff --git a/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_GSP_RW.java b/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_GSP_RW.java
index f410efb..18e7148 100644
--- a/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_GSP_RW.java
+++ b/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_GSP_RW.java
@@ -128,13 +128,17 @@ public class SPARQL_GSP_RW extends SPARQL_GSP_R
upload.setExistedBefore(existedBefore) ;
action.commit() ;
return upload ;
+ } catch (ActionErrorException ex) {
+ // Any ServletOps.error from calls in the try{} block.
+ action.abort() ;
+ throw ex;
} catch (RiotException ex) {
// Parse error
action.abort() ;
ServletOps.errorBadRequest(ex.getMessage()) ;
return null ;
} catch (Exception ex) {
- // Something else went wrong. Backout.
+ // Something unexpected.
action.abort() ;
ServletOps.errorOccurred(ex.getMessage()) ;
return null ;