Kaydet (Commit) 973eb2f6 authored tarafından Noel Grandin's avatar Noel Grandin

java: reduce the depth of some deeply nested if blocks

Change-Id: I3c0c7f08d4d8ea594e72fc0d9b93d085d4ab4bf5
üst fa652cdd
...@@ -352,27 +352,29 @@ public class InterfaceContainer implements Cloneable ...@@ -352,27 +352,29 @@ public class InterfaceContainer implements Cloneable
*/ */
synchronized public int indexOf(Object elem) synchronized public int indexOf(Object elem)
{ {
if (elementData == null || elem == null) {
return -1;
}
int index= -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 ...@@ -408,28 +410,30 @@ public class InterfaceContainer implements Cloneable
*/ */
synchronized public int lastIndexOf(Object elem) synchronized public int lastIndexOf(Object elem)
{ {
if (elementData == null || elem == null) {
return -1;
}
int index= -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--) for (int i = size-1; i >= 0; i--)
{ {
if (elem == elementData[i]) if (UnoRuntime.areSame(elem, elementData[i]))
{ {
index= i; index= i;
break; break;
} }
} }
if (index == -1)
{
for (int i = size-1; i >= 0; i--)
{
if (UnoRuntime.areSame(elem, elementData[i]))
{
index= i;
break;
}
}
}
} }
return index; return index;
} }
...@@ -535,52 +539,53 @@ public class InterfaceContainer implements Cloneable ...@@ -535,52 +539,53 @@ public class InterfaceContainer implements Cloneable
synchronized public boolean retainAll(Collection collection) synchronized public boolean retainAll(Collection collection)
{ {
if (elementData == null || collection == null) {
return false;
}
boolean retVal= false; boolean retVal= false;
if (elementData != null && collection != null) // iterate over data
{ Object[] arRetained= new Object[size];
// iterate over data int indexRetained= 0;
Object[] arRetained= new Object[size]; for(int i= 0; i < size; i++)
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]; if (curElem == itColl.next())
// try to find the element in collection
Iterator itColl= collection.iterator();
boolean bExists= false;
while (itColl.hasNext())
{ {
if (curElem == itColl.next()) // current element is in collection
{ bExists= true;
// current element is in collection break;
bExists= true;
break;
}
} }
if (!bExists) }
if (!bExists)
{
itColl= collection.iterator();
while (itColl.hasNext())
{ {
itColl= collection.iterator(); Object o= itColl.next();
while (itColl.hasNext()) if (o != null)
{ {
Object o= itColl.next(); if (UnoRuntime.areSame(o, curElem))
if (o != null)
{ {
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; return retVal;
} }
......
...@@ -84,49 +84,49 @@ public class JavaLoader implements XImplementationLoader, ...@@ -84,49 +84,49 @@ public class JavaLoader implements XImplementationLoader,
*/ */
private String expand_url( String url ) throws RuntimeException private String expand_url( String url ) throws RuntimeException
{ {
if (url != null && url.startsWith( EXPAND_PROTOCOL_PREFIX )) { if (url == null || !url.startsWith( EXPAND_PROTOCOL_PREFIX )) {
try { return url;
if (m_xMacroExpander == null) { }
XPropertySet xProps = try {
UnoRuntime.queryInterface( if (m_xMacroExpander == null) {
XPropertySet.class, multiServiceFactory ); XPropertySet xProps =
if (xProps == null) { UnoRuntime.queryInterface(
throw new com.sun.star.uno.RuntimeException( XPropertySet.class, multiServiceFactory );
"service manager does not support XPropertySet!", if (xProps == null) {
this ); throw new com.sun.star.uno.RuntimeException(
} "service manager does not support XPropertySet!",
XComponentContext xContext = (XComponentContext) this );
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; XComponentContext xContext = (XComponentContext)
} catch (com.sun.star.uno.Exception exc) { AnyConverter.toObject(
throw new com.sun.star.uno.RuntimeException( new Type( XComponentContext.class ),
exc.getMessage(), this ); xProps.getPropertyValue( "DefaultContext" ) );
} catch (java.lang.Exception exc) { m_xMacroExpander = (XMacroExpander)AnyConverter.toObject(
throw new com.sun.star.uno.RuntimeException( new Type( XMacroExpander.class ),
exc.getMessage(), this ); 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;
} }
/** /**
......
...@@ -89,33 +89,34 @@ public final class NativeLibraryLoader { ...@@ -89,33 +89,34 @@ public final class NativeLibraryLoader {
// (scheme://auth/dir1/name). The second step is important in a typical // (scheme://auth/dir1/name). The second step is important in a typical
// OOo installation, where the JAR files are in the program/classes // OOo installation, where the JAR files are in the program/classes
// directory while the shared libraries are in the program directory. // directory while the shared libraries are in the program directory.
if (loader instanceof URLClassLoader) { if (!(loader instanceof URLClassLoader)) {
URL[] urls = ((URLClassLoader) loader).getURLs(); return null;
for (int i = 0; i < urls.length; ++i) { }
File path = UrlToFileMapper.mapUrlToFile(urls[i]); URL[] urls = ((URLClassLoader) loader).getURLs();
if (path != null) { for (int i = 0; i < urls.length; ++i) {
File dir = path.isDirectory() ? path : path.getParentFile(); 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) { if (dir != null) {
path = new File(dir, name); path = new File(dir, name);
if (path.exists()) { if (path.exists()) {
return path; return path;
} }
dir = dir.getParentFile(); // On OS X, dir is now the Resources dir,
if (dir != null) { // we want to look in Frameworks
path = new File(dir, name); if (System.getProperty("os.name").startsWith("Mac")
&& dir.getName().equals("Resources")) {
dir = dir.getParentFile();
path = new File(dir, "Frameworks/" + name);
if (path.exists()) { if (path.exists()) {
return path; 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;
}
}
} }
} }
} }
......
...@@ -80,41 +80,46 @@ final class InstallationFinder { ...@@ -80,41 +80,46 @@ final class InstallationFinder {
// com.sun.star.lib.loader.unopath // com.sun.star.lib.loader.unopath
// (all platforms) // (all platforms)
path = getPathFromProperty( SYSPROP_NAME ); path = getPathFromProperty( SYSPROP_NAME );
if ( path == null ) { if ( path != null ) {
// get the installation path from the UNO_PATH environment variable return path;
// (all platforms, not working for Java 1.3.1 and Java 1.4) }
path = getPathFromEnvVar( ENVVAR_NAME ); // 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 ) { if ( path == null ) {
String osname = null; // get the installation path from the 'which'
try { // command (Unix/Linux platforms only)
osname = System.getProperty( "os.name" ); path = getPathFromWhich();
} catch ( SecurityException e ) { if ( path == null ) {
// if a SecurityException was thrown, // get the installation path from the
// return <code>null</code> // .sversionrc file (Unix/Linux platforms only,
return null; // for older versions than OOo 2.0)
} path = getPathFromSVersionFile();
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();
}
}
}
} }
} }
} }
......
...@@ -76,22 +76,23 @@ public class TestParameters extends HashMap<String,Object> { ...@@ -76,22 +76,23 @@ public class TestParameters extends HashMap<String,Object> {
* @return The value of this key, cast to a boolean type. * @return The value of this key, cast to a boolean type.
*/ */
public boolean getBool(Object key) { public boolean getBool(Object key) {
Object val = super.get(key); final Object val = super.get(key);
if (val != null) { if (val == null) {
if (val instanceof String) { return false;
String sVal = (String)val; }
if (sVal.equalsIgnoreCase("true") || if (val instanceof String) {
sVal.equalsIgnoreCase("yes")) { String sVal = (String)val;
return true; if (sVal.equalsIgnoreCase("true") ||
} sVal.equalsIgnoreCase("yes")) {
else if (sVal.equalsIgnoreCase("false") || return true;
sVal.equalsIgnoreCase("no")) { }
return false; 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; return false;
} }
......
...@@ -143,37 +143,37 @@ public class ChartRawReportTarget extends OfficeDocumentReportTarget ...@@ -143,37 +143,37 @@ public class ChartRawReportTarget extends OfficeDocumentReportTarget
return; return;
} }
final String namespace = ReportTargetUtil.getNamespaceFromAttribute(attrs); 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 (OfficeToken.TABLE.equals(elementType) || OfficeToken.TABLE_ROWS.equals(elementType))
// 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))
{ {
return; 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 @Override
......
...@@ -331,39 +331,39 @@ public class Helper ...@@ -331,39 +331,39 @@ public class Helper
//scrape the HTML source and find the EditURL //scrape the HTML source and find the EditURL
// TODO/LATER: Use parser in future // TODO/LATER: Use parser in future
String sResultURL = "";
int nInd = sWebPage.indexOf( "http-equiv=\"refresh\"" ); 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 ); int nURL = sWebPage.indexOf( "URL=", nContent );
if ( nContent > 0 ) if ( nURL > 0 )
{ {
int nURL = sWebPage.indexOf( "URL=", nContent ); int nEndURL = sWebPage.indexOf('"', nURL );
if ( nURL > 0 ) if ( nEndURL > 0 )
{ sResultURL = sWebPage.substring( nURL + 4, nEndURL );
int nEndURL = sWebPage.indexOf('"', nURL );
if ( nEndURL > 0 )
sResultURL = sWebPage.substring( nURL + 4, nEndURL );
}
} }
}
try try
{ {
URL aURL = new URL( sURL ); URL aURL = new URL( sURL );
if ( !sResultURL.startsWith( aURL.getProtocol() )) 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 )
{ {
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; return sResultURL;
......
...@@ -243,53 +243,53 @@ public class AccessibilityTree ...@@ -243,53 +243,53 @@ public class AccessibilityTree
public boolean popupTrigger( MouseEvent e ) public boolean popupTrigger( MouseEvent e )
{ {
boolean bIsPopup = e.isPopupTrigger(); 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()); AccessibleTreeNode aNode = (AccessibleTreeNode)aObject;
if (selRow != -1) String[] aActionNames = aNode.getActions();
int nCount=aActionNames.length;
if (nCount > 0)
{ {
TreePath aPath = maTree.getComponent().getPathForLocation(e.getX(), e.getY()); for (int i=0; i<nCount; i++)
aMenu.add( new NodeAction(
// check for actions aActionNames[i],
Object aObject = aPath.getLastPathComponent(); aNode,
JPopupMenu aMenu = new JPopupMenu(); i));
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());
} }
else
aMenu = null;
} }
if (aMenu != null)
aMenu.show (maTree.getComponent(),
e.getX(), e.getY());
return bIsPopup; return bIsPopup;
} }
......
...@@ -27,21 +27,20 @@ class AccessibleCellHandler extends NodeHandler ...@@ -27,21 +27,20 @@ class AccessibleCellHandler extends NodeHandler
@Override @Override
public NodeHandler createHandler (XAccessibleContext xContext) public NodeHandler createHandler (XAccessibleContext xContext)
{ {
if (xContext == null)
return null;
AccessibleCellHandler aCellHandler = null; AccessibleCellHandler aCellHandler = null;
if (xContext != null) XAccessible xParent = xContext.getAccessibleParent();
if (xParent != null)
{ {
XAccessible xParent = xContext.getAccessibleParent(); XAccessibleTable xTable =
if (xParent != null) UnoRuntime.queryInterface (
{ XAccessibleTable.class, xParent.getAccessibleContext());
XAccessibleTable xTable = if (xTable != null)
UnoRuntime.queryInterface ( aCellHandler = new AccessibleCellHandler (xTable);
XAccessibleTable.class, xParent.getAccessibleContext());
if (xTable != null)
aCellHandler = new AccessibleCellHandler (xTable);
}
} }
return aCellHandler; return aCellHandler;
} }
public AccessibleCellHandler () public AccessibleCellHandler ()
......
...@@ -51,71 +51,70 @@ class AccessibleSelectionHandler ...@@ -51,71 +51,70 @@ class AccessibleSelectionHandler
public AccessibleTreeNode createChild( AccessibleTreeNode aParent, public AccessibleTreeNode createChild( AccessibleTreeNode aParent,
int nIndex ) int nIndex )
{ {
if( !(aParent instanceof AccTreeNode) )
return null;
XAccessibleSelection xSelection = ((AccTreeNode)aParent).getSelection();
if( xSelection == null )
return null;
AccessibleTreeNode aChild = null; AccessibleTreeNode aChild = null;
if( aParent instanceof AccTreeNode ) switch( nIndex )
{ {
XAccessibleSelection xSelection = case 0:
((AccTreeNode)aParent).getSelection(); aChild = new StringNode(
if( xSelection != null ) "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: for( int i = 0; i < nCount; i++ )
aChild = new StringNode(
"getSelectedAccessibleChildCount: " +
xSelection.getSelectedAccessibleChildCount(),
aParent );
break;
case 1:
{ {
VectorNode aVNode =
new VectorNode( "Selected Children", aParent);
int nSelected = 0;
int nCount = ((AccTreeNode)aParent).getContext().
getAccessibleChildCount();
try try
{ {
for( int i = 0; i < nCount; i++ ) if( xSelection.isAccessibleChildSelected( i ) )
{ {
try XAccessible xSelChild = xSelection.
{ getSelectedAccessibleChild(nSelected);
if( xSelection.isAccessibleChildSelected( i ) ) XAccessible xNChild =
{ ((AccTreeNode)aParent).
XAccessible xSelChild = xSelection. getContext().getAccessibleChild( i );
getSelectedAccessibleChild(nSelected); aVNode.addChild( new StringNode(
XAccessible xNChild = i + ": " +
((AccTreeNode)aParent). xNChild.getAccessibleContext().
getContext().getAccessibleChild( i ); getAccessibleDescription() + " (" +
aVNode.addChild( new StringNode( (xSelChild.equals(xNChild) ? "OK" : "XXX") +
i + ": " + ")", aParent ) );
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 ));
}
} }
aChild = aVNode;
} }
catch( IndexOutOfBoundsException e ) catch (com.sun.star.lang.DisposedException e)
{ {
aChild = new StringNode( "IndexOutOfBounds", aVNode.addChild( new StringNode(
aParent ); i + ": caught DisposedException while creating",
aParent ));
} }
} }
break; aChild = aVNode;
default: }
aChild = new StringNode( "ERROR", aParent ); catch( IndexOutOfBoundsException e )
break; {
aChild = new StringNode( "IndexOutOfBounds",
aParent );
} }
} }
break;
default:
aChild = new StringNode( "ERROR", aParent );
break;
} }
return aChild; return aChild;
......
...@@ -82,48 +82,48 @@ public class CommandName ...@@ -82,48 +82,48 @@ public class CommandName
{ {
try try
{ {
if (this.setMetaDataAttributes()) if (!setMetaDataAttributes())
{ return;
this.DisplayName = _DisplayName;
int iIndex; this.DisplayName = _DisplayName;
if (oCommandMetaData.xDBMetaData.supportsCatalogsInDataManipulation()) int iIndex;
{ // ...dann Catalog mit in TableName if (oCommandMetaData.xDBMetaData.supportsCatalogsInDataManipulation())
iIndex = _DisplayName.indexOf(sCatalogSep); { // ...dann Catalog mit in TableName
if (iIndex >= 0) 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())
{ {
String[] NameList; if (bCatalogAtStart)
NameList = new String[0];
NameList = JavaTools.ArrayoutofString(_DisplayName, ".");
if (NameList.length > 1)
{ {
SchemaName = NameList[0]; CatalogName = _DisplayName.substring(0, iIndex);
TableName = NameList[1]; _DisplayName = _DisplayName.substring(iIndex + 1, _DisplayName.length());
} }
else 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 else
{ {
TableName = _DisplayName; TableName = _DisplayName;
} }
setComposedCommandName();
} }
else
{
TableName = _DisplayName;
}
setComposedCommandName();
} }
catch (Exception exception) catch (Exception exception)
{ {
......
...@@ -151,28 +151,20 @@ public final class Record { ...@@ -151,28 +151,20 @@ public final class Record {
*/ */
@Override @Override
public boolean equals(Object obj) { public boolean equals(Object obj) {
if (!(obj instanceof Record)) {
boolean bool = false; return false;
}
if (obj instanceof Record) { Record rec = (Record) obj;
if (rec.getAttributes() != attributes) {
Record rec = (Record) obj; return false;
}
checkLabel: { if (rec.getSize() == data.length) {
for (int i = 0; i < data.length; i++) {
if (rec.getAttributes() != attributes) { if (data[i] != rec.data[i]) {
break checkLabel; return false;
}
if (rec.getSize() == data.length) {
for (int i = 0; i < data.length; i++) {
if (data[i] != rec.data[i]) {
break checkLabel;
}
}
bool = true;
} }
} }
} }
return bool; return false;
} }
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment