diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2016-02-08 14:36:20 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2016-02-08 14:36:20 +0100 |
commit | 2d5f3dcf8dca6f0eb73e7435f333fba148bf9d49 (patch) | |
tree | 9c0f75b40df69544e1b0c69b94771907f0919227 /javaunohelper | |
parent | d282dec83e5d4aba749baba857e0f9b4573bc414 (diff) |
cid#1326918 FB.NP_CLONE_COULD_RETURN_NULL
Change-Id: I875cc2fc868fb4f1f45e90320e1fdaf70fe871d8
Diffstat (limited to 'javaunohelper')
-rw-r--r-- | javaunohelper/com/sun/star/lib/uno/helper/InterfaceContainer.java | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/javaunohelper/com/sun/star/lib/uno/helper/InterfaceContainer.java b/javaunohelper/com/sun/star/lib/uno/helper/InterfaceContainer.java index e0fa1456e817..6da92d6f5346 100644 --- a/javaunohelper/com/sun/star/lib/uno/helper/InterfaceContainer.java +++ b/javaunohelper/com/sun/star/lib/uno/helper/InterfaceContainer.java @@ -121,6 +121,11 @@ public class InterfaceContainer implements Cloneable this.elementData = new Object[initialCapacity]; } + private InterfaceContainer(Object[] data) { + elementData = data; + size = elementData == null ? 0 : elementData.length; + } + /** * Trims the capacity of this <tt>ArrayList</tt> instance to be the * list's current size. An application can use this operation to minimize @@ -448,16 +453,14 @@ public class InterfaceContainer implements Cloneable @Override synchronized public Object clone() { - Object ret= null; - if (elementData != null) - { - InterfaceContainer cont= new InterfaceContainer(); - cont.elementData = new Object[size]; - cont.size= size; - System.arraycopy(elementData, 0, cont.elementData, 0, size); - ret= cont; - } - return ret; + Object[] data; + if (elementData == null) { + data = null; + } else { + data = new Object[size]; + System.arraycopy(elementData, 0, data, 0, size); + } + return new InterfaceContainer(data); } synchronized public ListIterator listIterator() { |