[Libreoffice-commits] core.git: jurt/com

rbuj robert.buj at gmail.com
Sun Aug 10 00:34:51 PDT 2014


 jurt/com/sun/star/comp/servicemanager/ServiceManager.java |   15 +++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

New commits:
commit 85ab4a14c541f3d6c30300d102b97f8564a1c7ee
Author: rbuj <robert.buj at gmail.com>
Date:   Sun Aug 10 03:10:29 2014 +0200

    jurt: Use <T> T[] toArray(T[] a)
    
    http://docs.oracle.com/javase/1.5.0/docs/api/java/util/Set.html#toArray%28T%5b%5d%29
    
    Change-Id: I601e77db3cc978d81aebddfe6abba1c020671913
    Reviewed-on: https://gerrit.libreoffice.org/10853
    Reviewed-by: David Tardon <dtardon at redhat.com>
    Tested-by: David Tardon <dtardon at redhat.com>

diff --git a/jurt/com/sun/star/comp/servicemanager/ServiceManager.java b/jurt/com/sun/star/comp/servicemanager/ServiceManager.java
index a4a5f8d..38e5cb3 100644
--- a/jurt/com/sun/star/comp/servicemanager/ServiceManager.java
+++ b/jurt/com/sun/star/comp/servicemanager/ServiceManager.java
@@ -188,15 +188,12 @@ public class ServiceManager implements XMultiServiceFactory,
     public String[] getAvailableServiceNames()
             throws com.sun.star.uno.RuntimeException
     {
-        int i = 0;
-        String[] availableServiceNames = new String[factoriesByServiceNames.size()];
-
-        java.util.Iterator<String> keys = factoriesByServiceNames.keySet().iterator();
-
-        while (keys.hasNext())
-            availableServiceNames[i++] = keys.next();
-
-        return availableServiceNames;
+        try{
+            return factoriesByServiceNames.keySet().toArray(
+                new String[ factoriesByServiceNames.size() ] );
+        } catch(Exception ex) {
+            throw new com.sun.star.uno.RuntimeException(ex.toString());
+        }
     }
 
     // XMultiComponentFactory implementation


More information about the Libreoffice-commits mailing list