[Libreoffice-commits] core.git: 10 commits - accessibility/bridge bean/test bridges/test comphelper/qa dbaccess/qa embeddedobj/test filter/source forms/qa javaunohelper/com javaunohelper/test nlpsolver/src nlpsolver/ThirdParty odk/examples qadevOOo/runner qadevOOo/tests reportbuilder/java rhino/OfficeScriptInfo.java ridljar/com scripting/examples scripting/java scripting/workben sfx2/qa testtools/com toolkit/test vcl/qa wizards/com xmerge/source xmlsecurity/test_docs
Noel Grandin
noel at peralex.com
Mon May 6 02:46:30 PDT 2013
accessibility/bridge/org/openoffice/accessibility/AccessBridge.java | 2
accessibility/bridge/org/openoffice/accessibility/WindowsAccessBridgeAdapter.java | 6
accessibility/bridge/org/openoffice/java/accessibility/AccessibleObjectFactory.java | 2
bean/test/applet/oooapplet/OOoViewer.java | 8 -
bridges/test/java_uno/equals/TestEquals.java | 13 +
comphelper/qa/complex/comphelper/Map.java | 1
dbaccess/qa/complex/dbaccess/DatabaseDocument.java | 1
dbaccess/qa/complex/dbaccess/RowSet.java | 1
dbaccess/qa/complex/dbaccess/SingleSelectQueryComposer.java | 1
dbaccess/qa/complex/dbaccess/TestCase.java | 1
embeddedobj/test/Container1/EmbedContApp.java | 7 -
filter/source/config/tools/split/Splitter.java | 2
forms/qa/complex/forms/CheckOGroupBoxModel.java | 34 ++---
forms/qa/integration/forms/ListBox.java | 12 +
javaunohelper/com/sun/star/comp/helper/Bootstrap.java | 22 ++-
javaunohelper/com/sun/star/comp/helper/ComponentContext.java | 9 +
javaunohelper/com/sun/star/lib/uno/helper/PropertySetMixin.java | 1
javaunohelper/test/com/sun/star/comp/helper/Bootstrap_Test.java | 4
javaunohelper/test/com/sun/star/comp/helper/ComponentContext_Test.java | 13 -
nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/global/GlobalFile.java | 1
nlpsolver/src/com/sun/star/comp/Calc/NLPSolver/DEPSSolverImpl.java | 24 +--
odk/examples/DevelopersGuide/Forms/ButtonOperator.java | 14 +-
odk/examples/DevelopersGuide/Forms/InteractionRequest.java | 15 +-
odk/examples/DevelopersGuide/Forms/SalesFilter.java | 16 +-
odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/IOnewayLink.java | 4
odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/Interceptor.java | 8 -
odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/OnewayExecutor.java | 16 +-
odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/StatusListener.java | 6
odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/ViewContainer.java | 13 -
odk/examples/DevelopersGuide/Spreadsheet/ExampleAddIn.java | 25 +--
odk/examples/DevelopersGuide/UCB/ChildrenRetriever.java | 48 +++----
odk/examples/DevelopersGuide/UCB/PropertiesComposer.java | 24 +--
odk/examples/DevelopersGuide/UCB/PropertiesRetriever.java | 22 +--
odk/examples/java/EmbedDocument/EmbeddedObject/OwnEmbeddedObject.java | 40 ++---
odk/examples/java/Inspector/HideableTreeModel.java | 33 ++--
odk/examples/java/Inspector/Inspector.java | 14 +-
odk/examples/java/Inspector/Introspector.java | 11 -
odk/examples/java/Inspector/MethodParametersDialog.java | 14 +-
odk/examples/java/Inspector/SourceCodeGenerator.java | 20 +-
odk/examples/java/Inspector/SwingUnoMethodNode.java | 9 -
odk/examples/java/Inspector/UnoMethodNode.java | 3
odk/examples/java/Inspector/UnoNode.java | 7 -
odk/examples/java/Inspector/XUnoMethodNode.java | 3
odk/examples/java/Storage/Test05.java | 2
odk/examples/java/ToDo/ToDo.java | 64 ++++-----
qadevOOo/runner/base/java_fat.java | 45 +++---
qadevOOo/runner/helper/OfficeProvider.java | 4
qadevOOo/runner/helper/UnoProvider.java | 12 +
qadevOOo/runner/util/XMLTools.java | 3
qadevOOo/tests/java/ifc/beans/_XFastPropertySet.java | 1
qadevOOo/tests/java/ifc/beans/_XMultiPropertySet.java | 1
qadevOOo/tests/java/ifc/beans/_XPropertySet.java | 8 -
qadevOOo/tests/java/ifc/io/_XDataInputStream.java | 1
qadevOOo/tests/java/ifc/io/_XDataOutputStream.java | 1
qadevOOo/tests/java/ifc/io/_XOutputStream.java | 1
qadevOOo/tests/java/ifc/sdbc/_XParameters.java | 1
qadevOOo/tests/java/ifc/sdbc/_XRow.java | 1
qadevOOo/tests/java/ifc/sdbc/_XRowUpdate.java | 1
qadevOOo/tests/java/ifc/style/_ParagraphProperties.java | 35 ++---
qadevOOo/tests/java/ifc/view/_XMultiSelectionSupplier.java | 1
qadevOOo/tests/java/ifc/view/_XSelectionSupplier.java | 1
reportbuilder/java/org/libreoffice/report/pentaho/output/spreadsheet/SpreadsheetRawReportTarget.java | 16 --
rhino/OfficeScriptInfo.java | 16 +-
ridljar/com/sun/star/lib/util/WeakMap.java | 1
scripting/examples/java/Newsgroup/PostNewsgroup.java | 2
scripting/examples/java/Newsgroup/SubscribedNewsgroups.java | 12 -
scripting/java/com/sun/star/script/framework/container/ParcelDescriptor.java | 28 ++--
scripting/java/com/sun/star/script/framework/provider/ScriptProvider.java | 26 ---
scripting/java/org/openoffice/idesupport/CommandLineTools.java | 2
scripting/java/org/openoffice/idesupport/JavaFinder.java | 23 +--
scripting/java/org/openoffice/idesupport/LocalOffice.java | 14 +-
scripting/java/org/openoffice/idesupport/OfficeDocument.java | 17 +-
scripting/java/org/openoffice/idesupport/SVersionRCFile.java | 23 +--
scripting/java/org/openoffice/idesupport/ui/ConfigurePanel.java | 38 ++---
scripting/java/org/openoffice/idesupport/ui/MethodPanel.java | 25 ++-
scripting/java/org/openoffice/idesupport/ui/ScriptPanel.java | 37 ++---
scripting/java/org/openoffice/netbeans/modules/office/actions/BuildParcelAction.java | 2
scripting/java/org/openoffice/netbeans/modules/office/actions/ParcelFolderSupport.java | 8 -
scripting/workben/installer/FileUpdater.java | 33 +---
scripting/workben/installer/IdeUpdater.java | 12 -
scripting/workben/installer/InstUtil.java | 5
scripting/workben/installer/XmlUpdater.java | 12 -
scripting/workben/installer/ZipData.java | 68 ++++------
scripting/workben/mod/_scripting/TestDataLoader.java | 5
sfx2/qa/complex/sfx2/DocumentEvents.java | 22 +--
sfx2/qa/complex/sfx2/UndoManager.java | 1
testtools/com/sun/star/comp/bridge/TestComponent.java | 2
toolkit/test/accessibility/AccTreeNode.java | 24 ++-
toolkit/test/accessibility/AccessibilityTree.java | 26 ++-
toolkit/test/accessibility/AccessibilityTreeModel.java | 20 +-
toolkit/test/accessibility/AccessibilityTreeModelBase.java | 9 -
toolkit/test/accessibility/AccessibleTreeCellRenderer.java | 24 +--
toolkit/test/accessibility/AccessibleTreeHandler.java | 4
toolkit/test/accessibility/AccessibleTreeNode.java | 7 -
toolkit/test/accessibility/NodeFactory.java | 2
toolkit/test/accessibility/NodeHandler.java | 4
toolkit/test/accessibility/SelectionDialog.java | 22 ++-
toolkit/test/accessibility/VectorNode.java | 9 -
toolkit/test/accessibility/ov/ObjectViewContainer.java | 24 +--
vcl/qa/complex/memCheck/CheckMemoryUsage.java | 4
wizards/com/sun/star/wizards/common/FileAccess.java | 24 +--
wizards/com/sun/star/wizards/common/JavaTools.java | 10 -
wizards/com/sun/star/wizards/db/TypeInspector.java | 42 +++---
wizards/com/sun/star/wizards/ui/ButtonList.java | 3
wizards/com/sun/star/wizards/ui/FieldSelection.java | 6
wizards/com/sun/star/wizards/ui/ImageList.java | 5
xmerge/source/xmerge/java/org/openoffice/xmerge/util/ActiveSyncDriver.java | 3
xmlsecurity/test_docs/tools/httpserv/src/httpserv/Main.java | 1
108 files changed, 713 insertions(+), 723 deletions(-)
New commits:
commit 8bebd29976f41cb8793804f3e0b22ef75c56d8dd
Author: Noel Grandin <noel at peralex.com>
Date: Fri May 3 15:20:36 2013 +0200
Java cleanup, remove unnecessary @SuppressWarnings annotations
Change-Id: Ib5df091fc4a6233b526c44ae42dbdbacb0bef7c6
diff --git a/comphelper/qa/complex/comphelper/Map.java b/comphelper/qa/complex/comphelper/Map.java
index 84304d2..20ce90e 100644
--- a/comphelper/qa/complex/comphelper/Map.java
+++ b/comphelper/qa/complex/comphelper/Map.java
@@ -188,7 +188,6 @@ public class Map /* extends complexlib.ComplexTestCase */
);
}
- @SuppressWarnings("unchecked")
@Test public void testComplexKeyTypes() throws com.sun.star.uno.Exception
{
Type intType = new Type( Integer.class );
diff --git a/dbaccess/qa/complex/dbaccess/DatabaseDocument.java b/dbaccess/qa/complex/dbaccess/DatabaseDocument.java
index 264872d..fc5999d 100644
--- a/dbaccess/qa/complex/dbaccess/DatabaseDocument.java
+++ b/dbaccess/qa/complex/dbaccess/DatabaseDocument.java
@@ -173,7 +173,6 @@ public class DatabaseDocument extends TestCase implements com.sun.star.document.
};
}
- @SuppressWarnings("unchecked")
public void dispose()
{
final EventObject event = new EventObject(this);
diff --git a/dbaccess/qa/complex/dbaccess/RowSet.java b/dbaccess/qa/complex/dbaccess/RowSet.java
index b5ecad9..e7f195a 100644
--- a/dbaccess/qa/complex/dbaccess/RowSet.java
+++ b/dbaccess/qa/complex/dbaccess/RowSet.java
@@ -370,7 +370,6 @@ public class RowSet extends TestCase
// --------------------------------------------------------------------------------------------------------
@Test
- @SuppressWarnings("unchecked")
public void testRowSetEvents() throws java.lang.Exception
{
System.out.println("testing RowSet Events");
diff --git a/dbaccess/qa/complex/dbaccess/SingleSelectQueryComposer.java b/dbaccess/qa/complex/dbaccess/SingleSelectQueryComposer.java
index b95144a..4b762d8 100644
--- a/dbaccess/qa/complex/dbaccess/SingleSelectQueryComposer.java
+++ b/dbaccess/qa/complex/dbaccess/SingleSelectQueryComposer.java
@@ -80,7 +80,6 @@ public class SingleSelectQueryComposer extends CRMBasedTestCase
}
// --------------------------------------------------------------------------------------------------------
- @SuppressWarnings("unchecked")
private void checkAttributeAccess(String _attributeName, String _attributeValue)
{
System.out.println("setting " + _attributeName + " to " + _attributeValue);
diff --git a/dbaccess/qa/complex/dbaccess/TestCase.java b/dbaccess/qa/complex/dbaccess/TestCase.java
index 738f39d..3db21c8 100644
--- a/dbaccess/qa/complex/dbaccess/TestCase.java
+++ b/dbaccess/qa/complex/dbaccess/TestCase.java
@@ -117,7 +117,6 @@ public abstract class TestCase
* is the class of the exception to be caught. If this is null,
* it means that <em>no</em> exception must be throw by invoking the method.
*/
- @SuppressWarnings("unchecked")
protected void assureException( final String _message, final Object _object, final String _methodName,
final Class[] _argClasses, final Object[] _methodArgs, final Class _expectedExceptionClass )
{
diff --git a/javaunohelper/com/sun/star/lib/uno/helper/PropertySetMixin.java b/javaunohelper/com/sun/star/lib/uno/helper/PropertySetMixin.java
index cd57c63..dae489f 100644
--- a/javaunohelper/com/sun/star/lib/uno/helper/PropertySetMixin.java
+++ b/javaunohelper/com/sun/star/lib/uno/helper/PropertySetMixin.java
@@ -200,7 +200,6 @@ public final class PropertySetMixin {
{@link BoundListeners#notifyListeners} has not yet been called); may only
be null if the attribute that is going to be set is not bound
*/
- @SuppressWarnings("unchecked")
public void prepareSet(
String propertyName, Object oldValue, Object newValue,
BoundListeners bound)
diff --git a/qadevOOo/tests/java/ifc/beans/_XFastPropertySet.java b/qadevOOo/tests/java/ifc/beans/_XFastPropertySet.java
index 2ba2076..6ee8c0c 100644
--- a/qadevOOo/tests/java/ifc/beans/_XFastPropertySet.java
+++ b/qadevOOo/tests/java/ifc/beans/_XFastPropertySet.java
@@ -62,7 +62,6 @@ public class _XFastPropertySet extends MultiMethodTest {
/**
* Retrieves relation.
*/
- @SuppressWarnings("unchecked")
protected void before() {
exclude = (Set<String>) tEnv.getObjRelation("XFastPropertySet.ExcludeProps") ;
if (exclude == null) {
diff --git a/qadevOOo/tests/java/ifc/beans/_XMultiPropertySet.java b/qadevOOo/tests/java/ifc/beans/_XMultiPropertySet.java
index 54fe4ea..9b81465 100644
--- a/qadevOOo/tests/java/ifc/beans/_XMultiPropertySet.java
+++ b/qadevOOo/tests/java/ifc/beans/_XMultiPropertySet.java
@@ -76,7 +76,6 @@ public class _XMultiPropertySet extends MultiMethodTest {
/**
* Initializes some fields.
*/
- @SuppressWarnings("unchecked")
public void before() {
exclProps = (Set<String>) tEnv.getObjRelation("XMultiPropertySet.ExcludeProps");
if (exclProps == null) exclProps = new HashSet<String>(0);
diff --git a/qadevOOo/tests/java/ifc/io/_XDataInputStream.java b/qadevOOo/tests/java/ifc/io/_XDataInputStream.java
index e91233425..2671b4b 100644
--- a/qadevOOo/tests/java/ifc/io/_XDataInputStream.java
+++ b/qadevOOo/tests/java/ifc/io/_XDataInputStream.java
@@ -76,7 +76,6 @@ public class _XDataInputStream extends MultiMethodTest {
* data of different types and fills the appropriate variables.
* @throws StatusException If one of relations not found.
*/
- @SuppressWarnings("unchecked")
public void before(){
XInterface x = (XInterface)tEnv.getObjRelation("StreamWriter") ;
diff --git a/qadevOOo/tests/java/ifc/io/_XDataOutputStream.java b/qadevOOo/tests/java/ifc/io/_XDataOutputStream.java
index c66c8be..90d049c 100644
--- a/qadevOOo/tests/java/ifc/io/_XDataOutputStream.java
+++ b/qadevOOo/tests/java/ifc/io/_XDataOutputStream.java
@@ -56,7 +56,6 @@ public class _XDataOutputStream extends MultiMethodTest {
* If relation or data of some type in stream not found then
* tests of corresponding methods are skipped.
*/
- @SuppressWarnings("unchecked")
public void before() throws RuntimeException {
List<Object> data = (List<Object>) tEnv.getObjRelation("StreamData") ;
diff --git a/qadevOOo/tests/java/ifc/io/_XOutputStream.java b/qadevOOo/tests/java/ifc/io/_XOutputStream.java
index 9945437..8e53c67 100644
--- a/qadevOOo/tests/java/ifc/io/_XOutputStream.java
+++ b/qadevOOo/tests/java/ifc/io/_XOutputStream.java
@@ -56,7 +56,6 @@ public class _XOutputStream extends MultiMethodTest {
public void resetStreams();
}
- @SuppressWarnings("unchecked")
protected void before() {
checker = (StreamChecker)
tEnv.getObjRelation("XOutputStream.StreamChecker");
diff --git a/qadevOOo/tests/java/ifc/sdbc/_XParameters.java b/qadevOOo/tests/java/ifc/sdbc/_XParameters.java
index fd3dd2b..e9d9774 100644
--- a/qadevOOo/tests/java/ifc/sdbc/_XParameters.java
+++ b/qadevOOo/tests/java/ifc/sdbc/_XParameters.java
@@ -100,7 +100,6 @@ public class _XParameters extends MultiMethodTest {
/**
* Gets object relation
*/
- @SuppressWarnings("unchecked")
public void before() {
data = (List<Object>) tEnv.getObjRelation("XParameters.ParamValues") ;
if (data == null) {
diff --git a/qadevOOo/tests/java/ifc/sdbc/_XRow.java b/qadevOOo/tests/java/ifc/sdbc/_XRow.java
index 8eca402..b7d680e 100644
--- a/qadevOOo/tests/java/ifc/sdbc/_XRow.java
+++ b/qadevOOo/tests/java/ifc/sdbc/_XRow.java
@@ -100,7 +100,6 @@ public class _XRow extends MultiMethodTest {
/**
* Retrieves object relation first.
*/
- @SuppressWarnings("unchecked")
public void before() {
data = (List<Object>) tEnv.getObjRelation("CurrentRowData") ;
}
diff --git a/qadevOOo/tests/java/ifc/sdbc/_XRowUpdate.java b/qadevOOo/tests/java/ifc/sdbc/_XRowUpdate.java
index 0ae50bd..53cd93d 100644
--- a/qadevOOo/tests/java/ifc/sdbc/_XRowUpdate.java
+++ b/qadevOOo/tests/java/ifc/sdbc/_XRowUpdate.java
@@ -99,7 +99,6 @@ public class _XRowUpdate extends MultiMethodTest {
/**
* Gets relations.
*/
- @SuppressWarnings("unchecked")
public void before() {
rowData = (List<Object>) tEnv.getObjRelation("CurrentRowData") ;
if (rowData == null) {
diff --git a/qadevOOo/tests/java/ifc/view/_XMultiSelectionSupplier.java b/qadevOOo/tests/java/ifc/view/_XMultiSelectionSupplier.java
index 3d81a16..3ca7861 100644
--- a/qadevOOo/tests/java/ifc/view/_XMultiSelectionSupplier.java
+++ b/qadevOOo/tests/java/ifc/view/_XMultiSelectionSupplier.java
@@ -55,7 +55,6 @@ public class _XMultiSelectionSupplier extends MultiMethodTest {
Object[] selections = null;
Comparator<Object> ObjCompare = null;
- @SuppressWarnings("unchecked")
protected void before() {
selections = (Object[])tEnv.getObjRelation("Selections");
if (selections == null) {
diff --git a/qadevOOo/tests/java/ifc/view/_XSelectionSupplier.java b/qadevOOo/tests/java/ifc/view/_XSelectionSupplier.java
index 40f1b55..37fce51 100644
--- a/qadevOOo/tests/java/ifc/view/_XSelectionSupplier.java
+++ b/qadevOOo/tests/java/ifc/view/_XSelectionSupplier.java
@@ -53,7 +53,6 @@ public class _XSelectionSupplier extends MultiMethodTest {
Object[] selections = null;
Comparator<Object> ObjCompare = null;
- @SuppressWarnings("unchecked")
protected void before() {
selections = (Object[])tEnv.getObjRelation("Selections");
if (selections == null) {
diff --git a/ridljar/com/sun/star/lib/util/WeakMap.java b/ridljar/com/sun/star/lib/util/WeakMap.java
index 5de60a1..69c2cb0 100644
--- a/ridljar/com/sun/star/lib/util/WeakMap.java
+++ b/ridljar/com/sun/star/lib/util/WeakMap.java
@@ -275,7 +275,6 @@ public final class WeakMap<K,V> implements Map {
* (Specifically, iterating over the collections returned by those
* methods), as non-modifying methods might modify the underlying map.
**/
- @SuppressWarnings("unchecked")
private void cleanUp() {
for (;;) {
Entry<K,V> e = (Entry<K,V>) queue.poll();
diff --git a/sfx2/qa/complex/sfx2/UndoManager.java b/sfx2/qa/complex/sfx2/UndoManager.java
index 47734bf..69c9dd2 100644
--- a/sfx2/qa/complex/sfx2/UndoManager.java
+++ b/sfx2/qa/complex/sfx2/UndoManager.java
@@ -1375,7 +1375,6 @@ public class UndoManager
return new String[] { getCallbackComponentServiceName() };
}
- @SuppressWarnings("unchecked")
public void dispose()
{
final EventObject event = new EventObject( this );
diff --git a/wizards/com/sun/star/wizards/ui/ButtonList.java b/wizards/com/sun/star/wizards/ui/ButtonList.java
index 5dc2f4d..10b80af 100644
--- a/wizards/com/sun/star/wizards/ui/ButtonList.java
+++ b/wizards/com/sun/star/wizards/ui/ButtonList.java
@@ -80,7 +80,7 @@ public class ButtonList implements XItemEventBroadcaster, XActionListener
{
m_aControlName = _sName;
}
-
+
/** Setter for property m_aButtonSize.
* @param imageSize New value of property m_aButtonSize.
*/
@@ -413,7 +413,6 @@ public class ButtonList implements XItemEventBroadcaster, XActionListener
/** Notifies all registered listeners about the event.
*
*/
- @SuppressWarnings("unchecked")
private void fireItemSelected()
{
java.util.ArrayList<XItemListener> list;
diff --git a/wizards/com/sun/star/wizards/ui/ImageList.java b/wizards/com/sun/star/wizards/ui/ImageList.java
index 65ce47a..048ff0d 100644
--- a/wizards/com/sun/star/wizards/ui/ImageList.java
+++ b/wizards/com/sun/star/wizards/ui/ImageList.java
@@ -470,7 +470,7 @@ public class ImageList implements XItemEventBroadcaster, ListDataListener
}
/**
- *
+ *
* @param i
* @return the Object in the list model corresponding to the given image index.
*/
@@ -488,7 +488,7 @@ public class ImageList implements XItemEventBroadcaster, ListDataListener
}
/**
- *
+ *
* @param i
* @return the index in the listModel for the given image index.
*/
@@ -561,7 +561,6 @@ public class ImageList implements XItemEventBroadcaster, ListDataListener
/** Notifies all registered listeners about the event.
*/
- @SuppressWarnings("unchecked")
private void fireItemSelected()
{
java.util.ArrayList<XItemListener> list;
commit 402c8f5f1efd053cc69556d63999955b3af4f41d
Author: Noel Grandin <noel at peralex.com>
Date: Fri May 3 15:18:08 2013 +0200
Java cleanup, close file handles when done with them
Change-Id: I79e6e0b8f53ae6f232c34aa8e833853d2ec24cf0
diff --git a/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/global/GlobalFile.java b/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/global/GlobalFile.java
index 14449e2..03390e9 100644
--- a/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/global/GlobalFile.java
+++ b/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/global/GlobalFile.java
@@ -184,6 +184,7 @@ public class GlobalFile {
}
}
}
+ inReader.close();
}catch(Exception e){
//showMessage();
return null;//Uncertain data file error.
diff --git a/qadevOOo/runner/base/java_fat.java b/qadevOOo/runner/base/java_fat.java
index 1b95f28..031474f 100644
--- a/qadevOOo/runner/base/java_fat.java
+++ b/qadevOOo/runner/base/java_fat.java
@@ -511,40 +511,39 @@ public class java_fat implements TestBase
return entryList;
}
- while (line != null)
+ try
{
- try
+ while (line != null)
{
- if (!line.startsWith("#") && (line.length() > 1))
+ try
{
- entryList.add(line.trim());
- }
+ if (!line.startsWith("#") && (line.length() > 1))
+ {
+ entryList.add(line.trim());
+ }
- line = exclusion.readLine();
- }
- catch (java.io.IOException ioe)
- {
- if (debug)
- {
- System.out.println("Exception while reading exclusion list");
+ line = exclusion.readLine();
}
+ catch (java.io.IOException ioe)
+ {
+ if (debug)
+ {
+ System.out.println("Exception while reading exclusion list");
+ }
- return entryList;
+ return entryList;
+ }
}
}
-
- try
- {
- exclusion.close();
- }
- catch (java.io.IOException ioe)
+ finally
{
- if (debug)
+ try
+ {
+ exclusion.close();
+ }
+ catch (java.io.IOException ioe)
{
- System.out.println("Couldn't close file " + url);
}
-
- return entryList;
}
return entryList;
diff --git a/scripting/workben/installer/FileUpdater.java b/scripting/workben/installer/FileUpdater.java
index 786b8f4..21c3d34 100644
--- a/scripting/workben/installer/FileUpdater.java
+++ b/scripting/workben/installer/FileUpdater.java
@@ -42,6 +42,7 @@ public class FileUpdater {
s.trim();
xmlArray[count] = s;
}
+ reader.close();
}
catch( IOException ioe ) {
String message = "\nError reading ProtocolHandler.xcu, please view SFrameworkInstall.log.";
@@ -112,6 +113,7 @@ public class FileUpdater {
s.trim();
xmlArray[count] = s;
}
+ reader.close();
}
catch( IOException ioe ) {
String message = "Error reading script.xlc, please view SFrameworkInstall.log.";
@@ -184,6 +186,7 @@ public class FileUpdater {
s.trim();
xmlArray[count] = s;
}
+ reader.close();
}
catch( IOException ioe ) {
diff --git a/scripting/workben/installer/InstUtil.java b/scripting/workben/installer/InstUtil.java
index c6a7131..26ec202 100644
--- a/scripting/workben/installer/InstUtil.java
+++ b/scripting/workben/installer/InstUtil.java
@@ -237,6 +237,7 @@ public class InstUtil {
break;
}
}
+ reader.close();
}
catch( IOException ioe ) {
System.out.println( "Error reading Netbeans location information" );
@@ -285,6 +286,7 @@ public class InstUtil {
jeditDetails[1] = version;
}
}
+ reader.close();
}
catch( IOException ioe ) {
System.out.println( "Error reading Jedit location information" );
@@ -292,7 +294,6 @@ public class InstUtil {
//catch( FileNotFoundException fnfe ) {
//System.out.println( "Jedit activity.log FileNotFoundException" );
//}
-
return jeditDetails;
}
@@ -408,7 +409,7 @@ public class InstUtil {
}
}
}
-
+ reader.close();
return results;
}
diff --git a/scripting/workben/installer/ZipData.java b/scripting/workben/installer/ZipData.java
index 432201f..0cd144a 100644
--- a/scripting/workben/installer/ZipData.java
+++ b/scripting/workben/installer/ZipData.java
@@ -21,13 +21,12 @@ package installer;
import java.io.*;
import javax.swing.*;
-public class ZipData
-{
+public class ZipData {
public ZipData(String file) {
}
public boolean extractEntry(String entry, String destination,
- JLabel statusLabel) {
+ JLabel statusLabel) {
OutputStream out = null;
InputStream in = null;
@@ -35,23 +34,22 @@ public class ZipData
System.out.println("Copying: " + entry);
System.out.println("To: " + destination);
- if (statusLabel != null) {
- statusLabel.setText("Copying " + entry);
- }
+ if (statusLabel != null) {
+ statusLabel.setText("Copying " + entry);
+ }
String entryName;
if (entry.lastIndexOf("/") != -1) {
entryName = entry.substring(entry.lastIndexOf("/") + 1);
- }
- else {
+ } else {
entryName = entry;
}
String destName;
if (destination.lastIndexOf(File.separator) != -1) {
- destName = destination.substring(destination.lastIndexOf(File.separator) + 1);
- }
- else {
+ destName = destination.substring(destination
+ .lastIndexOf(File.separator) + 1);
+ } else {
destName = destination;
}
@@ -60,20 +58,6 @@ public class ZipData
System.out.println("Unzipping " + entry + " to " + destination);
- try {
- out = new FileOutputStream(destination);
- }
- catch (IOException ioe) {
- System.err.println("Error opening " + destination +
- ": " + ioe.getMessage());
-
- if (statusLabel != null)
- statusLabel.setText("Error opening" + destination +
- "see SFramework.log for more information");
-
- return false;
- }
-
if (entry.startsWith("/") == false)
entry = "/" + entry;
@@ -82,8 +66,21 @@ public class ZipData
System.err.println("File " + entry + " not found in jar file");
if (statusLabel != null)
- statusLabel.setText("Failed extracting " + entry +
- "see SFramework.log for more information");
+ statusLabel.setText("Failed extracting " + entry
+ + "see SFramework.log for more information");
+
+ return false;
+ }
+
+ try {
+ out = new FileOutputStream(destination);
+ } catch (IOException ioe) {
+ System.err.println("Error opening " + destination + ": "
+ + ioe.getMessage());
+
+ if (statusLabel != null)
+ statusLabel.setText("Error opening" + destination
+ + "see SFramework.log for more information");
return false;
}
@@ -94,22 +91,19 @@ public class ZipData
while ((len = in.read(bytes)) != -1)
out.write(bytes, 0, len);
- }
- catch (IOException ioe) {
- System.err.println("Error writing " + destination + ": " +
- ioe.getMessage());
+ } catch (IOException ioe) {
+ System.err.println("Error writing " + destination + ": "
+ + ioe.getMessage());
if (statusLabel != null)
- statusLabel.setText("Failed writing " + destination +
- "see SFramework.log for more information");
+ statusLabel.setText("Failed writing " + destination
+ + "see SFramework.log for more information");
return false;
- }
- finally {
+ } finally {
try {
in.close();
out.close();
- }
- catch (IOException ioe) {
+ } catch (IOException ioe) {
}
}
return true;
diff --git a/scripting/workben/mod/_scripting/TestDataLoader.java b/scripting/workben/mod/_scripting/TestDataLoader.java
index c76d435..63d360e 100644
--- a/scripting/workben/mod/_scripting/TestDataLoader.java
+++ b/scripting/workben/mod/_scripting/TestDataLoader.java
@@ -44,10 +44,9 @@ public class TestDataLoader {
if (!f.exists())
return;
- BufferedReader in;
try {
- in = new BufferedReader(new FileReader(f));
+ BufferedReader in = new BufferedReader(new FileReader(f));
String s, previous, current;
ArrayList<Parameters> list = new ArrayList<Parameters>(11);
@@ -59,6 +58,7 @@ public class TestDataLoader {
list.add(getParameters(st));
}
else {
+ in.close();
return;
}
@@ -77,6 +77,7 @@ public class TestDataLoader {
}
tEnv.addObjRelation(previous, list);
+ in.close();
}
catch (IOException ioe) {
}
diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/util/ActiveSyncDriver.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/util/ActiveSyncDriver.java
index 42ce0a9..a06dca7 100644
--- a/xmerge/source/xmerge/java/org/openoffice/xmerge/util/ActiveSyncDriver.java
+++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/util/ActiveSyncDriver.java
@@ -113,16 +113,19 @@ public class ActiveSyncDriver {
dataOut = conv.convert();
}
catch (Exception e) {
+ fos.close();
return false;
}
if (dataOut == null) {
+ fos.close();
return false;
}
// Get the document and write it out.
Document doc = (Document)dataOut.getDocumentEnumeration().next();
if (doc == null) {
+ fos.close();
return false;
}
diff --git a/xmlsecurity/test_docs/tools/httpserv/src/httpserv/Main.java b/xmlsecurity/test_docs/tools/httpserv/src/httpserv/Main.java
index 8a604fa..a9bd3ce 100644
--- a/xmlsecurity/test_docs/tools/httpserv/src/httpserv/Main.java
+++ b/xmlsecurity/test_docs/tools/httpserv/src/httpserv/Main.java
@@ -142,6 +142,7 @@ class MyHandler implements HttpHandler {
byte[] data = new byte[(int) fileRequest.length()];
FileInputStream fr = new FileInputStream(fileRequest);
int count = fr.read(data);
+ fr.close();
//set the Content-type header
Headers h = xchange.getResponseHeaders();
commit 7cba598a7ddcf02771ed31c8d8fce6f7e02ef715
Author: Noel Grandin <noel at peralex.com>
Date: Fri May 3 15:06:41 2013 +0200
Java cleanup, delete some dead code
Change-Id: I4423cc7ec49769e256f73d9b7fba7b78f84f932f
diff --git a/odk/examples/java/Storage/Test05.java b/odk/examples/java/Storage/Test05.java
index 9a21b74..15f37b9 100644
--- a/odk/examples/java/Storage/Test05.java
+++ b/odk/examples/java/Storage/Test05.java
@@ -145,8 +145,6 @@ public class Test05 implements StorageTest {
XStream xSubStream2clone = m_aTestHelper.OpenStream( xSubSubStorage,
"SubStream2",
ElementModes.READ | ElementModes.NOCREATE );
- if ( xSubStream2 == null )
- return false;
// so now the first stream can not be open neither for reading nor for writing
diff --git a/qadevOOo/runner/helper/OfficeProvider.java b/qadevOOo/runner/helper/OfficeProvider.java
index ec426a8..c0e573d 100644
--- a/qadevOOo/runner/helper/OfficeProvider.java
+++ b/qadevOOo/runner/helper/OfficeProvider.java
@@ -444,10 +444,6 @@ public class OfficeProvider implements AppProvider
if (debug && exc != null && exc.length() != 0)
{
- if (exc == null)
- {
- exc = "";
- }
dbg("Could not connect an Office. " + exc);
}
diff --git a/scripting/java/com/sun/star/script/framework/provider/ScriptProvider.java b/scripting/java/com/sun/star/script/framework/provider/ScriptProvider.java
index e1d044c..c0d9600 100644
--- a/scripting/java/com/sun/star/script/framework/provider/ScriptProvider.java
+++ b/scripting/java/com/sun/star/script/framework/provider/ScriptProvider.java
@@ -542,25 +542,17 @@ public abstract class ScriptProvider
public java.lang.Object getByName( String aName ) throws com.sun.star.container.NoSuchElementException, com.sun.star.lang.WrappedTargetException
{
// TODO needs implementing?
- if ( true )
- {
- throw new com.sun.star.uno.RuntimeException(
- "getByName not implemented" );
- }
- return new Object();
+ throw new com.sun.star.uno.RuntimeException(
+ "getByName not implemented" );
}
public String[] getElementNames()
{
// TODO needs implementing?
String[] result = new String[0];
- if ( true )
- {
- throw new com.sun.star.uno.RuntimeException(
- "getElementNames not implemented" );
+ throw new com.sun.star.uno.RuntimeException(
+ "getElementNames not implemented" );
- }
- return result;
}
@@ -585,14 +577,8 @@ public abstract class ScriptProvider
public boolean hasElements()
{
// TODO needs implementing?
- boolean result = false;
- if ( true )
- {
- throw new com.sun.star.uno.RuntimeException(
- "hasElements not implemented" );
-
- }
- return result;
+ throw new com.sun.star.uno.RuntimeException(
+ "hasElements not implemented" );
}
public void replaceByName( String aName, java.lang.Object aElement ) throws com.sun.star.lang.IllegalArgumentException, com.sun.star.container.NoSuchElementException, com.sun.star.lang.WrappedTargetException
{
diff --git a/scripting/workben/installer/FileUpdater.java b/scripting/workben/installer/FileUpdater.java
index 1e75aef..786b8f4 100644
--- a/scripting/workben/installer/FileUpdater.java
+++ b/scripting/workben/installer/FileUpdater.java
@@ -37,14 +37,10 @@ public class FileUpdater {
try {
BufferedReader reader = new BufferedReader(new FileReader(in_file));
count = -1;
- for (String s = reader.readLine(); s != null; s = reader.readLine()) { //</oor:node>
+ for (String s = reader.readLine(); s != null; s = reader.readLine()) { //</oor:node>
count = count + 1;
- if(s != null) {
- s.trim();
- xmlArray[count] = s;
- }
- else
- break;
+ s.trim();
+ xmlArray[count] = s;
}
}
catch( IOException ioe ) {
@@ -111,14 +107,10 @@ public class FileUpdater {
try {
BufferedReader reader = new BufferedReader(new FileReader(in_file));
count = -1;
- for (String s = reader.readLine(); s != null; s = reader.readLine()) { //</oor:node>
+ for (String s = reader.readLine(); s != null; s = reader.readLine()) { //</oor:node>
count = count + 1;
- if(s != null) {
- s.trim();
- xmlArray[count] = s;
- }
- else
- break;
+ s.trim();
+ xmlArray[count] = s;
}
}
catch( IOException ioe ) {
@@ -187,14 +179,10 @@ public class FileUpdater {
try {
BufferedReader reader = new BufferedReader(new FileReader(in_file));
count = -1;
- for (String s = reader.readLine(); s != null; s = reader.readLine()) {
+ for (String s = reader.readLine(); s != null; s = reader.readLine()) {
count = count + 1;
- if(s != null) {
- s.trim();
- xmlArray[count] = s;
- }
- else
- break;
+ s.trim();
+ xmlArray[count] = s;
}
}
catch( IOException ioe ) {
diff --git a/toolkit/test/accessibility/NodeFactory.java b/toolkit/test/accessibility/NodeFactory.java
index 5a53b91..7218c35 100644
--- a/toolkit/test/accessibility/NodeFactory.java
+++ b/toolkit/test/accessibility/NodeFactory.java
@@ -135,8 +135,6 @@ class NodeFactory
AccTreeNode aNode = new AccTreeNode (xAccessible, xContext, sDisplay, aParent);
addDefaultHandlers (aNode, xContext);
- if (aNode == null)
- System.out.println ("createDefaultNode == null");
return aNode;
}
commit 8be40d31d78723debd47f671544f480c1c606db7
Author: Noel Grandin <noel at peralex.com>
Date: Fri May 3 15:03:19 2013 +0200
Java cleanup, convert Hashtable to HashMap
Change-Id: If8a9c0c3a4b357fb9c0ff096f44ed1b44ebbcef4
diff --git a/accessibility/bridge/org/openoffice/accessibility/AccessBridge.java b/accessibility/bridge/org/openoffice/accessibility/AccessBridge.java
index f9b56fe..ebd0552 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 41e0e03..5d7a817 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 a79aacf..4023ee9 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 515c8e4..abfe008 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 989e283..85bc483 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 c47d623..0b3b194 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 2a292be..8e8032f 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 1a28a77..7847a86 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 47cc018..0d5cb6b 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 4e6f3bc..8ccba8b 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 ec63699..e3628de 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 cd73daf..b658aa5 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 7be6f0e..9f4ba6a 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 0732ca2..a71a68e 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 70db0b3..4a28f30 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 73e8175..5cb8d5f 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);
commit e527a340051b55a6f05d05f397d82ec797165163
Author: Noel Grandin <noel at peralex.com>
Date: Fri May 3 14:49:28 2013 +0200
Java cleanup, convert more Vector to ArrayList
Change-Id: Icb807382eaf50f515f2c9dfada0c061414baed33
diff --git a/embeddedobj/test/Container1/EmbedContApp.java b/embeddedobj/test/Container1/EmbedContApp.java
index 89dc27c..4481a98 100644
--- a/embeddedobj/test/Container1/EmbedContApp.java
+++ b/embeddedobj/test/Container1/EmbedContApp.java
@@ -174,7 +174,7 @@ public class EmbedContApp extends Applet
} catch( Exception e ) { System.exit( 0 ); }
m_oActionsNumberLock = new Object();
- m_aActionsList = new Vector();
+ m_aActionsList = new ArrayList();
m_oInHandlerLock = new Object();
m_oImageLock = new Object();
@@ -484,7 +484,7 @@ public class EmbedContApp extends Applet
{
for( int nInd = 0; nInd < m_aActionsList.size(); nInd++ )
{
- ActionObject aAction = ( ActionObject ) m_aActionsList.get( nInd );
+ ActionObject aAction = m_aActionsList.get( nInd );
if ( aAction != null )
{
if ( aAction.m_nID == DESTROY )
@@ -784,7 +784,7 @@ public class EmbedContApp extends Applet
m_aActionsList.add( new ActionObject( nActionID, sParam ) );
else
{
- ActionObject aAction = ( ActionObject ) m_aActionsList.get( nSize - 1 );
+ ActionObject aAction = m_aActionsList.get( nSize - 1 );
if ( aAction != null && aAction.m_nID != DESTROY )
m_aActionsList.add( new ActionObject( nActionID, sParam ) );
}
diff --git a/filter/source/config/tools/split/Splitter.java b/filter/source/config/tools/split/Splitter.java
index 88607f0..018ced0 100644
--- a/filter/source/config/tools/split/Splitter.java
+++ b/filter/source/config/tools/split/Splitter.java
@@ -81,7 +81,7 @@ public class Splitter
// generate all type fragments
m_aDataSet.m_aDebug.setGlobalInfo("generate type fragments ...");
- java.util.Vector lNames = m_aDataSet.m_aCache.getItemNames(Cache.E_TYPE);
+ java.util.ArrayList lNames = m_aDataSet.m_aCache.getItemNames(Cache.E_TYPE);
java.util.Enumeration it = lNames.elements();
while(it.hasMoreElements())
generateXMLFragment(Cache.E_TYPE, (java.lang.String)it.nextElement(), m_aDataSet.m_aFragmentDirTypes);
diff --git a/odk/examples/DevelopersGuide/Forms/SalesFilter.java b/odk/examples/DevelopersGuide/Forms/SalesFilter.java
index 33053db..932cf5c 100644
--- a/odk/examples/DevelopersGuide/Forms/SalesFilter.java
+++ b/odk/examples/DevelopersGuide/Forms/SalesFilter.java
@@ -57,13 +57,13 @@ class SalesFilter implements XActionListener, XPropertyChangeListener, XResetLis
private boolean m_bSettingDate;
private boolean m_bAdjustingFilterList;
private short m_nPreviousFilterIndex;
- private java.util.Vector m_aFilterDates;
+ private java.util.ArrayList m_aFilterDates;
/* ------------------------------------------------------------------ */
public SalesFilter( DocumentHelper aDocument, XPropertySet xSalesForm,
XPropertySet xFilterListBox, XPropertySet xManualFilterEdit, XPropertySet xStartFilterButton )
{
- m_aFilterDates = new java.util.Vector();
+ m_aFilterDates = new java.util.ArrayList();
m_bSettingsDirty = false;
m_bSettingDate = false;
m_bAdjustingFilterList = false;
@@ -311,7 +311,7 @@ class SalesFilter implements XActionListener, XPropertyChangeListener, XResetLis
m_aDocument.getCurrentView().grabControlFocus( m_xManualFilter );
m_bSettingDate = true;
- Object aSelectedDateLimit = m_aFilterDates.elementAt( m_nPreviousFilterIndex );
+ Object aSelectedDateLimit = m_aFilterDates.get( m_nPreviousFilterIndex );
if ( null != aSelectedDateLimit )
{
// translate this date into one the AWT Toolkit understands
@@ -374,7 +374,7 @@ class SalesFilter implements XActionListener, XPropertyChangeListener, XResetLis
{
if ( !isManualFilter( (short)i ) ) // do not compare with the manual filter
{
- GregorianCalendar aCheckCal = getCalendarObject( (java.util.Date)m_aFilterDates.elementAt( i ) );
+ GregorianCalendar aCheckCal = getCalendarObject( (java.util.Date)m_aFilterDates.get( i ) );
if ( equalDate( aDateCal, aCheckCal ) )
return (short)i;
}
@@ -386,7 +386,7 @@ class SalesFilter implements XActionListener, XPropertyChangeListener, XResetLis
// the first (and thus oldes) user defined item
aFilterItems.remove( 6 );
// keep our date vector synchron
- m_aFilterDates.removeElementAt( 6 );
+ m_aFilterDates.remove( 6 );
}
// add the current user defined filter
diff --git a/scripting/examples/java/Newsgroup/SubscribedNewsgroups.java b/scripting/examples/java/Newsgroup/SubscribedNewsgroups.java
index f514069..cba9d62 100644
--- a/scripting/examples/java/Newsgroup/SubscribedNewsgroups.java
+++ b/scripting/examples/java/Newsgroup/SubscribedNewsgroups.java
@@ -118,7 +118,7 @@ public class SubscribedNewsgroups {
}
//System.out.println("mailrc files found");
- ArrayList subscribed = new ArrayList();
+ ArrayList<NewsGroup> subscribed = new ArrayList<NewsGroup>();
// Get the newsgroups in each mailrc file
for( int i=0; i < allMailrcs.length; i++ )
{
@@ -137,7 +137,7 @@ public class SubscribedNewsgroups {
// Copy all unique Newsgroups into the global array
allSubscribed = new NewsGroup[ subscribed.size() ];
- subscribed.copyInto( allSubscribed );
+ subscribed.toArray( allSubscribed );
// Test that at least one subscribed newsgroup has been found
if( allSubscribed.length < 1 )
{
@@ -153,11 +153,11 @@ public class SubscribedNewsgroups {
// Tests if the NewsGroup object has already been listed by another mailrc file
- private static boolean listed( NewsGroup newsgroup, Vector uniqueSubscription )
+ private static boolean listed( NewsGroup newsgroup, ArrayList<NewsGroup> uniqueSubscription )
{
for(int i=0; i < uniqueSubscription.size(); i++)
{
- NewsGroup tempGroup = (NewsGroup) uniqueSubscription.elementAt(i);
+ NewsGroup tempGroup = uniqueSubscription.elementAt(i);
// Test for duplication
if(newsgroup.getHostName().equalsIgnoreCase( tempGroup.getHostName()) &&
newsgroup.getNewsgroupName().equalsIgnoreCase( tempGroup.getNewsgroupName() ) )
diff --git a/scripting/java/org/openoffice/netbeans/modules/office/actions/ParcelFolderSupport.java b/scripting/java/org/openoffice/netbeans/modules/office/actions/ParcelFolderSupport.java
index fb02680..b8fe3e6 100644
--- a/scripting/java/org/openoffice/netbeans/modules/office/actions/ParcelFolderSupport.java
+++ b/scripting/java/org/openoffice/netbeans/modules/office/actions/ParcelFolderSupport.java
@@ -166,8 +166,8 @@ public class ParcelFolderSupport implements ParcelFolderCookie
File contents = FileUtil.toFile(
primary.getFileObject(ParcelZipper.CONTENTS_DIRNAME));
- Vector classpath = getConfigureClasspath();
- classpath.addElement(contents.getAbsolutePath());
+ ArrayList<String> classpath = getConfigureClasspath();
+ classpath.add(contents.getAbsolutePath());
try {
ParcelDescriptor descriptor = getParcelDescriptor();
@@ -210,8 +210,8 @@ public class ParcelFolderSupport implements ParcelFolderCookie
return true;
}
- private Vector getConfigureClasspath() {
- ArrayList result = new ArrayList();
+ private ArrayList<String> getConfigureClasspath() {
+ ArrayList<String> result = new ArrayList<String>();
String classpath = NbClassPath.createRepositoryPath().getClassPath();
if ( System.getProperty( "os.name" ).startsWith( "Windows" ) )
diff --git a/toolkit/test/accessibility/AccessibleTreeHandler.java b/toolkit/test/accessibility/AccessibleTreeHandler.java
index 3e4a72c..a6945a5 100644
--- a/toolkit/test/accessibility/AccessibleTreeHandler.java
+++ b/toolkit/test/accessibility/AccessibleTreeHandler.java
@@ -105,7 +105,7 @@ class AccessibleTreeHandler
if ((nIndex >= 0) || (nIndex <= maChildList.size()))
{
aChild = NodeFactory.Instance().createDefaultNode (xChild, aParent);
- maChildList.insertElementAt (aChild, nIndex);
+ maChildList.add (nIndex, aChild);
}
}
}
@@ -121,7 +121,7 @@ class AccessibleTreeHandler
{
synchronized (maChildList)
{
- maChildList.setElementAt (null, 0);
+ maChildList.set (0, null);
}
}
}
diff --git a/toolkit/test/accessibility/NodeHandler.java b/toolkit/test/accessibility/NodeHandler.java
index 18c127f..efa8fb0 100644
--- a/toolkit/test/accessibility/NodeHandler.java
+++ b/toolkit/test/accessibility/NodeHandler.java
@@ -76,7 +76,7 @@ abstract class NodeHandler
aChild = createChild (aParent, nIndex);
if (aChild == null)
aChild = new StringNode ("could not create child", aParent);
- maChildList.setElementAt (aChild, nIndex);
+ maChildList.set (nIndex, aChild);
}
return aChild;
}
@@ -99,7 +99,7 @@ abstract class NodeHandler
synchronized (maChildList)
{
System.out.println (" removing child at position " + nIndex + ": "
- + maChildList.elementAt (nIndex));
+ + maChildList.get (nIndex));
maChildList.remove (nIndex);
}
}
diff --git a/vcl/qa/complex/memCheck/CheckMemoryUsage.java b/vcl/qa/complex/memCheck/CheckMemoryUsage.java
index 3c11d00..30447e0 100644
--- a/vcl/qa/complex/memCheck/CheckMemoryUsage.java
+++ b/vcl/qa/complex/memCheck/CheckMemoryUsage.java
@@ -25,9 +25,9 @@ import java.io.File;
import java.io.FileWriter;
import java.io.FilenameFilter;
import java.io.PrintWriter;
+import java.util.ArrayList;
import java.util.Iterator;
import java.util.StringTokenizer;
-import java.util.Vector;
import lib.TestParameters;
@@ -156,7 +156,7 @@ public class CheckMemoryUsage /* extends ComplexTestCase */
// get the file extension, export filter connection
Iterator<String> keys = param.keySet().iterator();
- Vector<String> v = new Vector<String>();
+ ArrayList<String> v = new ArrayList<String>();
while (keys.hasNext())
{
String key = keys.next();
diff --git a/wizards/com/sun/star/wizards/common/FileAccess.java b/wizards/com/sun/star/wizards/common/FileAccess.java
index 573e9fa..c559a3a 100644
--- a/wizards/com/sun/star/wizards/common/FileAccess.java
+++ b/wizards/com/sun/star/wizards/common/FileAccess.java
@@ -53,7 +53,7 @@ public class FileAccess
{
/**
- *
+ *
* @param xMSF
* @param sPath
* @param sAddPath
@@ -497,7 +497,7 @@ public class FileAccess
* @param xMSF
* @param FilterName the prefix of the filename. a "-" is added to the prefix !
* @param FolderName the folder (URL) to look for files...
- * @return an array with two array members. The first one, with document titles,
+ * @return an array with two array members. The first one, with document titles,
* the second with the corresponding URLs.
* @deprecated please use the getFolderTitles() with ArrayList
*/
@@ -506,8 +506,8 @@ public class FileAccess
String[][] LocLayoutFiles = new String[2][];
try
{
- java.util.Vector<String> TitleVector = null;
- java.util.Vector<String> NameVector = null;
+ java.util.ArrayList<String> TitleVector = null;
+ java.util.ArrayList<String> NameVector = null;
XInterface xDocInterface = (XInterface) xMSF.createInstance("com.sun.star.document.DocumentProperties");
XDocumentProperties xDocProps = UnoRuntime.queryInterface(XDocumentProperties.class, xDocInterface);
@@ -517,8 +517,8 @@ public class FileAccess
String[] nameList = xSimpleFileAccess.getFolderContents(FolderName, false);
- TitleVector = new java.util.Vector<String>(/*nameList.length*/);
- NameVector = new java.util.Vector<String>(nameList.length);
+ TitleVector = new java.util.ArrayList<String>(/*nameList.length*/);
+ NameVector = new java.util.ArrayList<String>(nameList.length);
FilterName = FilterName == null || FilterName.equals(PropertyNames.EMPTY_STRING) ? null : FilterName + "-";
@@ -531,15 +531,15 @@ public class FileAccess
if (FilterName == null || fileName.startsWith(FilterName))
{
xDocProps.loadFromMedium(nameList[i], noArgs);
- NameVector.addElement(nameList[i]);
- TitleVector.addElement(xDocProps.getTitle());
+ NameVector.add(nameList[i]);
+ TitleVector.add(xDocProps.getTitle());
}
}
String[] LocNameList = new String[NameVector.size()];
String[] LocTitleList = new String[TitleVector.size()];
- NameVector.copyInto(LocNameList);
- TitleVector.copyInto(LocTitleList);
+ NameVector.toArray(LocNameList);
+ TitleVector.toArray(LocTitleList);
LocLayoutFiles[1] = LocNameList;
LocLayoutFiles[0] = LocTitleList;
@@ -598,7 +598,7 @@ public class FileAccess
}
/**
- *
+ *
* @param xMSF
* @param _sStartFilterName
* @param FolderNames
@@ -1050,7 +1050,7 @@ public class FileAccess
}
/**
- * shortens a filename to a user displayable representation.
+ * shortens a filename to a user displayable representation.
* @param path
* @param maxLength
* @return
diff --git a/wizards/com/sun/star/wizards/common/JavaTools.java b/wizards/com/sun/star/wizards/common/JavaTools.java
index 37004bd..5436983 100644
--- a/wizards/com/sun/star/wizards/common/JavaTools.java
+++ b/wizards/com/sun/star/wizards/common/JavaTools.java
@@ -92,11 +92,11 @@ public class JavaTools
/**converts a list of Integer values included in an Integer vector to a list of int values
*
- *
+ *
* @param _aIntegerVector
* @return
*/
- public static int[] IntegerTointList(Vector<Integer> _aIntegerVector)
+ public static int[] IntegerTointList(java.util.List<Integer> _aIntegerVector)
{
try
{
@@ -117,12 +117,12 @@ public class JavaTools
}
/**converts a list of Boolean values included in a Boolean vector to a list of boolean values
- *
- *
+ *
+ *
* @param _aBooleanVector
* @return
*/
- public static boolean[] BooleanTobooleanList(Vector<Boolean> _aBooleanVector)
+ public static boolean[] BooleanTobooleanList(java.util.List<Boolean> _aBooleanVector)
{
try
{
diff --git a/wizards/com/sun/star/wizards/db/TypeInspector.java b/wizards/com/sun/star/wizards/db/TypeInspector.java
index 4c4ea185..a5ae292 100644
--- a/wizards/com/sun/star/wizards/db/TypeInspector.java
+++ b/wizards/com/sun/star/wizards/db/TypeInspector.java
@@ -17,7 +17,7 @@
*/
package com.sun.star.wizards.db;
-import java.util.Vector;
+import java.util.ArrayList;
import com.sun.star.beans.XPropertySet;
import com.sun.star.sdbc.ColumnSearch;
@@ -69,27 +69,27 @@ public class TypeInspector
try
{
xResultSet = _xResultSet;
- Vector<String> aTypeNameVector = new Vector<String>();
- Vector<Integer> aTypeVector = new Vector<Integer>();
- Vector<Integer> aNullableVector = new Vector<Integer>();
- Vector<Boolean> aAutoIncrementVector = new Vector<Boolean>();
- Vector<Integer> aPrecisionVector = new Vector<Integer>();
- Vector<Integer> aMinScaleVector = new Vector<Integer>();
- Vector<Integer> aMaxScaleVector = new Vector<Integer>();
- Vector<Integer> aSearchableVector = new Vector<Integer>();
+ ArrayList<String> aTypeNameVector = new ArrayList<String>();
+ ArrayList<Integer> aTypeVector = new ArrayList<Integer>();
+ ArrayList<Integer> aNullableVector = new ArrayList<Integer>();
+ ArrayList<Boolean> aAutoIncrementVector = new ArrayList<Boolean>();
+ ArrayList<Integer> aPrecisionVector = new ArrayList<Integer>();
+ ArrayList<Integer> aMinScaleVector = new ArrayList<Integer>();
+ ArrayList<Integer> aMaxScaleVector = new ArrayList<Integer>();
+ ArrayList<Integer> aSearchableVector = new ArrayList<Integer>();
// Integer[] aIntegerDataTypes = null;
// XResultSet xResultSet = xDBMetaDagetTypeInfo();
XRow xRow = UnoRuntime.queryInterface(XRow.class, xResultSet);
while (xResultSet.next())
{
- aTypeNameVector.addElement(xRow.getString(1));
- aTypeVector.addElement(new Integer(xRow.getShort(2)));
- aPrecisionVector.addElement(new Integer(xRow.getInt(3)));
- aNullableVector.addElement(new Integer(xRow.getShort(7)));
- aSearchableVector.addElement(new Integer(xRow.getShort(9)));
- aAutoIncrementVector.addElement(Boolean.valueOf(xRow.getBoolean(12)));
- aMinScaleVector.addElement(new Integer(xRow.getShort(14)));
- aMaxScaleVector.addElement(new Integer(xRow.getShort(15)));
+ aTypeNameVector.add(xRow.getString(1));
+ aTypeVector.add(new Integer(xRow.getShort(2)));
+ aPrecisionVector.add(new Integer(xRow.getInt(3)));
+ aNullableVector.add(new Integer(xRow.getShort(7)));
+ aSearchableVector.add(new Integer(xRow.getShort(9)));
+ aAutoIncrementVector.add(Boolean.valueOf(xRow.getBoolean(12)));
+ aMinScaleVector.add(new Integer(xRow.getShort(14)));
+ aMaxScaleVector.add(new Integer(xRow.getShort(15)));
}
sDataTypeNames = new String[aTypeNameVector.size()];
@@ -404,21 +404,21 @@ public class TypeInspector
return (getAutoIncrementIndex(_xColPropertySet) != INVALID);
}
- /** finds the first available DataType that can be used as a primary key in a table.
+ /** finds the first available DataType that can be used as a primary key in a table.
* @return The first datatype that also supports Autoincrmentation is taken according to the following list:
*1) INTEGER
*2) FLOAT
*3) REAL
*4) DOUBLE
*5) NUMERIC
- *6) DECIMAL *
+ *6) DECIMAL *
* If no appropriate datatype is found ther first available numeric type after DataType.INTEGER
* according to the 'convertDataType' method is returned
*/
- /**TODO the fallback order is the same as implemented in the method 'convertDataType'.
+ /**TODO the fallback order is the same as implemented in the method 'convertDataType'.
* It's not very elegant to have the same intelligence
* on several spots in the class!!
- *
+ *
*/
public TypeInfo findAutomaticPrimaryKeyType()
{
diff --git a/wizards/com/sun/star/wizards/ui/FieldSelection.java b/wizards/com/sun/star/wizards/ui/FieldSelection.java
index 7317a90..46845aa 100644
--- a/wizards/com/sun/star/wizards/ui/FieldSelection.java
+++ b/wizards/com/sun/star/wizards/ui/FieldSelection.java
@@ -604,17 +604,17 @@ public class FieldSelection
{
int MaxOriginalCount = AllFieldNames.length;
String[] SelList = xFieldsListBox.getItems();
- Vector<String> NewSourceVector = new Vector<String>();
+ ArrayList<String> NewSourceVector = new ArrayList<String>();
for (int i = 0; i < MaxOriginalCount; i++)
{
SearchString = AllFieldNames[i];
if (JavaTools.FieldInList(SelList, SearchString) != -1)
{
- NewSourceVector.addElement(SearchString);
+ NewSourceVector.add(SearchString);
}
else if (JavaTools.FieldInList(OldSelFieldItems, SearchString) != -1)
{
- NewSourceVector.addElement(SearchString);
+ NewSourceVector.add(SearchString);
}
}
xFieldsListBox.removeItems((short) 0, xFieldsListBox.getItemCount());
commit 587c59fbc931b12f4d63d077a78bcaa43ffbf83d
Author: Noel Grandin <noel at peralex.com>
Date: Fri May 3 14:35:04 2013 +0200
Java cleanup, Convert Vector to ArrayList
Change-Id: I323a6625f93347e69f3114fc10cb04dc759a539f
diff --git a/bean/test/applet/oooapplet/OOoViewer.java b/bean/test/applet/oooapplet/OOoViewer.java
index e09f78e..6ea9270 100644
--- a/bean/test/applet/oooapplet/OOoViewer.java
+++ b/bean/test/applet/oooapplet/OOoViewer.java
@@ -124,7 +124,7 @@ public class OOoViewer extends Applet {
final class CustomURLClassLoader extends URLClassLoader {
- private Vector<URL> resourcePaths;
+ private ArrayList<URL> resourcePaths;
public CustomURLClassLoader( URL[] urls ) {
super( urls );
@@ -163,7 +163,7 @@ final class CustomURLClassLoader extends URLClassLoader {
}
public void addResourcePath(URL rurl) {
- if (resourcePaths == null) resourcePaths = new Vector<URL>();
+ if (resourcePaths == null) resourcePaths = new ArrayList<URL>();
resourcePaths.add(rurl);
}
@@ -175,10 +175,8 @@ final class CustomURLClassLoader extends URLClassLoader {
return result;
}
- URL u = null;
URI uri = null;
- for (Enumeration<URL> e = resourcePaths.elements(); e.hasMoreElements();) {
- u = e.nextElement();
+ for (URL u : resourcePaths) {
if (u.getProtocol().startsWith("file")){
try {
File f1 = new File(u.getPath());
diff --git a/embeddedobj/test/Container1/EmbedContApp.java b/embeddedobj/test/Container1/EmbedContApp.java
index 737267a..89dc27c 100644
--- a/embeddedobj/test/Container1/EmbedContApp.java
+++ b/embeddedobj/test/Container1/EmbedContApp.java
@@ -125,7 +125,6 @@ public class EmbedContApp extends Applet
private String m_aLinkURI;
private Object m_oActionsNumberLock;
- private Vector m_aActionsList;
private Timer m_aTimer;
private boolean m_bDestroyed = false;
diff --git a/forms/qa/complex/forms/CheckOGroupBoxModel.java b/forms/qa/complex/forms/CheckOGroupBoxModel.java
index 33b6c2e..62b97c9 100644
--- a/forms/qa/complex/forms/CheckOGroupBoxModel.java
+++ b/forms/qa/complex/forms/CheckOGroupBoxModel.java
@@ -17,31 +17,35 @@
*/
package complex.forms;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.util.ArrayList;
+
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.openoffice.test.OfficeConnection;
+
+import util.FormTools;
+import util.SOfficeFactory;
+import util.ValueChanger;
+
import com.sun.star.beans.Property;
import com.sun.star.beans.PropertyAttribute;
import com.sun.star.beans.PropertyChangeEvent;
import com.sun.star.beans.XMultiPropertySet;
import com.sun.star.beans.XPropertiesChangeListener;
-import com.sun.star.lang.EventObject;
import com.sun.star.drawing.XControlShape;
+import com.sun.star.lang.EventObject;
import com.sun.star.lang.XComponent;
import com.sun.star.lang.XMultiServiceFactory;
import com.sun.star.uno.UnoRuntime;
-// import complexlib.ComplexTestCase;
import com.sun.star.util.CloseVetoException;
import com.sun.star.util.XCloseable;
-import java.util.Vector;
-import util.FormTools;
-import util.SOfficeFactory;
-import util.ValueChanger;
-
-import org.junit.After;
-import org.junit.AfterClass;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.openoffice.test.OfficeConnection;
-import static org.junit.Assert.*;
+// import complexlib.ComplexTestCase;
/**
*/
@@ -130,7 +134,7 @@ public class CheckOGroupBoxModel
Property[] properties = m_xPropSet.getPropertySetInfo().getProperties();
String[] testPropsNames = null;
- Vector<String> tNames = new Vector<String>();
+ ArrayList<String> tNames = new ArrayList<String>();
for (int i = 0; i < properties.length; i++)
{
diff --git a/forms/qa/integration/forms/ListBox.java b/forms/qa/integration/forms/ListBox.java
index acdfc71..d6c5749 100644
--- a/forms/qa/integration/forms/ListBox.java
+++ b/forms/qa/integration/forms/ListBox.java
@@ -17,6 +17,10 @@
*/
package integration.forms;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Map;
+
import com.sun.star.awt.XListBox;
import com.sun.star.beans.XPropertySet;
import com.sun.star.container.XChild;
@@ -32,13 +36,11 @@ import com.sun.star.sdbc.XParameters;
import com.sun.star.sdbc.XPreparedStatement;
import com.sun.star.uno.Exception;
import com.sun.star.uno.UnoRuntime;
+
import connectivity.tools.HsqlColumnDescriptor;
import connectivity.tools.HsqlDatabase;
import connectivity.tools.HsqlTableDescriptor;
import connectivity.tools.sdb.Connection;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Vector;
public class ListBox extends TestCase
{
@@ -175,10 +177,10 @@ public class ListBox extends TestCase
final String[] keyTypes = fieldDefinitions[0];
final String[] keyCreationArgs = fieldDefinitions[1];
- Vector< HsqlColumnDescriptor > foreignKeyColumns = new Vector< HsqlColumnDescriptor >();
+ ArrayList< HsqlColumnDescriptor > foreignKeyColumns = new ArrayList< HsqlColumnDescriptor >();
foreignKeyColumns.add( new HsqlColumnDescriptor( "ID", "integer", HsqlColumnDescriptor.PRIMARY ) );
- Vector< String[] > foreignKeyValues = new Vector< String[] >();
+ ArrayList< String[] > foreignKeyValues = new ArrayList< String[] >();
StringBuffer foreignKeyInsertSQL = new StringBuffer();
foreignKeyInsertSQL.append( "INSERT INTO \"" + m_foreignKeyTableName + "\" VALUES (?" );
diff --git a/nlpsolver/src/com/sun/star/comp/Calc/NLPSolver/DEPSSolverImpl.java b/nlpsolver/src/com/sun/star/comp/Calc/NLPSolver/DEPSSolverImpl.java
index 6c54926..523ae20 100644
--- a/nlpsolver/src/com/sun/star/comp/Calc/NLPSolver/DEPSSolverImpl.java
+++ b/nlpsolver/src/com/sun/star/comp/Calc/NLPSolver/DEPSSolverImpl.java
@@ -27,22 +27,23 @@
package com.sun.star.comp.Calc.NLPSolver;
-import com.sun.star.comp.Calc.NLPSolver.dialogs.IEvolutionarySolverStatusDialog;
-import com.sun.star.lang.IllegalArgumentException;
-import com.sun.star.uno.XComponentContext;
-import com.sun.star.lib.uno.helper.Factory;
-import com.sun.star.lang.XSingleComponentFactory;
-import com.sun.star.registry.XRegistryKey;
import java.util.logging.Level;
import java.util.logging.Logger;
+
import net.adaptivebox.deps.DEPSAgent;
import net.adaptivebox.deps.behavior.DEGTBehavior;
import net.adaptivebox.deps.behavior.PSGTBehavior;
import net.adaptivebox.global.IUpdateCycleEngine;
-import net.adaptivebox.knowledge.ILibEngine;
import net.adaptivebox.knowledge.Library;
import net.adaptivebox.knowledge.SearchPoint;
+import com.sun.star.comp.Calc.NLPSolver.dialogs.IEvolutionarySolverStatusDialog;
+import com.sun.star.lang.IllegalArgumentException;
+import com.sun.star.lang.XSingleComponentFactory;
+import com.sun.star.lib.uno.helper.Factory;
+import com.sun.star.registry.XRegistryKey;
+import com.sun.star.uno.XComponentContext;
+
public final class DEPSSolverImpl extends BaseEvolutionarySolver
implements com.sun.star.lang.XServiceInfo
diff --git a/odk/examples/DevelopersGuide/Forms/ButtonOperator.java b/odk/examples/DevelopersGuide/Forms/ButtonOperator.java
index a447381..3d12158 100644
--- a/odk/examples/DevelopersGuide/Forms/ButtonOperator.java
+++ b/odk/examples/DevelopersGuide/Forms/ButtonOperator.java
@@ -32,6 +32,8 @@
*
*************************************************************************/
// java base stuff
+import java.util.ArrayList;
+
import com.sun.star.awt.ActionEvent;
import com.sun.star.awt.XActionListener;
import com.sun.star.awt.XButton;
@@ -42,7 +44,6 @@ import com.sun.star.form.runtime.XFormOperations;
import com.sun.star.lang.EventObject;
import com.sun.star.uno.UnoRuntime;
import com.sun.star.uno.XComponentContext;
-import java.util.Vector;
/**************************************************************************/
@@ -55,7 +56,7 @@ public class ButtonOperator implements XActionListener, XFeatureInvalidation
private XPropertySet m_form;
private XFormOperations m_formOperations;
- private Vector<XPropertySet> m_aButtons;
+ private ArrayList<XPropertySet> m_aButtons;
/* ------------------------------------------------------------------ */
/** ctor
@@ -65,7 +66,7 @@ public class ButtonOperator implements XActionListener, XFeatureInvalidation
m_componentContext = xCtx;
m_aDocument = aDocument;
m_form = _form;
- m_aButtons = new Vector<XPropertySet>();
+ m_aButtons = new ArrayList<XPropertySet>();
}
/* ------------------------------------------------------------------ */
@@ -89,7 +90,7 @@ public class ButtonOperator implements XActionListener, XFeatureInvalidation
{
for ( int i=0; i < m_aButtons.size(); ++i )
{
- XPropertySet button = m_aButtons.elementAt( i );
+ XPropertySet button = m_aButtons.get( i );
if ( _formFeature == getAssociatedFormFeature( button ) )
return button;
}
@@ -104,7 +105,7 @@ public class ButtonOperator implements XActionListener, XFeatureInvalidation
int nPos = -1;
for ( int i=0; ( i < m_aButtons.size() ) && ( -1 == nPos ); ++i )
{
- if ( xButton.equals( m_aButtons.elementAt( i ) ) )
+ if ( xButton.equals( m_aButtons.get( i ) ) )
nPos = i;
}
return nPos;
@@ -207,9 +208,8 @@ public class ButtonOperator implements XActionListener, XFeatureInvalidation
public void invalidateAllFeatures() throws com.sun.star.uno.RuntimeException
{
- for ( int i=0; i < m_aButtons.size(); ++i )
+ for ( XPropertySet buttonModel : m_aButtons )
{
- XPropertySet buttonModel = m_aButtons.elementAt( i );
updateButtonState( buttonModel, getAssociatedFormFeature( buttonModel ) );
}
}
diff --git a/odk/examples/DevelopersGuide/Forms/SalesFilter.java b/odk/examples/DevelopersGuide/Forms/SalesFilter.java
index e4c5161..33053db 100644
--- a/odk/examples/DevelopersGuide/Forms/SalesFilter.java
+++ b/odk/examples/DevelopersGuide/Forms/SalesFilter.java
@@ -362,7 +362,7 @@ class SalesFilter implements XActionListener, XPropertyChangeListener, XResetLis
String[] aOldFilterItems = (String[])m_xFilterList.getPropertyValue( "StringItemList" );
// translate this into a vector - much more comfort to work with a vector than with an array ....
- java.util.Vector aFilterItems = new java.util.Vector();
+ java.util.ArrayList aFilterItems = new java.util.ArrayList();
for ( int i=0; i<aOldFilterItems.length; ++i )
aFilterItems.add( aOldFilterItems[i] );
@@ -384,7 +384,7 @@ class SalesFilter implements XActionListener, XPropertyChangeListener, XResetLis
if ( aFilterItems.size() > 10 ) // (6 standard items + 5 user defined items)
{
// the first (and thus oldes) user defined item
- aFilterItems.removeElementAt( 6 );
+ aFilterItems.remove( 6 );
// keep our date vector synchron
m_aFilterDates.removeElementAt( 6 );
}
@@ -397,7 +397,7 @@ class SalesFilter implements XActionListener, XPropertyChangeListener, XResetLis
m_bAdjustingFilterList = true;
String[] aNewFilterItems = new String[ aFilterItems.size() ];
for ( int i=0; i<aFilterItems.size(); ++i )
- aNewFilterItems[i] = (String)aFilterItems.elementAt( i );
+ aNewFilterItems[i] = (String)aFilterItems.get( i );
m_xFilterList.setPropertyValue( "StringItemList", aNewFilterItems );
m_bAdjustingFilterList = false;
diff --git a/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/IOnewayLink.java b/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/IOnewayLink.java
index 180137c..0ab7aa0 100644
--- a/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/IOnewayLink.java
+++ b/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/IOnewayLink.java
@@ -32,7 +32,7 @@
*
*************************************************************************/
-import java.util.Vector;
+import java.util.ArrayList;
// __________ Implementation __________
@@ -64,5 +64,5 @@ public interface IOnewayLink
* Note: Atomic types (e.g. int, long) will be transported as objects
* too (Integer, Long)!
*/
- public abstract void execOneway( int nRequest, Vector<Object> lParams );
+ public abstract void execOneway( int nRequest, ArrayList<Object> lParams );
}
diff --git a/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/Interceptor.java b/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/Interceptor.java
index c9fe4f3..628cc58 100644
--- a/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/Interceptor.java
+++ b/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/Interceptor.java
@@ -34,7 +34,7 @@
// __________ Imports __________
-import java.util.Vector;
+import java.util.ArrayList;
import com.sun.star.frame.FrameActionEvent;
import com.sun.star.uno.UnoRuntime;
@@ -160,7 +160,7 @@ public class Interceptor implements com.sun.star.frame.XFrameActionListener,
* @param lParams
* the vector with all packed parameters of the original request
*/
- public void execOneway(/*IN*/ int nRequest,/*IN*/ Vector<Object> lParams )
+ public void execOneway(/*IN*/ int nRequest,/*IN*/ ArrayList<Object> lParams )
{
synchronized(this)
{
@@ -234,7 +234,7 @@ public class Interceptor implements com.sun.star.frame.XFrameActionListener,
return;
// pack the event and start thread - which call us back later
- Vector<Object> lOutParams = new Vector<Object>();
+ ArrayList<Object> lOutParams = new ArrayList<Object>();
lOutParams.add(aEvent);
OnewayExecutor aExecutor = new OnewayExecutor( this ,
@@ -272,7 +272,7 @@ public class Interceptor implements com.sun.star.frame.XFrameActionListener,
lInURL[0] = aURL ;
lInArguments[0] = lArguments;
- Vector<Object> lOutParams = OnewayExecutor.encodeDispatch(
+ ArrayList<Object> lOutParams = OnewayExecutor.encodeDispatch(
lInURL ,
lInArguments );
OnewayExecutor aExecutor = new OnewayExecutor( this ,
diff --git a/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/OnewayExecutor.java b/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/OnewayExecutor.java
index 0f48ede..2861b23 100644
--- a/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/OnewayExecutor.java
+++ b/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/OnewayExecutor.java
@@ -32,7 +32,7 @@
*
*************************************************************************/
-import java.util.Vector;
+import java.util.ArrayList;
// __________ Implementation __________
@@ -76,7 +76,7 @@ class OnewayExecutor extends Thread
*/
private IOnewayLink m_rLink ;
private int m_nRequest ;
- private Vector<Object> m_lParams ;
+ private ArrayList<Object> m_lParams ;
// _______________________________
@@ -102,7 +102,7 @@ class OnewayExecutor extends Thread
*/
public OnewayExecutor( IOnewayLink rLink ,
int nRequest ,
- Vector<Object> lParams )
+ ArrayList<Object> lParams )
{
m_rLink = rLink ;
m_nRequest = nRequest;
@@ -144,13 +144,13 @@ class OnewayExecutor extends Thread
// _______________________________
- public static Vector<Object> encodeDispatch(
+ public static ArrayList<Object> encodeDispatch(
com.sun.star.util.URL[] aURL,
com.sun.star.beans.PropertyValue[][] lArgs)
{
int nLength = lArgs.length+1;
int nPos = 0;
- Vector<Object> lParams = new Vector<Object>(nLength);
+ ArrayList<Object> lParams = new ArrayList<Object>(nLength);
lParams.add( aURL[0] );
--nLength;
@@ -165,7 +165,7 @@ class OnewayExecutor extends Thread
}
public static void decodeDispatch(
- Vector<Object> lParams,
+ ArrayList<Object> lParams,
com.sun.star.util.URL[] aURL,
com.sun.star.beans.PropertyValue[][] lArgs)
{
@@ -173,12 +173,12 @@ class OnewayExecutor extends Thread
int nPos = 0;
lArgs[0] = new com.sun.star.beans.PropertyValue[nLength];
- aURL[0] = (com.sun.star.util.URL) lParams.elementAt(0);
+ aURL[0] = (com.sun.star.util.URL) lParams.get(0);
while (nPos<nLength)
{
lArgs[0][nPos] = (com.sun.star.beans.PropertyValue)
- (lParams.elementAt(nPos+1));
+ (lParams.get(nPos+1));
++nPos;
}
}
diff --git a/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/StatusListener.java b/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/StatusListener.java
index fd79205..5de834d 100644
--- a/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/StatusListener.java
+++ b/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/StatusListener.java
@@ -35,7 +35,7 @@
// __________ Imports __________
import java.awt.Component;
-import java.util.Vector;
+import java.util.ArrayList;
import javax.swing.JCheckBox;
import javax.swing.JLabel;
@@ -166,7 +166,7 @@ class StatusListener implements com.sun.star.frame.XStatusListener,
* @param lParams
* the vector with all packed parameters of the original request
*/
- public void execOneway(/*IN*/ int nRequest,/*IN*/ Vector<Object> lParams )
+ public void execOneway(/*IN*/ int nRequest,/*IN*/ ArrayList<Object> lParams )
{
synchronized(this)
{
@@ -213,7 +213,7 @@ class StatusListener implements com.sun.star.frame.XStatusListener,
if (! bHandle)
return;
- Vector<Object> lOutParams = new Vector<Object>();
+ ArrayList<Object> lOutParams = new ArrayList<Object>();
lOutParams.add(aEvent);
OnewayExecutor aExecutor = new OnewayExecutor( this ,
diff --git a/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/ViewContainer.java b/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/ViewContainer.java
index c2fbff2..e9f396e 100644
--- a/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/ViewContainer.java
+++ b/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/ViewContainer.java
@@ -74,8 +74,8 @@ public class ViewContainer extends Thread
*/
private ViewContainer()
{
- mlViews = new Vector<Object>();
- mlListener = new Vector<IShutdownListener>();
+ mlViews = new ArrayList<Object>();
+ mlListener = new ArrayList<IShutdownListener>();
mbShutdownActive = false ;
Runtime.getRuntime().addShutdownHook(this);
}
@@ -204,9 +204,8 @@ public class ViewContainer extends Thread
IShutdownListener aListener = null;
synchronized(mlListener)
{
- try{
- aListener = mlListener.firstElement();
- } catch(java.util.NoSuchElementException exEmpty) {}
+ if (!mlListener.isEmpty())
+ aListener = mlListener.get(0);
}
if (aListener==null)
break;
@@ -258,7 +257,7 @@ public class ViewContainer extends Thread
*/
public static boolean mbInplace = false ;
private static ViewContainer maSingleton = null ;
- private Vector<Object> mlViews ;
- private Vector<IShutdownListener> mlListener ;
+ private ArrayList<Object> mlViews ;
+ private ArrayList<IShutdownListener> mlListener ;
private boolean mbShutdownActive ;
}
diff --git a/odk/examples/DevelopersGuide/Spreadsheet/ExampleAddIn.java b/odk/examples/DevelopersGuide/Spreadsheet/ExampleAddIn.java
index 388e489..47cc018 100644
--- a/odk/examples/DevelopersGuide/Spreadsheet/ExampleAddIn.java
+++ b/odk/examples/DevelopersGuide/Spreadsheet/ExampleAddIn.java
@@ -38,7 +38,7 @@ class ExampleAddInResult implements com.sun.star.sheet.XVolatileResult
{
private String aName;
private int nValue;
- private java.util.Vector<XResultListener> aListeners = new java.util.Vector<XResultListener>();
+ private java.util.ArrayList<XResultListener> aListeners = new java.util.ArrayList<XResultListener>();
public ExampleAddInResult( String aNewName )
{
@@ -56,7 +56,7 @@ class ExampleAddInResult implements com.sun.star.sheet.XVolatileResult
public void addResultListener(com.sun.star.sheet.XResultListener aListener)
{
- aListeners.addElement( aListener );
+ aListeners.add( aListener );
// immediately notify of initial value
aListener.modified( getResult() );
@@ -64,7 +64,7 @@ class ExampleAddInResult implements com.sun.star.sheet.XVolatileResult
public void removeResultListener(com.sun.star.sheet.XResultListener aListener)
{
- aListeners.removeElement( aListener );
+ aListeners.remove( aListener );
}
public void incrementValue()
@@ -72,10 +72,8 @@ class ExampleAddInResult implements com.sun.star.sheet.XVolatileResult
++nValue;
com.sun.star.sheet.ResultEvent aEvent = getResult();
- java.util.Enumeration<XResultListener> aEnum = aListeners.elements();
- while (aEnum.hasMoreElements())
- aEnum.nextElement().modified(
- aEvent);
+ for( XResultListener l : aListeners)
+ l.modified(aEvent);
}
}
diff --git a/odk/examples/DevelopersGuide/UCB/ChildrenRetriever.java b/odk/examples/DevelopersGuide/UCB/ChildrenRetriever.java
index 00591ec..03a45ba 100644
... etc. - the rest is truncated
More information about the Libreoffice-commits
mailing list