diff options
author | Noel Grandin <noel@peralex.com> | 2012-06-27 16:08:28 +0200 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2012-06-29 22:03:01 +0200 |
commit | 453d7edc424d6652e209ace4915d96193a79be71 (patch) | |
tree | 0a6af928cf7d1fd90ec995ae7d114f08eaf617fd /qadevOOo/runner | |
parent | b65017a2a7af290f6681da7b197a52efe83d5185 (diff) |
Java5 update - convert more code to use generics:wq
Change-Id: I7ea32cad40a6657e4e5886d04af008cb6d67ac6e
Diffstat (limited to 'qadevOOo/runner')
47 files changed, 159 insertions, 179 deletions
diff --git a/qadevOOo/runner/complexlib/ShowTargets.java b/qadevOOo/runner/complexlib/ShowTargets.java index 3835fc44031d..478d565afc54 100644 --- a/qadevOOo/runner/complexlib/ShowTargets.java +++ b/qadevOOo/runner/complexlib/ShowTargets.java @@ -82,13 +82,13 @@ public class ShowTargets for ( int i=0; i<targets.size(); ++i ) { // target - String target = (String)targets.get(i); + String target = targets.get(i); // 'tab' System.out.print( " " + target ); for ( int s = maxTargetLength - target.length(); s>0; --s ) System.out.print( " " ); // description - System.out.println( " (" + (String)descs.get(i) + ")" ); + System.out.println( " (" + descs.get(i) + ")" ); } } diff --git a/qadevOOo/runner/convwatch/GraphicalDifferenceCheck.java b/qadevOOo/runner/convwatch/GraphicalDifferenceCheck.java index 0aea19d337b4..64d5fa244acf 100644 --- a/qadevOOo/runner/convwatch/GraphicalDifferenceCheck.java +++ b/qadevOOo/runner/convwatch/GraphicalDifferenceCheck.java @@ -306,7 +306,7 @@ public class GraphicalDifferenceCheck private static String getXMLOutputFilterforXComponent(XComponent xComponent, StringBuffer suffix){ - XServiceInfo xSI = (XServiceInfo) UnoRuntime.queryInterface(XServiceInfo.class, xComponent); + XServiceInfo xSI = UnoRuntime.queryInterface(XServiceInfo.class, xComponent); if (xSI.supportsService("com.sun.star.text.TextDocument")){ resetBuffer(suffix, ".sxw"); return "swriter: StarOffice XML (Writer)"; diff --git a/qadevOOo/runner/convwatch/GraphicalTestArguments.java b/qadevOOo/runner/convwatch/GraphicalTestArguments.java index 9f7fde65c437..be1ce9415714 100644 --- a/qadevOOo/runner/convwatch/GraphicalTestArguments.java +++ b/qadevOOo/runner/convwatch/GraphicalTestArguments.java @@ -343,7 +343,7 @@ public class GraphicalTestArguments } if (aObj != null) { - XNameAccess aNameAccess = (XNameAccess)UnoRuntime.queryInterface(XNameAccess.class, aObj); + XNameAccess aNameAccess = UnoRuntime.queryInterface(XNameAccess.class, aObj); if (aNameAccess != null) { diff --git a/qadevOOo/runner/convwatch/IniFile.java b/qadevOOo/runner/convwatch/IniFile.java index d7a831413b50..8b08c8e21601 100644 --- a/qadevOOo/runner/convwatch/IniFile.java +++ b/qadevOOo/runner/convwatch/IniFile.java @@ -308,7 +308,7 @@ class IniFile { String sLine = getItem(i); aWriter.writeBytes(sLine); - aWriter.writeByte((int)'\n'); + aWriter.writeByte('\n'); } aWriter.close(); } diff --git a/qadevOOo/runner/convwatch/MSOfficePrint.java b/qadevOOo/runner/convwatch/MSOfficePrint.java index e9dafbdd4bb3..87fbdd4136c8 100644 --- a/qadevOOo/runner/convwatch/MSOfficePrint.java +++ b/qadevOOo/runner/convwatch/MSOfficePrint.java @@ -249,7 +249,7 @@ public class MSOfficePrint String[] aList = new String[nValues]; for (int i=0;i<nValues;i++) { - String aStr = (String) _aStartCommand.get(i); + String aStr = _aStartCommand.get(i); if (aStr == null) { aStr = ""; diff --git a/qadevOOo/runner/convwatch/ReportDesignerTest.java b/qadevOOo/runner/convwatch/ReportDesignerTest.java index 14a75a91965a..3220fc95004d 100644 --- a/qadevOOo/runner/convwatch/ReportDesignerTest.java +++ b/qadevOOo/runner/convwatch/ReportDesignerTest.java @@ -75,7 +75,7 @@ class PropertySetHelper XPropertySet m_xPropertySet; public PropertySetHelper(Object _aObj) { - m_xPropertySet = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class, _aObj); + m_xPropertySet = UnoRuntime.queryInterface(XPropertySet.class, _aObj); } /** @@ -382,7 +382,7 @@ public class ReportDesignerTest extends ComplexTestCase { assure("can't create instance of com.sun.star.sdb.DatabaseContext", x != null); log.println("createInstance com.sun.star.sdb.DatabaseContext done"); - XNameAccess xNameAccess = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, x); + XNameAccess xNameAccess = UnoRuntime.queryInterface(XNameAccess.class, x); showElements(xNameAccess); Object aObj = xNameAccess.getByName(sFileURL); // log.println("1"); @@ -513,7 +513,7 @@ public class ReportDesignerTest extends ComplexTestCase { private String getFormatExtension(Object _xComponent /* int _nType*/ ) { String sExtension; - XServiceInfo xServiceInfo = (XServiceInfo) UnoRuntime.queryInterface( XServiceInfo.class, _xComponent ); + XServiceInfo xServiceInfo = UnoRuntime.queryInterface( XServiceInfo.class, _xComponent ); if ( xServiceInfo.supportsService( "com.sun.star.sheet.SpreadsheetDocument" ) ) { // calc diff --git a/qadevOOo/runner/convwatch/SimpleFileSemaphore.java b/qadevOOo/runner/convwatch/SimpleFileSemaphore.java index 7d62627064b3..3abb3a1e21e3 100644 --- a/qadevOOo/runner/convwatch/SimpleFileSemaphore.java +++ b/qadevOOo/runner/convwatch/SimpleFileSemaphore.java @@ -100,7 +100,7 @@ public class SimpleFileSemaphore /* extends *//* implements */ try { RandomAccessFile aWriter = new RandomAccessFile(_aSemaphore, "rw"); - aWriter.writeByte((int)1); + aWriter.writeByte(1); aWriter.close(); } diff --git a/qadevOOo/runner/graphical/EnhancedComplexTestCase.java b/qadevOOo/runner/graphical/EnhancedComplexTestCase.java index f3564d3c9473..52c09e7ffb5c 100644 --- a/qadevOOo/runner/graphical/EnhancedComplexTestCase.java +++ b/qadevOOo/runner/graphical/EnhancedComplexTestCase.java @@ -155,7 +155,7 @@ private void callEntry(String _sEntry, ParameterHelper _aParam) IniFile aIniFile = new IniFile(_aParam.getInputPath()); while (aIniFile.hasMoreElements()) { - String sKey = (String)aIniFile.nextElement(); + String sKey = aIniFile.nextElement(); String sPath = FileHelper.getPath(_aParam.getInputPath()); String sEntry = FileHelper.appendPath(sPath, sKey); File aFile = new File(sEntry); @@ -348,7 +348,7 @@ private void callEntry(String _sEntry, ParameterHelper _aParam) IniFile aIniFile = new IniFile(_aParam.getInputPath()); while (aIniFile.hasMoreElements()) { - String sSection = (String)aIniFile.nextElement(); + String sSection = aIniFile.nextElement(); // TODO: not supported yet. // callEveryPictureInIniFile(aIniFile, sSection, _aParam); } diff --git a/qadevOOo/runner/graphical/IniFile.java b/qadevOOo/runner/graphical/IniFile.java index 65303c876f8f..46173e4fb4ed 100644 --- a/qadevOOo/runner/graphical/IniFile.java +++ b/qadevOOo/runner/graphical/IniFile.java @@ -27,7 +27,7 @@ import java.util.Enumeration; Helper class to give a simple API to read/write windows like ini files */ /* public */ // is only need, if we need this class outside package convwatch -public class IniFile implements Enumeration +public class IniFile implements Enumeration<String> { /** @@ -423,10 +423,10 @@ public class IniFile implements Enumeration if (sLine.startsWith("[")) { // write an extra empty line before next section. - aWriter.writeByte((int) '\n'); + aWriter.writeByte('\n'); } aWriter.writeBytes(sLine); - aWriter.writeByte((int) '\n'); + aWriter.writeByte('\n'); } aWriter.close(); } @@ -648,7 +648,7 @@ public class IniFile implements Enumeration * Enumeration Interface * @return a key without the enveloped '[' ']' */ - public Object nextElement() + public String nextElement() { int nLineWithSection = findNextSection(m_aEnumerationPos); if (nLineWithSection != -1) diff --git a/qadevOOo/runner/graphical/MSOfficePostscriptCreator.java b/qadevOOo/runner/graphical/MSOfficePostscriptCreator.java index f4180560855f..bbd73f7eca4c 100644 --- a/qadevOOo/runner/graphical/MSOfficePostscriptCreator.java +++ b/qadevOOo/runner/graphical/MSOfficePostscriptCreator.java @@ -332,7 +332,7 @@ public class MSOfficePostscriptCreator implements IOffice String[] aList = new String[nValues]; for (int i=0;i<nValues;i++) { - String aStr = (String) _aStartCommand.get(i); + String aStr = _aStartCommand.get(i); if (aStr == null) { aStr = ""; diff --git a/qadevOOo/runner/graphical/Office.java b/qadevOOo/runner/graphical/Office.java index 33470cb35ab3..e88ca3498c5f 100644 --- a/qadevOOo/runner/graphical/Office.java +++ b/qadevOOo/runner/graphical/Office.java @@ -93,7 +93,7 @@ public class Office implements IOffice for (int i=0; i<aList.size();i++) { - String sDocumentName = (String)aList.get(i); + String sDocumentName = aList.get(i); m_aOffice.load(sDocumentName); m_aOffice.storeAsPostscript(); diff --git a/qadevOOo/runner/helper/APIDescGetter.java b/qadevOOo/runner/helper/APIDescGetter.java index 7dad332e2908..fb7a12a188c6 100644 --- a/qadevOOo/runner/helper/APIDescGetter.java +++ b/qadevOOo/runner/helper/APIDescGetter.java @@ -22,10 +22,10 @@ import java.io.File; import java.io.FileReader; import java.io.InputStream; import java.io.InputStreamReader; - import java.util.ArrayList; import java.util.Collections; import java.util.StringTokenizer; +import java.util.jar.JarEntry; import share.DescEntry; import share.DescGetter; @@ -576,7 +576,7 @@ public class APIDescGetter extends DescGetter java.util.jar.JarFile f = ((java.net.JarURLConnection) con).getJarFile(); // Enumerate over all entries - java.util.Enumeration e = f.entries(); + java.util.Enumeration<JarEntry> e = f.entries(); String sStartModule = "/" + module + "/"; while (e.hasMoreElements()) @@ -876,7 +876,7 @@ public class APIDescGetter extends DescGetter java.util.jar.JarFile f = ((java.net.JarURLConnection) con).getJarFile(); // Enumerate over all entries - java.util.Enumeration e = f.entries(); + java.util.Enumeration<JarEntry> e = f.entries(); while (e.hasMoreElements()) { @@ -913,7 +913,7 @@ public class APIDescGetter extends DescGetter for (int i = 0; i < scenarioList.size(); i++) { - scenario[i] = (String) scenarioList.get(i); + scenario[i] = scenarioList.get(i); } return scenario; diff --git a/qadevOOo/runner/helper/CfgParser.java b/qadevOOo/runner/helper/CfgParser.java index 880bf737e2d5..f34b4e6fb0a5 100644 --- a/qadevOOo/runner/helper/CfgParser.java +++ b/qadevOOo/runner/helper/CfgParser.java @@ -65,7 +65,7 @@ public class CfgParser if (cfg != null) { - Enumeration cfgEnum = cfg.keys(); + Enumeration<Object> cfgEnum = cfg.keys(); while (cfgEnum.hasMoreElements()) { String pName = (String) cfgEnum.nextElement(); @@ -81,7 +81,7 @@ public class CfgParser if (pName.equals(PropertyName.TEST_DOCUMENT_PATH)) { - param.put("DOCPTH", (String) pValue); + param.put("DOCPTH", pValue); System.setProperty("DOCPTH", (String) pValue); } @@ -104,10 +104,10 @@ public class CfgParser //found something that could be a prefix //check all parameters for this - Iterator keys = param.keySet().iterator(); + Iterator<String> keys = param.keySet().iterator(); while (keys.hasNext()) { - String key = (String) keys.next(); + String key = keys.next(); if (key.startsWith(os)) { Object oldValue = param.get(key); diff --git a/qadevOOo/runner/helper/ConfigHelper.java b/qadevOOo/runner/helper/ConfigHelper.java index b65056ef229a..36c80db2cead 100644 --- a/qadevOOo/runner/helper/ConfigHelper.java +++ b/qadevOOo/runner/helper/ConfigHelper.java @@ -131,7 +131,7 @@ public class ConfigHelper { try { - XPropertySet xPath = (XPropertySet)UnoRuntime.queryInterface( + XPropertySet xPath = UnoRuntime.queryInterface( XPropertySet.class, m_xConfig.getByHierarchicalName(sRelPath)); return xPath.getPropertyValue(sKey); @@ -150,7 +150,7 @@ public class ConfigHelper { try { - XPropertySet xPath = (XPropertySet)UnoRuntime.queryInterface( + XPropertySet xPath = UnoRuntime.queryInterface( XPropertySet.class, m_xConfig.getByHierarchicalName(sRelPath)); xPath.setPropertyValue(sKey, aValue); @@ -234,15 +234,13 @@ public class ConfigHelper } if (xChildAccess == null) { - XSingleServiceFactory xChildfactory = (XSingleServiceFactory) - UnoRuntime.queryInterface(XSingleServiceFactory.class,xSetCont); + XSingleServiceFactory xChildfactory = UnoRuntime.queryInterface(XSingleServiceFactory.class,xSetCont); Object xNewChild = xChildfactory.createInstance(); xSetCont.insertByName(groupName, xNewChild); - xChildAccess = (XNameReplace) - UnoRuntime.queryInterface(XNameContainer.class,xNewChild); + xChildAccess = UnoRuntime.queryInterface(XNameContainer.class,xNewChild); } return xChildAccess; @@ -266,7 +264,7 @@ public class ConfigHelper XPropertySet xProp = null; try { - xProp = (XPropertySet)UnoRuntime.queryInterface( + xProp = UnoRuntime.queryInterface( XPropertySet.class, xSetCont.getByName(groupName)); } catch (com.sun.star.container.NoSuchElementException e){ @@ -320,7 +318,7 @@ public class ConfigHelper try { Object xGroup=xGroupAccess.getByName(extGroup); - xExtGroupCont = (XNameContainer) UnoRuntime.queryInterface( + xExtGroupCont = UnoRuntime.queryInterface( XNameContainer.class,xGroup); } catch(com.sun.star.container.NoSuchElementException e) { throw new com.sun.star.uno.Exception( @@ -357,7 +355,7 @@ public class ConfigHelper throw new com.sun.star.uno.Exception( "could not get set '" + setName + ": null"); - return (XNameContainer) UnoRuntime.queryInterface( + return UnoRuntime.queryInterface( XNameContainer.class, oSet); } diff --git a/qadevOOo/runner/helper/ConfigurationRead.java b/qadevOOo/runner/helper/ConfigurationRead.java index 3940edc5e361..557e1199ff45 100644 --- a/qadevOOo/runner/helper/ConfigurationRead.java +++ b/qadevOOo/runner/helper/ConfigurationRead.java @@ -90,8 +90,7 @@ public class ConfigurationRead { */ public String[] getRootNodeNames() { - XNameAccess xName = (XNameAccess) - UnoRuntime.queryInterface(XNameAccess.class, root); + XNameAccess xName = UnoRuntime.queryInterface(XNameAccess.class, root); String[]names = xName.getElementNames(); return names; } @@ -106,7 +105,7 @@ public class ConfigurationRead { try { Object next = root.getByHierarchicalName(name); - XNameAccess x = (XNameAccess)UnoRuntime.queryInterface( + XNameAccess x = UnoRuntime.queryInterface( XNameAccess.class, next); names = x.getElementNames(); for (int i=0; i< names.length; i++) { diff --git a/qadevOOo/runner/helper/ContextMenuInterceptor.java b/qadevOOo/runner/helper/ContextMenuInterceptor.java index 6d80e1fdbbaf..9f1b250f8878 100644 --- a/qadevOOo/runner/helper/ContextMenuInterceptor.java +++ b/qadevOOo/runner/helper/ContextMenuInterceptor.java @@ -44,17 +44,17 @@ public class ContextMenuInterceptor implements XContextMenuInterceptor { // create root menu entry for sub menu and sub menu XPropertySet xRootMenuEntry = - (XPropertySet)UnoRuntime.queryInterface( - XPropertySet.class, - xMenuElementFactory.createInstance("com.sun.star.ui.ActionTrigger" )); + UnoRuntime.queryInterface( + XPropertySet.class, + xMenuElementFactory.createInstance("com.sun.star.ui.ActionTrigger" )); // create a line separator for our new help sub menu XPropertySet xSeparator = - (XPropertySet)UnoRuntime.queryInterface( - XPropertySet.class, - xMenuElementFactory.createInstance("com.sun.star.ui.ActionTriggerSeparator" ) ); + UnoRuntime.queryInterface( + XPropertySet.class, + xMenuElementFactory.createInstance("com.sun.star.ui.ActionTriggerSeparator" ) ); Short aSeparatorType = new Short( ActionTriggerSeparatorType.LINE ); - xSeparator.setPropertyValue( "SeparatorType", (Object)aSeparatorType ); + xSeparator.setPropertyValue( "SeparatorType", aSeparatorType ); // query sub menu for index container to get access XIndexContainer xSubMenuContainer = @@ -66,12 +66,12 @@ public class ContextMenuInterceptor implements XContextMenuInterceptor { xRootMenuEntry.setPropertyValue( "Text", new String( "Help" )); xRootMenuEntry.setPropertyValue( "CommandURL", new String( "slot:5410" )); xRootMenuEntry.setPropertyValue( "HelpURL", new String( "5410" )); - xRootMenuEntry.setPropertyValue( "SubContainer", (Object)xSubMenuContainer ); + xRootMenuEntry.setPropertyValue( "SubContainer", xSubMenuContainer ); // create menu entries for the new sub menu // intialize help/content menu entry // entry "Content" - XPropertySet xMenuEntry = (XPropertySet)UnoRuntime.queryInterface( + XPropertySet xMenuEntry = UnoRuntime.queryInterface( XPropertySet.class, xMenuElementFactory.createInstance( "com.sun.star.ui.ActionTrigger" )); xMenuEntry.setPropertyValue( "Text", new String( "Content" )); @@ -79,11 +79,11 @@ public class ContextMenuInterceptor implements XContextMenuInterceptor { xMenuEntry.setPropertyValue( "HelpURL", new String( "5401" )); // insert menu entry to sub menu - xSubMenuContainer.insertByIndex( 0, (Object)xMenuEntry ); + xSubMenuContainer.insertByIndex( 0, xMenuEntry ); // intialize help/help agent // entry "Help Agent" - xMenuEntry = (XPropertySet)UnoRuntime.queryInterface( + xMenuEntry = UnoRuntime.queryInterface( XPropertySet.class, xMenuElementFactory.createInstance("com.sun.star.ui.ActionTrigger" )); xMenuEntry.setPropertyValue( "Text", new String( "Help Agent" )); @@ -91,10 +91,10 @@ public class ContextMenuInterceptor implements XContextMenuInterceptor { xMenuEntry.setPropertyValue( "HelpURL", new String( "5962" )); // insert menu entry to sub menu - xSubMenuContainer.insertByIndex( 1, (Object)xMenuEntry ); + xSubMenuContainer.insertByIndex( 1, xMenuEntry ); // intialize help/tips // entry "Tips" - xMenuEntry = (XPropertySet)UnoRuntime.queryInterface( + xMenuEntry = UnoRuntime.queryInterface( XPropertySet.class, xMenuElementFactory.createInstance("com.sun.star.ui.ActionTrigger" )); xMenuEntry.setPropertyValue( "Text", new String( "Tips" )); @@ -102,13 +102,13 @@ public class ContextMenuInterceptor implements XContextMenuInterceptor { xMenuEntry.setPropertyValue( "HelpURL", new String( "5404" )); // insert menu entry to sub menu - xSubMenuContainer.insertByIndex( 2, (Object)xMenuEntry ); + xSubMenuContainer.insertByIndex( 2, xMenuEntry ); // add separator into the given context menu - xContextMenu.insertByIndex( 1, (Object)xSeparator ); + xContextMenu.insertByIndex( 1, xSeparator ); // add new sub menu into the given context menu - xContextMenu.insertByIndex( 1, (Object)xRootMenuEntry ); + xContextMenu.insertByIndex( 1, xRootMenuEntry ); // The controller should execute the modified context menu and stop notifying other // interceptors. diff --git a/qadevOOo/runner/helper/InetTools.java b/qadevOOo/runner/helper/InetTools.java index b4c5a8443239..1ee6622d8281 100644 --- a/qadevOOo/runner/helper/InetTools.java +++ b/qadevOOo/runner/helper/InetTools.java @@ -53,7 +53,7 @@ public class InetTools { "com.sun.star.configuration.ConfigurationUpdateAccess", ProvArgs); - XPropertySet oInetProps = (XPropertySet) UnoRuntime.queryInterface( + XPropertySet oInetProps = UnoRuntime.queryInterface( XPropertySet.class, oInet); String HTTPProxyName = (String)param.get("HTTPProxyName"); diff --git a/qadevOOo/runner/helper/UnoProvider.java b/qadevOOo/runner/helper/UnoProvider.java index e8b444cb9ef3..59ac51edd880 100644 --- a/qadevOOo/runner/helper/UnoProvider.java +++ b/qadevOOo/runner/helper/UnoProvider.java @@ -91,7 +91,7 @@ public class UnoProvider implements AppProvider { if (xMSF == null) { // bootstrap UNO. String unorcName = getUnorcName(param); - Hashtable env = new Hashtable(); + Hashtable<String,String> env = new Hashtable<String,String>(); env.put("SYSBINDIR", getSysBinDir(param)); XComponentContext xContext = null; diff --git a/qadevOOo/runner/lib/MultiPropertyTest.java b/qadevOOo/runner/lib/MultiPropertyTest.java index 03f51fe5e6ce..403f9cb4037f 100644 --- a/qadevOOo/runner/lib/MultiPropertyTest.java +++ b/qadevOOo/runner/lib/MultiPropertyTest.java @@ -74,7 +74,7 @@ public class MultiPropertyTest extends MultiMethodTest */ protected void before() { - XServiceInfo xInfo = (XServiceInfo) UnoRuntime.queryInterface( + XServiceInfo xInfo = UnoRuntime.queryInterface( XServiceInfo.class, oObj); optionalService = entry.isOptional; diff --git a/qadevOOo/runner/lib/Parameters.java b/qadevOOo/runner/lib/Parameters.java index bd24289ded5a..2db421c1142f 100644 --- a/qadevOOo/runner/lib/Parameters.java +++ b/qadevOOo/runner/lib/Parameters.java @@ -45,7 +45,7 @@ public class Parameters implements XPropertySet { final Parameters defaults; Property[] props; - public Parameters(Map params) { + public Parameters(Map<String, Object> params) { this (params, null); } @@ -57,7 +57,7 @@ public class Parameters implements XPropertySet { Set<String> paramSet = new HashSet<String>(parameters.keySet()); if (defaults != null) { - Set defSet = defaults.toMap().keySet(); + Set<String> defSet = defaults.toMap().keySet(); paramSet.addAll(defSet); } @@ -148,14 +148,10 @@ public class Parameters implements XPropertySet { }; } - public Map toMap() { - return new HashMap(parameters) { - public Object get(Object obj) { - if (obj instanceof String) { - return Parameters.this.get((String) obj); - } else { - return null; - } + public Map<String,Object> toMap() { + return new HashMap<String,Object>(parameters) { + public String get(String obj) { + return Parameters.this.get(obj); } }; } diff --git a/qadevOOo/runner/lib/TestParameters.java b/qadevOOo/runner/lib/TestParameters.java index 8849e2816474..3a01fd251794 100644 --- a/qadevOOo/runner/lib/TestParameters.java +++ b/qadevOOo/runner/lib/TestParameters.java @@ -31,7 +31,7 @@ import com.sun.star.uno.XComponentContext; * for example, standard paths, connection strings, etc. The TestParameters * also provides XMultiServiceFactory for the test (tests). */ -public class TestParameters extends HashMap { +public class TestParameters extends HashMap<String,Object> { /** * The ConnectionString for Office Connection<br> @@ -230,13 +230,13 @@ public class TestParameters extends HashMap { /** - * Wraper around "put()" + * Wrapper around "put()" * @param key A key of this table. * @param val The value of the key. * @return The value of this key. * @see java.util.HashMap */ - public Object put(Object key, Object val) { + public Object put(String key, Object val) { return super.put(key,val); } @@ -289,7 +289,7 @@ public class TestParameters extends HashMap { Object context = get( "ComponentContext" ); if ( context == null ) { - XPropertySet factoryProps = (XPropertySet)com.sun.star.uno.UnoRuntime.queryInterface( + XPropertySet factoryProps = com.sun.star.uno.UnoRuntime.queryInterface( XPropertySet.class, getMSF() ); try { diff --git a/qadevOOo/runner/org/openoffice/Runner.java b/qadevOOo/runner/org/openoffice/Runner.java index 17a5e209d2af..7ee8404f2355 100644 --- a/qadevOOo/runner/org/openoffice/Runner.java +++ b/qadevOOo/runner/org/openoffice/Runner.java @@ -131,7 +131,7 @@ public class Runner } Properties aProps = System.getProperties(); - Enumeration aEnum = aProps.propertyNames(); + Enumeration<?> aEnum = aProps.propertyNames(); // Enumeration aEnum = aProps.elements(); // these are only the values boolean bEmergencyStop = false; @@ -154,10 +154,10 @@ public class Runner bEmergencyStop |= checkPathVariable("sun.boot.class.path", sDelim); // ----- check all TestParameters ----- - Iterator aIter = _aParams.keySet().iterator(); + Iterator<String> aIter = _aParams.keySet().iterator(); while (aIter.hasNext()) { - String sKey = (String) aIter.next(); + String sKey = aIter.next(); if (_aParams.get(sKey) instanceof String) { String sValue = (String) _aParams.get(sKey); diff --git a/qadevOOo/runner/org/openoffice/RunnerService.java b/qadevOOo/runner/org/openoffice/RunnerService.java index 8b7489ec50eb..521dff7a30bc 100644 --- a/qadevOOo/runner/org/openoffice/RunnerService.java +++ b/qadevOOo/runner/org/openoffice/RunnerService.java @@ -22,6 +22,7 @@ import helper.CfgParser; import helper.ClParser; import java.util.ArrayList; +import java.util.jar.JarEntry; import lib.TestParameters; import share.LogWriter; @@ -221,7 +222,7 @@ public class RunnerService implements XJob, XServiceInfo, // get Jar file from connection java.util.jar.JarFile f = con.getJarFile(); // Enumerate over all entries - java.util.Enumeration aEnum = f.entries(); + java.util.Enumeration<JarEntry> aEnum = f.entries(); while (aEnum.hasMoreElements()) { String entry = aEnum.nextElement().toString(); diff --git a/qadevOOo/runner/share/DescEntry.java b/qadevOOo/runner/share/DescEntry.java index 12ef1c35dbfd..927715342ad5 100644 --- a/qadevOOo/runner/share/DescEntry.java +++ b/qadevOOo/runner/share/DescEntry.java @@ -83,6 +83,6 @@ public class DescEntry { * Contains an arbitrary set of parameters */ - public java.util.HashMap UserDefinedParams = new java.util.HashMap(); + public java.util.HashMap<String,Object> UserDefinedParams = new java.util.HashMap<String,Object>(); } diff --git a/qadevOOo/runner/stats/ComplexDataBaseOutProducer.java b/qadevOOo/runner/stats/ComplexDataBaseOutProducer.java index a64e6f3cbc35..386ec11ca844 100644 --- a/qadevOOo/runner/stats/ComplexDataBaseOutProducer.java +++ b/qadevOOo/runner/stats/ComplexDataBaseOutProducer.java @@ -30,7 +30,7 @@ import java.util.GregorianCalendar; public class ComplexDataBaseOutProducer extends DataBaseOutProducer { /** Creates a new instance of ComplexDataBaseOutProducer */ - public ComplexDataBaseOutProducer(HashMap param) { + public ComplexDataBaseOutProducer(HashMap<String,String> param) { super(param); // do we have to write debug output? Object o = param.get("DebugIsActive"); diff --git a/qadevOOo/runner/stats/DataBaseOutProducer.java b/qadevOOo/runner/stats/DataBaseOutProducer.java index 08e44d369b66..046440465196 100644 --- a/qadevOOo/runner/stats/DataBaseOutProducer.java +++ b/qadevOOo/runner/stats/DataBaseOutProducer.java @@ -27,7 +27,7 @@ import java.util.HashMap; * @author sg128468 */ public abstract class DataBaseOutProducer implements LogWriter { - protected HashMap mSqlInput = null; + protected HashMap<String,Object> mSqlInput = null; protected HashMap<String, String[]> mSqlOutput = null; protected String[] mWriteableEntryTypes = null; protected SQLExecution mSqlExec; @@ -37,8 +37,8 @@ public abstract class DataBaseOutProducer implements LogWriter { /** Creates a new instance of DataBaseOutProducer * @param param The HashMap with test parameters */ - public DataBaseOutProducer(HashMap param) { - mSqlInput = new HashMap(); + public DataBaseOutProducer(HashMap<String,String> param) { + mSqlInput = new HashMap<String,Object>(); mSqlInput.putAll(param); Object o = param.get("DebugIsActive"); @@ -119,7 +119,7 @@ public abstract class DataBaseOutProducer implements LogWriter { */ protected boolean insertEntry(DescEntry entry, LogWriter log) { // copy the swlInput HashMap, so it can be reset easily for the next run - HashMap copySqlInput = new HashMap(); + HashMap<String,Object> copySqlInput = new HashMap<String,Object>(); copySqlInput.putAll(mSqlInput); // put some stuff from entry in the HashMap mSqlInput.put("EntryLongName", entry.longName); diff --git a/qadevOOo/runner/stats/FatDataBaseOutProducer.java b/qadevOOo/runner/stats/FatDataBaseOutProducer.java index 88981f738247..baa6bb4a4e7a 100644 --- a/qadevOOo/runner/stats/FatDataBaseOutProducer.java +++ b/qadevOOo/runner/stats/FatDataBaseOutProducer.java @@ -31,7 +31,7 @@ public class FatDataBaseOutProducer extends DataBaseOutProducer { /** Creates a new instance of APIDataBaseOutProducer */ - public FatDataBaseOutProducer(HashMap param) { + public FatDataBaseOutProducer(HashMap<String,String> param) { super(param); String testBase = (String)mSqlInput.get("TestBase"); int sep = testBase.indexOf('_'); diff --git a/qadevOOo/runner/stats/FileLogWriter.java b/qadevOOo/runner/stats/FileLogWriter.java index b8e545351ce6..953814f16687 100644 --- a/qadevOOo/runner/stats/FileLogWriter.java +++ b/qadevOOo/runner/stats/FileLogWriter.java @@ -126,7 +126,7 @@ public class FileLogWriter extends PrintWriter implements LogWriter { } public void setWatcher(Object watcher) { - entry.UserDefinedParams.put("Watcher", (share.Watcher) watcher); + entry.UserDefinedParams.put("Watcher", watcher); } } diff --git a/qadevOOo/runner/stats/OutProducerFactory.java b/qadevOOo/runner/stats/OutProducerFactory.java index ffdac13b37a6..b5c95da36b66 100644 --- a/qadevOOo/runner/stats/OutProducerFactory.java +++ b/qadevOOo/runner/stats/OutProducerFactory.java @@ -36,7 +36,7 @@ public class OutProducerFactory { * @param Parameters of the test. * @return The created out producer. */ - public static LogWriter createOutProducer(HashMap param) { + public static LogWriter createOutProducer(HashMap<String,Object> param) { LogWriter dbOut = null; boolean getDatabase = convertToBool(param.get("DataBaseOut")); if (getDatabase) { @@ -65,7 +65,7 @@ public class OutProducerFactory { * @param The test parameters * @return The database out producer, or null if it couldn't be created. */ - public static LogWriter createDataBaseOutProducer(HashMap param) { + public static LogWriter createDataBaseOutProducer(HashMap<String,Object> param) { String dataProducerName = (String)param.get("DataBaseOutProducer"); if (dataProducerName == null) { String testBaseName = (String)param.get("TestBase"); @@ -77,7 +77,7 @@ public class OutProducerFactory { LogWriter dbOut = null; try { dbOut = (LogWriter)dcl.getInstance(dataProducerName, - new Class[]{new HashMap().getClass()}, new Object[]{param}); + new Class[]{HashMap.class}, new Object[]{param}); } catch(IllegalArgumentException e) { e.printStackTrace(); diff --git a/qadevOOo/runner/stats/SQLExecution.java b/qadevOOo/runner/stats/SQLExecution.java index 21d0cbeecf86..3253415bd490 100644 --- a/qadevOOo/runner/stats/SQLExecution.java +++ b/qadevOOo/runner/stats/SQLExecution.java @@ -125,7 +125,7 @@ public class SQLExecution { * @param sqlOutput The results of the command are put in this HashMap. * @return True, if no error occurred. */ - public boolean executeSQLCommand(String command, HashMap sqlInput, HashMap<String, String[]> sqlOutput) + public boolean executeSQLCommand(String command, HashMap<String,Object> sqlInput, HashMap<String, String[]> sqlOutput) throws IllegalArgumentException { return executeSQLCommand(command, sqlInput, sqlOutput, false); } @@ -139,7 +139,7 @@ public class SQLExecution { * sqlInput HashMap. * @return True, if no error occurred. */ - public boolean executeSQLCommand(String command, HashMap sqlInput, HashMap<String, String[]> sqlOutput, boolean mergeOutputIntoInput) + public boolean executeSQLCommand(String command, HashMap<String,Object> sqlInput, HashMap<String, String[]> sqlOutput, boolean mergeOutputIntoInput) throws IllegalArgumentException { if (sqlOutput == null) { sqlOutput = new HashMap<String, String[]>(); @@ -193,11 +193,11 @@ public class SQLExecution { // add the values if (addNewVals && i!=0) { // all values until now were of type String, not String[], so now new values have to be added. - sqlCommand.add(i, (String)sqlCommand.get(0) + " " + pre + value + post); + sqlCommand.add(i, sqlCommand.get(0) + " " + pre + value + post); } else { // we already have vals.length commands (or are at the first command), so just add. - sqlCommand.set(i, (String)sqlCommand.get(i) + " " + pre + value + post); + sqlCommand.set(i, sqlCommand.get(i) + " " + pre + value + post); } } } @@ -205,7 +205,7 @@ public class SQLExecution { // value is a String: no other possibility String value = checkForQuotationMarks((String)sqlInput.get(key)); for (int i=0; i<sqlCommand.size(); i++) { - sqlCommand.set(i, (String)sqlCommand.get(i) + " " + pre + value + post); + sqlCommand.set(i, sqlCommand.get(i) + " " + pre + value + post); } } } @@ -218,7 +218,7 @@ public class SQLExecution { else { // token is not a key, just add it for (int i=0; i<sqlCommand.size(); i++) - sqlCommand.set(i, (String)sqlCommand.get(i) + " " + originalKey); + sqlCommand.set(i, sqlCommand.get(i) + " " + originalKey); if (originalKey.equalsIgnoreCase("update") || originalKey.equalsIgnoreCase("delete") || originalKey.equalsIgnoreCase("insert")) { @@ -228,7 +228,7 @@ public class SQLExecution { } } for (int i=0;i<sqlCommand.size(); i++) { - execute((String)sqlCommand.get(i), sqlOutput, update); + execute(sqlCommand.get(i), sqlOutput, update); // merge output with input if (!update && mergeOutputIntoInput) { Iterator<String> keys = sqlOutput.keySet().iterator(); diff --git a/qadevOOo/runner/stats/SimpleLogWriter.java b/qadevOOo/runner/stats/SimpleLogWriter.java index 043cf342cb54..3d3164373fbf 100644 --- a/qadevOOo/runner/stats/SimpleLogWriter.java +++ b/qadevOOo/runner/stats/SimpleLogWriter.java @@ -96,7 +96,7 @@ public class SimpleLogWriter extends PrintWriter implements LogWriter { { if (watcher != null) { - entry.UserDefinedParams.put("Watcher", (share.Watcher) watcher); + entry.UserDefinedParams.put("Watcher", watcher); } } } diff --git a/qadevOOo/runner/util/BasicMacroTools.java b/qadevOOo/runner/util/BasicMacroTools.java index 313ed1b0f565..ffb4538254d6 100644 --- a/qadevOOo/runner/util/BasicMacroTools.java +++ b/qadevOOo/runner/util/BasicMacroTools.java @@ -55,7 +55,7 @@ public class BasicMacroTools { Object DocLibCont = null; try { - XPropertySet xDocProps = (XPropertySet) UnoRuntime.queryInterface( + XPropertySet xDocProps = UnoRuntime.queryInterface( XPropertySet.class, xDoc); DocLibCont = xDocProps.getPropertyValue("BasicLibraries"); } catch (com.sun.star.uno.Exception e) { @@ -63,7 +63,7 @@ public class BasicMacroTools { "Couldn't get BasicLibraries-Container from document: " + e.toString()); } - mLCxNA = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, + mLCxNA = UnoRuntime.queryInterface(XNameAccess.class, DocLibCont); mLCxLC = UnoRuntime.queryInterface( @@ -95,7 +95,7 @@ public class BasicMacroTools { "Couldn't create ApplicationScriptLibraryContainer" + e.toString()); } - mLCxNA = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, + mLCxNA = UnoRuntime.queryInterface(XNameAccess.class, ASLC); mLCxLC = UnoRuntime.queryInterface( @@ -237,10 +237,10 @@ public class BasicMacroTools { "com.sun.star.configuration.ConfigurationUpdateAccess", ProvArgs); - XPropertySet oSecureProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, oSecure); + XPropertySet oSecureProps = UnoRuntime.queryInterface(XPropertySet.class, oSecure); Object oScripting = oSecureProps.getPropertyValue("Scripting"); - XPropertySet oScriptingSettings = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, oScripting); + XPropertySet oScriptingSettings = UnoRuntime.queryInterface(XPropertySet.class, oScripting); oScriptingSettings.setPropertyValue("SecureURL", new String[]{secureURL}); oScriptingSettings.setPropertyValue("OfficeBasic", new Integer(2)); diff --git a/qadevOOo/runner/util/DBTools.java b/qadevOOo/runner/util/DBTools.java index 30c1b230548f..98e699cef28b 100644 --- a/qadevOOo/runner/util/DBTools.java +++ b/qadevOOo/runner/util/DBTools.java @@ -166,8 +166,7 @@ public class DBTools { * class fields. */ public DataSourceInfo(Object dataSource) { - XPropertySet xProps = (XPropertySet) - UnoRuntime.queryInterface(XPropertySet.class, dataSource) ; + XPropertySet xProps = UnoRuntime.queryInterface(XPropertySet.class, dataSource) ; try { Name = (String)xProps.getPropertyValue("Name") ; @@ -244,7 +243,7 @@ public class DBTools { { Object src = src = xMSF.createInstance("com.sun.star.sdb.DataSource") ; - XPropertySet props = (XPropertySet) UnoRuntime.queryInterface + XPropertySet props = UnoRuntime.queryInterface (XPropertySet.class, src) ; if (Name != null) props.setPropertyValue("Name", Name) ; @@ -340,8 +339,7 @@ public class DBTools { XInterface newSource = (XInterface) xMSF.createInstance ("com.sun.star.sdb.DataSource") ; - XPropertySet xSrcProp = (XPropertySet) - UnoRuntime.queryInterface(XPropertySet.class, newSource); + XPropertySet xSrcProp = UnoRuntime.queryInterface(XPropertySet.class, newSource); xSrcProp.setPropertyValue("URL", "sdbc:text:" + dirToUrl(dbDir)); @@ -383,8 +381,7 @@ public class DBTools { XInterface newSource = (XInterface) xMSF.createInstance ("com.sun.star.sdb.DataSource") ; - XPropertySet xSrcProp = (XPropertySet) - UnoRuntime.queryInterface(XPropertySet.class, newSource); + XPropertySet xSrcProp = UnoRuntime.queryInterface(XPropertySet.class, newSource); xSrcProp.setPropertyValue("URL", "sdbc:dbase:" + dirToUrl(dbDir)); dbContext.registerObject(contextName, newSource) ; @@ -444,14 +441,14 @@ public class DBTools { String existURL = null ; - XNameAccess na = (XNameAccess) UnoRuntime.queryInterface + XNameAccess na = UnoRuntime.queryInterface (XNameAccess.class, dbContext) ; Object src = null ; if (na.hasByName("APITestDatabase")) { src = dbContext.getRegisteredObject("APITestDatabase") ; - XPropertySet srcPs = (XPropertySet) UnoRuntime.queryInterface + XPropertySet srcPs = UnoRuntime.queryInterface (XPropertySet.class, src) ; existURL = (String) srcPs.getPropertyValue("URL") ; diff --git a/qadevOOo/runner/util/DesktopTools.java b/qadevOOo/runner/util/DesktopTools.java index e24037f6c622..791052ffa768 100644 --- a/qadevOOo/runner/util/DesktopTools.java +++ b/qadevOOo/runner/util/DesktopTools.java @@ -181,7 +181,7 @@ public class DesktopTools */ public static String getDocumentType(XComponent xComponent) { - XServiceInfo sInfo = (XServiceInfo) UnoRuntime.queryInterface( + XServiceInfo sInfo = UnoRuntime.queryInterface( XServiceInfo.class, xComponent); if (sInfo == null) @@ -413,7 +413,7 @@ public class DesktopTools XViewSettingsSupplier oVSSupp = UnoRuntime.queryInterface(XViewSettingsSupplier.class, oCont); XInterface oViewSettings = oVSSupp.getViewSettings(); - XPropertySet oViewProp = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, oViewSettings); + XPropertySet oViewProp = UnoRuntime.queryInterface(XPropertySet.class, oViewSettings); oViewProp.setPropertyValue("ZoomType", new Short(com.sun.star.view.DocumentZoomType.ENTIRE_PAGE)); diff --git a/qadevOOo/runner/util/FormTools.java b/qadevOOo/runner/util/FormTools.java index 7bafd75047df..032fe7eff2b0 100644 --- a/qadevOOo/runner/util/FormTools.java +++ b/qadevOOo/runner/util/FormTools.java @@ -70,8 +70,7 @@ public class FormTools { try{ Object oInt = oDocMSF.createInstance("com.sun.star.drawing.ControlShape"); Object aCon = oDocMSF.createInstance("com.sun.star.form.component."+kind); - XPropertySet model_props = (XPropertySet) - UnoRuntime.queryInterface(XPropertySet.class,aCon); + XPropertySet model_props = UnoRuntime.queryInterface(XPropertySet.class,aCon); model_props.setPropertyValue("DefaultControl","com.sun.star.form.control."+kind); aControl = UnoRuntime.queryInterface( XControlModel.class, aCon ); oCShape = UnoRuntime.queryInterface( XControlShape.class, oInt ); @@ -105,8 +104,7 @@ public class FormTools { try{ Object oInt = oDocMSF.createInstance("com.sun.star.drawing.ControlShape"); Object aCon = oDocMSF.createInstance("com.sun.star.form.component."+kind); - XPropertySet model_props = (XPropertySet) - UnoRuntime.queryInterface(XPropertySet.class,aCon); + XPropertySet model_props = UnoRuntime.queryInterface(XPropertySet.class,aCon); model_props.setPropertyValue("DefaultControl","com.sun.star.awt."+defControl); aControl = UnoRuntime.queryInterface( XControlModel.class, aCon ); oCShape = UnoRuntime.queryInterface( XControlShape.class, oInt ); @@ -198,7 +196,7 @@ public class FormTools { String aName ) { try { XInterface oControl = createControl(aDoc, "Form"); - XForm oForm = (XForm) UnoRuntime.queryInterface(XForm.class, oControl); + XForm oForm = UnoRuntime.queryInterface(XForm.class, oControl); Forms.insertByName(aName,oForm); } catch ( Exception e ) { throw new IllegalArgumentException( "Couldn't insert Form" ); @@ -225,7 +223,7 @@ public class FormTools { } catch (com.sun.star.lang.IllegalArgumentException iae) { System.out.println("### Couldn't convert Any"); } - XPropertySet formProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, the_form); + XPropertySet formProps = UnoRuntime.queryInterface(XPropertySet.class, the_form); formProps.setPropertyValue("DataSourceName","Bibliography"); formProps.setPropertyValue("Command","biblio"); formProps.setPropertyValue("CommandType",new Integer(com.sun.star.sdb.CommandType.TABLE)); @@ -254,7 +252,7 @@ public class FormTools { XForm the_form = (XForm) AnyConverter.toObject(new Type(XForm.class), FormTools.getIndexedForms(WriterTools.getDrawPage(aDoc)).getByIndex(0)); - XPropertySet formProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, the_form); + XPropertySet formProps = UnoRuntime.queryInterface(XPropertySet.class, the_form); formProps.setPropertyValue("DataSourceName",sourceName); formProps.setPropertyValue("Command",tableName); formProps.setPropertyValue("CommandType",new Integer(com.sun.star.sdb.CommandType.TABLE)); @@ -267,7 +265,7 @@ public class FormTools { try { XForm the_form = (XForm) FormTools.getForms(WriterTools.getDrawPage(aDoc)).getByName(formName); - XPropertySet formProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, the_form); + XPropertySet formProps = UnoRuntime.queryInterface(XPropertySet.class, the_form); formProps.setPropertyValue("DataSourceName","Bibliography"); formProps.setPropertyValue("Command","biblio"); formProps.setPropertyValue("CommandType",new Integer(com.sun.star.sdb.CommandType.TABLE)); @@ -297,7 +295,7 @@ public class FormTools { XForm the_form = (XForm) AnyConverter.toObject(new Type(XForm.class), FormTools.getForms(WriterTools.getDrawPage(aDoc)).getByName(formName)); - XPropertySet formProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, the_form); + XPropertySet formProps = UnoRuntime.queryInterface(XPropertySet.class, the_form); formProps.setPropertyValue("DataSourceName",sourceName); formProps.setPropertyValue("Command",tableName); formProps.setPropertyValue("CommandType",new Integer(com.sun.star.sdb.CommandType.TABLE)); @@ -322,7 +320,7 @@ public class FormTools { atrans.parseStrict(aURLA); aURL = aURLA[0]; - com.sun.star.frame.XDispatch aDisp = (com.sun.star.frame.XDispatch)aDispProv.queryDispatch(aURL, "", + com.sun.star.frame.XDispatch aDisp = aDispProv.queryDispatch(aURL, "", com.sun.star.frame.FrameSearchFlag.SELF | com.sun.star.frame.FrameSearchFlag.CHILDREN); diff --git a/qadevOOo/runner/util/FrameDsc.java b/qadevOOo/runner/util/FrameDsc.java index e5448afa651c..e1c8fc7b0dd4 100644 --- a/qadevOOo/runner/util/FrameDsc.java +++ b/qadevOOo/runner/util/FrameDsc.java @@ -94,8 +94,7 @@ public class FrameDsc extends InstDescr { XTextFrame TF = (XTextFrame)UnoRuntime.queryInterface( ifcClass, SrvObj ); - XPropertySet oPropSet = (XPropertySet) - UnoRuntime.queryInterface( XPropertySet.class, SrvObj ); + XPropertySet oPropSet = UnoRuntime.queryInterface( XPropertySet.class, SrvObj ); try { diff --git a/qadevOOo/runner/util/SOfficeFactory.java b/qadevOOo/runner/util/SOfficeFactory.java index 327b271c946c..df8b0ddfcf64 100644 --- a/qadevOOo/runner/util/SOfficeFactory.java +++ b/qadevOOo/runner/util/SOfficeFactory.java @@ -386,7 +386,7 @@ public class SOfficeFactory { Object oInt = oDocMSF.createInstance( "com.sun.star.sheet.Spreadsheet"); - XSpreadsheet oSpreadsheet = (XSpreadsheet) UnoRuntime.queryInterface(XSpreadsheet.class, oInt); + XSpreadsheet oSpreadsheet = UnoRuntime.queryInterface(XSpreadsheet.class, oInt); return oSpreadsheet; } @@ -402,7 +402,7 @@ public class SOfficeFactory { } public static String getUniqueName(XInterface oInterface, String prefix) { - XNameAccess oNameAccess = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, oInterface); + XNameAccess oNameAccess = UnoRuntime.queryInterface(XNameAccess.class, oInterface); if (oNameAccess == null) { return null; } @@ -473,7 +473,7 @@ public class SOfficeFactory { XMultiServiceFactory oDocMSF = UnoRuntime.queryInterface(XMultiServiceFactory.class, oDoc); try { - oInstance = (Object) oDocMSF.createInstance(kind); + oInstance = oDocMSF.createInstance(kind); } catch (Exception e) { // Some exception occures.FAILED System.out.println("Couldn't create instance " + kind + ": " + e); @@ -609,7 +609,7 @@ public class SOfficeFactory { // query for XServiceInfo public Object queryXServiceInfo(Object oObj) { if (oObj != null) { - XServiceInfo oInfo = (XServiceInfo) UnoRuntime.queryInterface( + XServiceInfo oInfo = UnoRuntime.queryInterface( XServiceInfo.class, oObj); System.out.println("!!!! XServiceInfo n.a. !!!! "); } else { diff --git a/qadevOOo/runner/util/SysUtils.java b/qadevOOo/runner/util/SysUtils.java index 78abc9502883..68166bb3e3bf 100644 --- a/qadevOOo/runner/util/SysUtils.java +++ b/qadevOOo/runner/util/SysUtils.java @@ -33,9 +33,9 @@ import com.sun.star.datatransfer.*; public class SysUtils { public static String getJavaPath() { - String cp = (String) System.getProperty("java.class.path"); - String jh = (String) System.getProperty("java.home"); - String fs = (String) System.getProperty("file.separator"); + String cp = System.getProperty("java.class.path"); + String jh = System.getProperty("java.home"); + String fs = System.getProperty("file.separator"); jh = jh + fs + "bin" + fs; jh = jh + "java -classpath "+cp; return jh; diff --git a/qadevOOo/runner/util/UITools.java b/qadevOOo/runner/util/UITools.java index bb35f80fd87e..779d1a861831 100644 --- a/qadevOOo/runner/util/UITools.java +++ b/qadevOOo/runner/util/UITools.java @@ -353,8 +353,7 @@ public class UITools { XAccessible xChild = xList.getAccessibleChild(i); XAccessibleContext xChildCont = xChild.getAccessibleContext(); - XInterface xChildInterface = (XInterface) - UnoRuntime.queryInterface(XInterface.class, xChildCont); + XInterface xChildInterface = UnoRuntime.queryInterface(XInterface.class, xChildCont); Items.add(xChildInterface); } catch (com.sun.star.lang.IndexOutOfBoundsException e) { @@ -416,8 +415,7 @@ public class UITools { XAccessible xChild = xList.getAccessibleChild(i); XAccessibleContext xChildCont = xChild.getAccessibleContext(); - XInterface xChildInterface = (XInterface) - UnoRuntime.queryInterface(XInterface.class, xChildCont); + XInterface xChildInterface = UnoRuntime.queryInterface(XInterface.class, xChildCont); Items.add(getString(xChildInterface)); } catch (com.sun.star.lang.IndexOutOfBoundsException e) { @@ -468,7 +466,7 @@ public class UITools { try{ XInterface xNumericField =mAT.getAccessibleObjectForRole( mXRoot, AccessibleRole.TEXT, NumericFieldName); - return (String) getString(xNumericField); + return getString(xNumericField); } catch (Exception e) { throw new Exception("Could get value from NumericField '" @@ -563,8 +561,7 @@ public class UITools { XAccessible xChild = xFrame.getAccessibleChild(i); XAccessibleContext xChildCont = xChild.getAccessibleContext(); - XInterface xChildInterface = (XInterface) - UnoRuntime.queryInterface(XInterface.class, xChildCont); + XInterface xChildInterface = UnoRuntime.queryInterface(XInterface.class, xChildCont); TextFieldText += (getString(xChildInterface)); } catch (com.sun.star.lang.IndexOutOfBoundsException e) { @@ -639,8 +636,7 @@ public class UITools { XAccessibleContext xMessage =mAT.getAccessibleObjectForRole(mXRoot, AccessibleRole.LABEL); - XInterface xMessageInterface = (XInterface) - UnoRuntime.queryInterface(XInterface.class, xMessage); + XInterface xMessageInterface = UnoRuntime.queryInterface(XInterface.class, xMessage); cMessage += (getString(xMessageInterface)); diff --git a/qadevOOo/runner/util/ValueChanger.java b/qadevOOo/runner/util/ValueChanger.java index 00c86ff4138e..6e18ee84c4a5 100644 --- a/qadevOOo/runner/util/ValueChanger.java +++ b/qadevOOo/runner/util/ValueChanger.java @@ -965,7 +965,7 @@ public class ValueChanger { private static boolean isStructure(Object val) { boolean result = true ; - Class clazz = val.getClass() ; + Class<?> clazz = val.getClass() ; Method[] meth = clazz.getDeclaredMethods() ; for (int i = 0; i < meth.length; i++) { diff --git a/qadevOOo/runner/util/ValueComparer.java b/qadevOOo/runner/util/ValueComparer.java index 3ce1719156d5..d4535bc6fde7 100644 --- a/qadevOOo/runner/util/ValueComparer.java +++ b/qadevOOo/runner/util/ValueComparer.java @@ -98,7 +98,7 @@ public class ValueComparer { if((op1.getClass().getComponentType() == op2.getClass().getComponentType()) && (Array.getLength(op1) == Array.getLength(op2))) { - Class zClass = op1.getClass().getComponentType(); + Class<?> zClass = op1.getClass().getComponentType(); for(int i = 0; i < Array.getLength(op1); ++ i) result = result & compareObjects(Array.get(op1, i), Array.get(op2, i)); @@ -113,11 +113,11 @@ public class ValueComparer { return op1 == op2; } - static boolean compareUntil(Class zClass, Class untilClass, Object op1, Object op2) throws Exception { + static boolean compareUntil(Class<?> zClass, Class<?> untilClass, Object op1, Object op2) throws Exception { boolean result = true; // write inherited members first - Class superClass = zClass.getSuperclass(); + Class<?> superClass = zClass.getSuperclass(); if(superClass != null && superClass != untilClass) result = result & compareUntil(superClass, untilClass, op1, op2); @@ -245,7 +245,7 @@ public class ValueComparer { compareEnums((Enum)op1, (Enum)op2); else if(op1.getClass() == String.class && op2.getClass() == String.class) // is it a String ? - result = ((String)op1).equals((String)op2); + result = ((String)op1).equals(op2); else // otherwise it must be a struct result = compareStructs(op1, op2); diff --git a/qadevOOo/runner/util/WaitUnreachable.java b/qadevOOo/runner/util/WaitUnreachable.java index 33e383be95de..56046397e123 100644 --- a/qadevOOo/runner/util/WaitUnreachable.java +++ b/qadevOOo/runner/util/WaitUnreachable.java @@ -47,7 +47,7 @@ public final class WaitUnreachable { */ public WaitUnreachable(Object obj) { this.obj = obj; - queue = new ReferenceQueue(); + queue = new ReferenceQueue<Object>(); ref = new PhantomReference<Object>(obj, queue); } @@ -113,6 +113,6 @@ public final class WaitUnreachable { } private Object obj; - private final ReferenceQueue queue; + private final ReferenceQueue<Object> queue; private final PhantomReference<Object> ref; } diff --git a/qadevOOo/runner/util/WriterTools.java b/qadevOOo/runner/util/WriterTools.java index 7b6b0cc8d18b..164bdf52e4c9 100644 --- a/qadevOOo/runner/util/WriterTools.java +++ b/qadevOOo/runner/util/WriterTools.java @@ -69,7 +69,7 @@ public class WriterTools { try { XDrawPageSupplier oDPS = UnoRuntime.queryInterface( XDrawPageSupplier.class, aDoc); - oDP = (XDrawPage) oDPS.getDrawPage(); + oDP = oDPS.getDrawPage(); } catch (Exception e) { throw new IllegalArgumentException("Couldn't get drawpage"); } @@ -82,7 +82,7 @@ public class WriterTools { int vpos, int width, int height, String pic, String name) { try { - Object oGObject = (XInterface) xMSF.createInstance( + Object oGObject = xMSF.createInstance( "com.sun.star.text.GraphicObject"); XText the_text = aDoc.getText(); @@ -91,7 +91,7 @@ public class WriterTools { XTextContent.class, oGObject); the_text.insertTextContent(the_cursor, the_content, true); - XPropertySet oProps = (XPropertySet) UnoRuntime.queryInterface( + XPropertySet oProps = UnoRuntime.queryInterface( XPropertySet.class, oGObject); String fullURL = util.utils.getFullTestURL(pic); diff --git a/qadevOOo/runner/util/XMLTools.java b/qadevOOo/runner/util/XMLTools.java index bfaa6b53f405..2e53cc993be6 100644 --- a/qadevOOo/runner/util/XMLTools.java +++ b/qadevOOo/runner/util/XMLTools.java @@ -20,10 +20,10 @@ package util; import java.io.PrintWriter; import java.util.ArrayList; -import java.util.Enumeration; +import java.util.HashMap; import java.util.HashSet; import java.util.Hashtable; -import java.util.Vector; +import java.util.Iterator; import com.sun.star.beans.PropertyValue; import com.sun.star.document.XExporter; @@ -369,8 +369,8 @@ public class XMLTools { * appropriate message is output. */ public static class XMLTagsChecker extends XMLWellFormChecker { - protected Hashtable tags = new Hashtable() ; - protected Hashtable chars = new Hashtable() ; + protected HashMap<String,String> tags = new HashMap<String,String>() ; + protected HashMap<String,String> chars = new HashMap<String,String>() ; protected boolean allOK = true ; public XMLTagsChecker(PrintWriter log) { @@ -407,7 +407,7 @@ public class XMLTools { public void startElement(String name, XAttributeList attrs) { super.startElement(name, attrs) ; if (tags.containsKey(name)) { - String outerTag = (String) tags.get(name); + String outerTag = tags.get(name); if (!outerTag.equals("")) { boolean isInTag = false ; for (int i = 0; i < tagStack.size(); i++) { @@ -430,7 +430,7 @@ public class XMLTools { super.characters(ch) ; if (chars.containsKey(ch)) { - String outerTag = (String) chars.get(ch); + String outerTag = chars.get(ch); if (!outerTag.equals("")) { boolean isInTag = false ; for (int i = 0; i < tagStack.size(); i++) { @@ -456,21 +456,21 @@ public class XMLTools { public boolean checkTags() { allOK &= isWellFormed() ; - Enumeration<String> badTags = tags.keys() ; - Enumeration<String> badChars = chars.keys() ; + Iterator<String> badTags = tags.keySet().iterator() ; + Iterator<String> badChars = chars.keySet().iterator() ; - if (badTags.hasMoreElements()) { + if (badTags.hasNext()) { allOK = false ; log.println("Required tags were not found in export :") ; - while(badTags.hasMoreElements()) { - log.println(" <" + badTags.nextElement() + ">") ; + while(badTags.hasNext()) { + log.println(" <" + badTags.next() + ">") ; } } - if (badChars.hasMoreElements()) { + if (badChars.hasNext()) { allOK = false ; log.println("Required characters were not found in export :") ; - while(badChars.hasMoreElements()) { - log.println(" <" + badChars.nextElement() + ">") ; + while(badChars.hasNext()) { + log.println(" <" + badChars.next() + ">") ; } } reset(); @@ -772,8 +772,7 @@ public class XMLTools { XActiveDataSource xADS = UnoRuntime.queryInterface(XActiveDataSource.class,Writer); xADS.setOutputStream(xPipeOutput); - XDocumentHandler handler = (XDocumentHandler) - UnoRuntime.queryInterface(XDocumentHandler.class,Writer); + XDocumentHandler handler = UnoRuntime.queryInterface(XDocumentHandler.class,Writer); Any arg = new Any(new Type(XDocumentHandler.class),handler); @@ -817,7 +816,7 @@ public class XMLTools { XInterface oWriter = (XInterface)xMSF.createInstance( "com.sun.star.xml.sax.Writer"); XActiveDataSource xWriterDS = UnoRuntime.queryInterface(XActiveDataSource.class, oWriter); - XDocumentHandler xDocHandWriter = (XDocumentHandler) UnoRuntime.queryInterface + XDocumentHandler xDocHandWriter = UnoRuntime.queryInterface (XDocumentHandler.class, oWriter) ; if (xFacc.exists(fileURL)) @@ -919,7 +918,7 @@ public class XMLTools { "com.sun.star.comp." + docType + ".XML" + importType + "Importer"); XImporter xImp = UnoRuntime.queryInterface (XImporter.class, oImp) ; - XDocumentHandler xDocHandImp = (XDocumentHandler) UnoRuntime.queryInterface + XDocumentHandler xDocHandImp = UnoRuntime.queryInterface (XDocumentHandler.class, oImp) ; xImp.setTargetDocument(xDoc) ; diff --git a/qadevOOo/runner/util/db/DataSource.java b/qadevOOo/runner/util/db/DataSource.java index 4c612fb08969..e92f81a19168 100644 --- a/qadevOOo/runner/util/db/DataSource.java +++ b/qadevOOo/runner/util/db/DataSource.java @@ -47,7 +47,7 @@ public class DataSource { m_dataSource = UnoRuntime.queryInterface( XDataSource.class, m_orb.createInstance( "com.sun.star.sdb.DataSource" ) ); - m_properties = (XPropertySet)UnoRuntime.queryInterface( XPropertySet.class, + m_properties = UnoRuntime.queryInterface( XPropertySet.class, m_dataSource ); Object[] descriptorProperties = new Object[] { diff --git a/qadevOOo/runner/util/dbg.java b/qadevOOo/runner/util/dbg.java index 95abe526a9a3..a97d6b12b4c2 100644 --- a/qadevOOo/runner/util/dbg.java +++ b/qadevOOo/runner/util/dbg.java @@ -77,8 +77,7 @@ public class dbg { */ public static Type[] getInterfaceTypes(XInterface xTarget) { Type[] types = null; - XTypeProvider xTypeProvider = (XTypeProvider) - UnoRuntime.queryInterface( XTypeProvider.class, xTarget); + XTypeProvider xTypeProvider = UnoRuntime.queryInterface( XTypeProvider.class, xTarget); if( xTypeProvider != null ) types = xTypeProvider.getTypes(); return types; @@ -116,7 +115,7 @@ public class dbg { */ public static void printInterfaceInfo(Type aType) { try { - Class zClass = aType.getZClass(); + Class<?> zClass = aType.getZClass(); Method[] methods = zClass.getDeclaredMethods(); for (int i=0; i<methods.length; i++) { System.out.println("\t" + methods[i].getReturnType().getName() @@ -297,8 +296,7 @@ public class dbg { * @param aObject A UNO object. */ public static void getSuppServices (Object aObject) { - XServiceInfo xSI = (XServiceInfo) - UnoRuntime.queryInterface(XServiceInfo.class,aObject); + XServiceInfo xSI = UnoRuntime.queryInterface(XServiceInfo.class,aObject); printArray(xSI.getSupportedServiceNames()); String str="Therein not Supported Service"; boolean notSupportedServices = false; @@ -319,8 +317,7 @@ public class dbg { */ public static String getImplID( XInterface xTarget ) { String str = ""; - XTypeProvider xTypeProvider = (XTypeProvider) - UnoRuntime.queryInterface( XTypeProvider.class, xTarget); + XTypeProvider xTypeProvider = UnoRuntime.queryInterface( XTypeProvider.class, xTarget); if( xTypeProvider != null ) { byte[] id = xTypeProvider.getImplementationId(); str = "ImplementationID: "; diff --git a/qadevOOo/runner/util/utils.java b/qadevOOo/runner/util/utils.java index 65c2f8da97cc..c584db16eaa0 100644 --- a/qadevOOo/runner/util/utils.java +++ b/qadevOOo/runner/util/utils.java @@ -262,7 +262,7 @@ public class utils { // get a folder wich is located in the user dir try { - userPath = (String) getOfficeSettingsValue(msf, "UserConfig"); + userPath = getOfficeSettingsValue(msf, "UserConfig"); } catch (Exception e) { System.out.println("Couldn't get Office User Path"); e.printStackTrace(); @@ -605,7 +605,7 @@ public class utils { public static String getImplName(Object aObject) { String res = "Error getting Implementation name"; try { - XServiceInfo xSI = (XServiceInfo) UnoRuntime.queryInterface(XServiceInfo.class, aObject); + XServiceInfo xSI = UnoRuntime.queryInterface(XServiceInfo.class, aObject); res = xSI.getImplementationName(); } catch (Exception e) { res = "Error getting Implementation name ( " + e + " )"; @@ -693,7 +693,7 @@ public class utils { public static String getOfficeURL(XMultiServiceFactory msf) { try { Object settings = msf.createInstance("com.sun.star.util.PathSettings"); - XPropertySet settingProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, settings); + XPropertySet settingProps = UnoRuntime.queryInterface(XPropertySet.class, settings); String path = (String) settingProps.getPropertyValue("Module"); return path; } catch (Exception e) { @@ -896,8 +896,8 @@ public class utils { */ public static String expandMacro(XMultiServiceFactory xMSF, String expand) throws java.lang.Exception { try { - XPropertySet xPS = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xMSF); - XComponentContext xContext = (XComponentContext) UnoRuntime.queryInterface(XComponentContext.class, + XPropertySet xPS = UnoRuntime.queryInterface(XPropertySet.class, xMSF); + XComponentContext xContext = UnoRuntime.queryInterface(XComponentContext.class, xPS.getPropertyValue("DefaultContext")); XMacroExpander xME = UnoRuntime.queryInterface(XMacroExpander.class, xContext.getValueByName("/singletons/com.sun.star.util.theMacroExpander")); |