cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a.@apache.org
Subject svn commit: r1499316 - in /cxf/branches/2.6.x-fixes: ./ rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/context/WrappedAttachments.java rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/context/WrappedAttachmentsTest.java
Date Wed, 03 Jul 2013 10:50:14 GMT
Author: ay
Date: Wed Jul  3 10:50:14 2013
New Revision: 1499316

URL: http://svn.apache.org/r1499316
Log:
Merged revisions 1498991 via  svn merge from
https://svn.apache.org/repos/asf/cxf/branches/2.7.x-fixes

........
  r1498991 | ay | 2013-07-02 17:52:45 +0200 (Tue, 02 Jul 2013) | 9 lines
  
  Merged revisions 1498988 via  svn merge from
  https://svn.apache.org/repos/asf/cxf/trunk
  
  ........
    r1498988 | ay | 2013-07-02 17:44:55 +0200 (Tue, 02 Jul 2013) | 1 line
    
    clean up and add another test for CXF-5095
  ........
  
........

Added:
    cxf/branches/2.6.x-fixes/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/context/WrappedAttachmentsTest.java
      - copied unchanged from r1498991, cxf/branches/2.7.x-fixes/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/context/WrappedAttachmentsTest.java
Modified:
    cxf/branches/2.6.x-fixes/   (props changed)
    cxf/branches/2.6.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/context/WrappedAttachments.java

Propchange: cxf/branches/2.6.x-fixes/
            ('svn:mergeinfo' removed)

Propchange: cxf/branches/2.6.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: cxf/branches/2.6.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/context/WrappedAttachments.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.6.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/context/WrappedAttachments.java?rev=1499316&r1=1499315&r2=1499316&view=diff
==============================================================================
--- cxf/branches/2.6.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/context/WrappedAttachments.java
(original)
+++ cxf/branches/2.6.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/context/WrappedAttachments.java
Wed Jul  3 10:50:14 2013
@@ -65,7 +65,13 @@ class WrappedAttachments implements Set<
     }
 
     public Object[] toArray() {
-        Object[] obj = new Object[attachments.size()];
+        return toArray(new Object[attachments.size()]);
+    }
+
+    @SuppressWarnings("unchecked")
+    public <T> T[] toArray(T[] a) {
+        T[] copy = a.length == attachments.size() 
+            ? a : (T[])Array.newInstance(a.getClass(), attachments.size());
         int i = 0;
         for (Map.Entry<String, DataHandler> entry : attachments.entrySet()) {
             Attachment o = cache.get(entry.getKey());
@@ -73,17 +79,9 @@ class WrappedAttachments implements Set<
                 o = new AttachmentImpl(entry.getKey(), entry.getValue());
                 cache.put(entry.getKey(), o);
             }
-            obj[i++] = o;
+            copy[i++] = (T)o;
         }
-        return obj;
-    }
-
-    @SuppressWarnings("unchecked")
-    public <T> T[] toArray(T[] a) {
-        Object[] obj = toArray();
-        T[] copy = (T[])Array.newInstance(a.getClass(), obj.length);
-        System.arraycopy(obj, 0, copy, 0, obj.length);
-        return copy;
+        return copy;        
     }
 
     public boolean add(Attachment e) {



Mime
View raw message