diff options
author | Ocke Janssen <oj@openoffice.org> | 2011-03-10 12:58:23 +0100 |
---|---|---|
committer | Ocke Janssen <oj@openoffice.org> | 2011-03-10 12:58:23 +0100 |
commit | a8b68a6b9d60ce4f11d82a6f4932b9587289d969 (patch) | |
tree | ca333cde5dfbb1f853dabe1cc0451c59c2c6e382 /jurt | |
parent | adf7a306ec2f5f27c0c95e1fb16b179ad316ae52 (diff) |
dba34d: automatic code corrections
Diffstat (limited to 'jurt')
14 files changed, 33 insertions, 46 deletions
diff --git a/jurt/com/sun/star/comp/bridgefactory/BridgeFactory.java b/jurt/com/sun/star/comp/bridgefactory/BridgeFactory.java index 1c4819326268..b0c093ffa2bb 100644 --- a/jurt/com/sun/star/comp/bridgefactory/BridgeFactory.java +++ b/jurt/com/sun/star/comp/bridgefactory/BridgeFactory.java @@ -108,7 +108,7 @@ public class BridgeFactory implements XBridgeFactory/*, XEventListener*/ { com.sun.star.uno.RuntimeException { boolean hasName = sName.length() != 0; - Object context = hasName ? (Object) sName : (Object) new UniqueToken(); + Object context = hasName ? sName : new UniqueToken(); // UnoRuntime.getBridgeByName internally uses context.toString() to // distinguish bridges, so the result of // new UniqueToken().toString() might clash with an explicit @@ -128,7 +128,7 @@ public class BridgeFactory implements XBridgeFactory/*, XEventListener*/ { } } - XBridge xBridge = null; + XBridge xBridge; try { IBridge iBridge = UnoRuntime.getBridgeByName("java", context, "remote", context, hasName ? new Object[]{sProtocol, aConnection, anInstanceProvider, sName} : new Object[]{sProtocol, aConnection, anInstanceProvider}); diff --git a/jurt/com/sun/star/comp/connections/PipedConnection.java b/jurt/com/sun/star/comp/connections/PipedConnection.java index f5a839ea78c5..aefc2eec3a7a 100644 --- a/jurt/com/sun/star/comp/connections/PipedConnection.java +++ b/jurt/com/sun/star/comp/connections/PipedConnection.java @@ -139,7 +139,7 @@ public class PipedConnection implements XConnection { if(_closed) throw new com.sun.star.io.IOException("connection has been closed"); - int bytes = 0; + int bytes ; if(_out < _in) { bytes = Math.min(aData.length - bytesWritten, _in - _out - 1); diff --git a/jurt/com/sun/star/comp/loader/FactoryHelper.java b/jurt/com/sun/star/comp/loader/FactoryHelper.java index 29b484631670..ef0dda4e3f23 100644 --- a/jurt/com/sun/star/comp/loader/FactoryHelper.java +++ b/jurt/com/sun/star/comp/loader/FactoryHelper.java @@ -413,10 +413,7 @@ public class FactoryHelper { _implementationId[2]= (byte)((hash >>> 16) & 0xff); _implementationId[3]= (byte)((hash >>>24) & 0xff); - for (int i= 0; i < nNameLength; i++) - { - _implementationId[4 + i]= arName[i]; - } + System.arraycopy(arName, 0, _implementationId, 4, nNameLength); } } return _implementationId; @@ -453,7 +450,7 @@ public class FactoryHelper { XSingleServiceFactory xSingleServiceFactory = null; try { - Field serviceName = null; + Field serviceName ; try { serviceName = implClass.getField("__serviceName"); diff --git a/jurt/com/sun/star/comp/loader/JavaLoader.java b/jurt/com/sun/star/comp/loader/JavaLoader.java index 47723b208497..25fc90b47676 100644 --- a/jurt/com/sun/star/comp/loader/JavaLoader.java +++ b/jurt/com/sun/star/comp/loader/JavaLoader.java @@ -265,7 +265,7 @@ public class JavaLoader implements XImplementationLoader, locationUrl = expand_url( locationUrl ); Object returnObject = null; - Class clazz = null; + Class clazz ; DEBUG("try to get factory for " + implementationName); diff --git a/jurt/com/sun/star/comp/servicemanager/ServiceManager.java b/jurt/com/sun/star/comp/servicemanager/ServiceManager.java index 3d672c6dfddf..026f198a2f02 100644 --- a/jurt/com/sun/star/comp/servicemanager/ServiceManager.java +++ b/jurt/com/sun/star/comp/servicemanager/ServiceManager.java @@ -187,7 +187,7 @@ public class ServiceManager implements XMultiServiceFactory, Class clazz = Class.forName( newImpls[i] ); Class[] methodClassParam = { String.class, XMultiServiceFactory.class, XRegistryKey.class }; - java.lang.reflect.Method getFactoryMeth = null; + java.lang.reflect.Method getFactoryMeth ; try { getFactoryMeth = clazz.getMethod("__getServiceFactory", methodClassParam); } @@ -233,7 +233,7 @@ public class ServiceManager implements XMultiServiceFactory, public void initialize( Object args[] ) throws com.sun.star.uno.Exception, com.sun.star.uno.RuntimeException { - XSimpleRegistry xSimpleRegistry = null; + XSimpleRegistry xSimpleRegistry ; try { xSimpleRegistry = (XSimpleRegistry) args[0]; if (xSimpleRegistry != null) @@ -462,9 +462,9 @@ public class ServiceManager implements XMultiServiceFactory, XEventListener listener = (XEventListener) enumer.nextElement(); listener.disposing(new com.sun.star.lang.EventObject(this)); } + eventListener.removeAllElements(); } - eventListener.removeAllElements(); factoriesByServiceNames.clear(); factoriesByImplNames.clear(); } @@ -527,12 +527,9 @@ public class ServiceManager implements XMultiServiceFactory, XServiceInfo xServiceInfo = UnoRuntime.queryInterface(XServiceInfo.class, object); - if (xServiceInfo != null) { - return UnoRuntime.areSame(factoriesByImplNames.get(xServiceInfo.getImplementationName()), object); - } + return xServiceInfo != null && UnoRuntime.areSame(factoriesByImplNames.get(xServiceInfo.getImplementationName()), object); - return false; - } + } /** * Adds a <code>SingleServiceFactory</code> to the <code>ServiceManager</code>. @@ -567,7 +564,7 @@ public class ServiceManager implements XMultiServiceFactory, String[] serviceNames = xServiceInfo.getSupportedServiceNames(); - java.util.Vector vec = null; + java.util.Vector vec ; for (int i=0; i<serviceNames.length; i++) { if ( !factoriesByServiceNames.containsKey( serviceNames[i] ) ) { @@ -688,7 +685,7 @@ public class ServiceManager implements XMultiServiceFactory, public XEnumeration createContentEnumeration( String serviceName ) throws com.sun.star.uno.RuntimeException { - XEnumeration enumer = null; + XEnumeration enumer ; java.util.Vector serviceList = (java.util.Vector) factoriesByServiceNames.get(serviceName); @@ -725,10 +722,9 @@ public class ServiceManager implements XMultiServiceFactory, for (int i=0; i<supportedServiceNames.length; i++) if (supportedServiceNames[i].equals( serviceName )) return true; - if (getImplementationName().equals( serviceName )) return true; + return getImplementationName().equals(serviceName); - return false; - } + } /** * Supplies list of all supported services. @@ -781,11 +777,9 @@ public class ServiceManager implements XMultiServiceFactory, public boolean hasMoreElements() throws com.sun.star.uno.RuntimeException { - if (enumeration != null) - return enumeration.hasMoreElements(); + return enumeration != null && enumeration.hasMoreElements(); - return false; - } + } /** * Returns the next element of the enumeration. If no further elements @@ -859,10 +853,9 @@ class ServiceManagerFactory implements XServiceInfo, XSingleComponentFactory, X for ( int i=0; i<ServiceManager.supportedServiceNames.length; i++ ) if ( ServiceManager.supportedServiceNames[i].equals(serviceName) ) return true; - if ( getImplementationName().equals(serviceName) ) return true; + return getImplementationName().equals(serviceName); - return false; - } + } /** * Returns all service names which are supported by <code>ServiceManager</code>. diff --git a/jurt/com/sun/star/comp/urlresolver/UrlResolver.java b/jurt/com/sun/star/comp/urlresolver/UrlResolver.java index 538315638553..2a7bddcb01d9 100644 --- a/jurt/com/sun/star/comp/urlresolver/UrlResolver.java +++ b/jurt/com/sun/star/comp/urlresolver/UrlResolver.java @@ -71,9 +71,9 @@ public class UrlResolver { } public Object resolve(/*IN*/String dcp) throws NoConnectException, ConnectionSetupException, IllegalArgumentException, com.sun.star.uno.RuntimeException { - String conDcp = null; - String protDcp = null; - String rootOid = null; + String conDcp ; + String protDcp ; + String rootOid ; if(dcp.indexOf(';') == -1) {// use old style conDcp = dcp; @@ -96,8 +96,8 @@ public class UrlResolver { rootOid = dcp.trim().trim(); } - Object rootObject = null; - XBridgeFactory xBridgeFactory= null; + Object rootObject ; + XBridgeFactory xBridgeFactory ; try { xBridgeFactory = UnoRuntime.queryInterface(XBridgeFactory.class, _xMultiServiceFactory.createInstance("com.sun.star.bridge.BridgeFactory")); @@ -107,7 +107,7 @@ public class UrlResolver { XBridge xBridge = xBridgeFactory.getBridge(conDcp + ";" + protDcp); if(xBridge == null) { - Object connector= null; + Object connector ; try { connector = _xMultiServiceFactory.createInstance("com.sun.star.connection.Connector"); } catch (com.sun.star.uno.Exception e) { diff --git a/jurt/com/sun/star/lib/connections/pipe/PipeConnection.java b/jurt/com/sun/star/lib/connections/pipe/PipeConnection.java index 455e3aab6502..f18cafb29c3e 100644 --- a/jurt/com/sun/star/lib/connections/pipe/PipeConnection.java +++ b/jurt/com/sun/star/lib/connections/pipe/PipeConnection.java @@ -82,7 +82,7 @@ public class PipeConnection implements XConnection, XConnectionBroadcaster { _bFirstRead = true; // get pipe name from pipe descriptor - String aPipeName = null; + String aPipeName ; StringTokenizer aTokenizer = new StringTokenizer( description, "," ); if ( aTokenizer.hasMoreTokens() ) { diff --git a/jurt/com/sun/star/lib/connections/socket/SocketConnection.java b/jurt/com/sun/star/lib/connections/socket/SocketConnection.java index 8512bdb49fe1..13da9d5cbea9 100644 --- a/jurt/com/sun/star/lib/connections/socket/SocketConnection.java +++ b/jurt/com/sun/star/lib/connections/socket/SocketConnection.java @@ -149,7 +149,7 @@ public class SocketConnection implements XConnection, XConnectionBroadcaster { bytes[0] = new byte[nBytesToRead]; try { - int count = 0; + int count ; do { count = _inputStream.read(bytes[0], read_bytes, nBytesToRead - read_bytes); diff --git a/jurt/com/sun/star/lib/uno/bridges/java_remote/ProxyFactory.java b/jurt/com/sun/star/lib/uno/bridges/java_remote/ProxyFactory.java index ae2719f1c07d..c29be0c9558d 100644 --- a/jurt/com/sun/star/lib/uno/bridges/java_remote/ProxyFactory.java +++ b/jurt/com/sun/star/lib/uno/bridges/java_remote/ProxyFactory.java @@ -113,9 +113,8 @@ final class ProxyFactory { throws Throwable { if (method.equals(METHOD_EQUALS) || method.equals(METHOD_IS_SAME)) { - return new Boolean( - args[0] != null - && oid.equals(UnoRuntime.generateOid(args[0]))); + return Boolean.valueOf(args[0] != null + && oid.equals(UnoRuntime.generateOid(args[0]))); } else if (method.equals(METHOD_HASH_CODE)) { return new Integer(oid.hashCode()); } else if (method.equals(METHOD_TO_STRING)) { diff --git a/jurt/com/sun/star/lib/uno/bridges/java_remote/XConnectionInputStream_Adapter.java b/jurt/com/sun/star/lib/uno/bridges/java_remote/XConnectionInputStream_Adapter.java index e663a96d1ea7..274d9389bcf0 100644 --- a/jurt/com/sun/star/lib/uno/bridges/java_remote/XConnectionInputStream_Adapter.java +++ b/jurt/com/sun/star/lib/uno/bridges/java_remote/XConnectionInputStream_Adapter.java @@ -50,7 +50,7 @@ class XConnectionInputStream_Adapter extends InputStream { public int read() throws IOException { - int len = 0; + int len ; try { len = _xConnection.read(_bytes, 1); diff --git a/jurt/com/sun/star/lib/uno/bridges/java_remote/XConnectionOutputStream_Adapter.java b/jurt/com/sun/star/lib/uno/bridges/java_remote/XConnectionOutputStream_Adapter.java index 51f3594330ee..51e4b6d0182c 100644 --- a/jurt/com/sun/star/lib/uno/bridges/java_remote/XConnectionOutputStream_Adapter.java +++ b/jurt/com/sun/star/lib/uno/bridges/java_remote/XConnectionOutputStream_Adapter.java @@ -60,7 +60,7 @@ class XConnectionOutputStream_Adapter extends OutputStream { } public void write(byte[] b, int off, int len) throws IOException { - byte bytes[] = null; + byte bytes[] ; if(off == 0 && len == b.length) bytes = b; 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 267a84d7515f..7589ffbe8c5a 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 @@ -620,8 +620,6 @@ public class java_remote_bridge checkDisposed(); - boolean goThroughThreadPool = false; - ThreadId threadId = _iThreadPool.getThreadId(); Object handle = _iThreadPool.attach(threadId); try { diff --git a/jurt/com/sun/star/lib/uno/protocols/urp/Unmarshal.java b/jurt/com/sun/star/lib/uno/protocols/urp/Unmarshal.java index 5a500ad3a0c1..fe7ea2231589 100644 --- a/jurt/com/sun/star/lib/uno/protocols/urp/Unmarshal.java +++ b/jurt/com/sun/star/lib/uno/protocols/urp/Unmarshal.java @@ -91,7 +91,7 @@ final class Unmarshal { public ThreadId readThreadId() { int len = readCompressedNumber(); - byte[] data = null; + byte[] data ; ThreadId id = null; if (len != 0) { data = new byte[len]; diff --git a/jurt/com/sun/star/lib/util/UrlToFileMapper.java b/jurt/com/sun/star/lib/util/UrlToFileMapper.java index 22b6ccf0a745..9de0a199880f 100644 --- a/jurt/com/sun/star/lib/util/UrlToFileMapper.java +++ b/jurt/com/sun/star/lib/util/UrlToFileMapper.java @@ -145,7 +145,7 @@ public final class UrlToFileMapper { try { enc = (String) urlEncoderEncode.invoke( null, - new Object[] { new Character(c).toString(), "UTF-8" }); + new Object[] {Character.toString(c), "UTF-8" }); } catch (IllegalAccessException e) { throw new RuntimeException("This cannot happen: " + e); } catch (InvocationTargetException e) { |