jena-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@apache.org
Subject jena git commit: Allow code to use HttpException for its own servlet error response.
Date Mon, 20 Nov 2017 12:36:07 GMT
Repository: jena
Updated Branches:
  refs/heads/master bd5843759 -> cdf47744a


Allow code to use HttpException for its own servlet error response.


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

Branch: refs/heads/master
Commit: cdf47744a43f682902fd3747928b4a0b98e4dfb5
Parents: bd58437
Author: Andy Seaborne <andy@apache.org>
Authored: Mon Nov 20 12:36:02 2017 +0000
Committer: Andy Seaborne <andy@apache.org>
Committed: Mon Nov 20 12:36:02 2017 +0000

----------------------------------------------------------------------
 .../main/java/org/apache/jena/fuseki/servlets/ActionBase.java | 7 +++++++
 1 file changed, 7 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jena/blob/cdf47744/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/servlets/ActionBase.java
----------------------------------------------------------------------
diff --git a/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/servlets/ActionBase.java
b/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/servlets/ActionBase.java
index ae52600..a64f2ee 100644
--- a/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/servlets/ActionBase.java
+++ b/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/servlets/ActionBase.java
@@ -28,6 +28,7 @@ import javax.servlet.http.HttpServletRequest ;
 import javax.servlet.http.HttpServletResponse ;
 
 import org.apache.jena.atlas.RuntimeIOException ;
+import org.apache.jena.atlas.web.HttpException;
 import org.apache.jena.fuseki.Fuseki ;
 import org.apache.jena.query.ARQ ;
 import org.apache.jena.query.QueryCancelledException ;
@@ -97,6 +98,12 @@ public abstract class ActionBase extends ServletBase
                     ServletOps.responseSendError(response, ex.getRC(), ex.getMessage()) ;
                 else
                     ServletOps.responseSendError(response, ex.getRC()) ;
+            } catch (HttpException ex) {
+                // Some code is passing up its own HttpException.
+                if ( ex.getMessage() == null )
+                    ServletOps.responseSendError(response, ex.getResponseCode());
+                else
+                    ServletOps.responseSendError(response, ex.getResponseCode(), ex.getMessage());
             } catch (RuntimeIOException ex) {
                 log.warn(format("[%d] Runtime IO Exception (client left?) RC = %d : %s",
id, HttpSC.INTERNAL_SERVER_ERROR_500, ex.getMessage()), ex) ;
                 ServletOps.responseSendError(response, HttpSC.INTERNAL_SERVER_ERROR_500,
ex.getMessage()) ;


Mime
View raw message