[Libreoffice-commits] core.git: javaunohelper/com jurt/com nlpsolver/ThirdParty odk/examples qadevOOo/tests scripting/java swext/mediawiki toolkit/test xmerge/source

Noel Grandin noel at peralex.com
Wed Nov 12 00:02:24 PST 2014


 javaunohelper/com/sun/star/lib/uno/helper/PropertySetMixin.java                                    |  185 +++++-----
 jurt/com/sun/star/lib/uno/bridges/java_remote/java_remote_bridge.java                              |   25 -
 jurt/com/sun/star/uno/WeakReference.java                                                           |   25 -
 nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/global/RandomGenerator.java            |  114 +++---
 odk/examples/DevelopersGuide/Components/Addons/ProtocolHandlerAddon_java/ProtocolHandlerAddon.java |   48 +-
 qadevOOo/tests/java/ifc/chart/_XChartDataArray.java                                                |   29 -
 scripting/java/com/sun/star/script/framework/container/DeployedUnoPackagesDB.java                  |   29 -
 swext/mediawiki/src/com/sun/star/wiki/Helper.java                                                  |   66 +--
 swext/mediawiki/src/com/sun/star/wiki/WikiDialog.java                                              |   16 
 swext/mediawiki/src/com/sun/star/wiki/WikiProtocolSocketFactory.java                               |   90 ++--
 toolkit/test/accessibility/TextUpdateListener.java                                                 |   36 -
 xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/StyleCatalog.java                    |   47 +-
 xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/TextStyle.java                       |   31 -
 xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/sxc/RowStyle.java                    |   31 -
 14 files changed, 389 insertions(+), 383 deletions(-)

New commits:
commit 36ff1527c9cb20542d3097d123d221c40a356795
Author: Noel Grandin <noel at peralex.com>
Date:   Tue Nov 11 15:32:10 2014 +0200

    java: reduce excessive code indentation levels
    
    by using early return in some methods
    
    Change-Id: I3611c8c89b3a94ef7e1772d178acf065fd7fcdc7
    Reviewed-on: https://gerrit.libreoffice.org/12374
    Reviewed-by: Noel Grandin <noelgrandin at gmail.com>
    Tested-by: Noel Grandin <noelgrandin at gmail.com>

diff --git a/javaunohelper/com/sun/star/lib/uno/helper/PropertySetMixin.java b/javaunohelper/com/sun/star/lib/uno/helper/PropertySetMixin.java
index f3d9a8e..7e2af48 100644
--- a/javaunohelper/com/sun/star/lib/uno/helper/PropertySetMixin.java
+++ b/javaunohelper/com/sun/star/lib/uno/helper/PropertySetMixin.java
@@ -563,106 +563,107 @@ public final class PropertySetMixin {
     {
         XInterfaceTypeDescription2 ifc = UnoRuntime.queryInterface(
             XInterfaceTypeDescription2.class, resolveTypedefs(type));
-        if (seen.add(ifc.getName())) {
-            XTypeDescription[] bases = ifc.getBaseTypes();
-            for (int i = 0; i < bases.length; ++i) {
-                initProperties(bases[i], map, handleNames, seen);
-            }
-            XInterfaceMemberTypeDescription[] members = ifc.getMembers();
-            for (int i = 0; i < members.length; ++i) {
-                if (members[i].getTypeClass() == TypeClass.INTERFACE_ATTRIBUTE)
-                {
-                    XInterfaceAttributeTypeDescription2 attr =
-                        UnoRuntime.queryInterface(
-                            XInterfaceAttributeTypeDescription2.class,
-                            members[i]);
-                    short attrAttribs = 0;
-                    if (attr.isBound()) {
-                        attrAttribs |= PropertyAttribute.BOUND;
+        if (!seen.add(ifc.getName())) {
+            return;
+        }
+        XTypeDescription[] bases = ifc.getBaseTypes();
+        for (int i = 0; i < bases.length; ++i) {
+            initProperties(bases[i], map, handleNames, seen);
+        }
+        XInterfaceMemberTypeDescription[] members = ifc.getMembers();
+        for (int i = 0; i < members.length; ++i) {
+            if (members[i].getTypeClass() == TypeClass.INTERFACE_ATTRIBUTE)
+            {
+                XInterfaceAttributeTypeDescription2 attr =
+                    UnoRuntime.queryInterface(
+                        XInterfaceAttributeTypeDescription2.class,
+                        members[i]);
+                short attrAttribs = 0;
+                if (attr.isBound()) {
+                    attrAttribs |= PropertyAttribute.BOUND;
+                }
+                boolean setUnknown = false;
+                if (attr.isReadOnly()) {
+                    attrAttribs |= PropertyAttribute.READONLY;
+                    setUnknown = true;
+                }
+                XCompoundTypeDescription[] excs = attr.getGetExceptions();
+                boolean getUnknown = false;
+                //XXX  Special interpretation of getter/setter exceptions
+                // only works if the specified exceptions are of the exact
+                // type, not of a supertype:
+                for (int j = 0; j < excs.length; ++j) {
+                    if (excs[j].getName().equals(
+                            "com.sun.star.beans.UnknownPropertyException"))
+                    {
+                        getUnknown = true;
+                        break;
                     }
-                    boolean setUnknown = false;
-                    if (attr.isReadOnly()) {
-                        attrAttribs |= PropertyAttribute.READONLY;
+                }
+                excs = attr.getSetExceptions();
+                for (int j = 0; j < excs.length; ++j) {
+                    if (excs[j].getName().equals(
+                            "com.sun.star.beans.UnknownPropertyException"))
+                    {
                         setUnknown = true;
+                    } else if (excs[j].getName().equals(
+                                   "com.sun.star.beans."
+                                   + "PropertyVetoException"))
+                    {
+                        attrAttribs |= PropertyAttribute.CONSTRAINED;
                     }
-                    XCompoundTypeDescription[] excs = attr.getGetExceptions();
-                    boolean getUnknown = false;
-                    //XXX  Special interpretation of getter/setter exceptions
-                    // only works if the specified exceptions are of the exact
-                    // type, not of a supertype:
-                    for (int j = 0; j < excs.length; ++j) {
-                        if (excs[j].getName().equals(
-                                "com.sun.star.beans.UnknownPropertyException"))
-                        {
-                            getUnknown = true;
-                            break;
-                        }
-                    }
-                    excs = attr.getSetExceptions();
-                    for (int j = 0; j < excs.length; ++j) {
-                        if (excs[j].getName().equals(
-                                "com.sun.star.beans.UnknownPropertyException"))
-                        {
-                            setUnknown = true;
-                        } else if (excs[j].getName().equals(
-                                       "com.sun.star.beans."
-                                       + "PropertyVetoException"))
-                        {
-                            attrAttribs |= PropertyAttribute.CONSTRAINED;
-                        }
-                    }
-                    if (getUnknown && setUnknown) {
-                        attrAttribs |= PropertyAttribute.OPTIONAL;
+                }
+                if (getUnknown && setUnknown) {
+                    attrAttribs |= PropertyAttribute.OPTIONAL;
+                }
+                XTypeDescription t = attr.getType();
+                for (;;) {
+                    t = resolveTypedefs(t);
+                    short n;
+                    if (t.getName().startsWith(
+                            "com.sun.star.beans.Ambiguous<"))
+                    {
+                        n = PropertyAttribute.MAYBEAMBIGUOUS;
+                    } else if (t.getName().startsWith(
+                                   "com.sun.star.beans.Defaulted<"))
+                    {
+                        n = PropertyAttribute.MAYBEDEFAULT;
+                    } else if (t.getName().startsWith(
+                                   "com.sun.star.beans.Optional<"))
+                    {
+                        n = PropertyAttribute.MAYBEVOID;
+                    } else {
+                        break;
                     }
-                    XTypeDescription t = attr.getType();
-                    for (;;) {
-                        t = resolveTypedefs(t);
-                        short n;
-                        if (t.getName().startsWith(
-                                "com.sun.star.beans.Ambiguous<"))
-                        {
-                            n = PropertyAttribute.MAYBEAMBIGUOUS;
-                        } else if (t.getName().startsWith(
-                                       "com.sun.star.beans.Defaulted<"))
-                        {
-                            n = PropertyAttribute.MAYBEDEFAULT;
-                        } else if (t.getName().startsWith(
-                                       "com.sun.star.beans.Optional<"))
-                        {
-                            n = PropertyAttribute.MAYBEVOID;
-                        } else {
+                    attrAttribs |= n;
+                    t = (UnoRuntime.queryInterface(
+                             XStructTypeDescription.class, t)).
+                        getTypeArguments()[0];
+                }
+                String name = members[i].getMemberName();
+                boolean present = true;
+                if (absentOptional != null) {
+                    for (int j = 0; j < absentOptional.length; ++j) {
+                        if (name.equals(absentOptional[j])) {
+                            present = false;
                             break;
                         }
-                        attrAttribs |= n;
-                        t = (UnoRuntime.queryInterface(
-                                 XStructTypeDescription.class, t)).
-                            getTypeArguments()[0];
-                    }
-                    String name = members[i].getMemberName();
-                    boolean present = true;
-                    if (absentOptional != null) {
-                        for (int j = 0; j < absentOptional.length; ++j) {
-                            if (name.equals(absentOptional[j])) {
-                                present = false;
-                                break;
-                            }
-                        }
                     }
-                    if (map.put(
-                            name,
-                            new PropertyData(
-                                new Property(
-                                    name, handleNames.size(),
-                                    new Type(t.getName(), t.getTypeClass()),
-                                    attrAttribs),
-                                present))
-                        != null)
-                    {
-                        throw new RuntimeException(
-                            "inconsistent UNO type registry");
-                    }
-                    handleNames.add(name);
                 }
+                if (map.put(
+                        name,
+                        new PropertyData(
+                            new Property(
+                                name, handleNames.size(),
+                                new Type(t.getName(), t.getTypeClass()),
+                                attrAttribs),
+                            present))
+                    != null)
+                {
+                    throw new RuntimeException(
+                        "inconsistent UNO type registry");
+                }
+                handleNames.add(name);
             }
         }
     }
diff --git a/jurt/com/sun/star/lib/uno/bridges/java_remote/java_remote_bridge.java b/jurt/com/sun/star/lib/uno/bridges/java_remote/java_remote_bridge.java
index c9473ea..722f825 100644
--- a/jurt/com/sun/star/lib/uno/bridges/java_remote/java_remote_bridge.java
+++ b/jurt/com/sun/star/lib/uno/bridges/java_remote/java_remote_bridge.java
@@ -258,21 +258,22 @@ public class java_remote_bridge
     final void remRefHolder(Type type, String oid) {
         synchronized (refHolders) {
             LinkedList<RefHolder> l = refHolders.get(oid);
-            if (l != null) {
-                for (RefHolder rh : l) {
-                    if (rh.getType().equals(type)) {
-                        try {
-                            if (rh.release()) {
-                                l.remove(rh);
-                                if (l.isEmpty()) {
-                                    refHolders.remove(oid);
-                                }
+            if (l == null) {
+                return;
+            }
+            for (RefHolder rh : l) {
+                if (rh.getType().equals(type)) {
+                    try {
+                        if (rh.release()) {
+                            l.remove(rh);
+                            if (l.isEmpty()) {
+                                refHolders.remove(oid);
                             }
-                        } finally {
-                            release();
                         }
-                        break;
+                    } finally {
+                        release();
                     }
+                    break;
                 }
             }
         }
diff --git a/jurt/com/sun/star/uno/WeakReference.java b/jurt/com/sun/star/uno/WeakReference.java
index 261bc1a..81c4cd4 100644
--- a/jurt/com/sun/star/uno/WeakReference.java
+++ b/jurt/com/sun/star/uno/WeakReference.java
@@ -43,19 +43,18 @@ public class WeakReference
      */
     public WeakReference(WeakReference obj)
     {
-        if (obj != null)
-        {
-            Object weakImpl= obj.get();
-            if (weakImpl != null)
-            {
-                XWeak weak= UnoRuntime.queryInterface(XWeak.class, weakImpl);
-                if (weak != null)
-                {
-                    XAdapter adapter= weak.queryAdapter();
-                    if (adapter != null)
-                        m_listener= new OWeakRefListener(adapter);
-                }
-            }
+        if (obj == null) {
+            return;
+        }
+        Object weakImpl = obj.get();
+        if (weakImpl == null) {
+            return;
+        }
+        XWeak weak = UnoRuntime.queryInterface(XWeak.class, weakImpl);
+        if (weak != null) {
+            XAdapter adapter = weak.queryAdapter();
+            if (adapter != null)
+                m_listener = new OWeakRefListener(adapter);
         }
     }
 
diff --git a/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/global/RandomGenerator.java b/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/global/RandomGenerator.java
index 448ae01..86103ee 100644
--- a/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/global/RandomGenerator.java
+++ b/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/global/RandomGenerator.java
@@ -24,65 +24,67 @@ package net.adaptivebox.global;
 
 public class RandomGenerator {
 
-/**This function returns a random integer number between the lowLimit and upLimit.
- * @param lowLimit lower limits
- *        upLimit The upper limits (between which the random number is to be generated)
- * @return int return value
- * Example: for find [0,1,2]
-*/
-public static int intRangeRandom(int lowLimit,int upLimit){
-  int num = (int)Math.floor(doubleRangeRandom(lowLimit,upLimit+1)-1E-10);
-  return(num);
-}
-
-/**This function returns a random float number between the lowLimit and upLimit.
- * @param lowLimit lower limits
- *        upLimit The upper limits (between which the random number is to be generated)
- * @return double return value
-*/
-public static double doubleRangeRandom(double lowLimit,double upLimit){
-  double num = lowLimit + Math.random()*(upLimit-lowLimit);
-  return(num);
-}
-
-
-
-
-
-
-
-
-
-  public static int[] randomSelection(int maxNum, int times) {
-    if(times<=0) return new int[0];
-    int realTimes = Math.min(maxNum, times);
-    boolean[] flags = new boolean[maxNum];
-    boolean isBelowHalf = times<maxNum*0.5;
-    int virtualTimes = realTimes;
-    if(!isBelowHalf) {
-      virtualTimes = maxNum-realTimes;
+    /**
+     * This function returns a random integer number between the lowLimit and
+     * upLimit.
+     *
+     * @param lowLimit
+     *            lower limits upLimit The upper limits (between which the
+     *            random number is to be generated)
+     * @return int return value Example: for find [0,1,2]
+     */
+    public static int intRangeRandom(int lowLimit, int upLimit) {
+        int num = (int) Math
+                .floor(doubleRangeRandom(lowLimit, upLimit + 1) - 1E-10);
+        return (num);
     }
-    int i = 0;
-    int upper = maxNum-1;
-    int[] indices = new int[realTimes];
 
-    while(i<virtualTimes) {
-      indices[i] = intRangeRandom(0, upper);
-      if(!flags[indices[i]]) {
-        flags[indices[i]] = true;
-        i++;
-      }
+    /**
+     * This function returns a random float number between the lowLimit and
+     * upLimit.
+     *
+     * @param lowLimit
+     *            lower limits upLimit The upper limits (between which the
+     *            random number is to be generated)
+     * @return double return value
+     */
+    public static double doubleRangeRandom(double lowLimit, double upLimit) {
+        double num = lowLimit + Math.random() * (upLimit - lowLimit);
+        return (num);
     }
-    if(!isBelowHalf) {
-      int j=0;
-      for(i=0; i<maxNum; i++) {
-        if(flags[i]==isBelowHalf) {
-          indices[j] = i;
-          j++;
-          if(j==realTimes) break;
+
+    public static int[] randomSelection(int maxNum, int times) {
+        if (times <= 0)
+            return new int[0];
+        int realTimes = Math.min(maxNum, times);
+        boolean[] flags = new boolean[maxNum];
+        boolean isBelowHalf = times < maxNum * 0.5;
+        int virtualTimes = realTimes;
+        if (!isBelowHalf) {
+            virtualTimes = maxNum - realTimes;
+        }
+        int i = 0;
+        int upper = maxNum - 1;
+        int[] indices = new int[realTimes];
+
+        while (i < virtualTimes) {
+            indices[i] = intRangeRandom(0, upper);
+            if (!flags[indices[i]]) {
+                flags[indices[i]] = true;
+                i++;
+            }
+        }
+        if (!isBelowHalf) {
+            int j = 0;
+            for (i = 0; i < maxNum; i++) {
+                if (flags[i] == isBelowHalf) {
+                    indices[j] = i;
+                    j++;
+                    if (j == realTimes)
+                        break;
+                }
+            }
         }
-      }
+        return indices;
     }
-    return indices;
-  }
 }
\ No newline at end of file
diff --git a/odk/examples/DevelopersGuide/Components/Addons/ProtocolHandlerAddon_java/ProtocolHandlerAddon.java b/odk/examples/DevelopersGuide/Components/Addons/ProtocolHandlerAddon_java/ProtocolHandlerAddon.java
index 8c2e95a..239296c 100644
--- a/odk/examples/DevelopersGuide/Components/Addons/ProtocolHandlerAddon_java/ProtocolHandlerAddon.java
+++ b/odk/examples/DevelopersGuide/Components/Addons/ProtocolHandlerAddon_java/ProtocolHandlerAddon.java
@@ -201,30 +201,30 @@ public class ProtocolHandlerAddon {
         }
 
         public void showMessageBox(String sTitle, String sMessage) {
-            if ( null != m_xFrame && null != m_xToolkit ) {
-
-                // describe window properties.
-                WindowDescriptor aDescriptor = new WindowDescriptor();
-                aDescriptor.Type              = WindowClass.MODALTOP;
-                aDescriptor.WindowServiceName = "infobox";
-                aDescriptor.ParentIndex       = -1;
-                aDescriptor.Parent            = UnoRuntime.queryInterface(
-                    XWindowPeer.class, m_xFrame.getContainerWindow());
-                aDescriptor.Bounds            = new Rectangle(0,0,300,200);
-                aDescriptor.WindowAttributes  = WindowAttribute.BORDER |
-                    WindowAttribute.MOVEABLE |
-                    WindowAttribute.CLOSEABLE;
-
-                XWindowPeer xPeer = m_xToolkit.createWindow( aDescriptor );
-                if ( null != xPeer ) {
-                    XMessageBox xMsgBox = UnoRuntime.queryInterface(
-                        XMessageBox.class, xPeer);
-                    if ( null != xMsgBox )
-                    {
-                        xMsgBox.setCaptionText( sTitle );
-                        xMsgBox.setMessageText( sMessage );
-                        xMsgBox.execute();
-                    }
+            if ( null == m_xFrame || null == m_xToolkit ) {
+                return;
+            }
+            // describe window properties.
+            WindowDescriptor aDescriptor = new WindowDescriptor();
+            aDescriptor.Type              = WindowClass.MODALTOP;
+            aDescriptor.WindowServiceName = "infobox";
+            aDescriptor.ParentIndex       = -1;
+            aDescriptor.Parent            = UnoRuntime.queryInterface(
+                XWindowPeer.class, m_xFrame.getContainerWindow());
+            aDescriptor.Bounds            = new Rectangle(0,0,300,200);
+            aDescriptor.WindowAttributes  = WindowAttribute.BORDER |
+                WindowAttribute.MOVEABLE |
+                WindowAttribute.CLOSEABLE;
+
+            XWindowPeer xPeer = m_xToolkit.createWindow( aDescriptor );
+            if ( null != xPeer ) {
+                XMessageBox xMsgBox = UnoRuntime.queryInterface(
+                    XMessageBox.class, xPeer);
+                if ( null != xMsgBox )
+                {
+                    xMsgBox.setCaptionText( sTitle );
+                    xMsgBox.setMessageText( sMessage );
+                    xMsgBox.execute();
                 }
             }
         }
diff --git a/qadevOOo/tests/java/ifc/chart/_XChartDataArray.java b/qadevOOo/tests/java/ifc/chart/_XChartDataArray.java
index 14e811e..99a41b5 100644
--- a/qadevOOo/tests/java/ifc/chart/_XChartDataArray.java
+++ b/qadevOOo/tests/java/ifc/chart/_XChartDataArray.java
@@ -56,23 +56,24 @@ public class _XChartDataArray extends MultiMethodTest {
             mbExcludeSetRowAndSetColumn = true;
             msExcludeMessage = (String)o;
         }
-        if (!mbExcludeSetRowAndSetColumn) {
-            XPropertySet xProp = UnoRuntime.queryInterface(XPropertySet.class, oObj);
-            if(xProp != null) {
-                try {
-                    boolean columnAsLabel = ((Boolean)xProp.getPropertyValue("ChartColumnAsLabel")).booleanValue();
-                    boolean rowAsLabel = ((Boolean)xProp.getPropertyValue("ChartRowAsLabel")).booleanValue();
-                    if (!columnAsLabel) {
-                        xProp.setPropertyValue("ChartColumnAsLabel", Boolean.TRUE);
-                    }
-                    if (!rowAsLabel) {
-                        xProp.setPropertyValue("ChartRowAsLabel", Boolean.TRUE);
-                    }
+        if (mbExcludeSetRowAndSetColumn) {
+            return;
+        }
+        XPropertySet xProp = UnoRuntime.queryInterface(XPropertySet.class, oObj);
+        if(xProp != null) {
+            try {
+                boolean columnAsLabel = ((Boolean)xProp.getPropertyValue("ChartColumnAsLabel")).booleanValue();
+                boolean rowAsLabel = ((Boolean)xProp.getPropertyValue("ChartRowAsLabel")).booleanValue();
+                if (!columnAsLabel) {
+                    xProp.setPropertyValue("ChartColumnAsLabel", Boolean.TRUE);
                 }
-                catch(Exception e) {
-                    // ignore
+                if (!rowAsLabel) {
+                    xProp.setPropertyValue("ChartRowAsLabel", Boolean.TRUE);
                 }
             }
+            catch(Exception e) {
+                // ignore
+            }
         }
     }
 
diff --git a/scripting/java/com/sun/star/script/framework/container/DeployedUnoPackagesDB.java b/scripting/java/com/sun/star/script/framework/container/DeployedUnoPackagesDB.java
index 634fa1a..c187fb0 100644
--- a/scripting/java/com/sun/star/script/framework/container/DeployedUnoPackagesDB.java
+++ b/scripting/java/com/sun/star/script/framework/container/DeployedUnoPackagesDB.java
@@ -118,7 +118,6 @@ public class DeployedUnoPackagesDB {
         Element langNode = null;
         int len = 0;
         NodeList langNodes = null;
-        boolean result = false;
 
         if ((langNodes = main.getElementsByTagName("language")) != null &&
             (len = langNodes.getLength()) != 0) {
@@ -132,22 +131,24 @@ public class DeployedUnoPackagesDB {
             }
         }
 
-        if (langNode != null) {
-            len = 0;
-            NodeList packages = null;
+        if (langNode == null) {
+            return false;
+        }
+        len = 0;
+        NodeList packages = null;
+        boolean result = false;
 
-            if ((packages = langNode.getElementsByTagName("package")) != null &&
-                (len = packages.getLength()) != 0) {
-                for (int i = 0; i < len; i++) {
+        if ((packages = langNode.getElementsByTagName("package")) != null &&
+            (len = packages.getLength()) != 0) {
+            for (int i = 0; i < len; i++) {
 
-                    Element e = (Element)packages.item(i);
-                    String value =  e.getAttribute("value");
+                Element e = (Element)packages.item(i);
+                String value =  e.getAttribute("value");
 
-                    if (value.equals(url)) {
-                        langNode.removeChild(e);
-                        result = true;
-                        break;
-                    }
+                if (value.equals(url)) {
+                    langNode.removeChild(e);
+                    result = true;
+                    break;
                 }
             }
         }
diff --git a/swext/mediawiki/src/com/sun/star/wiki/Helper.java b/swext/mediawiki/src/com/sun/star/wiki/Helper.java
index 9d58de7..6aad820 100644
--- a/swext/mediawiki/src/com/sun/star/wiki/Helper.java
+++ b/swext/mediawiki/src/com/sun/star/wiki/Helper.java
@@ -466,51 +466,51 @@ public class Helper
 
     protected static String GetFilterName( XComponentContext xContext, String aTypeName, String aDocServiceName )
     {
+        if ( xContext == null || aTypeName == null || aTypeName.length() == 0
+                || aDocServiceName == null || aDocServiceName.length() == 0 ) {
+            return "";
+        }
         String aFilterName = "";
-        if ( xContext != null && aTypeName != null && aTypeName.length() != 0
-          && aDocServiceName != null && aDocServiceName.length() != 0 )
+        try
         {
-            try
+            Object oFilterFactory = xContext.getServiceManager().createInstanceWithContext( "com.sun.star.document.FilterFactory", xContext );
+            XContainerQuery xQuery = UnoRuntime.queryInterface( XContainerQuery.class, oFilterFactory );
+            if ( xQuery != null )
             {
-                Object oFilterFactory = xContext.getServiceManager().createInstanceWithContext( "com.sun.star.document.FilterFactory", xContext );
-                XContainerQuery xQuery = UnoRuntime.queryInterface( XContainerQuery.class, oFilterFactory );
-                if ( xQuery != null )
-                {
-                    NamedValue[] aRequest = new NamedValue[2];
-                    aRequest[0] = new NamedValue( "Type", aTypeName );
-                    aRequest[1] = new NamedValue( "DocumentService", aDocServiceName );
+                NamedValue[] aRequest = new NamedValue[2];
+                aRequest[0] = new NamedValue( "Type", aTypeName );
+                aRequest[1] = new NamedValue( "DocumentService", aDocServiceName );
 
-                    XEnumeration xSet = xQuery.createSubSetEnumerationByProperties( aRequest );
-                    if ( xSet != null )
+                XEnumeration xSet = xQuery.createSubSetEnumerationByProperties( aRequest );
+                if ( xSet != null )
+                {
+                    boolean bAcceptable = false;
+                    while ( xSet.hasMoreElements() && !bAcceptable )
                     {
-                        boolean bAcceptable = false;
-                        while ( xSet.hasMoreElements() && !bAcceptable )
+                        PropertyValue[] pFilterProps = ( PropertyValue[] )AnyConverter.toArray( xSet.nextElement() );
+                        if ( pFilterProps != null )
                         {
-                            PropertyValue[] pFilterProps = ( PropertyValue[] )AnyConverter.toArray( xSet.nextElement() );
-                            if ( pFilterProps != null )
+                            int nLen = pFilterProps.length;
+                            String aTmpFilter = null;
+
+                            for ( int nInd = 0; nInd < nLen; nInd++ )
                             {
-                                int nLen = pFilterProps.length;
-                                String aTmpFilter = null;
-
-                                for ( int nInd = 0; nInd < nLen; nInd++ )
-                                {
-                                    if ( pFilterProps[nInd].Name.equals( "Name" ) )
-                                        aTmpFilter = AnyConverter.toString( pFilterProps[nInd].Value );
-                                    else if ( pFilterProps[nInd].Name.equals( "Flags" ) )
-                                        bAcceptable = ( ( AnyConverter.toInt( pFilterProps[nInd].Value ) & 2 ) == 2 ); // must allow export
-                                }
-
-                                if ( bAcceptable )
-                                    aFilterName = aTmpFilter;
+                                if ( pFilterProps[nInd].Name.equals( "Name" ) )
+                                    aTmpFilter = AnyConverter.toString( pFilterProps[nInd].Value );
+                                else if ( pFilterProps[nInd].Name.equals( "Flags" ) )
+                                    bAcceptable = ( ( AnyConverter.toInt( pFilterProps[nInd].Value ) & 2 ) == 2 ); // must allow export
                             }
+
+                            if ( bAcceptable )
+                                aFilterName = aTmpFilter;
                         }
                     }
                 }
             }
-            catch( java.lang.Exception e )
-            {
-                e.printStackTrace();
-            }
+        }
+        catch( java.lang.Exception e )
+        {
+            e.printStackTrace();
         }
 
         return aFilterName;
diff --git a/swext/mediawiki/src/com/sun/star/wiki/WikiDialog.java b/swext/mediawiki/src/com/sun/star/wiki/WikiDialog.java
index 699a682..55893cf 100644
--- a/swext/mediawiki/src/com/sun/star/wiki/WikiDialog.java
+++ b/swext/mediawiki/src/com/sun/star/wiki/WikiDialog.java
@@ -125,15 +125,15 @@ public class WikiDialog implements XDialogEventHandler, XTopWindowListener
     private static void SetTitle( XDialog xDialog, String sTitle )
         throws Exception
     {
-        if ( xDialog != null && sTitle != null )
+        if ( xDialog == null || sTitle == null ) {
+            return;
+        }
+        XControl xDialogControl = UnoRuntime.queryInterface( XControl.class, xDialog );
+        if ( xDialogControl != null )
         {
-            XControl xDialogControl = UnoRuntime.queryInterface( XControl.class, xDialog );
-            if ( xDialogControl != null )
-            {
-                XPropertySet xPropSet = UnoRuntime.queryInterface( XPropertySet.class, xDialogControl.getModel() );
-                if ( xPropSet != null )
-                    xPropSet.setPropertyValue( "Title", sTitle );
-            }
+            XPropertySet xPropSet = UnoRuntime.queryInterface( XPropertySet.class, xDialogControl.getModel() );
+            if ( xPropSet != null )
+                xPropSet.setPropertyValue( "Title", sTitle );
         }
     }
 
diff --git a/swext/mediawiki/src/com/sun/star/wiki/WikiProtocolSocketFactory.java b/swext/mediawiki/src/com/sun/star/wiki/WikiProtocolSocketFactory.java
index 196df54..b6da4a5 100644
--- a/swext/mediawiki/src/com/sun/star/wiki/WikiProtocolSocketFactory.java
+++ b/swext/mediawiki/src/com/sun/star/wiki/WikiProtocolSocketFactory.java
@@ -41,68 +41,68 @@ class WikiProtocolSocketFactory implements SecureProtocolSocketFactory
 
     private synchronized SSLContext GetNotSoSecureSSLContext()
     {
-        if ( m_aSSLContext == null )
+        if ( m_aSSLContext != null ) {
+            return m_aSSLContext;
+        }
+        TrustManager[] pTrustUnknownCerts = new TrustManager[]
         {
-            TrustManager[] pTrustUnknownCerts = new TrustManager[]
-            {
-                new X509TrustManager() {
-                    private X509TrustManager m_aOrgTrustManager;
+            new X509TrustManager() {
+                private X509TrustManager m_aOrgTrustManager;
 
-                    private X509TrustManager GetOrgTrustManager()
+                private X509TrustManager GetOrgTrustManager()
+                {
+                    if ( m_aOrgTrustManager == null )
                     {
-                        if ( m_aOrgTrustManager == null )
+                        try
                         {
-                            try
-                            {
-                                TrustManagerFactory aFactory = TrustManagerFactory.getInstance( TrustManagerFactory.getDefaultAlgorithm() );
-                                aFactory.init( (KeyStore)null );
-                                TrustManager[] pTrustmanagers = aFactory.getTrustManagers();
-                                if ( pTrustmanagers.length != 0 && pTrustmanagers[0] != null )
-                                    m_aOrgTrustManager = (X509TrustManager)pTrustmanagers[0];
-                            }
-                            catch( Exception e )
-                            {
-                                throw new RuntimeException( "No access to the default trust manager!", e );
-                            }
+                            TrustManagerFactory aFactory = TrustManagerFactory.getInstance( TrustManagerFactory.getDefaultAlgorithm() );
+                            aFactory.init( (KeyStore)null );
+                            TrustManager[] pTrustmanagers = aFactory.getTrustManagers();
+                            if ( pTrustmanagers.length != 0 && pTrustmanagers[0] != null )
+                                m_aOrgTrustManager = (X509TrustManager)pTrustmanagers[0];
+                        }
+                        catch( Exception e )
+                        {
+                            throw new RuntimeException( "No access to the default trust manager!", e );
                         }
-
-                        return m_aOrgTrustManager;
                     }
 
-                    public X509Certificate[] getAcceptedIssuers()
-                    {
-                        return GetOrgTrustManager().getAcceptedIssuers();
-                    }
+                    return m_aOrgTrustManager;
+                }
 
-                    public void checkClientTrusted(X509Certificate[] certs, String authType) throws CertificateException
-                    {
-                        GetOrgTrustManager().checkClientTrusted( certs, authType );
-                    }
+                public X509Certificate[] getAcceptedIssuers()
+                {
+                    return GetOrgTrustManager().getAcceptedIssuers();
+                }
 
-                    public void checkServerTrusted(X509Certificate[] certs, String authType) throws CertificateException
-                    {
-                        if ( certs == null || certs.length == 0 )
-                            GetOrgTrustManager().checkServerTrusted( certs, authType );
-                        else
-                            for ( int nInd = 0; nInd < certs.length; nInd++ )
-                                certs[nInd].checkValidity();
-                    }
+                public void checkClientTrusted(X509Certificate[] certs, String authType) throws CertificateException
+                {
+                    GetOrgTrustManager().checkClientTrusted( certs, authType );
                 }
-            };
 
-            try
-            {
-                SSLContext aContext = SSLContext.getInstance("SSL");
-                if ( aContext != null )
+                public void checkServerTrusted(X509Certificate[] certs, String authType) throws CertificateException
                 {
-                    aContext.init( null, pTrustUnknownCerts, null );
-                    m_aSSLContext = aContext;
+                    if ( certs == null || certs.length == 0 )
+                        GetOrgTrustManager().checkServerTrusted( certs, authType );
+                    else
+                        for ( int nInd = 0; nInd < certs.length; nInd++ )
+                            certs[nInd].checkValidity();
                 }
             }
-            catch ( Exception e )
+        };
+
+        try
+        {
+            SSLContext aContext = SSLContext.getInstance("SSL");
+            if ( aContext != null )
             {
+                aContext.init( null, pTrustUnknownCerts, null );
+                m_aSSLContext = aContext;
             }
         }
+        catch ( Exception e )
+        {
+        }
 
         if ( m_aSSLContext == null )
             throw new HttpClientError();
diff --git a/toolkit/test/accessibility/TextUpdateListener.java b/toolkit/test/accessibility/TextUpdateListener.java
index 61b4996..ef590f1 100644
--- a/toolkit/test/accessibility/TextUpdateListener.java
+++ b/toolkit/test/accessibility/TextUpdateListener.java
@@ -29,34 +29,30 @@ class TextUpdateListener implements TreeModelListener
     public void treeNodesChanged(TreeModelEvent e)
     {
         try {
-        // if the change is to the first child of a DefaultMutableTreeNode
-        // with an XAccessibleText child, then we call updateText
-        int[] aIndices = e.getChildIndices();
-        if( (aIndices != null) &&
-            (aIndices.length > 0) )
-        {
+            // if the change is to the first child of a DefaultMutableTreeNode
+            // with an XAccessibleText child, then we call updateText
+            int[] aIndices = e.getChildIndices();
+            if (aIndices == null || aIndices.length >= 0) {
+                return;
+            }
             // we have a parent... lets check for XAccessibleText then
-            DefaultMutableTreeNode aParent = (DefaultMutableTreeNode)
-                (e.getTreePath().getLastPathComponent());
-            DefaultMutableTreeNode aNode = (DefaultMutableTreeNode)
-                (aParent.getChildAt(aIndices[0]));
-            if( aParent.getUserObject() instanceof XAccessibleText)
-            {
+            DefaultMutableTreeNode aParent = (DefaultMutableTreeNode) (e
+                    .getTreePath().getLastPathComponent());
+            DefaultMutableTreeNode aNode = (DefaultMutableTreeNode) (aParent
+                    .getChildAt(aIndices[0]));
+            if (aParent.getUserObject() instanceof XAccessibleText) {
                 // aha! we have an xText. So we can now check for
                 // the various cases we support
-                XAccessibleText xText =
-                    (XAccessibleText)aParent.getUserObject();
+                XAccessibleText xText = (XAccessibleText) aParent
+                        .getUserObject();
 
-                if( aIndices[0] == 0 )
-                {
+                if (aIndices[0] == 0) {
                     // first child! Then we call updateText
-                    updateText( xText, aNode.toString() );
+                    updateText(xText, aNode.toString());
                 }
             }
+        } catch (com.sun.star.lang.IndexOutOfBoundsException aException) {
         }
-        }
-        catch (com.sun.star.lang.IndexOutOfBoundsException aException)
-        {}
     }
 
     // don't care:
diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/StyleCatalog.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/StyleCatalog.java
index ac66285..5c34c0e 100644
--- a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/StyleCatalog.java
+++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/StyleCatalog.java
@@ -84,39 +84,42 @@ public class StyleCatalog {
      *                              there is a match in the families array.
      */
     public void add(Node node, String families[], Class<?> classes[],
-    Class<?> defaultClass, boolean alwaysCreateDefault) {
+            Class<?> defaultClass, boolean alwaysCreateDefault) {
 
-    if (node == null)
+        if (node == null)
             return;
 
         if (families == null)
             families = new String[0];
         if (classes == null)
             classes = new Class[0];
-        if (node.hasChildNodes()) {
-            NodeList children = node.getChildNodes();
-            int len = children.getLength();
+        if (!node.hasChildNodes()) {
+            return;
+        }
+        NodeList children = node.getChildNodes();
+        int len = children.getLength();
 
-            for (int i = 0; i < len; i++) {
-                boolean found = false;
-                Node child = children.item(i);
-                String name = child.getNodeName();
-                if (name.equals("style:default-style") || name.equals("style:style")) {
-                    String familyName = getFamilyName(child);
-                    if (familyName == null) {
-                        Debug.log(Debug.ERROR, "familyName is null!");
-                        continue;
-                    }
+        for (int i = 0; i < len; i++) {
+            boolean found = false;
+            Node child = children.item(i);
+            String name = child.getNodeName();
+            if (name.equals("style:default-style")
+                    || name.equals("style:style")) {
+                String familyName = getFamilyName(child);
+                if (familyName == null) {
+                    Debug.log(Debug.ERROR, "familyName is null!");
+                    continue;
+                }
 
-                    for (int j = 0; j < families.length; j++) {
-                        if (families[j].equals(familyName)) {
-                            callConstructor(classes[j], child);
-                            found = true;
-                        }
+                for (int j = 0; j < families.length; j++) {
+                    if (families[j].equals(familyName)) {
+                        callConstructor(classes[j], child);
+                        found = true;
                     }
-                    if ((!found || alwaysCreateDefault) && (defaultClass != null))
-                        callConstructor(defaultClass, child);
                 }
+                if ((!found || alwaysCreateDefault)
+                        && (defaultClass != null))
+                    callConstructor(defaultClass, child);
             }
         }
     }
diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/TextStyle.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/TextStyle.java
index 20ccd6e..26115d4 100644
--- a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/TextStyle.java
+++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/TextStyle.java
@@ -87,21 +87,22 @@ public class TextStyle extends Style implements Cloneable {
         // Look for children.  Only ones we care about are "style:properties"
         // nodes.  If any are found, recursively traverse them, passing
         // along the style element to add properties to.
-        if (node.hasChildNodes()) {
-            NodeList children = node.getChildNodes();
-            int len = children.getLength();
-            for (int i = 0; i < len; i++) {
-                Node child = children.item(i);
-                String nodeName = child.getNodeName();
-                if (nodeName.equals("style:properties")) {
-                    NamedNodeMap childAttrNodes = child.getAttributes();
-                    if (childAttrNodes != null) {
-                        int nChildAttrNodes = childAttrNodes.getLength();
-                        for (int j = 0; j < nChildAttrNodes; j++) {
-                            Node attr = childAttrNodes.item(j);
-                            handleAttribute(attr.getNodeName(),
-                            attr.getNodeValue());
-                        }
+        if (!node.hasChildNodes()) {
+            return;
+        }
+        NodeList children = node.getChildNodes();
+        int len = children.getLength();
+        for (int i = 0; i < len; i++) {
+            Node child = children.item(i);
+            String nodeName = child.getNodeName();
+            if (nodeName.equals("style:properties")) {
+                NamedNodeMap childAttrNodes = child.getAttributes();
+                if (childAttrNodes != null) {
+                    int nChildAttrNodes = childAttrNodes.getLength();
+                    for (int j = 0; j < nChildAttrNodes; j++) {
+                        Node attr = childAttrNodes.item(j);
+                        handleAttribute(attr.getNodeName(),
+                        attr.getNodeValue());
                     }
                 }
             }
diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/sxc/RowStyle.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/sxc/RowStyle.java
index 6639ce1..97bf0c9 100644
--- a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/sxc/RowStyle.java
+++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/xml/sxc/RowStyle.java
@@ -60,21 +60,22 @@ public class RowStyle extends Style implements Cloneable {
         // Look for children.  Only ones we care about are "style:properties"
         // nodes.  If any are found, recursively traverse them, passing
         // along the style element to add properties to.
-        if (node.hasChildNodes()) {
-            NodeList children = node.getChildNodes();
-            int len = children.getLength();
-            for (int i = 0; i < len; i++) {
-                Node child = children.item(i);
-                String nodeName = child.getNodeName();
-                if (nodeName.equals("style:properties")) {
-                    NamedNodeMap childAttrNodes = child.getAttributes();
-                    if (childAttrNodes != null) {
-                        int nChildAttrNodes = childAttrNodes.getLength();
-                        for (int j = 0; j < nChildAttrNodes; j++) {
-                            Node attr = childAttrNodes.item(j);
-                            handleAttribute(attr.getNodeName(),
-                            attr.getNodeValue());
-                        }
+        if (!node.hasChildNodes()) {
+            return;
+        }
+        NodeList children = node.getChildNodes();
+        int len = children.getLength();
+        for (int i = 0; i < len; i++) {
+            Node child = children.item(i);
+            String nodeName = child.getNodeName();
+            if (nodeName.equals("style:properties")) {
+                NamedNodeMap childAttrNodes = child.getAttributes();
+                if (childAttrNodes != null) {
+                    int nChildAttrNodes = childAttrNodes.getLength();
+                    for (int j = 0; j < nChildAttrNodes; j++) {
+                        Node attr = childAttrNodes.item(j);
+                        handleAttribute(attr.getNodeName(),
+                        attr.getNodeValue());
                     }
                 }
             }


More information about the Libreoffice-commits mailing list