From a8b68a6b9d60ce4f11d82a6f4932b9587289d969 Mon Sep 17 00:00:00 2001 From: Ocke Janssen Date: Thu, 10 Mar 2011 12:58:23 +0100 Subject: dba34d: automatic code corrections --- .../sun/star/comp/bridgefactory/BridgeFactory.java | 4 +-- .../sun/star/comp/connections/PipedConnection.java | 2 +- jurt/com/sun/star/comp/loader/FactoryHelper.java | 7 ++--- jurt/com/sun/star/comp/loader/JavaLoader.java | 2 +- .../star/comp/servicemanager/ServiceManager.java | 33 +++++++++------------- .../com/sun/star/comp/urlresolver/UrlResolver.java | 12 ++++---- .../star/lib/connections/pipe/PipeConnection.java | 2 +- .../lib/connections/socket/SocketConnection.java | 2 +- .../lib/uno/bridges/java_remote/ProxyFactory.java | 5 ++-- .../XConnectionInputStream_Adapter.java | 2 +- .../XConnectionOutputStream_Adapter.java | 2 +- .../bridges/java_remote/java_remote_bridge.java | 2 -- .../sun/star/lib/uno/protocols/urp/Unmarshal.java | 2 +- jurt/com/sun/star/lib/util/UrlToFileMapper.java | 2 +- 14 files changed, 33 insertions(+), 46 deletions(-) (limited to 'jurt/com/sun') 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 SingleServiceFactory to the ServiceManager. @@ -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; iServiceManager. 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) { -- cgit