diff options
16 files changed, 87 insertions, 77 deletions
diff --git a/accessibility/bridge/org/openoffice/accessibility/AccessBridge.java b/accessibility/bridge/org/openoffice/accessibility/AccessBridge.java index f9b56fe03be5..ebd0552a4d26 100644 --- a/accessibility/bridge/org/openoffice/accessibility/AccessBridge.java +++ b/accessibility/bridge/org/openoffice/accessibility/AccessBridge.java @@ -38,7 +38,7 @@ import java.awt.Window; public class AccessBridge { // - protected static java.util.Hashtable<String, Window> topWindowMap = new java.util.Hashtable<String, Window>(); + protected static java.util.HashMap<String, Window> topWindowMap = new java.util.HashMap<String, Window>(); private static java.awt.Window getTopWindowImpl(XAccessible xAccessible) { // Because it can not be garantied that diff --git a/accessibility/bridge/org/openoffice/accessibility/WindowsAccessBridgeAdapter.java b/accessibility/bridge/org/openoffice/accessibility/WindowsAccessBridgeAdapter.java index 41e0e0381da6..5d7a81750b48 100644 --- a/accessibility/bridge/org/openoffice/accessibility/WindowsAccessBridgeAdapter.java +++ b/accessibility/bridge/org/openoffice/accessibility/WindowsAccessBridgeAdapter.java @@ -34,7 +34,7 @@ import javax.accessibility.*; public class WindowsAccessBridgeAdapter { private static Method registerVirtualFrame; private static Method revokeVirtualFrame; - private static java.util.Hashtable<Integer, Accessible> frameMap; + private static java.util.HashMap<Integer, Accessible> frameMap; protected static native byte[] getProcessID(); @@ -71,7 +71,7 @@ public class WindowsAccessBridgeAdapter { if (AnyConverter.isLong(any)) { createMapping(AnyConverter.toLong(any)); - frameMap = new java.util.Hashtable<Integer, Accessible>(); + frameMap = new java.util.HashMap<Integer, Accessible>(); } } } @@ -163,7 +163,7 @@ public class WindowsAccessBridgeAdapter { public static void registerTopWindow(int handle, XAccessible xAccessible) { Integer hwnd = new Integer(handle); - if (!frameMap.contains(hwnd)) { + if (!frameMap.containsKey(hwnd)) { if (Build.DEBUG) { System.err.println("Native frame " + hwnd + " of role " + AccessibleRoleAdapter.getAccessibleRole(xAccessible) + diff --git a/accessibility/bridge/org/openoffice/java/accessibility/AccessibleObjectFactory.java b/accessibility/bridge/org/openoffice/java/accessibility/AccessibleObjectFactory.java index a79aacf9ffda..4023ee9b2c4a 100644 --- a/accessibility/bridge/org/openoffice/java/accessibility/AccessibleObjectFactory.java +++ b/accessibility/bridge/org/openoffice/java/accessibility/AccessibleObjectFactory.java @@ -31,7 +31,7 @@ public class AccessibleObjectFactory { // This type is needed for conversions from/to uno Any public static final Type XAccessibleType = new Type(XAccessible.class); - private static java.util.Hashtable<String, WeakReference<Component>> objectList = new java.util.Hashtable<String, WeakReference<Component>>(); + private static java.util.HashMap<String, WeakReference<Component>> objectList = new java.util.HashMap<String, WeakReference<Component>>(); private static java.awt.FocusTraversalPolicy focusTraversalPolicy = new FocusTraversalPolicy(); private static java.awt.EventQueue theEventQueue = java.awt.Toolkit.getDefaultToolkit(). diff --git a/bridges/test/java_uno/equals/TestEquals.java b/bridges/test/java_uno/equals/TestEquals.java index 515c8e496f87..abfe00882ce0 100644 --- a/bridges/test/java_uno/equals/TestEquals.java +++ b/bridges/test/java_uno/equals/TestEquals.java @@ -18,6 +18,12 @@ package test.java_uno.equals; +import java.io.File; +import java.net.MalformedURLException; +import java.util.HashMap; + +import test.lib.TestBed; + import com.sun.star.bridge.XBridge; import com.sun.star.bridge.XBridgeFactory; import com.sun.star.bridge.XInstanceProvider; @@ -33,11 +39,6 @@ import com.sun.star.loader.XImplementationLoader; import com.sun.star.uno.UnoRuntime; import com.sun.star.uno.XComponentContext; import com.sun.star.uno.XInterface; -import java.io.File; -import java.net.MalformedURLException; -import java.util.HashMap; -import java.util.Hashtable; -import test.lib.TestBed; // In this test scenario, the Java server (see implementation of method // notifyAccepting) has a remote bridge to the Java client and a local JNI @@ -160,7 +161,7 @@ public final class TestEquals { UnoRuntime.queryInterface( XDerived.class, test2Aa); - Hashtable<String,String> params = new Hashtable<String,String>(); + HashMap<String,String> params = new HashMap<String,String>(); params.put("UNO_TYPES", unoTypes); params.put("UNO_SERVICES", unoServices); XComponentContext context = Bootstrap. diff --git a/javaunohelper/com/sun/star/comp/helper/Bootstrap.java b/javaunohelper/com/sun/star/comp/helper/Bootstrap.java index 989e283853b0..85bc4837a99d 100644 --- a/javaunohelper/com/sun/star/comp/helper/Bootstrap.java +++ b/javaunohelper/com/sun/star/comp/helper/Bootstrap.java @@ -89,13 +89,21 @@ public class Bootstrap { "com.sun.star.comp.connections.Acceptor", null, null, null ) ); } + /** + * backwards compatibility stub. + */ + static public XComponentContext createInitialComponentContext( Hashtable<String, Object> context_entries ) + throws Exception + { + return createInitialComponentContext((java.util.Map<String,Object>)context_entries); + } /** Bootstraps an initial component context with service manager and basic jurt components inserted. @param context_entries the hash table contains mappings of entry names (type string) to context entries (type class ComponentContextEntry). @return a new context. */ - static public XComponentContext createInitialComponentContext( Hashtable<String, Object> context_entries ) + static public XComponentContext createInitialComponentContext( java.util.Map<String, Object> context_entries ) throws Exception { ServiceManager xSMgr = new ServiceManager(); @@ -148,6 +156,16 @@ public class Bootstrap { { return defaultBootstrap_InitialComponentContext( null, null ); } + /** + * Backwards compatibility stub. + */ + static public final XComponentContext defaultBootstrap_InitialComponentContext( + String ini_file, Hashtable<String,String> bootstrap_parameters ) + throws Exception + { + return defaultBootstrap_InitialComponentContext(ini_file, (java.util.Map<String,String>)bootstrap_parameters); + + } /** Bootstraps the initial component context from a native UNO installation. @param ini_file @@ -158,7 +176,7 @@ public class Bootstrap { @see "cppuhelper/defaultBootstrap_InitialComponentContext()" */ static public final XComponentContext defaultBootstrap_InitialComponentContext( - String ini_file, Hashtable<String,String> bootstrap_parameters ) + String ini_file, java.util.Map<String,String> bootstrap_parameters ) throws Exception { // jni convenience: easier to iterate over array than calling Hashtable diff --git a/javaunohelper/com/sun/star/comp/helper/ComponentContext.java b/javaunohelper/com/sun/star/comp/helper/ComponentContext.java index c47d623dcfa8..0b3b1948acd2 100644 --- a/javaunohelper/com/sun/star/comp/helper/ComponentContext.java +++ b/javaunohelper/com/sun/star/comp/helper/ComponentContext.java @@ -58,7 +58,7 @@ public class ComponentContext implements XComponentContext, XComponent private static final String SMGR_NAME = "/singletons/com.sun.star.lang.theServiceManager"; private static final String TDMGR_NAME = "/singletons/com.sun.star.reflection.theTypeDescriptionManager"; - private Hashtable<String,Object> m_table; + private java.util.Map<String,Object> m_table; private XComponentContext m_xDelegate; private XMultiComponentFactory m_xSMgr; @@ -66,6 +66,11 @@ public class ComponentContext implements XComponentContext, XComponent private ArrayList<XEventListener> m_eventListener; + public ComponentContext( Hashtable<String,Object> table, XComponentContext xDelegate ) + { + this((java.util.Map<String,Object>)table, xDelegate); + } + /** Ctor to create a component context passing a hashtable for values and a delegator reference. Entries of the passed hashtable are either direct values or ComponentContextEntry objects. @@ -75,7 +80,7 @@ public class ComponentContext implements XComponentContext, XComponent @param xDelegate if values are not found, request is delegated to this object */ - public ComponentContext( Hashtable<String,Object> table, XComponentContext xDelegate ) + public ComponentContext( java.util.Map<String,Object> table, XComponentContext xDelegate ) { m_eventListener = new ArrayList<XEventListener>(); m_table = table; diff --git a/javaunohelper/test/com/sun/star/comp/helper/Bootstrap_Test.java b/javaunohelper/test/com/sun/star/comp/helper/Bootstrap_Test.java index 2a292be96b1a..8e8032f1addd 100644 --- a/javaunohelper/test/com/sun/star/comp/helper/Bootstrap_Test.java +++ b/javaunohelper/test/com/sun/star/comp/helper/Bootstrap_Test.java @@ -28,7 +28,7 @@ import com.sun.star.lang.XMultiServiceFactory; public class Bootstrap_Test { - static public boolean test( String ini_file, java.util.Hashtable<String,String> bootstrap_parameters ) + static public boolean test( String ini_file, java.util.Map<String,String> bootstrap_parameters ) throws java.lang.Exception { boolean passed = false; @@ -91,7 +91,7 @@ public class Bootstrap_Test { if ( args.length == 0 ) usage(); - java.util.Hashtable<String,String> bootstrap_parameters = new java.util.Hashtable<String,String>(); + java.util.HashMap<String,String> bootstrap_parameters = new java.util.HashMap<String,String>(); for ( int nPos = 1; nPos < args.length; ++nPos ) { String arg = args[ nPos ]; diff --git a/javaunohelper/test/com/sun/star/comp/helper/ComponentContext_Test.java b/javaunohelper/test/com/sun/star/comp/helper/ComponentContext_Test.java index 1a28a77f84f2..7847a86a26ec 100644 --- a/javaunohelper/test/com/sun/star/comp/helper/ComponentContext_Test.java +++ b/javaunohelper/test/com/sun/star/comp/helper/ComponentContext_Test.java @@ -17,25 +17,22 @@ */ package com.sun.star.comp.helper; -import com.sun.star.uno.XComponentContext; +import java.util.HashMap; + import com.sun.star.lang.XComponent; import com.sun.star.lang.XMultiComponentFactory; - -import com.sun.star.comp.helper.ComponentContext; -import com.sun.star.comp.helper.ComponentContextEntry; import com.sun.star.uno.UnoRuntime; - -import java.util.Hashtable; +import com.sun.star.uno.XComponentContext; public class ComponentContext_Test { public static void main(String args[]) { try { - Hashtable<String,Object> table = new Hashtable<String,Object>(); + HashMap<String,Object> table = new HashMap<String,Object>(); table.put( "bla1", new ComponentContextEntry( null, new Integer( 1 ) ) ); XComponentContext xInitialContext = Bootstrap.createInitialComponentContext( table ); - table = new Hashtable<String,Object>(); + table = new HashMap<String,Object>(); table.put( "bla2", new ComponentContextEntry( new Integer( 2 ) ) ); table.put( "bla3", new Integer( 3 ) ); XComponentContext xContext = new ComponentContext( table, xInitialContext ); diff --git a/odk/examples/DevelopersGuide/Spreadsheet/ExampleAddIn.java b/odk/examples/DevelopersGuide/Spreadsheet/ExampleAddIn.java index 47cc018ac2e4..0d5cb6bd781a 100644 --- a/odk/examples/DevelopersGuide/Spreadsheet/ExampleAddIn.java +++ b/odk/examples/DevelopersGuide/Spreadsheet/ExampleAddIn.java @@ -79,9 +79,9 @@ class ExampleAddInResult implements com.sun.star.sheet.XVolatileResult class ExampleAddInThread extends Thread { - private java.util.Hashtable<String, ExampleAddInResult> aCounters; + private java.util.HashMap<String, ExampleAddInResult> aCounters; - public ExampleAddInThread( java.util.Hashtable<String, ExampleAddInResult> aResults ) + public ExampleAddInThread( java.util.HashMap<String, ExampleAddInResult> aResults ) { aCounters = aResults; } @@ -99,9 +99,8 @@ class ExampleAddInThread extends Thread } // increment all counters - java.util.Enumeration<ExampleAddInResult> aEnum = aCounters.elements(); - while (aEnum.hasMoreElements()) - aEnum.nextElement().incrementValue(); + for (ExampleAddInResult r : aCounters.values()) + r.incrementValue(); } } } @@ -149,7 +148,7 @@ public class ExampleAddIn }; private com.sun.star.lang.Locale aFuncLocale; - private java.util.Hashtable<String, ExampleAddInResult> aResults; + private java.util.HashMap<String, ExampleAddInResult> aResults; public _ExampleAddIn( com.sun.star.lang.XMultiServiceFactory xFactory ) { @@ -176,7 +175,7 @@ public class ExampleAddIn { // create the table of results, and start a thread to increment // all counters - aResults = new java.util.Hashtable<String, ExampleAddInResult>(); + aResults = new java.util.HashMap<String, ExampleAddInResult>(); ExampleAddInThread aThread = new ExampleAddInThread( aResults ); aThread.start(); } diff --git a/odk/examples/java/Inspector/SourceCodeGenerator.java b/odk/examples/java/Inspector/SourceCodeGenerator.java index 4e6f3bc30115..8ccba8bba944 100644 --- a/odk/examples/java/Inspector/SourceCodeGenerator.java +++ b/odk/examples/java/Inspector/SourceCodeGenerator.java @@ -33,8 +33,7 @@ *************************************************************************/ import java.util.ArrayList; -import java.util.Enumeration; -import java.util.Hashtable; +import java.util.HashMap; import com.sun.star.reflection.ParamInfo; import com.sun.star.reflection.XIdlClass; @@ -55,7 +54,7 @@ public class SourceCodeGenerator { private String sStatementCode = ""; private String sMainMethodSignature = ""; - private Hashtable<String, UnoObjectDefinition> aVariables = new Hashtable<String, UnoObjectDefinition>(); + private HashMap<String, UnoObjectDefinition> aVariables = new HashMap<String, UnoObjectDefinition>(); private final String SSUFFIXSEPARATOR = "_"; private final String SVARIABLENAME = "VariableName"; private final String SARRAYVARIABLENAME = "VariableNameList"; @@ -344,9 +343,7 @@ public class SourceCodeGenerator { private String getHeaderSourceCode(){ - Enumeration<UnoObjectDefinition> aEnumeration = aVariables.elements(); - while(aEnumeration.hasMoreElements()){ - UnoObjectDefinition oUnoObjectDefinition = aEnumeration.nextElement(); + for(UnoObjectDefinition oUnoObjectDefinition : aVariables.values()){ String sCurHeaderStatement = m_xLanguageSourceCodeGenerator.getHeaderSourceCode(oUnoObjectDefinition.getUnoObject(), oUnoObjectDefinition.getTypeName(), oUnoObjectDefinition.getTypeClass()); sHeaderStatements.add(sCurHeaderStatement); } diff --git a/qadevOOo/runner/helper/UnoProvider.java b/qadevOOo/runner/helper/UnoProvider.java index ec63699f8cbb..e3628de63a0a 100644 --- a/qadevOOo/runner/helper/UnoProvider.java +++ b/qadevOOo/runner/helper/UnoProvider.java @@ -17,15 +17,17 @@ */ package helper; +import java.util.HashMap; + +import lib.TestParameters; +import util.PropertyName; +import util.utils; + import com.sun.star.comp.helper.Bootstrap; import com.sun.star.lang.XMultiComponentFactory; import com.sun.star.lang.XMultiServiceFactory; import com.sun.star.uno.UnoRuntime; import com.sun.star.uno.XComponentContext; -import java.util.Hashtable; -import lib.TestParameters; -import util.PropertyName; -import util.utils; /** * Bootstrap UNO from a Java environment. @@ -89,7 +91,7 @@ public class UnoProvider implements AppProvider { if (xMSF == null) { // bootstrap UNO. String unorcName = getUnorcName(param); - Hashtable<String,String> env = new Hashtable<String,String>(); + HashMap<String,String> env = new HashMap<String,String>(); env.put("SYSBINDIR", getSysBinDir(param)); XComponentContext xContext = null; diff --git a/qadevOOo/runner/util/XMLTools.java b/qadevOOo/runner/util/XMLTools.java index cd73daf47304..b658aa58f185 100644 --- a/qadevOOo/runner/util/XMLTools.java +++ b/qadevOOo/runner/util/XMLTools.java @@ -22,7 +22,6 @@ import java.io.PrintWriter; import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; -import java.util.Hashtable; import java.util.Iterator; import com.sun.star.beans.PropertyValue; @@ -58,7 +57,7 @@ public class XMLTools { public String Type ; public String Value ; } - private Hashtable<String, Attribute> attrByName = new Hashtable<String, Attribute>() ; + private HashMap<String, Attribute> attrByName = new HashMap<String, Attribute>() ; private ArrayList<Attribute> attributes = new ArrayList<Attribute>() ; private PrintWriter log = null ; diff --git a/qadevOOo/tests/java/ifc/style/_ParagraphProperties.java b/qadevOOo/tests/java/ifc/style/_ParagraphProperties.java index 7be6f0ecb4be..9f4ba6ad8806 100644 --- a/qadevOOo/tests/java/ifc/style/_ParagraphProperties.java +++ b/qadevOOo/tests/java/ifc/style/_ParagraphProperties.java @@ -17,6 +17,15 @@ */ package ifc.style; +import ifc.text._NumberingLevel; + +import java.util.HashMap; + +import lib.MultiPropertyTest; +import lib.Status; +import share.LogWriter; +import util.utils; + import com.sun.star.beans.PropertyValue; import com.sun.star.beans.UnknownPropertyException; import com.sun.star.container.XIndexReplace; @@ -25,16 +34,6 @@ import com.sun.star.lang.WrappedTargetException; import com.sun.star.uno.AnyConverter; import com.sun.star.uno.Type; import com.sun.star.xml.AttributeData; -import ifc.text._NumberingLevel; -import java.util.Enumeration; -import java.util.Hashtable; - -import lib.MultiPropertyTest; -import lib.Status; -import share.LogWriter; - - -import util.utils; /** @@ -446,11 +445,11 @@ public class _ParagraphProperties extends MultiPropertyTest { } private class OwnUserDefinedAttributes implements XNameContainer{ - Hashtable<String, Object> members = null; + HashMap<String, Object> members = null; public OwnUserDefinedAttributes() { - members = new Hashtable<String, Object>(); + members = new HashMap<String, Object>(); } public Object getByName(String str) throws com.sun.star.container.NoSuchElementException, com.sun.star.lang.WrappedTargetException { @@ -458,18 +457,12 @@ public class _ParagraphProperties extends MultiPropertyTest { } public String[] getElementNames() { - Enumeration<String> oEnum = members.keys(); - int count = members.size(); - String[] res = new String[count]; - int i=0; - while(oEnum.hasMoreElements()) - res[i] = oEnum.nextElement(); - return res; + java.util.Set<String> keySet = members.keySet(); + return keySet.toArray(new String[keySet.size()]); } public com.sun.star.uno.Type getElementType() { - Enumeration<String> oEnum = members.keys(); - String key = oEnum.nextElement(); + String key = members.keySet().iterator().next(); Object o = members.get(key); return new Type(o.getClass()); } diff --git a/rhino/OfficeScriptInfo.java b/rhino/OfficeScriptInfo.java index 0732ca2df1dd..a71a68e7c2a9 100644 --- a/rhino/OfficeScriptInfo.java +++ b/rhino/OfficeScriptInfo.java @@ -33,7 +33,7 @@ import org.mozilla.javascript.Scriptable; public class OfficeScriptInfo { - private Hashtable loadedSFScripts = new Hashtable(); + private HashMap<String, SFScriptInfo> loadedSFScripts = new HashMap<String, SFScriptInfo>(); public void addScript( URL url, Scriptable scope, Runnable closeCallback ) { @@ -42,7 +42,7 @@ public class OfficeScriptInfo public void addScript( String key, URL url, Scriptable scope, Runnable closeCallback ) { - SFScriptInfo si = (SFScriptInfo)loadedSFScripts.get( key ); + SFScriptInfo si = loadedSFScripts.get( key ); if ( si == null ) { si = new SFScriptInfo(); @@ -55,7 +55,7 @@ public class OfficeScriptInfo public void deleteScript( String key ) { - SFScriptInfo info = (SFScriptInfo)loadedSFScripts.remove( key ); + SFScriptInfo info = loadedSFScripts.remove( key ); if ( info != null ) { if ( info.closeCallback != null ) @@ -69,7 +69,7 @@ public class OfficeScriptInfo public Scriptable getScriptScope( String key ) { Scriptable result = null; - SFScriptInfo info = (SFScriptInfo)loadedSFScripts.get( key ); + SFScriptInfo info = loadedSFScripts.get( key ); if ( info != null ) { result = info.scope; @@ -80,7 +80,7 @@ public class OfficeScriptInfo public URL getScriptUrl( String key ) { URL result = null; - SFScriptInfo info = (SFScriptInfo)loadedSFScripts.get( key ); + SFScriptInfo info = loadedSFScripts.get( key ); if ( info != null ) { result = info.url; @@ -90,7 +90,7 @@ public class OfficeScriptInfo public boolean hasScript( String key ) { boolean result = true; - SFScriptInfo info = (SFScriptInfo)loadedSFScripts.get( key ); + SFScriptInfo info = loadedSFScripts.get( key ); if ( info == null ) { result = false; @@ -100,7 +100,7 @@ public class OfficeScriptInfo public void setScriptRunning( String key, boolean running ) { - SFScriptInfo info = (SFScriptInfo)loadedSFScripts.get( key ); + SFScriptInfo info = loadedSFScripts.get( key ); if ( info != null ) { info.isExecuting = running; @@ -110,7 +110,7 @@ public class OfficeScriptInfo public boolean isScriptRunning( String key ) { boolean result = false; - SFScriptInfo info = (SFScriptInfo)loadedSFScripts.get( key ); + SFScriptInfo info = loadedSFScripts.get( key ); if ( info != null ) { result = info.isExecuting; diff --git a/scripting/java/com/sun/star/script/framework/container/ParcelDescriptor.java b/scripting/java/com/sun/star/script/framework/container/ParcelDescriptor.java index 70db0b39b680..4a28f30bbc3f 100644 --- a/scripting/java/com/sun/star/script/framework/container/ParcelDescriptor.java +++ b/scripting/java/com/sun/star/script/framework/container/ParcelDescriptor.java @@ -27,7 +27,6 @@ import java.io.InputStream; import java.io.OutputStream; import java.util.ArrayList; import java.util.HashMap; -import java.util.Hashtable; import java.util.Iterator; import java.util.Map; @@ -59,7 +58,7 @@ public class ParcelDescriptor { private File file = null; private Document document = null; private String language = null; - private Map<String,String> languagedepprops = new Hashtable<String,String>(3); + private Map<String,String> languagedepprops = new HashMap<String,String>(3); public static synchronized void removeParcelDescriptor(File parent) { File path = new File(parent, PARCEL_DESCRIPTOR_NAME); diff --git a/scripting/java/org/openoffice/idesupport/CommandLineTools.java b/scripting/java/org/openoffice/idesupport/CommandLineTools.java index 73e81755679a..5cb8d5f51b55 100644 --- a/scripting/java/org/openoffice/idesupport/CommandLineTools.java +++ b/scripting/java/org/openoffice/idesupport/CommandLineTools.java @@ -181,7 +181,7 @@ public class CommandLineTools { private String language = null; private MethodFinder finder = null; private ArrayList scripts = null; - private Hashtable properties = new Hashtable(3); + private HashMap properties = new HashMap(3); public GenerateCommand(String basedir) { this.basedir = new File(basedir); |