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 | fbc1bfa92beb2e774af2ea4af9f8fd4aec1b8eee (patch) | |
tree | b36845a162df8dc9d984be8e54f38cd7eb1a731a /jurt/com/sun | |
parent | f4bed91c1cd3f0f347a3b163d4c3bebd06519db5 (diff) |
dba34d: automatic code corrections
Diffstat (limited to 'jurt/com/sun')
14 files changed, 37 insertions, 50 deletions
diff --git a/jurt/com/sun/star/comp/bridgefactory/BridgeFactory.java b/jurt/com/sun/star/comp/bridgefactory/BridgeFactory.java index 23516fef0..44edff876 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 719e24b15..251035035 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 4bd6ef595..dc11c3d4f 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 2fec17bfe..b0af62995 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 cb6088544..e01e082ec 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(); } @@ -526,13 +526,10 @@ public class ServiceManager implements XMultiServiceFactory, throw new com.sun.star.uno.RuntimeException("The parameter must not been null"); 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); @@ -724,11 +721,10 @@ 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 @@ -858,11 +852,10 @@ class ServiceManagerFactory implements XServiceInfo, XSingleComponentFactory, X { for ( int i=0; i<ServiceManager.supportedServiceNames.length; i++ ) if ( ServiceManager.supportedServiceNames[i].equals(serviceName) ) return true; + + return getImplementationName().equals(serviceName); - if ( getImplementationName().equals(serviceName) ) return true; - - 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 7b8dce558..9a94dd21f 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 ea5057365..b2c82d88b 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 3d766389b..1f733b9d7 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 fd7fefdad..273705c39 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 9ba019199..d62914746 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 388f5bc08..cb2a0733e 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 12ea6bd2e..ab4b98a20 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 36a0720ea..e622db067 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 c356e8410..9319dd417 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) { |