8181100: Better Base Exceptions
authoraefimov
Mon, 19 Jun 2017 22:51:35 +0100
changeset 47403 a39992e8c9a7
parent 47402 fd5d1d2bc1d4
child 47404 e0aec2769cff
8181100: Better Base Exceptions Reviewed-by: dfuchs, rhalade, skoivu Contributed-by: roman.grigoriadi@oracle.com
src/java.xml.ws/share/classes/com/sun/xml/internal/ws/util/exception/JAXWSExceptionBase.java
--- a/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/util/exception/JAXWSExceptionBase.java	Tue Jun 13 11:13:56 2017 -0700
+++ b/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/util/exception/JAXWSExceptionBase.java	Mon Jun 19 22:51:35 2017 +0100
@@ -34,6 +34,8 @@
 import java.io.ObjectInputStream;
 import java.io.ObjectOutputStream;
 import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
 import java.util.Locale;
 import java.util.ResourceBundle;
 import javax.xml.ws.WebServiceException;
@@ -122,13 +124,21 @@
         String resourceBundleName = (String) in.readObject();
         String key = (String) in.readObject();
         int len = in.readInt();
-        if (len == -1) {
+        if (len < -1) {
+            throw new NegativeArraySizeException();
+        } else if (len == -1) {
             args = null;
-        } else {
+        } else if (len < 255) {
             args = new Object[len];
             for (int i = 0; i < args.length; i++) {
                 args[i] = in.readObject();
             }
+        } else {
+            List<Object> argList = new ArrayList<>(Math.min(len, 1024));
+            for (int i = 0; i < len; i++) {
+                argList.add(in.readObject());
+            }
+            args = argList.toArray(new Object[argList.size()]);
         }
         msg = new LocalizableMessageFactory(resourceBundleName).getMessage(key,args);
     }