jena-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@apache.org
Subject [1/3] jena git commit: JENA-1312: Verbose logging: capture bytes then safe-decode to string.
Date Sat, 01 Apr 2017 13:08:35 GMT
Repository: jena
Updated Branches:
  refs/heads/master 6719a07cd -> 3981cd69d


JENA-1312: Verbose logging: capture bytes then safe-decode to string.

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

Branch: refs/heads/master
Commit: 1a089359f612942e79739788729adadb55d5269c
Parents: 4e7459c
Author: Andy Seaborne <andy@apache.org>
Authored: Wed Mar 29 14:35:51 2017 +0100
Committer: Andy Seaborne <andy@apache.org>
Committed: Wed Mar 29 14:35:51 2017 +0100

----------------------------------------------------------------------
 jena-fuseki2/jena-fuseki-core/fuseki-dev            |  5 +++++
 .../apache/jena/fuseki/servlets/SPARQL_Update.java  | 16 +++++++++-------
 2 files changed, 14 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jena/blob/1a089359/jena-fuseki2/jena-fuseki-core/fuseki-dev
----------------------------------------------------------------------
diff --git a/jena-fuseki2/jena-fuseki-core/fuseki-dev b/jena-fuseki2/jena-fuseki-core/fuseki-dev
index 781460c..365a33a 100755
--- a/jena-fuseki2/jena-fuseki-core/fuseki-dev
+++ b/jena-fuseki2/jena-fuseki-core/fuseki-dev
@@ -94,6 +94,11 @@ fi
 
 JVM_ARGS=${JVM_ARGS:--Xmx1200M}
 
+# Debug assistence
+## echo "++++ Classpath:"
+## echo "$(echo $CP | sed -e "s/:/\n/g")"
+## exit
+
 exec "$JAVA" -cp "$CP" $JVM_ARGS $FUSEKI_LOG org.apache.jena.fuseki.cmd.FusekiCmd "$@"
 
 # Run as war file.

http://git-wip-us.apache.org/repos/asf/jena/blob/1a089359/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_Update.java
----------------------------------------------------------------------
diff --git a/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_Update.java
b/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_Update.java
index 7ffa028..0807bf6 100644
--- a/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_Update.java
+++ b/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_Update.java
@@ -44,6 +44,7 @@ import javax.servlet.http.HttpServletRequest ;
 import javax.servlet.http.HttpServletResponse ;
 
 import org.apache.jena.atlas.io.IO ;
+import org.apache.jena.atlas.lib.Bytes ;
 import org.apache.jena.atlas.lib.StrUtils ;
 import org.apache.jena.atlas.web.ContentType ;
 import org.apache.jena.fuseki.Fuseki ;
@@ -178,13 +179,14 @@ public class SPARQL_Update extends SPARQL_Protocol
 
         if ( action.verbose ) {
             // Verbose mode only .... capture request for logging (does not scale).
-            String requestStr = null ;
-            try { requestStr = IO.readWholeFileAsUTF8(input) ; }
-            catch (IOException ex) { IO.exception(ex) ; }
-            action.log.info(format("[%d] Update = %s", action.id, ServletOps.formatForLog(requestStr)))
;
-
-            input = new ByteArrayInputStream(requestStr.getBytes());
-            requestStr = null;
+            byte[] bytes = IO.readWholeFile(input);
+            input = new ByteArrayInputStream(bytes);
+            try {
+                String requestStr = Bytes.bytes2string(bytes) ;
+                action.log.info(format("[%d] Update = %s", action.id, ServletOps.formatForLog(requestStr)))
;
+            } catch (Exception ex) {
+                action.log.info(format("[%d] Update = <failed to decode>", action.id))
;
+            }
         }
 
         execute(action, input) ;


Mime
View raw message