[Mulgara-svn] r1529 - trunk/src/jar/web/java/org/mulgara/webquery

pag at mulgara.org pag at mulgara.org
Thu Feb 19 16:44:20 UTC 2009


Author: pag
Date: 2009-02-19 08:44:19 -0800 (Thu, 19 Feb 2009)
New Revision: 1529

Modified:
   trunk/src/jar/web/java/org/mulgara/webquery/QueryServlet.java
Log:
Fixed bug in data uplaod where a query was also being executed. Data uploads now include the filename with the mime type, in case the mime type is not recognized (Firefox usually sends an octet stream). Also included better error reporting on load failures.

Modified: trunk/src/jar/web/java/org/mulgara/webquery/QueryServlet.java
===================================================================
--- trunk/src/jar/web/java/org/mulgara/webquery/QueryServlet.java	2009-02-19 16:42:16 UTC (rev 1528)
+++ trunk/src/jar/web/java/org/mulgara/webquery/QueryServlet.java	2009-02-19 16:44:19 UTC (rev 1529)
@@ -216,7 +216,7 @@
 
     String type = req.getContentType();
     if (type != null && type.startsWith(POSTED_DATA_TYPE)) handleDataUpload(req, resp);
-    doQuery(req, resp, req.getParameter(GRAPH_ARG));
+    else doQuery(req, resp, req.getParameter(GRAPH_ARG));
   }
 
 
@@ -361,7 +361,7 @@
       try {
         new CreateGraph(destGraph).execute(conn);
       } catch (QueryException e) {
-        throw new RequestException("Unable to create graph: " + e.getMessage());
+        throw new RequestException("Unable to create graph <" + destGraph + ">: " + e.getMessage());
       }
 
       // upload the data
@@ -375,7 +375,10 @@
             break;
           }
         } catch (QueryException e) {
-          throw new RequestException("Unable to load data: " + partName);
+          String filename = part.getFileName();
+          String message = "Unable to load data: " + (filename == null ? partName : filename);
+          message += ".  " + StackTrace.getReasonMessage(e);
+          throw new RequestException(message);
         }
       }
 
@@ -414,6 +417,7 @@
         throw new RequestException("Invalid URI for upload graph. " + e.getInput());
       }
     }
+    System.err.println("No graphs in the parameter values");
     // look in the mime data
     if (mime != null) {
       try {
@@ -447,7 +451,7 @@
     String contentType = "";
     try {
       contentType = data.getContentType();
-      Load loadCmd = new Load(graph, data.getInputStream(), new MimeType(contentType));
+      Load loadCmd = new Load(graph, data.getInputStream(), new MimeType(contentType), data.getFileName());
       loadCmd.execute(cxt);
       return loadCmd;
     } catch (MessagingException e) {




More information about the Mulgara-svn mailing list