[Dive4elements-commits] [PATCH] Add some debug output to FileUploadServiceImpl

Wald Commits scm-commit at wald.intevation.org
Tue May 28 13:04:17 CEST 2013


# HG changeset patch
# User Christian Lins <christian.lins at intevation.de>
# Date 1369739053 -7200
# Node ID 427ef71724766b49dd09bdc6318a8728d36cf27d
# Parent  4db57e2f35f54c6d21ec01885243b471386ca2d6
Add some debug output to FileUploadServiceImpl.

diff -r 4db57e2f35f5 -r 427ef7172476 gwt-client/src/main/java/org/dive4elements/river/client/server/FileUploadServiceImpl.java
--- a/gwt-client/src/main/java/org/dive4elements/river/client/server/FileUploadServiceImpl.java	Mon May 27 17:59:00 2013 +0200
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/server/FileUploadServiceImpl.java	Tue May 28 13:04:13 2013 +0200
@@ -53,7 +53,7 @@
             Document result = client.callService(url, "fileupload", request);
 
             resp.setContentType("text/html");
-            
+
             PrintWriter respWriter = resp.getWriter();
             respWriter.write("<html><body><div style='font-face: Arial,Verdana,sans-serif; font-size: 11px'>");
 
@@ -82,7 +82,7 @@
 
 
     protected Document createFileXML(HttpServletRequest req) {
-           ServletFileUpload upload = new ServletFileUpload();
+        ServletFileUpload upload = new ServletFileUpload();
 
         try{
             FileItemIterator iter = upload.getItemIterator(req);
@@ -93,11 +93,13 @@
 
                 // Process the input stream
                 ByteArrayOutputStream out = new ByteArrayOutputStream();
-                int len;
+                int len, cnt = 0;
                 byte[] buffer = new byte[stream.available()];
                 while ((len = stream.read(buffer, 0, buffer.length)) != -1) {
                     out.write(buffer, 0, len);
+                    cnt += len;
                 }
+                logger.debug("FileUploadServiceImpl.createFileXML(): " + cnt + " bytes file to be uploaded");
 
                 buffer = Base64.encodeBase64(buffer);
                 String b64File = new String(buffer);


More information about the Dive4elements-commits mailing list