[Libreoffice-commits] core.git: javaunohelper/com
Stephan Bergmann
sbergman at redhat.com
Mon Feb 8 13:36:47 UTC 2016
javaunohelper/com/sun/star/lib/uno/helper/InterfaceContainer.java | 23 +++++-----
1 file changed, 13 insertions(+), 10 deletions(-)
New commits:
commit 2d5f3dcf8dca6f0eb73e7435f333fba148bf9d49
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Mon Feb 8 14:36:20 2016 +0100
cid#1326918 FB.NP_CLONE_COULD_RETURN_NULL
Change-Id: I875cc2fc868fb4f1f45e90320e1fdaf70fe871d8
diff --git a/javaunohelper/com/sun/star/lib/uno/helper/InterfaceContainer.java b/javaunohelper/com/sun/star/lib/uno/helper/InterfaceContainer.java
index e0fa145..6da92d6 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()
{
More information about the Libreoffice-commits
mailing list