myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject svn commit: r1767459 - in /myfaces/tobago/branches/tobago-2.0.x: tobago-core/src/main/java/org/apache/myfaces/tobago/internal/webapp/ tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/
Date Tue, 01 Nov 2016 09:33:55 GMT
Author: deki
Date: Tue Nov  1 09:33:55 2016
New Revision: 1767459

URL: http://svn.apache.org/viewvc?rev=1767459&view=rev
Log:
TOBAGO-1580: avoid NPEs

Modified:
    myfaces/tobago/branches/tobago-2.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/webapp/TobagoMultipartFormdataRequest.java
    myfaces/tobago/branches/tobago-2.0.x/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/Upload.java

Modified: myfaces/tobago/branches/tobago-2.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/webapp/TobagoMultipartFormdataRequest.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-2.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/webapp/TobagoMultipartFormdataRequest.java?rev=1767459&r1=1767458&r2=1767459&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-2.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/webapp/TobagoMultipartFormdataRequest.java
(original)
+++ myfaces/tobago/branches/tobago-2.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/webapp/TobagoMultipartFormdataRequest.java
Tue Nov  1 09:33:55 2016
@@ -154,9 +154,9 @@ public class TobagoMultipartFormdataRequ
 
   public FileItem getFileItem(final String key) {
     if (fileItems != null) {
-      final List<FileItem> fileItems = this.fileItems.get(key);
-      if (fileItems.size() > 0) {
-        return fileItems.get(0);
+      final List<FileItem> fileItemsForKey = this.fileItems.get(key);
+      if (fileItemsForKey != null && fileItemsForKey.size() > 0) {
+        return fileItemsForKey.get(0);
       } else {
         return null;
       }
@@ -166,8 +166,10 @@ public class TobagoMultipartFormdataRequ
 
   public FileItem[] getFileItems(final String key) {
     if (fileItems != null) {
-      final List<FileItem> fileItems = this.fileItems.get(key);
-      return fileItems.toArray(new FileItem[fileItems.size()]);
+      final List<FileItem> fileItemsForKey = this.fileItems.get(key);
+      if (fileItemsForKey != null) {
+        return fileItemsForKey.toArray(new FileItem[fileItemsForKey.size()]);
+      }
     }
     return null;
   }

Modified: myfaces/tobago/branches/tobago-2.0.x/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/Upload.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-2.0.x/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/Upload.java?rev=1767459&r1=1767458&r2=1767459&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-2.0.x/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/Upload.java
(original)
+++ myfaces/tobago/branches/tobago-2.0.x/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/Upload.java
Tue Nov  1 09:33:55 2016
@@ -44,8 +44,10 @@ public class Upload {
     }
 
   public void upload(FileItem[] files) {
-    for (FileItem file : files) {
-      upload(file);
+    if (files != null) {
+      for (FileItem file : files) {
+        upload(file);
+      }
     }
   }
 



Mime
View raw message