summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2014-10-15 14:43:35 +0200
committerNoel Grandin <noel@peralex.com>2014-10-16 08:15:48 +0200
commit973eb2f6db60c0939299a968a3121e3310e6d1f5 (patch)
tree9eece355c20bc4d930e7e58943fc2d33bedfcfd0
parentfa652cdd2314f485359119a8ff081a7afd1c01b0 (diff)
java: reduce the depth of some deeply nested if blocks
Change-Id: I3c0c7f08d4d8ea594e72fc0d9b93d085d4ab4bf5
-rw-r--r--javaunohelper/com/sun/star/lib/uno/helper/InterfaceContainer.java129
-rw-r--r--jurt/com/sun/star/comp/loader/JavaLoader.java80
-rw-r--r--jurt/com/sun/star/lib/util/NativeLibraryLoader.java39
-rw-r--r--odk/source/com/sun/star/lib/loader/InstallationFinder.java73
-rw-r--r--qadevOOo/runner/lib/TestParameters.java29
-rw-r--r--reportbuilder/java/org/libreoffice/report/pentaho/output/chart/ChartRawReportTarget.java48
-rw-r--r--swext/mediawiki/src/com/sun/star/wiki/Helper.java50
-rw-r--r--toolkit/test/accessibility/AccessibilityTree.java86
-rw-r--r--toolkit/test/accessibility/AccessibleCellHandler.java21
-rw-r--r--toolkit/test/accessibility/AccessibleSelectionHandler.java97
-rw-r--r--wizards/com/sun/star/wizards/db/CommandName.java60
-rw-r--r--xmerge/source/xmerge/java/org/openoffice/xmerge/converter/palm/Record.java32
12 files changed, 373 insertions, 371 deletions
diff --git a/javaunohelper/com/sun/star/lib/uno/helper/InterfaceContainer.java b/javaunohelper/com/sun/star/lib/uno/helper/InterfaceContainer.java
index b49b28f523f2..48ca6c68ab72 100644
--- a/javaunohelper/com/sun/star/lib/uno/helper/InterfaceContainer.java
+++ b/javaunohelper/com/sun/star/lib/uno/helper/InterfaceContainer.java
@@ -352,27 +352,29 @@ public class InterfaceContainer implements Cloneable
*/
synchronized public int indexOf(Object elem)
{
+ if (elementData == null || elem == null) {
+ return -1;
+ }
+
int index= -1;
- if (elementData != null && elem != null)
+
+ for (int i = 0; i < size; i++)
{
- for (int i = 0; i < size; i++)
+ if (elem == elementData[i])
{
- if (elem == elementData[i])
- {
- index= i;
- break;
- }
+ index= i;
+ break;
}
+ }
- if (index == -1)
+ if (index == -1)
+ {
+ for (int i = 0; i < size; i++)
{
- for (int i = 0; i < size; i++)
+ if (UnoRuntime.areSame(elem, elementData[i]))
{
- if (UnoRuntime.areSame(elem, elementData[i]))
- {
- index= i;
- break;
- }
+ index= i;
+ break;
}
}
}
@@ -408,28 +410,30 @@ public class InterfaceContainer implements Cloneable
*/
synchronized public int lastIndexOf(Object elem)
{
+ if (elementData == null || elem == null) {
+ return -1;
+ }
+
int index= -1;
- if (elementData != null && elem != null)
+
+ for (int i = size-1; i >= 0; i--)
+ {
+ if (elem == elementData[i])
+ {
+ index= i;
+ break;
+ }
+ }
+ if (index == -1)
{
for (int i = size-1; i >= 0; i--)
{
- if (elem == elementData[i])
+ if (UnoRuntime.areSame(elem, elementData[i]))
{
index= i;
break;
}
}
- if (index == -1)
- {
- for (int i = size-1; i >= 0; i--)
- {
- if (UnoRuntime.areSame(elem, elementData[i]))
- {
- index= i;
- break;
- }
- }
- }
}
return index;
}
@@ -535,52 +539,53 @@ public class InterfaceContainer implements Cloneable
synchronized public boolean retainAll(Collection collection)
{
+ if (elementData == null || collection == null) {
+ return false;
+ }
+
boolean retVal= false;
- if (elementData != null && collection != null)
- {
- // iterate over data
- Object[] arRetained= new Object[size];
- int indexRetained= 0;
- for(int i= 0; i < size; i++)
+ // iterate over data
+ Object[] arRetained= new Object[size];
+ int indexRetained= 0;
+ for(int i= 0; i < size; i++)
+ {
+ Object curElem= elementData[i];
+ // try to find the element in collection
+ Iterator itColl= collection.iterator();
+ boolean bExists= false;
+ while (itColl.hasNext())
{
- Object curElem= elementData[i];
- // try to find the element in collection
- Iterator itColl= collection.iterator();
- boolean bExists= false;
- while (itColl.hasNext())
+ if (curElem == itColl.next())
{
- if (curElem == itColl.next())
- {
- // current element is in collection
- bExists= true;
- break;
- }
+ // current element is in collection
+ bExists= true;
+ break;
}
- if (!bExists)
+ }
+ if (!bExists)
+ {
+ itColl= collection.iterator();
+ while (itColl.hasNext())
{
- itColl= collection.iterator();
- while (itColl.hasNext())
+ Object o= itColl.next();
+ if (o != null)
{
- Object o= itColl.next();
- if (o != null)
+ if (UnoRuntime.areSame(o, curElem))
{
- if (UnoRuntime.areSame(o, curElem))
- {
- bExists= true;
- break;
- }
+ bExists= true;
+ break;
}
}
}
- if (bExists)
- arRetained[indexRetained++]= curElem;
- }
- retVal= size != indexRetained;
- if (indexRetained > 0)
- {
- elementData= arRetained;
- size= indexRetained;
}
+ if (bExists)
+ arRetained[indexRetained++]= curElem;
+ }
+ retVal= size != indexRetained;
+ if (indexRetained > 0)
+ {
+ elementData= arRetained;
+ size= indexRetained;
}
return retVal;
}
diff --git a/jurt/com/sun/star/comp/loader/JavaLoader.java b/jurt/com/sun/star/comp/loader/JavaLoader.java
index fb7c6d8372da..8244d43c326c 100644
--- a/jurt/com/sun/star/comp/loader/JavaLoader.java
+++ b/jurt/com/sun/star/comp/loader/JavaLoader.java
@@ -84,49 +84,49 @@ public class JavaLoader implements XImplementationLoader,
*/
private String expand_url( String url ) throws RuntimeException
{
- if (url != null && url.startsWith( EXPAND_PROTOCOL_PREFIX )) {
- try {
- if (m_xMacroExpander == null) {
- XPropertySet xProps =
- UnoRuntime.queryInterface(
- XPropertySet.class, multiServiceFactory );
- if (xProps == null) {
- throw new com.sun.star.uno.RuntimeException(
- "service manager does not support XPropertySet!",
- this );
- }
- XComponentContext xContext = (XComponentContext)
- AnyConverter.toObject(
- new Type( XComponentContext.class ),
- xProps.getPropertyValue( "DefaultContext" ) );
- m_xMacroExpander = (XMacroExpander)AnyConverter.toObject(
- new Type( XMacroExpander.class ),
- xContext.getValueByName(
- "/singletons/com.sun.star.util.theMacroExpander" )
- );
- }
- // decode uric class chars
- String macro = URLDecoder.decode(
- StringHelper.replace(
- url.substring( EXPAND_PROTOCOL_PREFIX.length() ),
- '+', "%2B" ), "UTF-8" );
- // expand macro string
- String ret = m_xMacroExpander.expandMacros( macro );
- if (DEBUG) {
- System.err.println(
- "JavaLoader.expand_url(): " + url + " => " +
- macro + " => " + ret );
+ if (url == null || !url.startsWith( EXPAND_PROTOCOL_PREFIX )) {
+ return url;
+ }
+ try {
+ if (m_xMacroExpander == null) {
+ XPropertySet xProps =
+ UnoRuntime.queryInterface(
+ XPropertySet.class, multiServiceFactory );
+ if (xProps == null) {
+ throw new com.sun.star.uno.RuntimeException(
+ "service manager does not support XPropertySet!",
+ this );
}
- return ret;
- } catch (com.sun.star.uno.Exception exc) {
- throw new com.sun.star.uno.RuntimeException(
- exc.getMessage(), this );
- } catch (java.lang.Exception exc) {
- throw new com.sun.star.uno.RuntimeException(
- exc.getMessage(), this );
+ XComponentContext xContext = (XComponentContext)
+ AnyConverter.toObject(
+ new Type( XComponentContext.class ),
+ xProps.getPropertyValue( "DefaultContext" ) );
+ m_xMacroExpander = (XMacroExpander)AnyConverter.toObject(
+ new Type( XMacroExpander.class ),
+ xContext.getValueByName(
+ "/singletons/com.sun.star.util.theMacroExpander" )
+ );
+ }
+ // decode uric class chars
+ String macro = URLDecoder.decode(
+ StringHelper.replace(
+ url.substring( EXPAND_PROTOCOL_PREFIX.length() ),
+ '+', "%2B" ), "UTF-8" );
+ // expand macro string
+ String ret = m_xMacroExpander.expandMacros( macro );
+ if (DEBUG) {
+ System.err.println(
+ "JavaLoader.expand_url(): " + url + " => " +
+ macro + " => " + ret );
}
+ return ret;
+ } catch (com.sun.star.uno.Exception exc) {
+ throw new com.sun.star.uno.RuntimeException(
+ exc.getMessage(), this );
+ } catch (java.lang.Exception exc) {
+ throw new com.sun.star.uno.RuntimeException(
+ exc.getMessage(), this );
}
- return url;
}
/**
diff --git a/jurt/com/sun/star/lib/util/NativeLibraryLoader.java b/jurt/com/sun/star/lib/util/NativeLibraryLoader.java
index 099cf69d1881..d9486550855e 100644
--- a/jurt/com/sun/star/lib/util/NativeLibraryLoader.java
+++ b/jurt/com/sun/star/lib/util/NativeLibraryLoader.java
@@ -89,33 +89,34 @@ public final class NativeLibraryLoader {
// (scheme://auth/dir1/name). The second step is important in a typical
// OOo installation, where the JAR files are in the program/classes
// directory while the shared libraries are in the program directory.
- if (loader instanceof URLClassLoader) {
- URL[] urls = ((URLClassLoader) loader).getURLs();
- for (int i = 0; i < urls.length; ++i) {
- File path = UrlToFileMapper.mapUrlToFile(urls[i]);
- if (path != null) {
- File dir = path.isDirectory() ? path : path.getParentFile();
+ if (!(loader instanceof URLClassLoader)) {
+ return null;
+ }
+ URL[] urls = ((URLClassLoader) loader).getURLs();
+ for (int i = 0; i < urls.length; ++i) {
+ File path = UrlToFileMapper.mapUrlToFile(urls[i]);
+ if (path != null) {
+ File dir = path.isDirectory() ? path : path.getParentFile();
+ if (dir != null) {
+ path = new File(dir, name);
+ if (path.exists()) {
+ return path;
+ }
+ dir = dir.getParentFile();
if (dir != null) {
path = new File(dir, name);
if (path.exists()) {
return path;
}
- dir = dir.getParentFile();
- if (dir != null) {
- path = new File(dir, name);
+ // On OS X, dir is now the Resources dir,
+ // we want to look in Frameworks
+ if (System.getProperty("os.name").startsWith("Mac")
+ && dir.getName().equals("Resources")) {
+ dir = dir.getParentFile();
+ path = new File(dir, "Frameworks/" + name);
if (path.exists()) {
return path;
}
- // On OS X, dir is now the Resources dir,
- // we want to look in Frameworks
- if (System.getProperty("os.name").startsWith("Mac")
- && dir.getName().equals("Resources")) {
- dir = dir.getParentFile();
- path = new File(dir, "Frameworks/" + name);
- if (path.exists()) {
- return path;
- }
- }
}
}
}
diff --git a/odk/source/com/sun/star/lib/loader/InstallationFinder.java b/odk/source/com/sun/star/lib/loader/InstallationFinder.java
index c8894435608e..eb1c78c412b2 100644
--- a/odk/source/com/sun/star/lib/loader/InstallationFinder.java
+++ b/odk/source/com/sun/star/lib/loader/InstallationFinder.java
@@ -80,41 +80,46 @@ final class InstallationFinder {
// com.sun.star.lib.loader.unopath
// (all platforms)
path = getPathFromProperty( SYSPROP_NAME );
- if ( path == null ) {
- // get the installation path from the UNO_PATH environment variable
- // (all platforms, not working for Java 1.3.1 and Java 1.4)
- path = getPathFromEnvVar( ENVVAR_NAME );
+ if ( path != null ) {
+ return path;
+ }
+ // get the installation path from the UNO_PATH environment variable
+ // (all platforms, not working for Java 1.3.1 and Java 1.4)
+ path = getPathFromEnvVar( ENVVAR_NAME );
+ if ( path != null ) {
+ return path;
+ }
+
+ String osname = null;
+ try {
+ osname = System.getProperty( "os.name" );
+ } catch ( SecurityException e ) {
+ // if a SecurityException was thrown,
+ // return <code>null</code>
+ return null;
+ }
+ if ( osname == null ) {
+ return null;
+ }
+
+ if ( osname.startsWith( "Windows" ) ) {
+ // get the installation path from the Windows Registry
+ // (Windows platform only)
+ path = getPathFromWindowsRegistry();
+ } else {
+ // get the installation path from the PATH environment
+ // variable (Unix/Linux platforms only, not working for
+ // Java 1.3.1 and Java 1.4)
+ path = getPathFromPathEnvVar();
if ( path == null ) {
- String osname = null;
- try {
- osname = System.getProperty( "os.name" );
- } catch ( SecurityException e ) {
- // if a SecurityException was thrown,
- // return <code>null</code>
- return null;
- }
- if ( osname != null ) {
- if ( osname.startsWith( "Windows" ) ) {
- // get the installation path from the Windows Registry
- // (Windows platform only)
- path = getPathFromWindowsRegistry();
- } else {
- // get the installation path from the PATH environment
- // variable (Unix/Linux platforms only, not working for
- // Java 1.3.1 and Java 1.4)
- path = getPathFromPathEnvVar();
- if ( path == null ) {
- // get the installation path from the 'which'
- // command (Unix/Linux platforms only)
- path = getPathFromWhich();
- if ( path == null ) {
- // get the installation path from the
- // .sversionrc file (Unix/Linux platforms only,
- // for older versions than OOo 2.0)
- path = getPathFromSVersionFile();
- }
- }
- }
+ // get the installation path from the 'which'
+ // command (Unix/Linux platforms only)
+ path = getPathFromWhich();
+ if ( path == null ) {
+ // get the installation path from the
+ // .sversionrc file (Unix/Linux platforms only,
+ // for older versions than OOo 2.0)
+ path = getPathFromSVersionFile();
}
}
}
diff --git a/qadevOOo/runner/lib/TestParameters.java b/qadevOOo/runner/lib/TestParameters.java
index a62565fcbaf4..69bf9fcd2980 100644
--- a/qadevOOo/runner/lib/TestParameters.java
+++ b/qadevOOo/runner/lib/TestParameters.java
@@ -76,22 +76,23 @@ public class TestParameters extends HashMap<String,Object> {
* @return The value of this key, cast to a boolean type.
*/
public boolean getBool(Object key) {
- Object val = super.get(key);
- if (val != null) {
- if (val instanceof String) {
- String sVal = (String)val;
- if (sVal.equalsIgnoreCase("true") ||
- sVal.equalsIgnoreCase("yes")) {
- return true;
- }
- else if (sVal.equalsIgnoreCase("false") ||
- sVal.equalsIgnoreCase("no")) {
- return false;
- }
+ final Object val = super.get(key);
+ if (val == null) {
+ return false;
+ }
+ if (val instanceof String) {
+ String sVal = (String)val;
+ if (sVal.equalsIgnoreCase("true") ||
+ sVal.equalsIgnoreCase("yes")) {
+ return true;
+ }
+ else if (sVal.equalsIgnoreCase("false") ||
+ sVal.equalsIgnoreCase("no")) {
+ return false;
}
- if (val instanceof Boolean)
- return ((Boolean)val).booleanValue();
}
+ else if (val instanceof Boolean)
+ return ((Boolean)val).booleanValue();
return false;
}
diff --git a/reportbuilder/java/org/libreoffice/report/pentaho/output/chart/ChartRawReportTarget.java b/reportbuilder/java/org/libreoffice/report/pentaho/output/chart/ChartRawReportTarget.java
index ca4dbd9a9764..1029b14b24b8 100644
--- a/reportbuilder/java/org/libreoffice/report/pentaho/output/chart/ChartRawReportTarget.java
+++ b/reportbuilder/java/org/libreoffice/report/pentaho/output/chart/ChartRawReportTarget.java
@@ -143,37 +143,37 @@ public class ChartRawReportTarget extends OfficeDocumentReportTarget
return;
}
final String namespace = ReportTargetUtil.getNamespaceFromAttribute(attrs);
- if (!isFilteredNamespace(namespace))
+ if (isFilteredNamespace(namespace))
+ return;
+
+ final String elementType = ReportTargetUtil.getElemenTypeFromAttribute(attrs);
+ // if this is the report namespace, write out a table definition ..
+ if (OfficeNamespaces.TABLE_NS.equals(namespace))
{
- final String elementType = ReportTargetUtil.getElemenTypeFromAttribute(attrs);
- // if this is the report namespace, write out a table definition ..
- if (OfficeNamespaces.TABLE_NS.equals(namespace))
- {
- if (OfficeToken.TABLE.equals(elementType) || OfficeToken.TABLE_ROWS.equals(elementType))
- {
- return;
- }
- else if (isFiltered(elementType))
- {
- inFilterElements = false;
- if (tableCount > 1)
- {
- return;
- }
- }
- }
- else if (OfficeNamespaces.CHART_NS.equals(namespace) && "chart".equals(elementType))
+ if (OfficeToken.TABLE.equals(elementType) || OfficeToken.TABLE_ROWS.equals(elementType))
{
return;
}
- if (inFilterElements && tableCount > 1)
+ else if (isFiltered(elementType))
{
- return;
+ inFilterElements = false;
+ if (tableCount > 1)
+ {
+ return;
+ }
}
- final XmlWriter xmlWriter = getXmlWriter();
- xmlWriter.writeCloseTag();
- --closeTags;
}
+ else if (OfficeNamespaces.CHART_NS.equals(namespace) && "chart".equals(elementType))
+ {
+ return;
+ }
+ if (inFilterElements && tableCount > 1)
+ {
+ return;
+ }
+ final XmlWriter xmlWriter = getXmlWriter();
+ xmlWriter.writeCloseTag();
+ --closeTags;
}
@Override
diff --git a/swext/mediawiki/src/com/sun/star/wiki/Helper.java b/swext/mediawiki/src/com/sun/star/wiki/Helper.java
index 1eb42040139b..9d58de7a3b90 100644
--- a/swext/mediawiki/src/com/sun/star/wiki/Helper.java
+++ b/swext/mediawiki/src/com/sun/star/wiki/Helper.java
@@ -331,39 +331,39 @@ public class Helper
//scrape the HTML source and find the EditURL
// TODO/LATER: Use parser in future
- String sResultURL = "";
int nInd = sWebPage.indexOf( "http-equiv=\"refresh\"" );
- if ( nInd != -1 )
+ if ( nInd == -1 )
+ return "";
+
+ String sResultURL = "";
+ int nContent = sWebPage.indexOf( "content=", nInd );
+ if ( nContent > 0 )
{
- int nContent = sWebPage.indexOf( "content=", nInd );
- if ( nContent > 0 )
+ int nURL = sWebPage.indexOf( "URL=", nContent );
+ if ( nURL > 0 )
{
- int nURL = sWebPage.indexOf( "URL=", nContent );
- if ( nURL > 0 )
- {
- int nEndURL = sWebPage.indexOf('"', nURL );
- if ( nEndURL > 0 )
- sResultURL = sWebPage.substring( nURL + 4, nEndURL );
- }
+ int nEndURL = sWebPage.indexOf('"', nURL );
+ if ( nEndURL > 0 )
+ sResultURL = sWebPage.substring( nURL + 4, nEndURL );
}
+ }
- try
- {
- URL aURL = new URL( sURL );
- if ( !sResultURL.startsWith( aURL.getProtocol() ))
- {
- //if the url is only relative then complete it
- if ( sResultURL.startsWith( "/" ) )
- sResultURL = aURL.getProtocol() + "://" + aURL.getHost() + sResultURL;
- else
- sResultURL = aURL.getProtocol() + "://" + aURL.getHost() + aURL.getPath() + sResultURL;
- }
- }
- catch ( MalformedURLException ex )
+ try
+ {
+ URL aURL = new URL( sURL );
+ if ( !sResultURL.startsWith( aURL.getProtocol() ))
{
- ex.printStackTrace();
+ //if the url is only relative then complete it
+ if ( sResultURL.startsWith( "/" ) )
+ sResultURL = aURL.getProtocol() + "://" + aURL.getHost() + sResultURL;
+ else
+ sResultURL = aURL.getProtocol() + "://" + aURL.getHost() + aURL.getPath() + sResultURL;
}
}
+ catch ( MalformedURLException ex )
+ {
+ ex.printStackTrace();
+ }
return sResultURL;
diff --git a/toolkit/test/accessibility/AccessibilityTree.java b/toolkit/test/accessibility/AccessibilityTree.java
index 6f9484762e00..72944e30e1ab 100644
--- a/toolkit/test/accessibility/AccessibilityTree.java
+++ b/toolkit/test/accessibility/AccessibilityTree.java
@@ -243,53 +243,53 @@ public class AccessibilityTree
public boolean popupTrigger( MouseEvent e )
{
boolean bIsPopup = e.isPopupTrigger();
- if( bIsPopup )
+ if( !bIsPopup )
+ return false;
+
+ int selRow = maTree.getComponent().getRowForLocation(e.getX(), e.getY());
+ if (selRow == -1)
+ return bIsPopup;
+
+ TreePath aPath = maTree.getComponent().getPathForLocation(e.getX(), e.getY());
+
+ // check for actions
+ Object aObject = aPath.getLastPathComponent();
+ JPopupMenu aMenu = new JPopupMenu();
+ if( aObject instanceof AccTreeNode )
+ {
+ AccTreeNode aNode = (AccTreeNode)aObject;
+
+ ArrayList<String> aActions = new ArrayList<String>();
+ aMenu.add (new AccessibilityTree.ShapeExpandAction(maTree, aNode));
+ aMenu.add (new AccessibilityTree.SubtreeExpandAction(maTree, aNode));
+
+ aNode.getActions(aActions);
+ for( int i = 0; i < aActions.size(); i++ )
+ {
+ aMenu.add( new NodeAction(
+ aActions.get(i),
+ aNode, i ) );
+ }
+ }
+ else if (aObject instanceof AccessibleTreeNode)
{
- int selRow = maTree.getComponent().getRowForLocation(e.getX(), e.getY());
- if (selRow != -1)
+ AccessibleTreeNode aNode = (AccessibleTreeNode)aObject;
+ String[] aActionNames = aNode.getActions();
+ int nCount=aActionNames.length;
+ if (nCount > 0)
{
- TreePath aPath = maTree.getComponent().getPathForLocation(e.getX(), e.getY());
-
- // check for actions
- Object aObject = aPath.getLastPathComponent();
- JPopupMenu aMenu = new JPopupMenu();
- if( aObject instanceof AccTreeNode )
- {
- AccTreeNode aNode = (AccTreeNode)aObject;
-
- ArrayList<String> aActions = new ArrayList<String>();
- aMenu.add (new AccessibilityTree.ShapeExpandAction(maTree, aNode));
- aMenu.add (new AccessibilityTree.SubtreeExpandAction(maTree, aNode));
-
- aNode.getActions(aActions);
- for( int i = 0; i < aActions.size(); i++ )
- {
- aMenu.add( new NodeAction(
- aActions.get(i),
- aNode, i ) );
- }
- }
- else if (aObject instanceof AccessibleTreeNode)
- {
- AccessibleTreeNode aNode = (AccessibleTreeNode)aObject;
- String[] aActionNames = aNode.getActions();
- int nCount=aActionNames.length;
- if (nCount > 0)
- {
- for (int i=0; i<nCount; i++)
- aMenu.add( new NodeAction(
- aActionNames[i],
- aNode,
- i));
- }
- else
- aMenu = null;
- }
- if (aMenu != null)
- aMenu.show (maTree.getComponent(),
- e.getX(), e.getY());
+ for (int i=0; i<nCount; i++)
+ aMenu.add( new NodeAction(
+ aActionNames[i],
+ aNode,
+ i));
}
+ else
+ aMenu = null;
}
+ if (aMenu != null)
+ aMenu.show (maTree.getComponent(),
+ e.getX(), e.getY());
return bIsPopup;
}
diff --git a/toolkit/test/accessibility/AccessibleCellHandler.java b/toolkit/test/accessibility/AccessibleCellHandler.java
index 6ba28a1411b9..d99fdbfe4cb4 100644
--- a/toolkit/test/accessibility/AccessibleCellHandler.java
+++ b/toolkit/test/accessibility/AccessibleCellHandler.java
@@ -27,21 +27,20 @@ class AccessibleCellHandler extends NodeHandler
@Override
public NodeHandler createHandler (XAccessibleContext xContext)
{
+ if (xContext == null)
+ return null;
+
AccessibleCellHandler aCellHandler = null;
- if (xContext != null)
+ XAccessible xParent = xContext.getAccessibleParent();
+ if (xParent != null)
{
- XAccessible xParent = xContext.getAccessibleParent();
- if (xParent != null)
- {
- XAccessibleTable xTable =
- UnoRuntime.queryInterface (
- XAccessibleTable.class, xParent.getAccessibleContext());
- if (xTable != null)
- aCellHandler = new AccessibleCellHandler (xTable);
- }
+ XAccessibleTable xTable =
+ UnoRuntime.queryInterface (
+ XAccessibleTable.class, xParent.getAccessibleContext());
+ if (xTable != null)
+ aCellHandler = new AccessibleCellHandler (xTable);
}
return aCellHandler;
-
}
public AccessibleCellHandler ()
diff --git a/toolkit/test/accessibility/AccessibleSelectionHandler.java b/toolkit/test/accessibility/AccessibleSelectionHandler.java
index 2d4f64f5d44d..ece8153b67e5 100644
--- a/toolkit/test/accessibility/AccessibleSelectionHandler.java
+++ b/toolkit/test/accessibility/AccessibleSelectionHandler.java
@@ -51,71 +51,70 @@ class AccessibleSelectionHandler
public AccessibleTreeNode createChild( AccessibleTreeNode aParent,
int nIndex )
{
+ if( !(aParent instanceof AccTreeNode) )
+ return null;
+
+ XAccessibleSelection xSelection = ((AccTreeNode)aParent).getSelection();
+ if( xSelection == null )
+ return null;
+
AccessibleTreeNode aChild = null;
- if( aParent instanceof AccTreeNode )
+ switch( nIndex )
{
- XAccessibleSelection xSelection =
- ((AccTreeNode)aParent).getSelection();
- if( xSelection != null )
+ case 0:
+ aChild = new StringNode(
+ "getSelectedAccessibleChildCount: " +
+ xSelection.getSelectedAccessibleChildCount(),
+ aParent );
+ break;
+ case 1:
{
- switch( nIndex )
+ VectorNode aVNode =
+ new VectorNode( "Selected Children", aParent);
+ int nSelected = 0;
+ int nCount = ((AccTreeNode)aParent).getContext().
+ getAccessibleChildCount();
+ try
{
- case 0:
- aChild = new StringNode(
- "getSelectedAccessibleChildCount: " +
- xSelection.getSelectedAccessibleChildCount(),
- aParent );
- break;
- case 1:
+ for( int i = 0; i < nCount; i++ )
{
- VectorNode aVNode =
- new VectorNode( "Selected Children", aParent);
- int nSelected = 0;
- int nCount = ((AccTreeNode)aParent).getContext().
- getAccessibleChildCount();
try
{
- for( int i = 0; i < nCount; i++ )
+ if( xSelection.isAccessibleChildSelected( i ) )
{
- try
- {
- if( xSelection.isAccessibleChildSelected( i ) )
- {
- XAccessible xSelChild = xSelection.
- getSelectedAccessibleChild(nSelected);
- XAccessible xNChild =
- ((AccTreeNode)aParent).
- getContext().getAccessibleChild( i );
- aVNode.addChild( new StringNode(
- i + ": " +
- xNChild.getAccessibleContext().
- getAccessibleDescription() + " (" +
- (xSelChild.equals(xNChild) ? "OK" : "XXX") +
- ")", aParent ) );
- }
- }
- catch (com.sun.star.lang.DisposedException e)
- {
- aVNode.addChild( new StringNode(
- i + ": caught DisposedException while creating",
- aParent ));
- }
+ XAccessible xSelChild = xSelection.
+ getSelectedAccessibleChild(nSelected);
+ XAccessible xNChild =
+ ((AccTreeNode)aParent).
+ getContext().getAccessibleChild( i );
+ aVNode.addChild( new StringNode(
+ i + ": " +
+ xNChild.getAccessibleContext().
+ getAccessibleDescription() + " (" +
+ (xSelChild.equals(xNChild) ? "OK" : "XXX") +
+ ")", aParent ) );
}
- aChild = aVNode;
}
- catch( IndexOutOfBoundsException e )
+ catch (com.sun.star.lang.DisposedException e)
{
- aChild = new StringNode( "IndexOutOfBounds",
- aParent );
+ aVNode.addChild( new StringNode(
+ i + ": caught DisposedException while creating",
+ aParent ));
}
}
- break;
- default:
- aChild = new StringNode( "ERROR", aParent );
- break;
+ aChild = aVNode;
+ }
+ catch( IndexOutOfBoundsException e )
+ {
+ aChild = new StringNode( "IndexOutOfBounds",
+ aParent );
}
}
+ break;
+ default:
+ aChild = new StringNode( "ERROR", aParent );
+ break;
}
return aChild;
diff --git a/wizards/com/sun/star/wizards/db/CommandName.java b/wizards/com/sun/star/wizards/db/CommandName.java
index 2621b96e167b..1db997976ea9 100644
--- a/wizards/com/sun/star/wizards/db/CommandName.java
+++ b/wizards/com/sun/star/wizards/db/CommandName.java
@@ -82,48 +82,48 @@ public class CommandName
{
try
{
- if (this.setMetaDataAttributes())
- {
- this.DisplayName = _DisplayName;
- int iIndex;
- if (oCommandMetaData.xDBMetaData.supportsCatalogsInDataManipulation())
- { // ...dann Catalog mit in TableName
- iIndex = _DisplayName.indexOf(sCatalogSep);
- if (iIndex >= 0)
- {
- if (bCatalogAtStart)
- {
- CatalogName = _DisplayName.substring(0, iIndex);
- _DisplayName = _DisplayName.substring(iIndex + 1, _DisplayName.length());
- }
- else
- {
- CatalogName = _DisplayName.substring(iIndex + 1, _DisplayName.length());
- _DisplayName = _DisplayName.substring(0, iIndex);
- }
- }
- }
- if (oCommandMetaData.xDBMetaData.supportsSchemasInDataManipulation())
+ if (!setMetaDataAttributes())
+ return;
+
+ this.DisplayName = _DisplayName;
+ int iIndex;
+ if (oCommandMetaData.xDBMetaData.supportsCatalogsInDataManipulation())
+ { // ...dann Catalog mit in TableName
+ iIndex = _DisplayName.indexOf(sCatalogSep);
+ if (iIndex >= 0)
{
- String[] NameList;
- NameList = new String[0];
- NameList = JavaTools.ArrayoutofString(_DisplayName, ".");
- if (NameList.length > 1)
+ if (bCatalogAtStart)
{
- SchemaName = NameList[0];
- TableName = NameList[1];
+ CatalogName = _DisplayName.substring(0, iIndex);
+ _DisplayName = _DisplayName.substring(iIndex + 1, _DisplayName.length());
}
else
{
- TableName = _DisplayName;
+ CatalogName = _DisplayName.substring(iIndex + 1, _DisplayName.length());
+ _DisplayName = _DisplayName.substring(0, iIndex);
}
}
+ }
+ if (oCommandMetaData.xDBMetaData.supportsSchemasInDataManipulation())
+ {
+ String[] NameList;
+ NameList = new String[0];
+ NameList = JavaTools.ArrayoutofString(_DisplayName, ".");
+ if (NameList.length > 1)
+ {
+ SchemaName = NameList[0];
+ TableName = NameList[1];
+ }
else
{
TableName = _DisplayName;
}
- setComposedCommandName();
}
+ else
+ {
+ TableName = _DisplayName;
+ }
+ setComposedCommandName();
}
catch (Exception exception)
{
diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/palm/Record.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/palm/Record.java
index ac7ba521884b..cf9fad8c15ad 100644
--- a/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/palm/Record.java
+++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/converter/palm/Record.java
@@ -151,28 +151,20 @@ public final class Record {
*/
@Override
public boolean equals(Object obj) {
-
- boolean bool = false;
-
- if (obj instanceof Record) {
-
- Record rec = (Record) obj;
-
- checkLabel: {
-
- if (rec.getAttributes() != attributes) {
- break checkLabel;
- }
- if (rec.getSize() == data.length) {
- for (int i = 0; i < data.length; i++) {
- if (data[i] != rec.data[i]) {
- break checkLabel;
- }
- }
- bool = true;
+ if (!(obj instanceof Record)) {
+ return false;
+ }
+ Record rec = (Record) obj;
+ if (rec.getAttributes() != attributes) {
+ return false;
+ }
+ if (rec.getSize() == data.length) {
+ for (int i = 0; i < data.length; i++) {
+ if (data[i] != rec.data[i]) {
+ return false;
}
}
}
- return bool;
+ return false;
}
} \ No newline at end of file