You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openmeetings.apache.org by so...@apache.org on 2017/10/16 04:27:45 UTC

openmeetings git commit: no jira: error handling while file upload is improved

Repository: openmeetings
Updated Branches:
  refs/heads/master c4b01401c -> ae40f805f


no jira: error handling while file upload is improved


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

Branch: refs/heads/master
Commit: ae40f805f74d4dcbacfb4c8d8bce2ba5d8f94d24
Parents: c4b0140
Author: Maxim Solodovnik <so...@gmail.com>
Authored: Mon Oct 16 11:27:37 2017 +0700
Committer: Maxim Solodovnik <so...@gmail.com>
Committed: Mon Oct 16 11:27:37 2017 +0700

----------------------------------------------------------------------
 .../openmeetings/core/data/file/FileProcessor.java   | 15 +++++++--------
 .../openmeetings/web/room/sidebar/UploadDialog.html  |  2 +-
 2 files changed, 8 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/openmeetings/blob/ae40f805/openmeetings-core/src/main/java/org/apache/openmeetings/core/data/file/FileProcessor.java
----------------------------------------------------------------------
diff --git a/openmeetings-core/src/main/java/org/apache/openmeetings/core/data/file/FileProcessor.java b/openmeetings-core/src/main/java/org/apache/openmeetings/core/data/file/FileProcessor.java
index 4714836..ca74063 100644
--- a/openmeetings-core/src/main/java/org/apache/openmeetings/core/data/file/FileProcessor.java
+++ b/openmeetings-core/src/main/java/org/apache/openmeetings/core/data/file/FileProcessor.java
@@ -65,12 +65,9 @@ public class FileProcessor {
 
 		File temp = null;
 		try {
-			temp = File.createTempFile(String.format("upload_%s", hash), ".tmp");
-			copyInputStreamToFile(is, temp);
-
 			String ext = getFileExt(f.getName());
-			log.debug("file extension: " + ext);
-			StoredFile sf = new StoredFile(hash, ext, temp);
+			log.debug("file extension: {}", ext);
+			StoredFile sf = new StoredFile(hash, ext, is);
 			// Check variable to see if this file is a presentation
 			// check if this is a a file that can be converted by
 			// openoffice-service
@@ -101,13 +98,15 @@ public class FileProcessor {
 			f.setHash(hash);
 
 			File file = f.getFile(ext);
-			log.debug("writing file to: " + file);
+			log.debug("writing file to: {}", file);
 			if (!file.getParentFile().exists() && !file.getParentFile().mkdirs()) {
 				result.addItem("No parent", new ProcessResult("Unable to create parent for file: " + file.getCanonicalPath()));
 				return result;
 			}
 
-			log.debug("canBeConverted: " + isOffice);
+			temp = File.createTempFile(String.format("upload_%s", hash), ".tmp");
+			copyInputStreamToFile(is, temp);
+			log.debug("canBeConverted: {}", isOffice);
 			if (isOffice || isPdf) {
 				copyFile(temp, file);
 				// convert to pdf, thumbs, swf and xml-description
@@ -130,7 +129,7 @@ public class FileProcessor {
 				}
 			}
 			f = fileDao.update(f);
-			log.debug("fileId: " + f.getId());
+			log.debug("fileId: {}", f.getId());
 		} catch (Exception e) {
 			log.debug("Error while processing the file", e);
 			result.addItem("exception", new ProcessResult("Unexpected exception: " + e.getMessage()));

http://git-wip-us.apache.org/repos/asf/openmeetings/blob/ae40f805/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/sidebar/UploadDialog.html
----------------------------------------------------------------------
diff --git a/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/sidebar/UploadDialog.html b/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/sidebar/UploadDialog.html
index 50b2c52..718749e 100644
--- a/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/sidebar/UploadDialog.html
+++ b/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/sidebar/UploadDialog.html
@@ -29,7 +29,7 @@
 				<input type="file" multiple="multiple" wicket:id="file"/>
 			</span>
 		</div>
-		<div wicket:id="feedback"></div>
+		<div wicket:id="feedback" class="error"></div>
 		<span wicket:id="progress">[progressbar]</span>
 		<div style="margin-top: 30px;">
 			<input wicket:id="to-wb" type="checkbox"/><label wicket:for="to-wb"><wicket:message key="1312"/></label>