Author: sascharodekamp
Date: Wed Sep 21 12:53:35 2011 New Revision: 1173607 URL: http://svn.apache.org/viewvc?rev=1173607&view=rev Log: FIX: Wrong use of toArray() method (https://issues.apache.org/jira/browse/OFBIZ-4425). A patch from Dimitri Unruh which replaces Array Casts with a propper call of the toArray method. String[] temp = (String[]) foo.toArray(); <-- may cause class cast exception it is better to use: String[] temp = foo.toArray(new String[foo.size()]) Modified: ofbiz/trunk/applications/content/src/org/ofbiz/content/content/PermissionRecorder.java ofbiz/trunk/framework/base/src/org/ofbiz/base/util/KeyStoreUtil.java ofbiz/trunk/framework/jetty/src/org/ofbiz/jetty/container/JettyContainer.java Modified: ofbiz/trunk/applications/content/src/org/ofbiz/content/content/PermissionRecorder.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/src/org/ofbiz/content/content/PermissionRecorder.java?rev=1173607&r1=1173606&r2=1173607&view=diff ============================================================================== --- ofbiz/trunk/applications/content/src/org/ofbiz/content/content/PermissionRecorder.java (original) +++ ofbiz/trunk/applications/content/src/org/ofbiz/content/content/PermissionRecorder.java Wed Sep 21 12:53:35 2011 @@ -99,7 +99,7 @@ public class PermissionRecorder { } public void setContentPurposeOperations(List<GenericValue> opList) { - contentPurposeOperations = (GenericValue [])opList.toArray(); + contentPurposeOperations = opList.toArray(new GenericValue[opList.size()]); } public void setPrivilegeEnumId(String id) { @@ -115,7 +115,7 @@ public class PermissionRecorder { } public void setStatusTargets(List<String> opList) { - statusTargets = (String [])opList.toArray(); + statusTargets = opList.toArray(new String[opList.size()]); } public String [] getTargetOperations() { @@ -123,7 +123,7 @@ public class PermissionRecorder { } public void setTargetOperations(List<String> opList) { - targetOperations = (String [])opList.toArray(); + targetOperations = opList.toArray(new String[opList.size()]); } public void setCurrentContentId(String id) { Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/util/KeyStoreUtil.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/KeyStoreUtil.java?rev=1173607&r1=1173606&r2=1173607&view=diff ============================================================================== --- ofbiz/trunk/framework/base/src/org/ofbiz/base/util/KeyStoreUtil.java (original) +++ ofbiz/trunk/framework/base/src/org/ofbiz/base/util/KeyStoreUtil.java Wed Sep 21 12:53:35 2011 @@ -176,7 +176,7 @@ public class KeyStoreUtil { certs[0] = cert; } else { Debug.log("Certificate chain length : " + certCol.size(), module); - certs = (Certificate[]) certCol.toArray(); + certs = certCol.toArray(new Certificate[certCol.size()]); } ks.setKeyEntry(alias, pk, keyPass.toCharArray(), certs); Modified: ofbiz/trunk/framework/jetty/src/org/ofbiz/jetty/container/JettyContainer.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/jetty/src/org/ofbiz/jetty/container/JettyContainer.java?rev=1173607&r1=1173606&r2=1173607&view=diff ============================================================================== --- ofbiz/trunk/framework/jetty/src/org/ofbiz/jetty/container/JettyContainer.java (original) +++ ofbiz/trunk/framework/jetty/src/org/ofbiz/jetty/container/JettyContainer.java Wed Sep 21 12:53:35 2011 @@ -118,7 +118,7 @@ public class JettyContainer implements C // set the virtual hosts if (UtilValidate.isNotEmpty(virtualHosts)) { - context.setVirtualHosts((String[]) virtualHosts.toArray()); + context.setVirtualHosts(virtualHosts.toArray(new String[virtualHosts.size()])); } // set the init parameters |
Free forum by Nabble | Edit this page |