diff options
author | Noel Grandin <noel@peralex.com> | 2012-06-27 15:40:17 +0200 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2012-06-29 22:03:01 +0200 |
commit | b65017a2a7af290f6681da7b197a52efe83d5185 (patch) | |
tree | 06f71a435ba200d044109469b13be7c8f5dbe950 /qadevOOo/runner | |
parent | 33ec740d1438c3dddf8e1974757ed05bb76425ca (diff) |
Java5 update - usage generics where possible
Change-Id: I12f8c448961919e153047e28fee2a0acf3af1002
Diffstat (limited to 'qadevOOo/runner')
66 files changed, 372 insertions, 413 deletions
diff --git a/qadevOOo/runner/base/java_fat.java b/qadevOOo/runner/base/java_fat.java index d80167fa268d..d3864d997be9 100644 --- a/qadevOOo/runner/base/java_fat.java +++ b/qadevOOo/runner/base/java_fat.java @@ -65,7 +65,7 @@ public class java_fat implements TestBase DescGetter dg = new APIDescGetter(); String job = (String) m_aParams.get("TestJob"); String ExclusionFile = (String) m_aParams.get("ExclusionList"); - ArrayList exclusions = null; + ArrayList<String> exclusions = null; boolean retValue = true; m_isDebug = m_aParams.getBool("DebugIsActive"); logging = m_aParams.getBool("LoggingIsActive"); @@ -494,9 +494,9 @@ public class java_fat implements TestBase // } // } - private ArrayList getExclusionList(String url, boolean debug) + private ArrayList<String> getExclusionList(String url, boolean debug) { - ArrayList entryList = new ArrayList(); + ArrayList<String> entryList = new ArrayList<String>(); String line = "#"; BufferedReader exclusion = null; diff --git a/qadevOOo/runner/complexlib/Assurance.java b/qadevOOo/runner/complexlib/Assurance.java index a980f12bb4ae..2fa05585e907 100644 --- a/qadevOOo/runner/complexlib/Assurance.java +++ b/qadevOOo/runner/complexlib/Assurance.java @@ -260,9 +260,9 @@ public class Assurance * it means that <em>no</em> exception must be throw by invoking the method. */ protected void assureException( final String _message, final Object _object, final String _methodName, - final Class[] _argClasses, final Object[] _methodArgs, final Class _expectedExceptionClass ) + final Class<?>[] _argClasses, final Object[] _methodArgs, final Class<?> _expectedExceptionClass ) { - Class objectClass = _object.getClass(); + Class<?> objectClass = _object.getClass(); boolean noExceptionAllowed = ( _expectedExceptionClass == null ); @@ -296,9 +296,9 @@ public class Assurance * it means that <em>no</em> exception must be throw by invoking the method. */ protected void assureException( final String _message, final Object _object, final String _methodName, - final Object[] _methodArgs, final Class _expectedExceptionClass ) + final Object[] _methodArgs, final Class<?> _expectedExceptionClass ) { - Class[] argClasses = new Class[ _methodArgs.length ]; + Class<?>[] argClasses = new Class[ _methodArgs.length ]; for ( int i=0; i<_methodArgs.length; ++i ) argClasses[i] = _methodArgs[i].getClass(); assureException( _message, _object, _methodName, argClasses, _methodArgs, _expectedExceptionClass ); @@ -313,7 +313,7 @@ public class Assurance * it means that <em>no</em> exception must be throw by invoking the method. */ protected void assureException( final Object _object, final String _methodName, final Object[] _methodArgs, - final Class _expectedExceptionClass ) + final Class<?> _expectedExceptionClass ) { assureException( "did not catch the expected exception (" + @@ -330,8 +330,8 @@ public class Assurance * @param _expectedExceptionClass 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. */ - protected void assureException( final Object _object, final String _methodName, final Class[] _argClasses, - final Object[] _methodArgs, final Class _expectedExceptionClass ) + protected void assureException( final Object _object, final String _methodName, final Class<?>[] _argClasses, + final Object[] _methodArgs, final Class<?> _expectedExceptionClass ) { assureException( "did not catch the expected exception (" + diff --git a/qadevOOo/runner/complexlib/ShowTargets.java b/qadevOOo/runner/complexlib/ShowTargets.java index 335614c0d2e4..3835fc44031d 100644 --- a/qadevOOo/runner/complexlib/ShowTargets.java +++ b/qadevOOo/runner/complexlib/ShowTargets.java @@ -33,8 +33,8 @@ public class ShowTargets public static void main( String[] args ) { - ArrayList targets = new ArrayList(); - ArrayList descs = new ArrayList(); + ArrayList<String> targets = new ArrayList<String>(); + ArrayList<String> descs = new ArrayList<String>(); targets.add( "run" ); descs.add( "runs all complex tests in this module" ); @@ -52,7 +52,7 @@ public class ShowTargets continue; // get the class - Class potentialTestClass = null; + Class<?> potentialTestClass = null; try { potentialTestClass = Class.forName( completePotentialClassName ); } catch( java.lang.ClassNotFoundException e ) { @@ -60,7 +60,7 @@ public class ShowTargets } // see if it is derived from complexlib.ComplexTestCase - Class superClass = potentialTestClass.getSuperclass(); + Class<?> superClass = potentialTestClass.getSuperclass(); while ( superClass != null ) { if ( superClass.getName().equals( "complexlib.ComplexTestCase" ) ) @@ -94,7 +94,7 @@ public class ShowTargets /** determines if the test denoted by a given Class is an interactive test */ - static private boolean isInteractiveTest( Class testClass ) + static private boolean isInteractiveTest( Class<?> testClass ) { java.lang.reflect.Method interactiveTestMethod = null; try { interactiveTestMethod = testClass.getMethod( "isInteractiveTest", new Class[]{} ); } @@ -112,7 +112,7 @@ public class ShowTargets return false; } - static private String getShortTestDescription( Class _testClass ) + static private String getShortTestDescription( Class<?> _testClass ) { java.lang.reflect.Method getShortDescriptionMethod = null; try { getShortDescriptionMethod = _testClass.getMethod( "getShortTestDescription", new Class[]{} ); } diff --git a/qadevOOo/runner/convwatch/BorderRemover.java b/qadevOOo/runner/convwatch/BorderRemover.java index 473f84902c7c..e9a81c93bcb6 100644 --- a/qadevOOo/runner/convwatch/BorderRemover.java +++ b/qadevOOo/runner/convwatch/BorderRemover.java @@ -154,7 +154,7 @@ class BorderRemover Exception ex = null; try { - Class imageIOClass = Class.forName("javax.imageio.ImageIO"); + Class<?> imageIOClass = Class.forName("javax.imageio.ImageIO"); // GlobalLogWriter.get().println("Hello World: get Class"); Method getWriterMIMETypesMethod = imageIOClass.getDeclaredMethod("getWriterMIMETypes", new Class[]{ }); diff --git a/qadevOOo/runner/convwatch/ConvWatchStarter.java b/qadevOOo/runner/convwatch/ConvWatchStarter.java index b9fd3ea66b92..f5034bd12be8 100644 --- a/qadevOOo/runner/convwatch/ConvWatchStarter.java +++ b/qadevOOo/runner/convwatch/ConvWatchStarter.java @@ -149,9 +149,9 @@ public class ConvWatchStarter extends EnhancedComplexTestCase * * @return a List of software which must accessable as an external executable */ - protected Object[] mustInstalledSoftware() + protected String[] mustInstalledSoftware() { - ArrayList aList = new ArrayList(); + ArrayList<String> aList = new ArrayList<String>(); // Tools from ImageMagick if (! OSHelper.isWindows()) { @@ -170,7 +170,7 @@ public class ConvWatchStarter extends EnhancedComplexTestCase aList.add( "gswin32c.exe -version" ); } - return aList.toArray(); + return aList.toArray(new String[aList.size()]); } diff --git a/qadevOOo/runner/convwatch/DB.java b/qadevOOo/runner/convwatch/DB.java index 97ff3fd05559..57d831c0b7a7 100644 --- a/qadevOOo/runner/convwatch/DB.java +++ b/qadevOOo/runner/convwatch/DB.java @@ -254,11 +254,11 @@ public class DB extends DBHelper System.out.println("UUID: " + sUUID); } - public ArrayList QuerySQL(Connection _aCon, String _sSQL) + public ArrayList<String> QuerySQL(Connection _aCon, String _sSQL) { java.sql.Statement oStmt = null; Connection oCon = null; - ArrayList aResultList = new ArrayList(); + ArrayList<String> aResultList = new ArrayList<String>(); try { oStmt = _aCon.createStatement(); @@ -418,11 +418,11 @@ public class DB extends DBHelper Connection aCon = new ShareConnection().getConnection(); String sSQL = "SELECT uuid()"; - ArrayList aResultList = QuerySQL(aCon, sSQL); + ArrayList<String> aResultList = QuerySQL(aCon, sSQL); for (int i=0;i<aResultList.size();i++) { - String sResult = (String)aResultList.get(i); + String sResult = aResultList.get(i); StringTokenizer aTokenizer = new StringTokenizer(sResult,",",false); while (aTokenizer.hasMoreTokens()) diff --git a/qadevOOo/runner/convwatch/DirectoryHelper.java b/qadevOOo/runner/convwatch/DirectoryHelper.java index 94992bf739a8..c48ec41fea09 100644 --- a/qadevOOo/runner/convwatch/DirectoryHelper.java +++ b/qadevOOo/runner/convwatch/DirectoryHelper.java @@ -29,7 +29,7 @@ import java.util.ArrayList; */ public class DirectoryHelper { - ArrayList m_aFileList = new ArrayList(); + ArrayList<String> m_aFileList = new ArrayList<String>(); boolean m_bRecursiveIsAllowed = true; void setRecursiveIsAllowed(boolean _bValue) diff --git a/qadevOOo/runner/convwatch/DocumentConverter.java b/qadevOOo/runner/convwatch/DocumentConverter.java index 941fcdf703f1..fce3456b57a8 100644 --- a/qadevOOo/runner/convwatch/DocumentConverter.java +++ b/qadevOOo/runner/convwatch/DocumentConverter.java @@ -131,11 +131,11 @@ public class DocumentConverter extends EnhancedComplexTestCase /** * Function returns a List of software which must accessable as an external executable */ - protected Object[] mustInstalledSoftware() + protected String[] mustInstalledSoftware() { - ArrayList aList = new ArrayList(); + ArrayList<String> aList = new ArrayList<String>(); // aList.add("perl -version"); - return aList.toArray(); + return aList.toArray(new String[aList.size()]); } // the test ====================================================================== diff --git a/qadevOOo/runner/convwatch/GfxCompare.java b/qadevOOo/runner/convwatch/GfxCompare.java index 8d705dd0864f..44f766eeb602 100644 --- a/qadevOOo/runner/convwatch/GfxCompare.java +++ b/qadevOOo/runner/convwatch/GfxCompare.java @@ -53,16 +53,16 @@ public class GfxCompare extends EnhancedComplexTestCase * * @return a List of software which must accessable as an external executable */ - protected Object[] mustInstalledSoftware() + protected String[] mustInstalledSoftware() { - ArrayList aList = new ArrayList(); + ArrayList<String> aList = new ArrayList<String>(); // Tools from ImageMagick aList.add( "composite -version" ); aList.add( "identify -version" ); // Ghostscript aList.add( "gs -version" ); - return aList.toArray(); + return aList.toArray(new String[aList.size()]); } diff --git a/qadevOOo/runner/convwatch/GraphicalDifferenceCheck.java b/qadevOOo/runner/convwatch/GraphicalDifferenceCheck.java index e1e10537a05c..0aea19d337b4 100644 --- a/qadevOOo/runner/convwatch/GraphicalDifferenceCheck.java +++ b/qadevOOo/runner/convwatch/GraphicalDifferenceCheck.java @@ -280,7 +280,7 @@ public class GraphicalDifferenceCheck String resultURL = URLHelper.getFileURLFromSystemPath(ensureEndingFileSep(_sOutputPath) + resultDocName); XStorable xStorable = null; - xStorable = (com.sun.star.frame.XStorable)UnoRuntime.queryInterface(com.sun.star.frame.XStorable.class, xComponent); + xStorable = UnoRuntime.queryInterface(com.sun.star.frame.XStorable.class, xComponent); if(xStorable == null) { throw new ConvWatchCancelException("com.sun.star.frame.XStorable could not be instantiated from the office."); diff --git a/qadevOOo/runner/convwatch/ImageHelper.java b/qadevOOo/runner/convwatch/ImageHelper.java index 7754893f5d9d..1114a8d6aea8 100644 --- a/qadevOOo/runner/convwatch/ImageHelper.java +++ b/qadevOOo/runner/convwatch/ImageHelper.java @@ -76,7 +76,7 @@ class ImageHelper File aFile = new File(_sFilename); Exception ex = null; try { - Class imageIOClass = Class.forName("javax.imageio.ImageIO"); + Class<?> imageIOClass = Class.forName("javax.imageio.ImageIO"); Method readMethod = imageIOClass.getDeclaredMethod("read", new Class[]{java.io.File.class}); Object retValue = readMethod.invoke(imageIOClass, new Object[]{aFile}); aImage = (Image)retValue; diff --git a/qadevOOo/runner/convwatch/IniFile.java b/qadevOOo/runner/convwatch/IniFile.java index 83d82e62ca32..d7a831413b50 100644 --- a/qadevOOo/runner/convwatch/IniFile.java +++ b/qadevOOo/runner/convwatch/IniFile.java @@ -33,7 +33,7 @@ class IniFile * Problem, if ini file changed why other write something difference, we don't realise this. */ String m_sFilename; - ArrayList m_aList; + ArrayList<String> m_aList; boolean m_bListContainUnsavedChanges = false; /** @@ -47,10 +47,10 @@ class IniFile m_aList = loadLines(); } - ArrayList loadLines() + ArrayList<String> loadLines() { File aFile = new File(m_sFilename); - ArrayList aLines = new ArrayList(); + ArrayList<String> aLines = new ArrayList<String>(); if (! aFile.exists()) { GlobalLogWriter.get().println("couldn't find file " + m_sFilename); @@ -120,7 +120,7 @@ class IniFile String getItem(int i) { - return (String)m_aList.get(i); + return m_aList.get(i); } String buildSectionName(String _sSectionName) diff --git a/qadevOOo/runner/convwatch/MSOfficePrint.java b/qadevOOo/runner/convwatch/MSOfficePrint.java index 2023f6071ef6..e9dafbdd4bb3 100644 --- a/qadevOOo/runner/convwatch/MSOfficePrint.java +++ b/qadevOOo/runner/convwatch/MSOfficePrint.java @@ -37,7 +37,7 @@ import helper.OSHelper; class ProcessHelper { - ArrayList m_aArray; + ArrayList<String> m_aArray; } public class MSOfficePrint @@ -105,7 +105,7 @@ public class MSOfficePrint { String sDocumentSuffix = FileHelper.getSuffix(_sInputFile); String sFilterName = _aGTA.getExportFilterName(); - ArrayList aStartCommand = new ArrayList(); + ArrayList<String> aStartCommand = new ArrayList<String>(); if (isWordDocument(sDocumentSuffix)) { aStartCommand = createWordStoreHelper(); @@ -166,7 +166,7 @@ public class MSOfficePrint setPrinterName(_aGTA.getPrinterName()); - ArrayList aStartCommand = new ArrayList(); + ArrayList<String> aStartCommand = new ArrayList<String>(); if (isWordDocument(sDocumentSuffix)) { aStartCommand = createWordPrintHelper(); @@ -235,7 +235,7 @@ public class MSOfficePrint TimeHelper.waitInSeconds(2, "Give Microsoft Office some time to print."); } - public void realStartCommand(ArrayList _aStartCommand) throws ConvWatchCancelException + public void realStartCommand(ArrayList<String> _aStartCommand) throws ConvWatchCancelException { if (_aStartCommand.isEmpty()) { @@ -281,7 +281,7 @@ public class MSOfficePrint } - ArrayList createWordPrintHelper() throws java.io.IOException + ArrayList<String> createWordPrintHelper() throws java.io.IOException { // create a program in tmp file String sTmpPath = util.utils.getUsersTempDir(); @@ -290,7 +290,7 @@ public class MSOfficePrint String sPrintViaWord = "printViaWord.pl"; - ArrayList aList = searchLocalFile(sPrintViaWord); + ArrayList<String> aList = searchLocalFile(sPrintViaWord); if (aList.isEmpty() == false) { return aList; @@ -386,12 +386,12 @@ public class MSOfficePrint // TODO: Maybe give a possibility to say where search the script from outside - ArrayList searchLocalFile(String _sScriptName) + ArrayList<String> searchLocalFile(String _sScriptName) { String userdir = System.getProperty("user.dir"); String fs = System.getProperty("file.separator"); - ArrayList aList = new ArrayList(); + ArrayList<String> aList = new ArrayList<String>(); File aPerlScript = new File(userdir + fs + _sScriptName); if (FileHelper.isDebugEnabled()) { @@ -415,7 +415,7 @@ public class MSOfficePrint return aList; } - ArrayList createWordStoreHelper() throws java.io.IOException + ArrayList<String> createWordStoreHelper() throws java.io.IOException { // create a program in tmp file String sTmpPath = util.utils.getUsersTempDir(); @@ -425,7 +425,7 @@ public class MSOfficePrint // ArrayList aList = new ArrayList(); String sSaveViaWord = "saveViaWord.pl"; - ArrayList aList = searchLocalFile(sSaveViaWord); + ArrayList<String> aList = searchLocalFile(sSaveViaWord); if (aList.isEmpty() == false) { return aList; @@ -498,7 +498,7 @@ public class MSOfficePrint } - ArrayList createExcelPrintHelper() throws java.io.IOException + ArrayList<String> createExcelPrintHelper() throws java.io.IOException { // create a program in tmp file String sTmpPath = util.utils.getUsersTempDir(); @@ -507,7 +507,7 @@ public class MSOfficePrint String sPrintViaExcel = "printViaExcel.pl"; - ArrayList aList = searchLocalFile(sPrintViaExcel); + ArrayList<String> aList = searchLocalFile(sPrintViaExcel); if (aList.isEmpty() == false) { return aList; @@ -596,7 +596,7 @@ public class MSOfficePrint return aList; } - ArrayList createExcelStoreHelper() throws java.io.IOException + ArrayList<String> createExcelStoreHelper() throws java.io.IOException { // create a program in tmp file String sTmpPath = util.utils.getUsersTempDir(); @@ -605,7 +605,7 @@ public class MSOfficePrint String sSaveViaExcel = "saveViaExcel.pl"; - ArrayList aList = searchLocalFile(sSaveViaExcel); + ArrayList<String> aList = searchLocalFile(sSaveViaExcel); if (aList.isEmpty() == false) { return aList; @@ -686,7 +686,7 @@ public class MSOfficePrint return aList; } - ArrayList createPowerPointPrintHelper() throws java.io.IOException + ArrayList<String> createPowerPointPrintHelper() throws java.io.IOException { // create a program in tmp file String sTmpPath = util.utils.getUsersTempDir(); @@ -695,7 +695,7 @@ public class MSOfficePrint String sPrintViaPowerPoint = "printViaPowerPoint.pl"; - ArrayList aList = searchLocalFile(sPrintViaPowerPoint); + ArrayList<String> aList = searchLocalFile(sPrintViaPowerPoint); if (aList.isEmpty() == false) { return aList; diff --git a/qadevOOo/runner/convwatch/PRNCompare.java b/qadevOOo/runner/convwatch/PRNCompare.java index e5f2f7a0ba90..5c0602eff25c 100644 --- a/qadevOOo/runner/convwatch/PRNCompare.java +++ b/qadevOOo/runner/convwatch/PRNCompare.java @@ -256,7 +256,7 @@ public class PRNCompare // TODO: return a real filename, due to the fact we don't know how much files are created, maybe better to return a list - ArrayList m_aFileList = new ArrayList(); + ArrayList<String> m_aFileList = new ArrayList<String>(); for (int i=1;i<9999;i++) { String sNewJPEGFilename = utils.replaceAll13(sJPGFilename, sGS_PageOutput, StringHelper.createValueString(i, 4)); @@ -270,7 +270,7 @@ public class PRNCompare } } String[] aList = new String[m_aFileList.size()]; - aList = (String[])m_aFileList.toArray(aList); + aList = m_aFileList.toArray(aList); return aList; // sNewJPEGFilename; } diff --git a/qadevOOo/runner/convwatch/ReferenceBuilder.java b/qadevOOo/runner/convwatch/ReferenceBuilder.java index f41797ed759c..d3cf71afc5e3 100644 --- a/qadevOOo/runner/convwatch/ReferenceBuilder.java +++ b/qadevOOo/runner/convwatch/ReferenceBuilder.java @@ -131,11 +131,9 @@ public class ReferenceBuilder extends EnhancedComplexTestCase /** * Function returns a List of software which must accessable as an external executable */ - protected Object[] mustInstalledSoftware() + protected String[] mustInstalledSoftware() { - ArrayList aList = new ArrayList(); - aList.add("perl -version"); - return aList.toArray(); + return new String[] { "perl -version" }; } // the test ====================================================================== diff --git a/qadevOOo/runner/convwatch/ReportDesignerTest.java b/qadevOOo/runner/convwatch/ReportDesignerTest.java index f6fdb9295c9d..14a75a91965a 100644 --- a/qadevOOo/runner/convwatch/ReportDesignerTest.java +++ b/qadevOOo/runner/convwatch/ReportDesignerTest.java @@ -115,7 +115,7 @@ class PropertyHelper @param _aArrayList @return a PropertyValue[] */ - public static PropertyValue[] createPropertyValueArrayFormArrayList(ArrayList _aPropertyList) + public static PropertyValue[] createPropertyValueArrayFormArrayList(ArrayList<PropertyValue> _aPropertyList) { // copy the whole PropertyValue List to an PropertyValue Array PropertyValue[] aSaveProperties = null; @@ -131,7 +131,7 @@ class PropertyHelper aSaveProperties = new PropertyValue[_aPropertyList.size()]; for (int i = 0;i<_aPropertyList.size(); i++) { - aSaveProperties[i] = (PropertyValue) _aPropertyList.get(i); + aSaveProperties[i] = _aPropertyList.get(i); } } else @@ -199,7 +199,7 @@ public class ReportDesignerTest extends ComplexTestCase { try { XInterface xInterface = (XInterface) m_xXMultiServiceFactory.createInstance( "com.sun.star.frame.Desktop" ); - m_xDesktop = (XDesktop) UnoRuntime.queryInterface(XDesktop.class, xInterface); + m_xDesktop = UnoRuntime.queryInterface(XDesktop.class, xInterface); } catch (com.sun.star.uno.Exception e) { @@ -388,7 +388,7 @@ public class ReportDesignerTest extends ComplexTestCase { // log.println("1"); // PropertySetHelper aHelper = new PropertySetHelper(aObj); - XDocumentDataSource xDataSource = (XDocumentDataSource)UnoRuntime.queryInterface(XDocumentDataSource.class, aObj); + XDocumentDataSource xDataSource = UnoRuntime.queryInterface(XDocumentDataSource.class, aObj); // Object aDatabaseDocmuent = aHelper.getPropertyValueAsObject("DatabaseDocument"); XOfficeDatabaseDocument xOfficeDBDoc = xDataSource.getDatabaseDocument(); @@ -396,12 +396,12 @@ public class ReportDesignerTest extends ComplexTestCase { assure("can't access DatabaseDocument", xOfficeDBDoc != null); // log.println("2"); - XModel xDBSource = (XModel)UnoRuntime.queryInterface(XModel.class, xOfficeDBDoc); + XModel xDBSource = UnoRuntime.queryInterface(XModel.class, xOfficeDBDoc); Object aController = xDBSource.getCurrentController(); assure("Controller of xOfficeDatabaseDocument is empty!", aController != null); // log.println("3"); - XDatabaseDocumentUI aDBDocUI = (XDatabaseDocumentUI)UnoRuntime.queryInterface(XDatabaseDocumentUI.class, aController); + XDatabaseDocumentUI aDBDocUI = UnoRuntime.queryInterface(XDatabaseDocumentUI.class, aController); aDBDocUI.connect(); // if (aDBDocUI.isConnected()) // { @@ -420,14 +420,14 @@ public class ReportDesignerTest extends ComplexTestCase { assure("ActiveConnection is empty", aActiveConnectionObj != null); // log.println("5"); - XReportDocumentsSupplier xSupplier = (XReportDocumentsSupplier)UnoRuntime.queryInterface(XReportDocumentsSupplier.class, xOfficeDBDoc); + XReportDocumentsSupplier xSupplier = UnoRuntime.queryInterface(XReportDocumentsSupplier.class, xOfficeDBDoc); xNameAccess = xSupplier.getReportDocuments(); assure("xOfficeDatabaseDocument returns no Report Document", xNameAccess != null); // log.println("5"); showElements(xNameAccess); - ArrayList aPropertyList = new ArrayList(); + ArrayList<PropertyValue> aPropertyList = new ArrayList<PropertyValue>(); PropertyValue aActiveConnection = new PropertyValue(); aActiveConnection.Name = "ActiveConnection"; @@ -494,7 +494,7 @@ public class ReportDesignerTest extends ComplexTestCase { // System.exit(1); } - private void loadAndStoreReports(XNameAccess _xNameAccess, ArrayList _aPropertyList /*, int _nType*/ ) + private void loadAndStoreReports(XNameAccess _xNameAccess, ArrayList<PropertyValue> _aPropertyList /*, int _nType*/ ) { if (_xNameAccess != null) { @@ -608,7 +608,7 @@ public class ReportDesignerTest extends ComplexTestCase { String sOutputURL = URLHelper.getFileURLFromSystemPath(sOutputPath); - ArrayList aPropertyList = new ArrayList(); // set some properties for storeAsURL + ArrayList<PropertyValue> aPropertyList = new ArrayList<PropertyValue>(); // set some properties for storeAsURL // PropertyValue aFileFormat = new PropertyValue(); // aFileFormat.Name = "FilterName"; @@ -621,7 +621,7 @@ public class ReportDesignerTest extends ComplexTestCase { aPropertyList.add(aOverwrite); // store the document in an other directory - XStorable aStorable = (XStorable) UnoRuntime.queryInterface( XStorable.class, _xComponent); + XStorable aStorable = UnoRuntime.queryInterface( XStorable.class, _xComponent); if (aStorable != null) { log.println("store document as URL: '" + sOutputURL + "'"); @@ -638,10 +638,10 @@ public class ReportDesignerTest extends ComplexTestCase { } } - private XComponent loadComponent(String _sName, Object _xComponent, ArrayList _aPropertyList) + private XComponent loadComponent(String _sName, Object _xComponent, ArrayList<PropertyValue> _aPropertyList) { XComponent xDocComponent = null; - XComponentLoader xComponentLoader = (XComponentLoader) UnoRuntime.queryInterface( XComponentLoader.class, _xComponent ); + XComponentLoader xComponentLoader = UnoRuntime.queryInterface( XComponentLoader.class, _xComponent ); try { @@ -668,7 +668,7 @@ public class ReportDesignerTest extends ComplexTestCase { private void closeComponent(XComponent _xDoc) { // Close the document - XCloseable xCloseable = (XCloseable) UnoRuntime.queryInterface(XCloseable.class, _xDoc); + XCloseable xCloseable = UnoRuntime.queryInterface(XCloseable.class, _xDoc); try { xCloseable.close(true); diff --git a/qadevOOo/runner/graphical/ImageHelper.java b/qadevOOo/runner/graphical/ImageHelper.java index b7ff7b5d1eed..beea44fe056d 100644 --- a/qadevOOo/runner/graphical/ImageHelper.java +++ b/qadevOOo/runner/graphical/ImageHelper.java @@ -80,7 +80,7 @@ class ImageHelper File aFile = new File(_sFilename); Exception ex = null; try { - Class imageIOClass = Class.forName("javax.imageio.ImageIO"); + Class<?> imageIOClass = Class.forName("javax.imageio.ImageIO"); Method readMethod = imageIOClass.getDeclaredMethod("read", new Class[]{java.io.File.class}); Object retValue = readMethod.invoke(imageIOClass, new Object[]{aFile}); aImage = (Image)retValue; diff --git a/qadevOOo/runner/graphical/MSOfficePostscriptCreator.java b/qadevOOo/runner/graphical/MSOfficePostscriptCreator.java index 8f338a4e9e8a..f4180560855f 100644 --- a/qadevOOo/runner/graphical/MSOfficePostscriptCreator.java +++ b/qadevOOo/runner/graphical/MSOfficePostscriptCreator.java @@ -318,7 +318,7 @@ public class MSOfficePostscriptCreator implements IOffice TimeHelper.waitInSeconds(2, "Give Microsoft Office some time to print."); } - public void realStartCommand(ArrayList _aStartCommand) throws OfficeException + public void realStartCommand(ArrayList<String> _aStartCommand) throws OfficeException { if (_aStartCommand.isEmpty()) { diff --git a/qadevOOo/runner/graphical/Office.java b/qadevOOo/runner/graphical/Office.java index 5377a6fb2e8d..33470cb35ab3 100644 --- a/qadevOOo/runner/graphical/Office.java +++ b/qadevOOo/runner/graphical/Office.java @@ -80,7 +80,7 @@ public class Office implements IOffice } // TODO: run through all documents which exists as reports in odb files OpenOfficeDatabaseReportExtractor aExtractor = new OpenOfficeDatabaseReportExtractor(m_aParameterHelper); - ArrayList aList = aExtractor.load(m_sDocumentName); + ArrayList<String> aList = aExtractor.load(m_sDocumentName); if (aList != null) { // remove the whole section about the 'name'.odb there are no information we need diff --git a/qadevOOo/runner/graphical/OpenOfficeDatabaseReportExtractor.java b/qadevOOo/runner/graphical/OpenOfficeDatabaseReportExtractor.java index 55cf50d381a3..7d5d99831207 100644 --- a/qadevOOo/runner/graphical/OpenOfficeDatabaseReportExtractor.java +++ b/qadevOOo/runner/graphical/OpenOfficeDatabaseReportExtractor.java @@ -510,7 +510,7 @@ public class OpenOfficeDatabaseReportExtractor extends Assurance return sBackPathName; } - private XComponent loadComponent(String _sName, Object _xComponent, ArrayList _aPropertyList) + private XComponent loadComponent(String _sName, Object _xComponent, ArrayList<PropertyValue> _aPropertyList) { XComponent xDocComponent = null; XComponentLoader xComponentLoader = UnoRuntime.queryInterface( XComponentLoader.class, _xComponent ); diff --git a/qadevOOo/runner/helper/APIDescGetter.java b/qadevOOo/runner/helper/APIDescGetter.java index a99bd979d37e..7dad332e2908 100644 --- a/qadevOOo/runner/helper/APIDescGetter.java +++ b/qadevOOo/runner/helper/APIDescGetter.java @@ -99,7 +99,7 @@ public class APIDescGetter extends DescGetter } else { - ArrayList subs = getSubInterfaces(job); + ArrayList<String> subs = getSubInterfaces(job); String partjob = job.substring(0, job.indexOf(",")).trim(); DescEntry entry = getDescriptionForSingleJob(partjob, descPath, debug); @@ -167,13 +167,13 @@ public class APIDescGetter extends DescGetter { //look the scenarion like this? : // sw.SwXBodyText,sw.SwXTextCursor - ArrayList subs = getSubObjects(job); + ArrayList<String> subs = getSubObjects(job); DescEntry[] entries = new DescEntry[subs.size()]; for (int i = 0; i < subs.size(); i++) { entries[i] = getDescriptionForSingleJob( - (String) subs.get(i), descPath, debug); + subs.get(i), descPath, debug); } return entries; } @@ -263,8 +263,8 @@ public class APIDescGetter extends DescGetter { String line = ""; String old_ifc_name = ""; - ArrayList ifc_names = new ArrayList(); - ArrayList meth_names = new ArrayList(); + ArrayList<DescEntry> ifc_names = new ArrayList<DescEntry>(); + ArrayList<DescEntry> meth_names = new ArrayList<DescEntry>(); DescEntry ifcDesc = null; while (line != null) @@ -464,17 +464,17 @@ public class APIDescGetter extends DescGetter return methDesc; } - private static void createIfcName(String ifc_name, ArrayList meth_names, DescEntry ifcDesc) + private static void createIfcName(String ifc_name, ArrayList<String> meth_names, DescEntry ifcDesc) { } /** * This method ensures that XComponent will be the last in the list of interfaces */ - protected static Object[] makeArray(ArrayList entries) + protected static Object[] makeArray(ArrayList<DescEntry> entries) { Object[] entriesArray = entries.toArray(); - ArrayList returnArray = new ArrayList(); + ArrayList<Object> returnArray = new ArrayList<Object>(); Object addAtEnd = null; for (int k = 0; k < entriesArray.length; k++) @@ -730,9 +730,9 @@ public class APIDescGetter extends DescGetter return aEntry; } - protected ArrayList getSubInterfaces(String job) + protected ArrayList<String> getSubInterfaces(String job) { - ArrayList namesList = new ArrayList(); + ArrayList<String> namesList = new ArrayList<String>(); StringTokenizer st = new StringTokenizer(job, ","); for (int i = 0; st.hasMoreTokens(); i++) @@ -748,9 +748,9 @@ public class APIDescGetter extends DescGetter return namesList; } - protected ArrayList getSubObjects(String job) + protected ArrayList<String> getSubObjects(String job) { - ArrayList namesList = new ArrayList(); + ArrayList<String> namesList = new ArrayList<String>(); StringTokenizer st = new StringTokenizer(job, ","); for (int i = 0; st.hasMoreTokens(); i++) @@ -792,7 +792,7 @@ public class APIDescGetter extends DescGetter boolean debug) { String[] modules = null; - ArrayList componentList = new ArrayList(); + ArrayList<String> componentList = new ArrayList<String>(); if (!job.equals("unknown") && !job.equals("listall")) { @@ -841,7 +841,7 @@ public class APIDescGetter extends DescGetter for (int i = 0; i < componentList.size(); i++) { - scenario[i] = (String) componentList.get(i); + scenario[i] = componentList.get(i); } return scenario; @@ -864,7 +864,7 @@ public class APIDescGetter extends DescGetter return null; } - ArrayList scenarioList = new ArrayList(); + ArrayList<String> scenarioList = new ArrayList<String>(); try { @@ -945,7 +945,7 @@ public class APIDescGetter extends DescGetter protected boolean isUnusedModule(String moduleName) { - ArrayList removed = new ArrayList(); + ArrayList<String> removed = new ArrayList<String>(); removed.add("acceptor"); removed.add("brdgfctr"); removed.add("connectr"); diff --git a/qadevOOo/runner/helper/ComplexDescGetter.java b/qadevOOo/runner/helper/ComplexDescGetter.java index 413733342be1..e269e1816d1c 100644 --- a/qadevOOo/runner/helper/ComplexDescGetter.java +++ b/qadevOOo/runner/helper/ComplexDescGetter.java @@ -85,7 +85,7 @@ public class ComplexDescGetter extends DescGetter // case3: method1(param1,param2),method2(param1,param2) String method = className.substring(index + 2); className = className.substring(0, index); - ArrayList methods = new ArrayList(); + ArrayList<String> methods = new ArrayList<String>(); String[] split = method.split("(?<=\\)),(?=\\w+)"); @@ -102,7 +102,7 @@ public class ComplexDescGetter extends DescGetter } methodNames = new String[methods.size()]; - methodNames = (String[]) methods.toArray(methodNames); + methodNames = methods.toArray(methodNames); } // create an instance diff --git a/qadevOOo/runner/helper/ConfigHelper.java b/qadevOOo/runner/helper/ConfigHelper.java index a5d1191f1e5b..b65056ef229a 100644 --- a/qadevOOo/runner/helper/ConfigHelper.java +++ b/qadevOOo/runner/helper/ConfigHelper.java @@ -96,11 +96,10 @@ public class ConfigHelper { m_xSMGR = xSMGR; - XMultiServiceFactory xConfigRoot = (XMultiServiceFactory) - UnoRuntime.queryInterface( - XMultiServiceFactory.class, - m_xSMGR.createInstance( - "com.sun.star.configuration.ConfigurationProvider")); + XMultiServiceFactory xConfigRoot = UnoRuntime.queryInterface( + XMultiServiceFactory.class, + m_xSMGR.createInstance( + "com.sun.star.configuration.ConfigurationProvider")); PropertyValue[] lParams = new PropertyValue[1]; lParams[0] = new PropertyValue(); @@ -117,7 +116,7 @@ public class ConfigHelper "com.sun.star.configuration.ConfigurationUpdateAccess", lParams); - m_xConfig = (XHierarchicalNameAccess)UnoRuntime.queryInterface( + m_xConfig = UnoRuntime.queryInterface( XHierarchicalNameAccess.class, aConfig); @@ -172,7 +171,7 @@ public class ConfigHelper { try { - XChangesBatch xBatch = (XChangesBatch)UnoRuntime.queryInterface( + XChangesBatch xBatch = UnoRuntime.queryInterface( XChangesBatch.class, m_xConfig); xBatch.commitChanges(); @@ -228,7 +227,7 @@ public class ConfigHelper try { Object xChild=xSetCont.getByName(groupName); - xChildAccess = (XNameReplace) UnoRuntime.queryInterface( + xChildAccess = UnoRuntime.queryInterface( XNameReplace.class,xSetCont); } catch(com.sun.star.container.NoSuchElementException e) { // proceed with inserting @@ -311,7 +310,7 @@ public class ConfigHelper try { Object xGroup=xSetCont.getByName(group); - xGroupAccess = (XNameReplace) UnoRuntime.queryInterface( + xGroupAccess = UnoRuntime.queryInterface( XNameReplace.class,xGroup); } catch(com.sun.star.container.NoSuchElementException e) { throw new com.sun.star.uno.Exception( @@ -350,8 +349,7 @@ public class ConfigHelper public XNameContainer getSet(String setName) throws com.sun.star.uno.Exception { - XNameReplace xCont = (XNameReplace) - UnoRuntime.queryInterface(XNameReplace.class, m_xConfig); + XNameReplace xCont = UnoRuntime.queryInterface(XNameReplace.class, m_xConfig); Object oSet = xCont.getByName(setName); diff --git a/qadevOOo/runner/helper/ConfigurationRead.java b/qadevOOo/runner/helper/ConfigurationRead.java index b865c3064925..3940edc5e361 100644 --- a/qadevOOo/runner/helper/ConfigurationRead.java +++ b/qadevOOo/runner/helper/ConfigurationRead.java @@ -53,9 +53,8 @@ public class ConfigurationRead { "com.sun.star.configuration.ConfigurationAccess", nodeArgs); - root = (XHierarchicalNameAccess) - UnoRuntime.queryInterface( - XHierarchicalNameAccess.class, rootObject); + root = UnoRuntime.queryInterface( + XHierarchicalNameAccess.class, rootObject); } catch(com.sun.star.uno.Exception e) { e.printStackTrace(); diff --git a/qadevOOo/runner/helper/ContextMenuInterceptor.java b/qadevOOo/runner/helper/ContextMenuInterceptor.java index ea377c2e0158..6d80e1fdbbaf 100644 --- a/qadevOOo/runner/helper/ContextMenuInterceptor.java +++ b/qadevOOo/runner/helper/ContextMenuInterceptor.java @@ -37,8 +37,8 @@ public class ContextMenuInterceptor implements XContextMenuInterceptor { // create sub menus, menu entries and separators XIndexContainer xContextMenu = aEvent.ActionTriggerContainer; XMultiServiceFactory xMenuElementFactory = - (XMultiServiceFactory)UnoRuntime.queryInterface( - XMultiServiceFactory.class, xContextMenu ); + UnoRuntime.queryInterface( + XMultiServiceFactory.class, xContextMenu ); if ( xMenuElementFactory != null ) { @@ -58,9 +58,9 @@ public class ContextMenuInterceptor implements XContextMenuInterceptor { // query sub menu for index container to get access XIndexContainer xSubMenuContainer = - (XIndexContainer)UnoRuntime.queryInterface( - XIndexContainer.class, - xMenuElementFactory.createInstance("com.sun.star.ui.ActionTriggerContainer" )); + UnoRuntime.queryInterface( + XIndexContainer.class, + xMenuElementFactory.createInstance("com.sun.star.ui.ActionTriggerContainer" )); // intialize root menu entry "Help" xRootMenuEntry.setPropertyValue( "Text", new String( "Help" )); diff --git a/qadevOOo/runner/helper/CwsDataExchangeImpl.java b/qadevOOo/runner/helper/CwsDataExchangeImpl.java index ba873d6ff149..1619a8146c88 100644 --- a/qadevOOo/runner/helper/CwsDataExchangeImpl.java +++ b/qadevOOo/runner/helper/CwsDataExchangeImpl.java @@ -49,7 +49,7 @@ public class CwsDataExchangeImpl implements CwsDataExchange mDebug = param.getBool(PropertyName.DEBUG_IS_ACTIVE); } - public ArrayList getModules() + public ArrayList<String> getModules() { // the cwstouched command send its version information to StdErr. // A piping from StdErr to SdtOut the tcsh does not support. diff --git a/qadevOOo/runner/helper/InetTools.java b/qadevOOo/runner/helper/InetTools.java index b7529920a3f6..b4c5a8443239 100644 --- a/qadevOOo/runner/helper/InetTools.java +++ b/qadevOOo/runner/helper/InetTools.java @@ -45,7 +45,7 @@ public class InetTools { Object oProvider = xMSF.createInstance( "com.sun.star.configuration.ConfigurationProvider"); - XMultiServiceFactory oProviderMSF = (XMultiServiceFactory) UnoRuntime.queryInterface( + XMultiServiceFactory oProviderMSF = UnoRuntime.queryInterface( XMultiServiceFactory.class, oProvider); @@ -67,7 +67,7 @@ public class InetTools { oInetProps.setPropertyValue("ooInetHTTPProxyPort", HTTPProxyPort); oInetProps.setPropertyValue("ooInetProxyType", new Long(2)); - XChangesBatch oSecureChange = (XChangesBatch) UnoRuntime.queryInterface( + XChangesBatch oSecureChange = UnoRuntime.queryInterface( XChangesBatch.class, oInet); oSecureChange.commitChanges(); } diff --git a/qadevOOo/runner/helper/PropertyHelper.java b/qadevOOo/runner/helper/PropertyHelper.java index 76179927cd87..c91b4053aeb4 100644 --- a/qadevOOo/runner/helper/PropertyHelper.java +++ b/qadevOOo/runner/helper/PropertyHelper.java @@ -29,7 +29,7 @@ public class PropertyHelper @param _aArrayList @return a PropertyValue[] */ - public static PropertyValue[] createPropertyValueArrayFormArrayList(ArrayList _aPropertyList) + public static PropertyValue[] createPropertyValueArrayFormArrayList(ArrayList<PropertyValue> _aPropertyList) { // copy the whole PropertyValue List to an PropertyValue Array PropertyValue[] aSaveProperties = null; @@ -40,7 +40,7 @@ public class PropertyHelper } else { - aSaveProperties = (PropertyValue[])_aPropertyList.toArray(new PropertyValue[_aPropertyList.size()]); + aSaveProperties = _aPropertyList.toArray(new PropertyValue[_aPropertyList.size()]); // old java 1.4 // if (_aPropertyList.size() > 0) // { diff --git a/qadevOOo/runner/helper/StreamSimulator.java b/qadevOOo/runner/helper/StreamSimulator.java index f53f17de5cab..fe4a19deda09 100644 --- a/qadevOOo/runner/helper/StreamSimulator.java +++ b/qadevOOo/runner/helper/StreamSimulator.java @@ -88,9 +88,8 @@ public class StreamSimulator implements com.sun.star.io.XInputStream , try { - XSimpleFileAccess xHelper = (XSimpleFileAccess) - UnoRuntime.queryInterface(XSimpleFileAccess.class, - ((XMultiServiceFactory)param.getMSF()).createInstance("com.sun.star.ucb.SimpleFileAccess")); + XSimpleFileAccess xHelper = UnoRuntime.queryInterface(XSimpleFileAccess.class, + ((XMultiServiceFactory)param.getMSF()).createInstance("com.sun.star.ucb.SimpleFileAccess")); /* com.sun.star.ucb.XSimpleFileAccess xHelper = (com.sun.star.ucb.XSimpleFileAccess)OfficeConnect.createRemoteInstance( com.sun.star.ucb.XSimpleFileAccess.class, "com.sun.star.ucb.SimpleFileAccess");*/ @@ -101,14 +100,14 @@ public class StreamSimulator implements com.sun.star.io.XInputStream , if (bInput) { m_xInStream = xHelper.openFileRead(m_sFileName); - m_xSeek = (com.sun.star.io.XSeekable)UnoRuntime.queryInterface( + m_xSeek = UnoRuntime.queryInterface( com.sun.star.io.XSeekable.class, m_xInStream); } else { m_xOutStream = xHelper.openFileWrite(m_sFileName); - m_xSeek = (com.sun.star.io.XSeekable)UnoRuntime.queryInterface( + m_xSeek = UnoRuntime.queryInterface( com.sun.star.io.XSeekable.class, m_xOutStream); } diff --git a/qadevOOo/runner/helper/URLHelper.java b/qadevOOo/runner/helper/URLHelper.java index c33ac40ffb8b..bd091a988f01 100644 --- a/qadevOOo/runner/helper/URLHelper.java +++ b/qadevOOo/runner/helper/URLHelper.java @@ -240,7 +240,7 @@ public class URLHelper * a filtered list of java File objects of all available files of the start dir * and all accessable sub directories. */ - public static ArrayList getSystemFilesFromDir(String sStartDir) + public static ArrayList<File> getSystemFilesFromDir(String sStartDir) { File aRoot = new File(sStartDir); @@ -254,7 +254,7 @@ public class URLHelper if (lAllFiles == null ) return null; - ArrayList lFilteredFiles = new ArrayList(lAllFiles.length); + ArrayList<File> lFilteredFiles = new ArrayList<File>(lAllFiles.length); for (int i=0; i<lAllFiles.length; ++i) { @@ -264,10 +264,10 @@ public class URLHelper if (lAllFiles[i].isDirectory()) { // recursion! - ArrayList lSubFiles = URLHelper.getSystemFilesFromDir(lAllFiles[i].getPath()); + ArrayList<File> lSubFiles = URLHelper.getSystemFilesFromDir(lAllFiles[i].getPath()); if (lSubFiles != null) { - Iterator aSnapshot = lSubFiles.iterator(); + Iterator<File> aSnapshot = lSubFiles.iterator(); while (aSnapshot.hasNext()) lFilteredFiles.add(aSnapshot.next()); } diff --git a/qadevOOo/runner/helper/UnoProvider.java b/qadevOOo/runner/helper/UnoProvider.java index 9194ec54e549..e8b444cb9ef3 100644 --- a/qadevOOo/runner/helper/UnoProvider.java +++ b/qadevOOo/runner/helper/UnoProvider.java @@ -105,7 +105,7 @@ public class UnoProvider implements AppProvider { return null; } XMultiComponentFactory xMCF = xContext.getServiceManager(); - xMSF = (XMultiServiceFactory)UnoRuntime.queryInterface( + xMSF = UnoRuntime.queryInterface( XMultiServiceFactory.class, xMCF); } return xMSF; diff --git a/qadevOOo/runner/lib/DynamicClassLoader.java b/qadevOOo/runner/lib/DynamicClassLoader.java index 5104350422a0..ef38533bb8f3 100644 --- a/qadevOOo/runner/lib/DynamicClassLoader.java +++ b/qadevOOo/runner/lib/DynamicClassLoader.java @@ -32,7 +32,7 @@ public class DynamicClassLoader { * policy is required for Component and Interface * testing classes. */ - public static Class forName(String className) + public static Class<?> forName(String className) throws ClassNotFoundException { return Class.forName(className) ; @@ -41,7 +41,7 @@ public class DynamicClassLoader { public Object getInstance(String className) throws IllegalArgumentException { try { - Class cls = DynamicClassLoader.forName(className); + Class<?> cls = DynamicClassLoader.forName(className); return cls.newInstance(); } catch ( ClassNotFoundException e ) { throw new IllegalArgumentException("Couldn't find " + className @@ -58,12 +58,12 @@ public class DynamicClassLoader { public Object getInstance(String className, Object[] ctorArgs) throws IllegalArgumentException { try { - Class cls = DynamicClassLoader.forName(className); - Class[] ctorType = new Class[ctorArgs.length]; + Class<?> cls = DynamicClassLoader.forName(className); + Class<?>[] ctorType = new Class[ctorArgs.length]; for(int i=0; i<ctorType.length; i++) { ctorType[i] = ctorArgs[i].getClass(); } - Constructor ctor = cls.getConstructor(ctorType); + Constructor<?> ctor = cls.getConstructor(ctorType); return ctor.newInstance(ctorArgs); } catch ( ClassNotFoundException e ) { throw new IllegalArgumentException("Couldn't find " + className diff --git a/qadevOOo/runner/lib/MultiMethodTest.java b/qadevOOo/runner/lib/MultiMethodTest.java index 004dd448fb74..e2c695671a73 100644 --- a/qadevOOo/runner/lib/MultiMethodTest.java +++ b/qadevOOo/runner/lib/MultiMethodTest.java @@ -97,7 +97,7 @@ public class MultiMethodTest /** * Contains names of the methods have been already called */ - private ArrayList methCalled = new ArrayList(10); + private ArrayList<String> methCalled = new ArrayList<String>(10); /** * Disposes the test environment, which was corrupted by the test. @@ -147,7 +147,7 @@ public class MultiMethodTest // this.log = log; this.entry = entry; this.tRes = new TestResult(); - Class testedClass; + Class<?> testedClass; // Some fake code for a self test. // For normal test we must not be a "ifc.qadevooo._SelfTest" @@ -445,7 +445,7 @@ public class MultiMethodTest mName = mName.substring(0, mName.length() - 2); } - final Class[] paramTypes = new Class[0]; + final Class<?>[] paramTypes = new Class[0]; try { diff --git a/qadevOOo/runner/lib/Parameters.java b/qadevOOo/runner/lib/Parameters.java index 9f0a7e58108d..bd24289ded5a 100644 --- a/qadevOOo/runner/lib/Parameters.java +++ b/qadevOOo/runner/lib/Parameters.java @@ -41,7 +41,7 @@ import com.sun.star.uno.Type; public class Parameters implements XPropertySet { /* final protected Map parameters; final Parameters defaults; */ - final protected Map parameters; + final protected Map<String, Object> parameters; final Parameters defaults; Property[] props; @@ -49,12 +49,12 @@ public class Parameters implements XPropertySet { this (params, null); } - public Parameters(Map params, Parameters defaultParams) { + public Parameters(Map<String, Object> params, Parameters defaultParams) { parameters = params; defaults = defaultParams; checkParameters(parameters); - Set paramSet = new HashSet(parameters.keySet()); + Set<String> paramSet = new HashSet<String>(parameters.keySet()); if (defaults != null) { Set defSet = defaults.toMap().keySet(); @@ -65,8 +65,8 @@ public class Parameters implements XPropertySet { int num = 0; - for (Iterator i = paramSet.iterator(); i.hasNext(); num++) { - String name = (String)i.next(); + for (Iterator<String> i = paramSet.iterator(); i.hasNext(); num++) { + String name = i.next(); props[num] = new Property(name, num, new Type(String.class), (short)0); } @@ -160,8 +160,8 @@ public class Parameters implements XPropertySet { }; } - private static void checkParameters(Map params) { - for (Iterator i = params.keySet().iterator(); i.hasNext();) { + private static void checkParameters(Map<String, Object> params) { + for (Iterator<String> i = params.keySet().iterator(); i.hasNext();) { Object key = i.next(); if (!(key instanceof String)) { @@ -198,8 +198,8 @@ public class Parameters implements XPropertySet { } } - public static Map toMap(XPropertySet props) { - HashMap result = new HashMap(10); + public static Map<String, Object> toMap(XPropertySet props) { + HashMap<String, Object> result = new HashMap<String, Object>(10); XPropertySetInfo setInfo = props.getPropertySetInfo(); Property[] properties = setInfo.getProperties(); diff --git a/qadevOOo/runner/lib/TestEnvironment.java b/qadevOOo/runner/lib/TestEnvironment.java index e88c90e3c0f3..7c9b3d7cbe82 100644 --- a/qadevOOo/runner/lib/TestEnvironment.java +++ b/qadevOOo/runner/lib/TestEnvironment.java @@ -34,7 +34,7 @@ public final class TestEnvironment { * Contains object relations - auxiliary objects associated with the * tested object and required for testing. */ - private final HashMap relations = new HashMap(10); + private final HashMap<String, Object> relations = new HashMap<String, Object>(10); /** * An instance of the tested implementation object. diff --git a/qadevOOo/runner/lib/TestResult.java b/qadevOOo/runner/lib/TestResult.java index e49aaa6224b3..1df57a950d53 100644 --- a/qadevOOo/runner/lib/TestResult.java +++ b/qadevOOo/runner/lib/TestResult.java @@ -27,7 +27,7 @@ public class TestResult { /** * Contains methods having been tested and their results. */ - protected HashMap testedMethods = new HashMap(); + protected HashMap<String, Status> testedMethods = new HashMap<String, Status>(); /** * The method makes method tested with the result, i.e. it adds to its @@ -70,7 +70,7 @@ public class TestResult { * @return methods available in the interface tested. */ public String[] getTestedMethods() { - return (String[])testedMethods.keySet().toArray( + return testedMethods.keySet().toArray( new String[testedMethods.size()]); } @@ -91,7 +91,7 @@ public class TestResult { * @see #assert */ public Status getStatusFor( String method ) { - return (Status)testedMethods.get( method ); + return testedMethods.get( method ); } }
\ No newline at end of file diff --git a/qadevOOo/runner/org/openoffice/RunnerService.java b/qadevOOo/runner/org/openoffice/RunnerService.java index 6a0d131f6386..8b7489ec50eb 100644 --- a/qadevOOo/runner/org/openoffice/RunnerService.java +++ b/qadevOOo/runner/org/openoffice/RunnerService.java @@ -213,7 +213,7 @@ public class RunnerService implements XJob, XServiceInfo, return pVal; } - ArrayList v = new ArrayList(600); + ArrayList<String> v = new ArrayList<String>(600); try { // open connection to Jar java.net.JarURLConnection con = diff --git a/qadevOOo/runner/share/CwsDataExchange.java b/qadevOOo/runner/share/CwsDataExchange.java index 6593cedef6f3..3b160a179a24 100644 --- a/qadevOOo/runner/share/CwsDataExchange.java +++ b/qadevOOo/runner/share/CwsDataExchange.java @@ -30,7 +30,7 @@ public interface CwsDataExchange { * Retunrs all module names which are added to the specified childworkspace * @return a String array of all added modules */ - public ArrayList getModules(); + public ArrayList<String> getModules(); /** * Set the test status of cws related UnoAPI tests to the EIS dabase diff --git a/qadevOOo/runner/share/DescGetter.java b/qadevOOo/runner/share/DescGetter.java index 7ab8b2de044f..22d8b62199a0 100644 --- a/qadevOOo/runner/share/DescGetter.java +++ b/qadevOOo/runner/share/DescGetter.java @@ -46,7 +46,7 @@ public abstract class DescGetter protected DescEntry[] getScenario(String url, String descPath, boolean debug) { - ArrayList entryList = new ArrayList(); + ArrayList<DescEntry> entryList = new ArrayList<DescEntry>(); String line = ""; BufferedReader scenario = null; DescEntry[] entries = null; @@ -78,7 +78,7 @@ public abstract class DescGetter } else { - ArrayList subs = getSubInterfaces(job); + ArrayList<String> subs = getSubInterfaces(job); String partjob = job.substring(0, job.indexOf(",")).trim(); aEntry = getDescriptionForSingleJob(partjob, descPath, debug); @@ -163,14 +163,14 @@ public abstract class DescGetter return null; } entries = new DescEntry[entryList.size()]; - entries = (DescEntry[]) entryList.toArray(entries); + entries = entryList.toArray(entries); return entries; } - protected ArrayList getSubInterfaces(String job) + protected ArrayList<String> getSubInterfaces(String job) { - ArrayList namesList = new ArrayList(); + ArrayList<String> namesList = new ArrayList<String>(); StringTokenizer st = new StringTokenizer(job, ","); for (int i = 0; st.hasMoreTokens(); i++) diff --git a/qadevOOo/runner/stats/DataBaseOutProducer.java b/qadevOOo/runner/stats/DataBaseOutProducer.java index e0b8e172098d..08e44d369b66 100644 --- a/qadevOOo/runner/stats/DataBaseOutProducer.java +++ b/qadevOOo/runner/stats/DataBaseOutProducer.java @@ -28,7 +28,7 @@ import java.util.HashMap; */ public abstract class DataBaseOutProducer implements LogWriter { protected HashMap mSqlInput = null; - protected HashMap mSqlOutput = null; + protected HashMap<String, String[]> mSqlOutput = null; protected String[] mWriteableEntryTypes = null; protected SQLExecution mSqlExec; protected boolean m_bDebug = false; diff --git a/qadevOOo/runner/stats/FileLogWriter.java b/qadevOOo/runner/stats/FileLogWriter.java index d27f8295f735..b8e545351ce6 100644 --- a/qadevOOo/runner/stats/FileLogWriter.java +++ b/qadevOOo/runner/stats/FileLogWriter.java @@ -32,7 +32,7 @@ import java.util.Iterator; public class FileLogWriter extends PrintWriter implements LogWriter { - HashMap mFileWriters = null; + HashMap<String, FileWriter> mFileWriters = null; boolean logging = false; share.DescEntry entry = null; share.Watcher ow = null; @@ -61,7 +61,7 @@ public class FileLogWriter extends PrintWriter implements LogWriter { public void addFileLog(String filePath){ try{ if(mFileWriters == null) - mFileWriters = new HashMap(); + mFileWriters = new HashMap<String, FileWriter>(); mFileWriters.put(filePath, new FileWriter(filePath)); }catch(IOException e ){ e.printStackTrace(this); @@ -92,9 +92,9 @@ public class FileLogWriter extends PrintWriter implements LogWriter { if(mFileWriters != null && mFileWriters.size() > 0){ try{ FileWriter fw = null; - Iterator iter = mFileWriters.values().iterator(); + Iterator<FileWriter> iter = mFileWriters.values().iterator(); while(iter.hasNext()){ - fw = (FileWriter) iter.next(); + fw = iter.next(); fw.write("LOG> " + msg + "\n"); fw.flush(); } diff --git a/qadevOOo/runner/stats/SQLExecution.java b/qadevOOo/runner/stats/SQLExecution.java index 6fcab9ee84a0..21d0cbeecf86 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 sqlOutput) + public boolean executeSQLCommand(String command, HashMap sqlInput, HashMap<String, String[]> sqlOutput) throws IllegalArgumentException { return executeSQLCommand(command, sqlInput, sqlOutput, false); } @@ -139,10 +139,10 @@ public class SQLExecution { * sqlInput HashMap. * @return True, if no error occurred. */ - public boolean executeSQLCommand(String command, HashMap sqlInput, HashMap sqlOutput, boolean mergeOutputIntoInput) + public boolean executeSQLCommand(String command, HashMap sqlInput, HashMap<String, String[]> sqlOutput, boolean mergeOutputIntoInput) throws IllegalArgumentException { if (sqlOutput == null) { - sqlOutput = new HashMap(); + sqlOutput = new HashMap<String, String[]>(); // this has to be true, so the user of this method gets a return mergeOutputIntoInput = true; if (sqlInput == null) { @@ -150,7 +150,7 @@ public class SQLExecution { return false; } } - ArrayList sqlCommand = new ArrayList(); + ArrayList<String> sqlCommand = new ArrayList<String>(); sqlCommand.add(""); boolean update = false; // synchronize all "$varname" occurrences in the command string with @@ -231,10 +231,10 @@ public class SQLExecution { execute((String)sqlCommand.get(i), sqlOutput, update); // merge output with input if (!update && mergeOutputIntoInput) { - Iterator keys = sqlOutput.keySet().iterator(); + Iterator<String> keys = sqlOutput.keySet().iterator(); while(keys.hasNext()) { - String key = (String)keys.next(); - String[]val = (String[])sqlOutput.get(key); + String key = keys.next(); + String[]val = sqlOutput.get(key); if (val != null && val.length != 0) { if (val.length == 1) sqlInput.put(key, val[0]); @@ -256,7 +256,7 @@ public class SQLExecution { * command * @return A HashMap with the result. */ - private void execute(String command, HashMap output, boolean update) { + private void execute(String command, HashMap<String, String[]> output, boolean update) { if (m_bDebug) System.out.println("Debug - SQLExecution - execute Command: " + command); try { @@ -275,7 +275,7 @@ public class SQLExecution { for(int i=1; i<=columnCount; i++) { columnNames[i-1] = sqlRSMeta.getColumnName(i); // initialize output - ArrayList v = new ArrayList(); + ArrayList<String> v = new ArrayList<String>(); sqlResult.beforeFirst(); while (sqlResult.next()) { @@ -291,7 +291,7 @@ public class SQLExecution { // put result in output HashMap String[]s = new String[countRows]; - s = (String[])v.toArray(s); + s = v.toArray(s); output.put(columnNames[i-1], s); if (m_bDebug) { if (i == 1) { diff --git a/qadevOOo/runner/stats/Summarizer.java b/qadevOOo/runner/stats/Summarizer.java index 3d9afbc10ad8..b63c5c255eb1 100644 --- a/qadevOOo/runner/stats/Summarizer.java +++ b/qadevOOo/runner/stats/Summarizer.java @@ -42,8 +42,8 @@ public class Summarizer } int count = entry.SubEntryCount; int knownIssues = 0; - ArrayList failures = new ArrayList(); - ArrayList states = new ArrayList(); + ArrayList<String> failures = new ArrayList<String>(); + ArrayList<String> states = new ArrayList<String>(); for (int i = 0; i < count; i++) { if (entry.SubEntries[i].State == null) diff --git a/qadevOOo/runner/util/AccessibilityTools.java b/qadevOOo/runner/util/AccessibilityTools.java index 95f45cf8b286..e6f345b0493c 100644 --- a/qadevOOo/runner/util/AccessibilityTools.java +++ b/qadevOOo/runner/util/AccessibilityTools.java @@ -339,7 +339,7 @@ public class AccessibilityTools { ac.getAccessibleDescription() + "):" + utils.getImplName(ac)); - XAccessibleComponent aComp = (XAccessibleComponent) UnoRuntime.queryInterface( + XAccessibleComponent aComp = UnoRuntime.queryInterface( XAccessibleComponent.class, xacc); if (aComp != null) { @@ -389,7 +389,7 @@ public class AccessibilityTools { } public static String accessibleToString(Object AC) { - XAccessibleContext xAC = (XAccessibleContext) UnoRuntime.queryInterface( + XAccessibleContext xAC = UnoRuntime.queryInterface( XAccessibleContext.class, AC); if (xAC != null) { @@ -398,7 +398,7 @@ public class AccessibilityTools { xAC.getAccessibleDescription() + "):"; } - XAccessible xA = (XAccessible) UnoRuntime.queryInterface( + XAccessible xA = UnoRuntime.queryInterface( XAccessible.class, AC); if (xA == null) { diff --git a/qadevOOo/runner/util/BasicMacroTools.java b/qadevOOo/runner/util/BasicMacroTools.java index b5e55278c787..313ed1b0f565 100644 --- a/qadevOOo/runner/util/BasicMacroTools.java +++ b/qadevOOo/runner/util/BasicMacroTools.java @@ -66,7 +66,7 @@ public class BasicMacroTools { mLCxNA = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, DocLibCont); - mLCxLC = (XLibraryContainer) UnoRuntime.queryInterface( + mLCxLC = UnoRuntime.queryInterface( XLibraryContainer.class, DocLibCont); } catch (Exception e) { @@ -98,7 +98,7 @@ public class BasicMacroTools { mLCxNA = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, ASLC); - mLCxLC = (XLibraryContainer) UnoRuntime.queryInterface( + mLCxLC = UnoRuntime.queryInterface( XLibraryContainer.class, ASLC); } catch (Exception e) { @@ -117,14 +117,14 @@ public class BasicMacroTools { throw new Exception("Could not create DispatchProvider"); } - return (XDispatchProvider) UnoRuntime.queryInterface( + return UnoRuntime.queryInterface( XDispatchProvider.class, xFrame); } private static XURLTransformer makeParser(XMultiServiceFactory mMSF) throws java.lang.Exception { try { - return (com.sun.star.util.XURLTransformer) UnoRuntime.queryInterface( + return UnoRuntime.queryInterface( XURLTransformer.class, mMSF.createInstance( "com.sun.star.util.URLTransformer")); } catch (Exception e) { @@ -231,8 +231,7 @@ public class BasicMacroTools { Object oProvider = xMSF.createInstance("com.sun.star.configuration.ConfigurationProvider"); - XMultiServiceFactory oProviderMSF = (XMultiServiceFactory) - UnoRuntime.queryInterface(XMultiServiceFactory.class, oProvider); + XMultiServiceFactory oProviderMSF = UnoRuntime.queryInterface(XMultiServiceFactory.class, oProvider); Object oSecure = oProviderMSF.createInstanceWithArguments( "com.sun.star.configuration.ConfigurationUpdateAccess", @@ -246,7 +245,7 @@ public class BasicMacroTools { oScriptingSettings.setPropertyValue("SecureURL", new String[]{secureURL}); oScriptingSettings.setPropertyValue("OfficeBasic", new Integer(2)); - XChangesBatch oSecureChange = (XChangesBatch) UnoRuntime.queryInterface(XChangesBatch.class, oSecure); + XChangesBatch oSecureChange = UnoRuntime.queryInterface(XChangesBatch.class, oSecure); oSecureChange.commitChanges(); } } diff --git a/qadevOOo/runner/util/CalcTools.java b/qadevOOo/runner/util/CalcTools.java index 7f12b2462aba..22bd2258ca3c 100644 --- a/qadevOOo/runner/util/CalcTools.java +++ b/qadevOOo/runner/util/CalcTools.java @@ -95,7 +95,7 @@ public class CalcTools { "Couldn't get CellRange from sheett: " + e.toString()); } - XCellRangeData xRangeData = (XCellRangeData) UnoRuntime.queryInterface(XCellRangeData.class, xRange); + XCellRangeData xRangeData = UnoRuntime.queryInterface(XCellRangeData.class, xRange); xRangeData.setDataArray(newData); } catch (Exception e){ @@ -119,13 +119,11 @@ public class CalcTools { XSpreadsheet xSheet = null; try{ - XSpreadsheetDocument xSpreadsheetDoc = (XSpreadsheetDocument) - UnoRuntime.queryInterface(XSpreadsheetDocument.class, xSheetDoc); + XSpreadsheetDocument xSpreadsheetDoc = UnoRuntime.queryInterface(XSpreadsheetDocument.class, xSheetDoc); XSpreadsheets xSpreadsheets = xSpreadsheetDoc.getSheets(); - XIndexAccess xSheetsIndexArray = (XIndexAccess) - UnoRuntime.queryInterface(XIndexAccess.class, xSpreadsheets); + XIndexAccess xSheetsIndexArray = UnoRuntime.queryInterface(XIndexAccess.class, xSpreadsheets); try{ xSheet = (XSpreadsheet) AnyConverter.toObject( diff --git a/qadevOOo/runner/util/DBTools.java b/qadevOOo/runner/util/DBTools.java index 825c626403e6..30c1b230548f 100644 --- a/qadevOOo/runner/util/DBTools.java +++ b/qadevOOo/runner/util/DBTools.java @@ -274,7 +274,7 @@ public class DBTools { try { Object cont = xMSF.createInstance("com.sun.star.sdb.DatabaseContext") ; - dbContext = (XNamingService) UnoRuntime.queryInterface + dbContext = UnoRuntime.queryInterface (XNamingService.class, cont) ; } catch (com.sun.star.uno.Exception e) {} @@ -320,9 +320,8 @@ public class DBTools { revokeDB(name) ; } catch (com.sun.star.uno.Exception e) {} - XDocumentDataSource xDDS = (XDocumentDataSource) - UnoRuntime.queryInterface(XDocumentDataSource.class, dataSource); - XStorable store = (XStorable) UnoRuntime.queryInterface(XStorable.class, + XDocumentDataSource xDDS = UnoRuntime.queryInterface(XDocumentDataSource.class, dataSource); + XStorable store = UnoRuntime.queryInterface(XStorable.class, xDDS.getDatabaseDocument()); String aFile = utils.getOfficeTemp(xMSF) + name + ".odb"; store.storeAsURL(aFile, new PropertyValue[] { }); @@ -355,11 +354,9 @@ public class DBTools { dbContext.registerObject(contextName, newSource) ; Object handler = xMSF.createInstance("com.sun.star.sdb.InteractionHandler"); - XInteractionHandler xHandler = (XInteractionHandler) - UnoRuntime.queryInterface(XInteractionHandler.class, handler) ; + XInteractionHandler xHandler = UnoRuntime.queryInterface(XInteractionHandler.class, handler) ; - XCompletedConnection xSrcCon = (XCompletedConnection) - UnoRuntime.queryInterface(XCompletedConnection.class, newSource) ; + XCompletedConnection xSrcCon = UnoRuntime.queryInterface(XCompletedConnection.class, newSource) ; XConnection con = xSrcCon.connectWithCompletion(xHandler) ; @@ -416,11 +413,9 @@ public class DBTools { throws com.sun.star.uno.Exception { Object handler = xMSF.createInstance("com.sun.star.sdb.InteractionHandler"); - XInteractionHandler xHandler = (XInteractionHandler) - UnoRuntime.queryInterface(XInteractionHandler.class, handler) ; + XInteractionHandler xHandler = UnoRuntime.queryInterface(XInteractionHandler.class, handler) ; - XCompletedConnection xSrcCon = (XCompletedConnection) - UnoRuntime.queryInterface(XCompletedConnection.class, dbSource) ; + XCompletedConnection xSrcCon = UnoRuntime.queryInterface(XCompletedConnection.class, dbSource) ; return xSrcCon.connectWithCompletion(xHandler) ; } @@ -510,7 +505,7 @@ public class DBTools { XResultSet set = stat.executeQuery("SELECT * FROM " + table) ; - XResultSetUpdate updt = (XResultSetUpdate) UnoRuntime.queryInterface + XResultSetUpdate updt = UnoRuntime.queryInterface (XResultSetUpdate.class, set) ; int count = 0 ; @@ -524,7 +519,7 @@ public class DBTools { count ++ ; } - XCloseable xClose = (XCloseable) UnoRuntime.queryInterface + XCloseable xClose = UnoRuntime.queryInterface (XCloseable.class, set) ; xClose.close() ; @@ -556,10 +551,10 @@ public class DBTools { XResultSet set = stat.executeQuery("SELECT * FROM " + table) ; - XResultSetUpdate updt = (XResultSetUpdate) UnoRuntime.queryInterface + XResultSetUpdate updt = UnoRuntime.queryInterface (XResultSetUpdate.class, set) ; - XRowUpdate rowUpdt = (XRowUpdate) UnoRuntime.queryInterface + XRowUpdate rowUpdt = UnoRuntime.queryInterface (XRowUpdate.class, set) ; updt.moveToInsertRow() ; @@ -592,7 +587,7 @@ public class DBTools { updt.insertRow() ; - XCloseable xClose = (XCloseable) UnoRuntime.queryInterface + XCloseable xClose = UnoRuntime.queryInterface (XCloseable.class, set) ; xClose.close() ; } @@ -622,8 +617,7 @@ public class DBTools { * Prints full info about currently registered DataSource's. */ public void printRegisteredDatabasesInfo(PrintWriter out) { - XEnumerationAccess dbContEA = (XEnumerationAccess) - UnoRuntime.queryInterface(XEnumerationAccess.class, dbContext) ; + XEnumerationAccess dbContEA = UnoRuntime.queryInterface(XEnumerationAccess.class, dbContext) ; XEnumeration xEnum = dbContEA.createEnumeration() ; diff --git a/qadevOOo/runner/util/DesktopTools.java b/qadevOOo/runner/util/DesktopTools.java index 0c7e6b3913d4..e24037f6c622 100644 --- a/qadevOOo/runner/util/DesktopTools.java +++ b/qadevOOo/runner/util/DesktopTools.java @@ -59,10 +59,10 @@ public class DesktopTools */ public static XComponentLoader getCLoader(XMultiServiceFactory xMSF) { - XDesktop oDesktop = (XDesktop) UnoRuntime.queryInterface( + XDesktop oDesktop = UnoRuntime.queryInterface( XDesktop.class, createDesktop(xMSF)); - XComponentLoader oCLoader = (XComponentLoader) UnoRuntime.queryInterface( + XComponentLoader oCLoader = UnoRuntime.queryInterface( XComponentLoader.class, oDesktop); return oCLoader; @@ -97,7 +97,7 @@ public class DesktopTools */ public static XEnumeration getAllComponents(XMultiServiceFactory xMSF) { - XDesktop xDesktop = (XDesktop) UnoRuntime.queryInterface( + XDesktop xDesktop = UnoRuntime.queryInterface( XDesktop.class, createDesktop(xMSF)); return xDesktop.getComponents().createEnumeration(); } @@ -109,7 +109,7 @@ public class DesktopTools */ public static XComponent getCurrentComponent(XMultiServiceFactory xMSF) { - XDesktop xDesktop = (XDesktop) UnoRuntime.queryInterface( + XDesktop xDesktop = UnoRuntime.queryInterface( XDesktop.class, createDesktop(xMSF)); return xDesktop.getCurrentComponent(); } @@ -121,7 +121,7 @@ public class DesktopTools */ public static XFrame getCurrentFrame(XMultiServiceFactory xMSF) { - XDesktop xDesktop = (XDesktop) UnoRuntime.queryInterface( + XDesktop xDesktop = UnoRuntime.queryInterface( XDesktop.class, createDesktop(xMSF)); return xDesktop.getCurrentFrame(); } @@ -138,8 +138,8 @@ public class DesktopTools */ public static Object[] getAllOpenDocuments(XMultiServiceFactory xMSF) { - ArrayList components = new ArrayList(); - XDesktop xDesktop = (XDesktop) UnoRuntime.queryInterface( + ArrayList<XComponent> components = new ArrayList<XComponent>(); + XDesktop xDesktop = UnoRuntime.queryInterface( XDesktop.class, createDesktop(xMSF)); XEnumeration allComp = getAllComponents(xMSF); @@ -148,7 +148,7 @@ public class DesktopTools { try { - XComponent xComponent = (XComponent) UnoRuntime.queryInterface( + XComponent xComponent = UnoRuntime.queryInterface( XComponent.class, allComp.nextElement()); if (getDocumentType(xComponent) != null) @@ -293,8 +293,8 @@ public class DesktopTools System.out.println("The property 'KeepDocument' is set and so the document won't be disposed"); return; } - XModifiable modified = (XModifiable) UnoRuntime.queryInterface(XModifiable.class, DocumentToClose); - XCloseable closer = (XCloseable) UnoRuntime.queryInterface(XCloseable.class, DocumentToClose); + XModifiable modified = UnoRuntime.queryInterface(XModifiable.class, DocumentToClose); + XCloseable closer = UnoRuntime.queryInterface(XCloseable.class, DocumentToClose); try { @@ -363,7 +363,7 @@ public class DesktopTools throw new StatusException("Couldn't get toolkit", e); } - XToolkit tk = (XToolkit) UnoRuntime.queryInterface( + XToolkit tk = UnoRuntime.queryInterface( XToolkit.class, oObj); WindowDescriptor descriptor = new com.sun.star.awt.WindowDescriptor(); @@ -408,9 +408,9 @@ public class DesktopTools { try { - XModel xMod = (XModel) UnoRuntime.queryInterface(XModel.class, xDoc); + XModel xMod = UnoRuntime.queryInterface(XModel.class, xDoc); XInterface oCont = xMod.getCurrentController(); - XViewSettingsSupplier oVSSupp = (XViewSettingsSupplier) UnoRuntime.queryInterface(XViewSettingsSupplier.class, oCont); + XViewSettingsSupplier oVSSupp = UnoRuntime.queryInterface(XViewSettingsSupplier.class, oCont); XInterface oViewSettings = oVSSupp.getViewSettings(); XPropertySet oViewProp = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, oViewSettings); @@ -488,9 +488,9 @@ public class DesktopTools // System.out.println("DEBUG: bring to front xModel"); XTopWindow xTopWindow = - (XTopWindow) UnoRuntime.queryInterface( - XTopWindow.class, - xModel.getCurrentController().getFrame().getContainerWindow()); + UnoRuntime.queryInterface( + XTopWindow.class, + xModel.getCurrentController().getFrame().getContainerWindow()); xTopWindow.toFront(); } @@ -498,7 +498,7 @@ public class DesktopTools public static void bringWindowToFront(XComponent xComponent) { // System.out.println("DEBUG: bring to front xComponent"); - XModel xModel = (XModel) UnoRuntime.queryInterface(XModel.class, xComponent); + XModel xModel = UnoRuntime.queryInterface(XModel.class, xComponent); if (xModel != null) { bringWindowToFront(xModel); diff --git a/qadevOOo/runner/util/DrawTools.java b/qadevOOo/runner/util/DrawTools.java index 64270d8ca9f9..842f34affee5 100644 --- a/qadevOOo/runner/util/DrawTools.java +++ b/qadevOOo/runner/util/DrawTools.java @@ -68,8 +68,7 @@ public class DrawTools { public static XDrawPages getDrawPages ( XComponent aDoc ) { XDrawPages oDPn = null; try { - XDrawPagesSupplier oDPS = (XDrawPagesSupplier) - UnoRuntime.queryInterface(XDrawPagesSupplier.class,aDoc); + XDrawPagesSupplier oDPS = UnoRuntime.queryInterface(XDrawPagesSupplier.class,aDoc); oDPn = oDPS.getDrawPages(); } catch ( Exception e ) { @@ -105,7 +104,7 @@ public class DrawTools { */ public static XShapes getShapes ( XDrawPage oDP ) { - return (XShapes) UnoRuntime.queryInterface(XShapes.class,oDP); + return UnoRuntime.queryInterface(XShapes.class,oDP); } /** diff --git a/qadevOOo/runner/util/DynamicClassLoader.java b/qadevOOo/runner/util/DynamicClassLoader.java index 702264017176..dbb3dd7972c2 100644 --- a/qadevOOo/runner/util/DynamicClassLoader.java +++ b/qadevOOo/runner/util/DynamicClassLoader.java @@ -31,7 +31,7 @@ public class DynamicClassLoader { * @param className The name of the class to create. * @return The created class. */ - public static Class forName(String className) + public static Class<?> forName(String className) throws ClassNotFoundException { return Class.forName(className) ; @@ -45,7 +45,7 @@ public class DynamicClassLoader { public Object getInstance(String className) throws IllegalArgumentException { try { - Class cls = DynamicClassLoader.forName(className); + Class<?> cls = DynamicClassLoader.forName(className); return cls.newInstance(); } catch ( ClassNotFoundException e ) { throw new IllegalArgumentException("Couldn't find " + className @@ -68,7 +68,7 @@ public class DynamicClassLoader { */ public Object getInstance(String className, Object[] ctorArgs) throws IllegalArgumentException { - Class[] ctorType = new Class[ctorArgs.length]; + Class<?>[] ctorType = new Class[ctorArgs.length]; for(int i=0; i<ctorType.length; i++) { ctorType[i] = ctorArgs[i].getClass(); } @@ -85,11 +85,11 @@ public class DynamicClassLoader { * @param ctorArgs Arguments for the constructor. * @return The instance of the class. */ - public Object getInstance(String className, Class[]ctorClassTypes, Object[] ctorArgs) + public Object getInstance(String className, Class<?>[]ctorClassTypes, Object[] ctorArgs) throws IllegalArgumentException { try { - Class cls = DynamicClassLoader.forName(className); - Constructor ctor = cls.getConstructor(ctorClassTypes); + Class<?> cls = DynamicClassLoader.forName(className); + Constructor<?> ctor = cls.getConstructor(ctorClassTypes); System.out.println("ctor: " + ctor.getName() + " " + ctor.getModifiers()); return ctor.newInstance(ctorArgs); diff --git a/qadevOOo/runner/util/FormTools.java b/qadevOOo/runner/util/FormTools.java index 2dc2f3bc1906..7bafd75047df 100644 --- a/qadevOOo/runner/util/FormTools.java +++ b/qadevOOo/runner/util/FormTools.java @@ -65,8 +65,7 @@ public class FormTools { XControlModel aControl = null; //get MSF - XMultiServiceFactory oDocMSF = (XMultiServiceFactory) - UnoRuntime.queryInterface( XMultiServiceFactory.class, oDoc ); + XMultiServiceFactory oDocMSF = UnoRuntime.queryInterface( XMultiServiceFactory.class, oDoc ); try{ Object oInt = oDocMSF.createInstance("com.sun.star.drawing.ControlShape"); @@ -74,8 +73,8 @@ public class FormTools { XPropertySet model_props = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class,aCon); model_props.setPropertyValue("DefaultControl","com.sun.star.form.control."+kind); - aControl = (XControlModel) UnoRuntime.queryInterface( XControlModel.class, aCon ); - oCShape = (XControlShape) UnoRuntime.queryInterface( XControlShape.class, oInt ); + aControl = UnoRuntime.queryInterface( XControlModel.class, aCon ); + oCShape = UnoRuntime.queryInterface( XControlShape.class, oInt ); size.Height = height; size.Width = width; position.X = x; @@ -101,7 +100,7 @@ public class FormTools { XControlModel aControl = null; //get MSF - XMultiServiceFactory oDocMSF = (XMultiServiceFactory) UnoRuntime.queryInterface( XMultiServiceFactory.class, oDoc ); + XMultiServiceFactory oDocMSF = UnoRuntime.queryInterface( XMultiServiceFactory.class, oDoc ); try{ Object oInt = oDocMSF.createInstance("com.sun.star.drawing.ControlShape"); @@ -109,8 +108,8 @@ public class FormTools { XPropertySet model_props = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class,aCon); model_props.setPropertyValue("DefaultControl","com.sun.star.awt."+defControl); - aControl = (XControlModel) UnoRuntime.queryInterface( XControlModel.class, aCon ); - oCShape = (XControlShape) UnoRuntime.queryInterface( XControlShape.class, oInt ); + aControl = UnoRuntime.queryInterface( XControlModel.class, aCon ); + oCShape = UnoRuntime.queryInterface( XControlShape.class, oInt ); size.Height = height; size.Width = width; position.X = x; @@ -138,14 +137,14 @@ public class FormTools { XControlModel aControl = null; //get MSF - XMultiServiceFactory oDocMSF = (XMultiServiceFactory) UnoRuntime.queryInterface( XMultiServiceFactory.class, oDoc ); + XMultiServiceFactory oDocMSF = UnoRuntime.queryInterface( XMultiServiceFactory.class, oDoc ); try{ Object oInt = oDocMSF.createInstance("com.sun.star.drawing.ControlShape"); Object aCon = oDocMSF.createInstance("com.sun.star.form.component."+kind); - aControl = (XControlModel) UnoRuntime.queryInterface( XControlModel.class, aCon ); - oCShape = (XControlShape) UnoRuntime.queryInterface( XControlShape.class, oInt ); + aControl = UnoRuntime.queryInterface( XControlModel.class, aCon ); + oCShape = UnoRuntime.queryInterface( XControlShape.class, oInt ); size.Height = height; size.Width = width; position.X = x; @@ -168,8 +167,7 @@ public class FormTools { XInterface oControl = null; - XMultiServiceFactory oDocMSF = (XMultiServiceFactory) - UnoRuntime.queryInterface( XMultiServiceFactory.class, oDoc ); + XMultiServiceFactory oDocMSF = UnoRuntime.queryInterface( XMultiServiceFactory.class, oDoc ); try{ oControl = (XInterface) oDocMSF.createInstance( @@ -183,16 +181,16 @@ public class FormTools { public static XNameContainer getForms ( XDrawPage oDP ) { - XFormsSupplier oFS = (XFormsSupplier) UnoRuntime.queryInterface( + XFormsSupplier oFS = UnoRuntime.queryInterface( XFormsSupplier.class,oDP); return oFS.getForms(); } //finish getForms public static XIndexContainer getIndexedForms ( XDrawPage oDP ) { - XFormsSupplier oFS = (XFormsSupplier) UnoRuntime.queryInterface( + XFormsSupplier oFS = UnoRuntime.queryInterface( XFormsSupplier.class,oDP); - return (XIndexContainer)UnoRuntime.queryInterface( XIndexContainer.class, + return UnoRuntime.queryInterface( XIndexContainer.class, oFS.getForms() ); } //finish getIndexedForms @@ -231,7 +229,7 @@ public class FormTools { formProps.setPropertyValue("DataSourceName","Bibliography"); formProps.setPropertyValue("Command","biblio"); formProps.setPropertyValue("CommandType",new Integer(com.sun.star.sdb.CommandType.TABLE)); - formLoader = (XLoadable) UnoRuntime.queryInterface(XLoadable.class, the_form); + formLoader = UnoRuntime.queryInterface(XLoadable.class, the_form); } catch (Exception ex) { System.out.println("Exception: "+ex); @@ -261,7 +259,7 @@ public class FormTools { formProps.setPropertyValue("Command",tableName); formProps.setPropertyValue("CommandType",new Integer(com.sun.star.sdb.CommandType.TABLE)); - return (XLoadable) UnoRuntime.queryInterface(XLoadable.class, the_form); + return UnoRuntime.queryInterface(XLoadable.class, the_form); } public static XLoadable bindForm( XTextDocument aDoc, String formName ) { @@ -273,7 +271,7 @@ public class FormTools { formProps.setPropertyValue("DataSourceName","Bibliography"); formProps.setPropertyValue("Command","biblio"); formProps.setPropertyValue("CommandType",new Integer(com.sun.star.sdb.CommandType.TABLE)); - formLoader = (XLoadable) UnoRuntime.queryInterface(XLoadable.class, the_form); + formLoader = UnoRuntime.queryInterface(XLoadable.class, the_form); } catch (Exception ex) { System.out.println("Exception: "+ex); @@ -304,22 +302,21 @@ public class FormTools { formProps.setPropertyValue("Command",tableName); formProps.setPropertyValue("CommandType",new Integer(com.sun.star.sdb.CommandType.TABLE)); - return (XLoadable) UnoRuntime.queryInterface(XLoadable.class, the_form); + return UnoRuntime.queryInterface(XLoadable.class, the_form); } public static void switchDesignOf(XMultiServiceFactory xMSF, XTextDocument aDoc) { try { com.sun.star.frame.XController aController = aDoc.getCurrentController(); com.sun.star.frame.XFrame aFrame = aController.getFrame(); - com.sun.star.frame.XDispatchProvider aDispProv = (com.sun.star.frame.XDispatchProvider) - UnoRuntime.queryInterface(com.sun.star.frame.XDispatchProvider.class,aFrame); + com.sun.star.frame.XDispatchProvider aDispProv = UnoRuntime.queryInterface(com.sun.star.frame.XDispatchProvider.class,aFrame); com.sun.star.util.URL aURL = new com.sun.star.util.URL(); aURL.Complete = ".uno:SwitchControlDesignMode"; Object instance = xMSF.createInstance("com.sun.star.util.URLTransformer"); com.sun.star.util.XURLTransformer atrans = - (com.sun.star.util.XURLTransformer)UnoRuntime.queryInterface( - com.sun.star.util.XURLTransformer.class,instance); + UnoRuntime.queryInterface( + com.sun.star.util.XURLTransformer.class,instance); com.sun.star.util.URL[] aURLA = new com.sun.star.util.URL[1]; aURLA[0] = aURL; atrans.parseStrict(aURLA); diff --git a/qadevOOo/runner/util/FrameDsc.java b/qadevOOo/runner/util/FrameDsc.java index 86a80465f0eb..e5448afa651c 100644 --- a/qadevOOo/runner/util/FrameDsc.java +++ b/qadevOOo/runner/util/FrameDsc.java @@ -85,7 +85,7 @@ public class FrameDsc extends InstDescr { } catch( com.sun.star.uno.Exception cssuE ){ } - XShape shape = (XShape)UnoRuntime.queryInterface( XShape.class, SrvObj ); + XShape shape = UnoRuntime.queryInterface( XShape.class, SrvObj ); try { shape.setSize(size); } diff --git a/qadevOOo/runner/util/InstCreator.java b/qadevOOo/runner/util/InstCreator.java index bfd894c0e296..684b93479dd8 100644 --- a/qadevOOo/runner/util/InstCreator.java +++ b/qadevOOo/runner/util/InstCreator.java @@ -43,7 +43,7 @@ public class InstCreator implements XInstCreator { this.xParent = xParent; this.iDsc = iDsc; - xMSF = (XMultiServiceFactory)UnoRuntime.queryInterface( + xMSF = UnoRuntime.queryInterface( XMultiServiceFactory.class, xParent ); xInstance = createInstance(); @@ -70,44 +70,39 @@ public class InstCreator implements XInstCreator { XNameAccess oNA = null; if ( iDsc instanceof TableDsc ) { - XTextTablesSupplier oTTS = (XTextTablesSupplier) - UnoRuntime.queryInterface( - XTextTablesSupplier.class, xParent ); + XTextTablesSupplier oTTS = UnoRuntime.queryInterface( + XTextTablesSupplier.class, xParent ); oNA = oTTS.getTextTables(); } if ( iDsc instanceof FrameDsc ) { - XTextFramesSupplier oTTS = (XTextFramesSupplier) - UnoRuntime.queryInterface( - XTextFramesSupplier.class, xParent ); + XTextFramesSupplier oTTS = UnoRuntime.queryInterface( + XTextFramesSupplier.class, xParent ); oNA = oTTS.getTextFrames(); } if ( iDsc instanceof BookmarkDsc ) { - XBookmarksSupplier oTTS = (XBookmarksSupplier) - UnoRuntime.queryInterface( - XBookmarksSupplier.class, xParent ); + XBookmarksSupplier oTTS = UnoRuntime.queryInterface( + XBookmarksSupplier.class, xParent ); oNA = oTTS.getBookmarks(); } if ( iDsc instanceof FootnoteDsc ) { - XFootnotesSupplier oTTS = (XFootnotesSupplier) - UnoRuntime.queryInterface( - XFootnotesSupplier.class, xParent ); + XFootnotesSupplier oTTS = UnoRuntime.queryInterface( + XFootnotesSupplier.class, xParent ); return( oTTS.getFootnotes() ); } if ( iDsc instanceof TextSectionDsc ) { - XTextSectionsSupplier oTSS = (XTextSectionsSupplier) - UnoRuntime.queryInterface( - XTextSectionsSupplier.class, xParent ); + XTextSectionsSupplier oTSS = UnoRuntime.queryInterface( + XTextSectionsSupplier.class, xParent ); oNA = oTSS.getTextSections(); } - return (XIndexAccess)UnoRuntime.queryInterface( + return UnoRuntime.queryInterface( XIndexAccess.class, oNA); } }
\ No newline at end of file diff --git a/qadevOOo/runner/util/InstDescr.java b/qadevOOo/runner/util/InstDescr.java index 14a7bc89f0db..7b349b0f8427 100644 --- a/qadevOOo/runner/util/InstDescr.java +++ b/qadevOOo/runner/util/InstDescr.java @@ -25,7 +25,7 @@ import com.sun.star.uno.XInterface; */ abstract public class InstDescr { - protected Class ifcClass = null; + protected Class<?> ifcClass = null; protected abstract String getIfcName(); protected abstract String getName(); @@ -33,7 +33,7 @@ abstract public class InstDescr { /** * the method getIfcClass */ - public Class getIfcClass() { + public Class<?> getIfcClass() { return ifcClass; } /** diff --git a/qadevOOo/runner/util/RegistryTools.java b/qadevOOo/runner/util/RegistryTools.java index cff6783272c1..d8129087d4f9 100644 --- a/qadevOOo/runner/util/RegistryTools.java +++ b/qadevOOo/runner/util/RegistryTools.java @@ -43,7 +43,7 @@ public class RegistryTools { Object oInterface = xMSF.createInstance ("com.sun.star.registry.SimpleRegistry"); - return (XSimpleRegistry) UnoRuntime.queryInterface ( + return UnoRuntime.queryInterface ( XSimpleRegistry.class, oInterface) ; } diff --git a/qadevOOo/runner/util/SOfficeFactory.java b/qadevOOo/runner/util/SOfficeFactory.java index 27398b2f486e..327b271c946c 100644 --- a/qadevOOo/runner/util/SOfficeFactory.java +++ b/qadevOOo/runner/util/SOfficeFactory.java @@ -44,7 +44,7 @@ import com.sun.star.awt.*; public class SOfficeFactory { - private static HashMap lookup = new HashMap(10); + private static HashMap<String, SOfficeFactory> lookup = new HashMap<String, SOfficeFactory>(10); protected XComponentLoader oCLoader; private SOfficeFactory(XMultiServiceFactory xMSF) { @@ -58,16 +58,16 @@ public class SOfficeFactory { } // query the desktop interface and then it's componentloader - XDesktop oDesktop = (XDesktop) UnoRuntime.queryInterface( + XDesktop oDesktop = UnoRuntime.queryInterface( XDesktop.class, oInterface); - oCLoader = (XComponentLoader) UnoRuntime.queryInterface( + oCLoader = UnoRuntime.queryInterface( XComponentLoader.class, oDesktop); } public static SOfficeFactory getFactory(XMultiServiceFactory xMSF) { - SOfficeFactory soFactory = (SOfficeFactory) lookup.get(new Integer(xMSF.hashCode()).toString()); + SOfficeFactory soFactory = lookup.get(new Integer(xMSF.hashCode()).toString()); if (soFactory == null) { soFactory = new SOfficeFactory(xMSF); @@ -92,7 +92,7 @@ public class SOfficeFactory { if (oDoc != null) { DesktopTools.bringWindowToFront(oDoc); - return (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, oDoc); + return UnoRuntime.queryInterface(XTextDocument.class, oDoc); } else { return null; } @@ -111,7 +111,7 @@ public class SOfficeFactory { if (oDoc != null) { DesktopTools.bringWindowToFront(oDoc); - return (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, oDoc); + return UnoRuntime.queryInterface(XTextDocument.class, oDoc); } else { return null; } @@ -129,7 +129,7 @@ public class SOfficeFactory { if (oDoc != null) { DesktopTools.bringWindowToFront(oDoc); - return (XSpreadsheetDocument) UnoRuntime.queryInterface(XSpreadsheetDocument.class, oDoc); + return UnoRuntime.queryInterface(XSpreadsheetDocument.class, oDoc); } else { return null; } @@ -147,7 +147,7 @@ public class SOfficeFactory { if (oDoc != null) { DesktopTools.bringWindowToFront(oDoc); - return (XSpreadsheetDocument) UnoRuntime.queryInterface(XSpreadsheetDocument.class, oDoc); + return UnoRuntime.queryInterface(XSpreadsheetDocument.class, oDoc); } else { return null; } @@ -225,7 +225,7 @@ public class SOfficeFactory { if (oDoc != null) { DesktopTools.bringWindowToFront(oDoc); - return (XChartDocument) UnoRuntime.queryInterface(XChartDocument.class, oDoc); + return UnoRuntime.queryInterface(XChartDocument.class, oDoc); } else { return null; } @@ -290,7 +290,7 @@ public class SOfficeFactory { public static void insertString(XTextDocument xTextDoc, String cString) throws com.sun.star.uno.Exception { XText xText = xTextDoc.getText(); - XText oText = (XText) UnoRuntime.queryInterface( + XText oText = UnoRuntime.queryInterface( XText.class, xText); XTextCursor oCursor = oText.createTextCursor(); @@ -301,7 +301,7 @@ public class SOfficeFactory { XTextContent xCont) throws com.sun.star.lang.IllegalArgumentException { XText xText = xTextDoc.getText(); - XText oText = (XText) UnoRuntime.queryInterface( + XText oText = UnoRuntime.queryInterface( XText.class, xText); XTextCursor oCursor = oText.createTextCursor(); @@ -367,12 +367,12 @@ public class SOfficeFactory { public static XTextContent createIndex(XTextDocument xTextDoc, String kind) throws com.sun.star.uno.Exception { - XMultiServiceFactory oDocMSF = (XMultiServiceFactory) UnoRuntime.queryInterface(XMultiServiceFactory.class, + XMultiServiceFactory oDocMSF = UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDoc); Object oInt = oDocMSF.createInstance(kind); - XTextContent xTC = (XTextContent) UnoRuntime.queryInterface(XDocumentIndex.class, oInt); + XTextContent xTC = UnoRuntime.queryInterface(XDocumentIndex.class, oInt); return xTC; @@ -381,7 +381,7 @@ public class SOfficeFactory { public static XSpreadsheet createSpreadsheet(XSpreadsheetDocument oDoc) throws com.sun.star.uno.Exception { - XMultiServiceFactory oDocMSF = (XMultiServiceFactory) UnoRuntime.queryInterface(XMultiServiceFactory.class, oDoc); + XMultiServiceFactory oDocMSF = UnoRuntime.queryInterface(XMultiServiceFactory.class, oDoc); Object oInt = oDocMSF.createInstance( "com.sun.star.sheet.Spreadsheet"); @@ -393,10 +393,10 @@ public class SOfficeFactory { public static XIndexAccess getTableCollection(XTextDocument oDoc) { - XTextTablesSupplier oTTS = (XTextTablesSupplier) UnoRuntime.queryInterface(XTextTablesSupplier.class, oDoc); + XTextTablesSupplier oTTS = UnoRuntime.queryInterface(XTextTablesSupplier.class, oDoc); XNameAccess oNA = oTTS.getTextTables(); - XIndexAccess oIA = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, oNA); + XIndexAccess oIA = UnoRuntime.queryInterface(XIndexAccess.class, oNA); return oIA; } @@ -433,11 +433,11 @@ public class SOfficeFactory { XDiagram oDiagram = null; //get LineDiagram - XMultiServiceFactory oDocMSF = (XMultiServiceFactory) UnoRuntime.queryInterface(XMultiServiceFactory.class, oDoc); + XMultiServiceFactory oDocMSF = UnoRuntime.queryInterface(XMultiServiceFactory.class, oDoc); try { oInterface = (XInterface) oDocMSF.createInstance("com.sun.star.chart." + kind); - oDiagram = (XDiagram) UnoRuntime.queryInterface(XDiagram.class, oInterface); + oDiagram = UnoRuntime.queryInterface(XDiagram.class, oInterface); } catch (Exception e) { // Some exception occures.FAILED System.out.println("Couldn't create " + kind + "-Diagram " + e); @@ -452,7 +452,7 @@ public class SOfficeFactory { XInterface oControl = null; - XMultiServiceFactory oDocMSF = (XMultiServiceFactory) UnoRuntime.queryInterface(XMultiServiceFactory.class, oDoc); + XMultiServiceFactory oDocMSF = UnoRuntime.queryInterface(XMultiServiceFactory.class, oDoc); try { oControl = (XInterface) oDocMSF.createInstance("com.sun.star.form.component." + kind); @@ -470,7 +470,7 @@ public class SOfficeFactory { Object oInstance = null; - XMultiServiceFactory oDocMSF = (XMultiServiceFactory) UnoRuntime.queryInterface(XMultiServiceFactory.class, oDoc); + XMultiServiceFactory oDocMSF = UnoRuntime.queryInterface(XMultiServiceFactory.class, oDoc); try { oInstance = (Object) oDocMSF.createInstance(kind); @@ -489,13 +489,13 @@ public class SOfficeFactory { XControlModel aControl = null; //get MSF - XMultiServiceFactory oDocMSF = (XMultiServiceFactory) UnoRuntime.queryInterface(XMultiServiceFactory.class, oDoc); + XMultiServiceFactory oDocMSF = UnoRuntime.queryInterface(XMultiServiceFactory.class, oDoc); try { Object oInt = oDocMSF.createInstance("com.sun.star.drawing.ControlShape"); Object aCon = oDocMSF.createInstance("com.sun.star.form.component." + kind); - aControl = (XControlModel) UnoRuntime.queryInterface(XControlModel.class, aCon); - oCShape = (XControlShape) UnoRuntime.queryInterface(XControlShape.class, oInt); + aControl = UnoRuntime.queryInterface(XControlModel.class, aCon); + oCShape = UnoRuntime.queryInterface(XControlShape.class, oInt); size.Height = height; size.Width = width; position.X = x; diff --git a/qadevOOo/runner/util/SysUtils.java b/qadevOOo/runner/util/SysUtils.java index 6252a7eb930d..78abc9502883 100644 --- a/qadevOOo/runner/util/SysUtils.java +++ b/qadevOOo/runner/util/SysUtils.java @@ -41,7 +41,7 @@ public class SysUtils { return jh; } - static ArrayList files = new ArrayList(); + static ArrayList<String> files = new ArrayList<String>(); public static Object[] traverse( String afileDirectory ) { @@ -89,7 +89,7 @@ public class SysUtils { XComponent ac = null; try { Object desk = msf.createInstance("com.sun.star.frame.Desktop"); - XDesktop xDesk = (XDesktop) UnoRuntime.queryInterface(XDesktop.class,desk); + XDesktop xDesk = UnoRuntime.queryInterface(XDesktop.class,desk); ac = xDesk.getCurrentComponent(); } catch (com.sun.star.uno.Exception e) { System.out.println("Couldn't get active Component"); @@ -100,7 +100,7 @@ public class SysUtils { public static XFrame getActiveFrame(XMultiServiceFactory msf) { try { Object desk = msf.createInstance("com.sun.star.frame.Desktop"); - XDesktop xDesk = (XDesktop) UnoRuntime.queryInterface(XDesktop.class,desk); + XDesktop xDesk = UnoRuntime.queryInterface(XDesktop.class,desk); return xDesk.getCurrentFrame(); } catch (com.sun.star.uno.Exception e) { System.out.println("Couldn't get active Component"); @@ -122,7 +122,7 @@ public class SysUtils { public static String getSysClipboardText(XMultiServiceFactory msf) throws com.sun.star.uno.Exception { - XClipboard xCB = (XClipboard) UnoRuntime.queryInterface + XClipboard xCB = UnoRuntime.queryInterface (XClipboard.class, msf.createInstance ("com.sun.star.datatransfer.clipboard.SystemClipboard")); diff --git a/qadevOOo/runner/util/UITools.java b/qadevOOo/runner/util/UITools.java index a489498fd8b4..bb35f80fd87e 100644 --- a/qadevOOo/runner/util/UITools.java +++ b/qadevOOo/runner/util/UITools.java @@ -61,7 +61,7 @@ public class UITools { public UITools(XMultiServiceFactory msf, XTextDocument xTextDoc) { mMSF = msf; - XModel xModel = (XModel) UnoRuntime.queryInterface(XModel.class, xTextDoc); + XModel xModel = UnoRuntime.queryInterface(XModel.class, xTextDoc); mXRoot = makeRoot(mMSF, xModel); } @@ -80,23 +80,20 @@ public class UITools { private static String getString(XInterface xInt) { - XAccessibleText oText = (XAccessibleText) - UnoRuntime.queryInterface(XAccessibleText.class, xInt); + XAccessibleText oText = UnoRuntime.queryInterface(XAccessibleText.class, xInt); return oText.getText(); } private static void setString(XInterface xInt, String cText) { - XAccessibleEditableText oText = (XAccessibleEditableText) - UnoRuntime.queryInterface(XAccessibleEditableText.class, xInt); + XAccessibleEditableText oText = UnoRuntime.queryInterface(XAccessibleEditableText.class, xInt); oText.setText(cText); } private static Object getValue(XInterface xInt) { - XAccessibleValue oValue = (XAccessibleValue) - UnoRuntime.queryInterface(XAccessibleValue.class, xInt); + XAccessibleValue oValue = UnoRuntime.queryInterface(XAccessibleValue.class, xInt); return oValue.getCurrentValue(); } @@ -154,8 +151,7 @@ public class UITools { if (oButton == null){ throw new Exception("Could not get button '" + buttonName + "'"); } - XAccessibleAction oAction = (XAccessibleAction) - UnoRuntime.queryInterface(XAccessibleAction.class, oButton); + XAccessibleAction oAction = UnoRuntime.queryInterface(XAccessibleAction.class, oButton); // "click" the button try{ @@ -183,8 +179,7 @@ public class UITools { if (oButton != null){ boolean isChecked = oButton.getAccessibleStateSet().contains(com.sun.star.accessibility.AccessibleStateType.CHECKED); if((isChecked && !toBePressed) || (!isChecked && toBePressed)){ - XAccessibleAction oAction = (XAccessibleAction) - UnoRuntime.queryInterface(XAccessibleAction.class, oButton); + XAccessibleAction oAction = UnoRuntime.queryInterface(XAccessibleAction.class, oButton); try{ // "click" the button oAction.doAccessibleAction(0); @@ -269,8 +264,7 @@ public class UITools { XInterface xRB =mAT.getAccessibleObjectForRole(mXRoot, AccessibleRole.RADIO_BUTTON, buttonName); if(xRB == null) System.out.println("AccessibleObjectForRole couldn't be found for " + buttonName); - XAccessibleValue oValue = (XAccessibleValue) - UnoRuntime.queryInterface(XAccessibleValue.class, xRB); + XAccessibleValue oValue = UnoRuntime.queryInterface(XAccessibleValue.class, xRB); if(oValue == null) System.out.println("XAccessibleValue couldn't be queried for " + buttonName); oValue.setCurrentValue(new Integer(iValue)); @@ -301,15 +295,13 @@ public class UITools { xListBox =mAT.getAccessibleObjectForRole(mXRoot, AccessibleRole.PANEL, ListBoxName); } - XAccessible xListBoxAccess = (XAccessible) - UnoRuntime.queryInterface(XAccessible.class, xListBox); + XAccessible xListBoxAccess = UnoRuntime.queryInterface(XAccessible.class, xListBox); // if a List is not pulled to be open all entries are not visiblle, therefore the // boolean argument XAccessibleContext xList =mAT.getAccessibleObjectForRole( xListBoxAccess, AccessibleRole.LIST, true); - XAccessibleSelection xListSelect = (XAccessibleSelection) - UnoRuntime.queryInterface(XAccessibleSelection.class, xList); + XAccessibleSelection xListSelect = UnoRuntime.queryInterface(XAccessibleSelection.class, xList); xListSelect.selectAccessibleChild(nChildIndex); @@ -329,7 +321,7 @@ public class UITools { public Object[] getListBoxObjects(String ListBoxName) throws java.lang.Exception { - ArrayList Items = new ArrayList(); + ArrayList<XInterface> Items = new ArrayList<XInterface>(); try { XAccessibleContext xListBox = null; XAccessibleContext xList = null; @@ -349,8 +341,7 @@ public class UITools { // all other list boxes have a children of kind of LIST } else { - XAccessible xListBoxAccess = (XAccessible) - UnoRuntime.queryInterface(XAccessible.class, xListBox); + XAccessible xListBoxAccess = UnoRuntime.queryInterface(XAccessible.class, xListBox); // if a List is not pulled to be open all entries are not visiblle, therefore the // boolean argument xList =mAT.getAccessibleObjectForRole( @@ -393,7 +384,7 @@ public class UITools { public String[] getListBoxItems(String ListBoxName) throws java.lang.Exception { - ArrayList Items = new ArrayList(); + ArrayList<String> Items = new ArrayList<String>(); try { XAccessibleContext xListBox = null; XAccessibleContext xList = null; @@ -413,8 +404,7 @@ public class UITools { // all other list boxes have a children of kind of LIST } else { - XAccessible xListBoxAccess = (XAccessible) - UnoRuntime.queryInterface(XAccessible.class, xListBox); + XAccessible xListBoxAccess = UnoRuntime.queryInterface(XAccessible.class, xListBox); // if a List is not pulled to be open all entries are not visiblle, therefore the // boolean argument xList =mAT.getAccessibleObjectForRole( @@ -441,7 +431,7 @@ public class UITools { + ListBoxName + "' : " + e.toString()); } String[]ret = new String[Items.size()]; - return (String[])Items.toArray(ret); + return Items.toArray(ret); } /** * set to a named nureric filed a given value @@ -456,9 +446,8 @@ public class UITools { XInterface xNumericField =mAT.getAccessibleObjectForRole( mXRoot, AccessibleRole.TEXT, NumericFieldName); //util.dbg.printInterfaces(xNumericField); - XAccessibleEditableText oValue = (XAccessibleEditableText) - UnoRuntime.queryInterface( - XAccessibleEditableText.class, xNumericField); + XAccessibleEditableText oValue = UnoRuntime.queryInterface( + XAccessibleEditableText.class, xNumericField); setString(xNumericField, cValue); } catch (Exception e) { @@ -566,8 +555,7 @@ public class UITools { try{ XAccessibleContext xTextField =mAT.getAccessibleObjectForRole(mXRoot, AccessibleRole.SCROLL_PANE, TextFieldName); - XAccessible xTextFieldAccess = (XAccessible) - UnoRuntime.queryInterface(XAccessible.class, xTextField); + XAccessible xTextFieldAccess = UnoRuntime.queryInterface(XAccessible.class, xTextField); XAccessibleContext xFrame =mAT.getAccessibleObjectForRole( xTextFieldAccess, AccessibleRole.TEXT_FRAME); for (int i=0;i<xFrame.getAccessibleChildCount();i++) { @@ -608,8 +596,7 @@ public class UITools { try { XInterface xCheckBox =mAT.getAccessibleObjectForRole(mXRoot, AccessibleRole.CHECK_BOX, CheckBoxName); - XAccessibleValue xCheckBoxValue = (XAccessibleValue) - UnoRuntime.queryInterface(XAccessibleValue.class, xCheckBox); + XAccessibleValue xCheckBoxValue = UnoRuntime.queryInterface(XAccessibleValue.class, xCheckBox); xCheckBoxValue.setCurrentValue(Value); } catch (Exception e) { @@ -630,8 +617,7 @@ public class UITools { try { XInterface xCheckBox =mAT.getAccessibleObjectForRole(mXRoot, AccessibleRole.CHECK_BOX, CheckBoxName); - XAccessibleValue xCheckBoxValue = (XAccessibleValue) - UnoRuntime.queryInterface(XAccessibleValue.class, xCheckBox); + XAccessibleValue xCheckBoxValue = UnoRuntime.queryInterface(XAccessibleValue.class, xCheckBox); return (Integer) xCheckBoxValue.getCurrentValue(); } catch (Exception e) { @@ -677,8 +663,7 @@ public class UITools { } catch (com.sun.star.uno.Exception e) { throw new Exception("Could not toolkit: " + e.toString()); } - XExtendedToolkit tk = (XExtendedToolkit) - UnoRuntime.queryInterface(XExtendedToolkit.class, xToolKit); + XExtendedToolkit tk = UnoRuntime.queryInterface(XExtendedToolkit.class, xToolKit); int count = tk.getTopWindowCount(); @@ -706,13 +691,13 @@ public class UITools { if (retWindow == null) System.out.println("could not found window with name '" + WindowName + "'"); System.out.println("<- getTopWindow "); } - return (XWindow) UnoRuntime.queryInterface(XWindow.class, retWindow); + return UnoRuntime.queryInterface(XWindow.class, retWindow); } public void clickMiddleOfAccessibleObject(short role, String name){ XAccessibleContext xAcc =mAT.getAccessibleObjectForRole(mXRoot, role, name); - XAccessibleComponent aComp = (XAccessibleComponent) UnoRuntime.queryInterface( + XAccessibleComponent aComp = UnoRuntime.queryInterface( XAccessibleComponent.class, xAcc); System.out.println(xAcc.getAccessibleRole() + "," + @@ -744,7 +729,7 @@ public class UITools { public void doubleClickMiddleOfAccessibleObject(short role, String name) { XAccessibleContext xAcc =mAT.getAccessibleObjectForRole(mXRoot, role, name); - XAccessibleComponent aComp = (XAccessibleComponent) UnoRuntime.queryInterface( + XAccessibleComponent aComp = UnoRuntime.queryInterface( XAccessibleComponent.class, xAcc); System.out.println(xAcc.getAccessibleRole() + "," + diff --git a/qadevOOo/runner/util/ValueChanger.java b/qadevOOo/runner/util/ValueChanger.java index b2e9b2873654..00c86ff4138e 100644 --- a/qadevOOo/runner/util/ValueChanger.java +++ b/qadevOOo/runner/util/ValueChanger.java @@ -748,7 +748,7 @@ public class ValueChanger { if (oldValue instanceof com.sun.star.uno.Enum) { // universal changer for Enumerations try { - Class enumClass = oldValue.getClass() ; + Class<?> enumClass = oldValue.getClass() ; Field[] flds = enumClass.getFields() ; newValue = null ; @@ -861,7 +861,7 @@ public class ValueChanger { } else if (oldValue.getClass().isArray()) { // changer for arrays : changes all elements - Class arrType = oldValue.getClass().getComponentType() ; + Class<?> arrType = oldValue.getClass().getComponentType() ; newValue = Array.newInstance(arrType, Array.getLength(oldValue)) ; for (int i = 0; i < Array.getLength(newValue); i++) { if (!arrType.isPrimitive()) { @@ -900,13 +900,13 @@ public class ValueChanger { } else if (isStructure(oldValue)) { // universal changer for structures - Class clazz = oldValue.getClass() ; + Class<?> clazz = oldValue.getClass() ; try { newValue = clazz.newInstance() ; Field[] fields = clazz.getFields(); for (int i = 0; i < fields.length; i++) { if ((fields[i].getModifiers() & Modifier.PUBLIC) != 0) { - Class fType = fields[i].getType() ; + Class<?> fType = fields[i].getType() ; Field field = fields[i] ; if (!fType.isPrimitive()) { field.set(newValue, changePValue(field.get(oldValue))); diff --git a/qadevOOo/runner/util/ValueComparer.java b/qadevOOo/runner/util/ValueComparer.java index 47dd0a9e7f5f..3ce1719156d5 100644 --- a/qadevOOo/runner/util/ValueComparer.java +++ b/qadevOOo/runner/util/ValueComparer.java @@ -73,7 +73,7 @@ public class ValueComparer { if ( pv1.length != pv2.length) { return false; } - HashMap hm1 = new HashMap(); + HashMap<String, Object> hm1 = new HashMap<String, Object>(); boolean result = true; int i = 0; diff --git a/qadevOOo/runner/util/WaitUnreachable.java b/qadevOOo/runner/util/WaitUnreachable.java index cfae04a08d16..33e383be95de 100644 --- a/qadevOOo/runner/util/WaitUnreachable.java +++ b/qadevOOo/runner/util/WaitUnreachable.java @@ -48,7 +48,7 @@ public final class WaitUnreachable { public WaitUnreachable(Object obj) { this.obj = obj; queue = new ReferenceQueue(); - ref = new PhantomReference(obj, queue); + ref = new PhantomReference<Object>(obj, queue); } /** @@ -114,5 +114,5 @@ public final class WaitUnreachable { private Object obj; private final ReferenceQueue queue; - private final PhantomReference ref; + private final PhantomReference<Object> ref; } diff --git a/qadevOOo/runner/util/WriterTools.java b/qadevOOo/runner/util/WriterTools.java index 82c7208a0229..7b6b0cc8d18b 100644 --- a/qadevOOo/runner/util/WriterTools.java +++ b/qadevOOo/runner/util/WriterTools.java @@ -40,7 +40,7 @@ public class WriterTools { public static XTextDocument createTextDoc(XMultiServiceFactory xMSF) { PropertyValue[] Args = new PropertyValue[0]; XComponent comp = DesktopTools.openNewDoc(xMSF, "swriter", Args); - XTextDocument WriterDoc = (XTextDocument) UnoRuntime.queryInterface( + XTextDocument WriterDoc = UnoRuntime.queryInterface( XTextDocument.class, comp); return WriterDoc; @@ -57,7 +57,7 @@ public class WriterTools { public static XTextDocument loadTextDoc(XMultiServiceFactory xMSF, String url, PropertyValue[] Args) { XComponent comp = DesktopTools.loadDoc(xMSF, url, Args); - XTextDocument WriterDoc = (XTextDocument) UnoRuntime.queryInterface( + XTextDocument WriterDoc = UnoRuntime.queryInterface( XTextDocument.class, comp); return WriterDoc; @@ -67,7 +67,7 @@ public class WriterTools { XDrawPage oDP = null; try { - XDrawPageSupplier oDPS = (XDrawPageSupplier) UnoRuntime.queryInterface( + XDrawPageSupplier oDPS = UnoRuntime.queryInterface( XDrawPageSupplier.class, aDoc); oDP = (XDrawPage) oDPS.getDrawPage(); } catch (Exception e) { @@ -87,7 +87,7 @@ public class WriterTools { XText the_text = aDoc.getText(); XTextCursor the_cursor = the_text.createTextCursor(); - XTextContent the_content = (XTextContent) UnoRuntime.queryInterface( + XTextContent the_content = UnoRuntime.queryInterface( XTextContent.class, oGObject); the_text.insertTextContent(the_cursor, the_content, true); @@ -101,7 +101,7 @@ public class WriterTools { oProps.setPropertyValue("Width", new Integer(width)); oProps.setPropertyValue("Height", new Integer(height)); - XNamed the_name = (XNamed) UnoRuntime.queryInterface(XNamed.class, + XNamed the_name = UnoRuntime.queryInterface(XNamed.class, oGObject); the_name.setName(name); } catch (Exception ex) { diff --git a/qadevOOo/runner/util/XMLTools.java b/qadevOOo/runner/util/XMLTools.java index c5acb225b048..bfaa6b53f405 100644 --- a/qadevOOo/runner/util/XMLTools.java +++ b/qadevOOo/runner/util/XMLTools.java @@ -58,8 +58,8 @@ public class XMLTools { public String Type ; public String Value ; } - private Hashtable attrByName = new Hashtable() ; - private ArrayList attributes = new ArrayList() ; + private Hashtable<String, Attribute> attrByName = new Hashtable<String, Attribute>() ; + private ArrayList<Attribute> attributes = new ArrayList<Attribute>() ; private PrintWriter log = null ; /** @@ -128,7 +128,7 @@ public class XMLTools { } public String getNameByIndex(short idx) { - String name = ((Attribute) attributes.get(idx)).Name ; + String name = attributes.get(idx).Name ; if (log != null) log.println("getNameByIndex(" + idx + ") called -> '" + name + "'") ; @@ -136,7 +136,7 @@ public class XMLTools { } public String getTypeByIndex(short idx) { - String type = ((Attribute) attributes.get(idx)).Type ; + String type = attributes.get(idx).Type ; if (log != null) log.println("getTypeByIndex(" + idx + ") called -> '" + type + "'") ; @@ -144,14 +144,14 @@ public class XMLTools { } public String getTypeByName(String name) { - String type = ((Attribute) attrByName.get(name)).Type ; + String type = attrByName.get(name).Type ; if (log != null) log.println("getTypeByName('" + name + "') called -> '" + type + "'") ; return type; } public String getValueByIndex(short idx) { - String value = ((Attribute) attributes.get(idx)).Value ; + String value = attributes.get(idx).Value ; if (log != null) log.println("getValueByIndex(" + idx + ") called -> '" + value + "'") ; @@ -159,7 +159,7 @@ public class XMLTools { } public String getValueByName(String name) { - String value = ((Attribute) attrByName.get(name)).Value ; + String value = attrByName.get(name).Value ; if (log != null) log.println("getValueByName('" + name + "') called -> '" + value + "'") ; @@ -255,7 +255,7 @@ public class XMLTools { public static class XMLWellFormChecker extends XMLWriter { protected boolean docStarted = false ; protected boolean docEnded = false ; - protected ArrayList tagStack = new ArrayList() ; + protected ArrayList<String> tagStack = new ArrayList<String>() ; protected boolean wellFormed = true ; protected boolean noOtherErrors = true ; protected PrintWriter log = null ; @@ -279,7 +279,7 @@ public class XMLTools { public void reset() { docStarted = false ; docEnded = false ; - tagStack = new ArrayList() ; + tagStack = new ArrayList<String>() ; wellFormed = true ; noOtherErrors = true ; PrintWriter log = null ; @@ -320,7 +320,7 @@ public class XMLTools { wellFormed = false ; printError("No tags to close (bad closing tag </" + name + ">)") ; } else { - String startTag = (String) tagStack.get(0) ; + String startTag = tagStack.get(0) ; tagStack.remove(0) ; if (!startTag.equals(name)) { wellFormed = false ; @@ -355,7 +355,7 @@ public class XMLTools { if (printXMLData) return ; log.println(" Tag trace :") ; for (int i = 0; i < tagStack.size(); i++) { - String tag = (String) tagStack.get(i) ; + String tag = tagStack.get(i) ; log.println(" <" + tag + ">") ; } } @@ -411,7 +411,7 @@ public class XMLTools { if (!outerTag.equals("")) { boolean isInTag = false ; for (int i = 0; i < tagStack.size(); i++) { - if (outerTag.equals((String) tagStack.get(i))) { + if (outerTag.equals(tagStack.get(i))) { isInTag = true ; break ; } @@ -434,7 +434,7 @@ public class XMLTools { if (!outerTag.equals("")) { boolean isInTag = false ; for (int i = 0; i < tagStack.size(); i++) { - if (outerTag.equals((String) tagStack.get(i))) { + if (outerTag.equals(tagStack.get(i))) { isInTag = true ; break ; } @@ -456,21 +456,21 @@ public class XMLTools { public boolean checkTags() { allOK &= isWellFormed() ; - Enumeration badTags = tags.keys() ; - Enumeration badChars = chars.keys() ; + Enumeration<String> badTags = tags.keys() ; + Enumeration<String> badChars = chars.keys() ; if (badTags.hasMoreElements()) { allOK = false ; log.println("Required tags were not found in export :") ; while(badTags.hasMoreElements()) { - log.println(" <" + ((String) badTags.nextElement()) + ">") ; + log.println(" <" + badTags.nextElement() + ">") ; } } if (badChars.hasMoreElements()) { allOK = false ; log.println("Required characters were not found in export :") ; while(badChars.hasMoreElements()) { - log.println(" <" + ((String) badChars.nextElement()) + ">") ; + log.println(" <" + badChars.nextElement() + ">") ; } } reset(); @@ -622,11 +622,11 @@ public class XMLTools { * character data exists inside any tag specified. */ public static class XMLChecker extends XMLWellFormChecker { - protected HashSet tagSet = new HashSet() ; - protected ArrayList tags = new ArrayList() ; - protected ArrayList chars = new ArrayList() ; - protected ArrayList tagStack = new ArrayList() ; - protected ArrayList attrStack = new ArrayList() ; + protected HashSet<String> tagSet = new HashSet<String>() ; + protected ArrayList<Tag[]> tags = new ArrayList<Tag[]>() ; + protected ArrayList<Object[]> chars = new ArrayList<Object[]>() ; + protected ArrayList<String> tagStack = new ArrayList<String>() ; + protected ArrayList<AttributeList> attrStack = new ArrayList<AttributeList>() ; public XMLChecker(PrintWriter log, boolean writeXML) { super(log, writeXML) ; @@ -656,15 +656,15 @@ public class XMLTools { if (tagSet.contains(name)) { for (int i = 0; i < tags.size(); i++) { - Tag[] tag = (Tag[]) tags.get(i); + Tag[] tag = tags.get(i); if (tag[0].isMatchTo(name, attr)) { if (tag[1] == null) { tags.remove(i--); } else { boolean isInStack = false ; for (int j = 0; j < tagStack.size(); j++) { - if (tag[1].isMatchTo((String) tagStack.get(j), - (XAttributeList) attrStack.get(j))) { + if (tag[1].isMatchTo(tagStack.get(j), + attrStack.get(j))) { isInStack = true ; break ; @@ -688,15 +688,15 @@ public class XMLTools { public void characters(String ch) { super.characters(ch) ; for (int i = 0; i < chars.size(); i++) { - Object[] chr = (Object[]) chars.get(i); + Object[] chr = chars.get(i); if (((String) chr[0]).equals(ch)) { if (chr[1] == null) { chars.remove(i--); } else { boolean isInStack = false ; for (int j = 0; j < tagStack.size(); j++) { - if (((Tag) chr[1]).isMatchTo((String) tagStack.get(j), - (XAttributeList) attrStack.get(j))) { + if (((Tag) chr[1]).isMatchTo(tagStack.get(j), + attrStack.get(j))) { isInStack = true ; break ; @@ -727,7 +727,7 @@ public class XMLTools { if (tags.size()> 0) { log.println("!!! Error: Some tags were not found :") ; for (int i = 0; i < tags.size(); i++) { - Tag[] tag = (Tag[]) tags.get(i) ; + Tag[] tag = tags.get(i) ; log.println(" Tag " + tag[0] + " was not found"); if (tag[1] != null) log.println(" inside tag " + tag[1]) ; @@ -736,7 +736,7 @@ public class XMLTools { if (chars.size() > 0) { log.println("!!! Error: Some character data blocks were not found :") ; for (int i = 0; i < chars.size(); i++) { - Object[] ch = (Object[]) chars.get(i) ; + Object[] ch = chars.get(i) ; log.println(" Character data \"" + ch[0] + "\" was not found ") ; if (ch[1] != null) log.println(" inside tag " + ch[1]) ; @@ -767,11 +767,10 @@ public class XMLTools { "com.sun.star.xml.sax.Writer"); XInterface oPipe = (XInterface) xMSF.createInstance ( "com.sun.star.io.Pipe" ); - XOutputStream xPipeOutput = (XOutputStream) UnoRuntime. + XOutputStream xPipeOutput = UnoRuntime. queryInterface(XOutputStream.class, oPipe) ; - XActiveDataSource xADS = (XActiveDataSource) - UnoRuntime.queryInterface(XActiveDataSource.class,Writer); + XActiveDataSource xADS = UnoRuntime.queryInterface(XActiveDataSource.class,Writer); xADS.setOutputStream(xPipeOutput); XDocumentHandler handler = (XDocumentHandler) UnoRuntime.queryInterface(XDocumentHandler.class,Writer); @@ -812,13 +811,12 @@ public class XMLTools { { XInterface oFacc = (XInterface)xMSF.createInstance( "com.sun.star.comp.ucb.SimpleFileAccess"); - XSimpleFileAccess xFacc = (XSimpleFileAccess)UnoRuntime.queryInterface + XSimpleFileAccess xFacc = UnoRuntime.queryInterface (XSimpleFileAccess.class, oFacc) ; XInterface oWriter = (XInterface)xMSF.createInstance( "com.sun.star.xml.sax.Writer"); - XActiveDataSource xWriterDS = (XActiveDataSource) - UnoRuntime.queryInterface(XActiveDataSource.class, oWriter); + XActiveDataSource xWriterDS = UnoRuntime.queryInterface(XActiveDataSource.class, oWriter); XDocumentHandler xDocHandWriter = (XDocumentHandler) UnoRuntime.queryInterface (XDocumentHandler.class, oWriter) ; @@ -842,13 +840,13 @@ public class XMLTools { { XInterface oFacc = (XInterface)xMSF.createInstance( "com.sun.star.comp.ucb.SimpleFileAccess"); - XSimpleFileAccess xFacc = (XSimpleFileAccess)UnoRuntime.queryInterface + XSimpleFileAccess xFacc = UnoRuntime.queryInterface (XSimpleFileAccess.class, oFacc) ; XInputStream oIn = xFacc.openFileRead(fileURL) ; XInterface oParser = (XInterface)xMSF.createInstance( "com.sun.star.xml.sax.Parser"); - XParser xParser = (XParser) UnoRuntime.queryInterface(XParser.class, oParser); + XParser xParser = UnoRuntime.queryInterface(XParser.class, oParser); xParser.setDocumentHandler(handler) ; InputSource inSrc = new InputSource() ; @@ -886,11 +884,11 @@ public class XMLTools { "com.sun.star.comp." + docType + ".XML" + exportType + "Exporter", new Object[] {arg}); - XExporter xExp = (XExporter) UnoRuntime.queryInterface + XExporter xExp = UnoRuntime.queryInterface (XExporter.class, oExp) ; xExp.setSourceDocument(xDoc) ; - XFilter filter = (XFilter) UnoRuntime.queryInterface(XFilter.class, oExp) ; + XFilter filter = UnoRuntime.queryInterface(XFilter.class, oExp) ; filter.filter(XMLTools.createMediaDescriptor( new String[] {"FilterName"}, new Object[] {"Custom filter"})) ; @@ -919,7 +917,7 @@ public class XMLTools { XInterface oImp = (XInterface)xMSF.createInstance( "com.sun.star.comp." + docType + ".XML" + importType + "Importer"); - XImporter xImp = (XImporter) UnoRuntime.queryInterface + XImporter xImp = UnoRuntime.queryInterface (XImporter.class, oImp) ; XDocumentHandler xDocHandImp = (XDocumentHandler) UnoRuntime.queryInterface (XDocumentHandler.class, oImp) ; diff --git a/qadevOOo/runner/util/db/DataSource.java b/qadevOOo/runner/util/db/DataSource.java index 2b861f156c37..4c612fb08969 100644 --- a/qadevOOo/runner/util/db/DataSource.java +++ b/qadevOOo/runner/util/db/DataSource.java @@ -45,7 +45,7 @@ public class DataSource m_orb = _orb; try { - m_dataSource = (XDataSource)UnoRuntime.queryInterface( XDataSource.class, + m_dataSource = UnoRuntime.queryInterface( XDataSource.class, m_orb.createInstance( "com.sun.star.sdb.DataSource" ) ); m_properties = (XPropertySet)UnoRuntime.queryInterface( XPropertySet.class, m_dataSource ); @@ -90,7 +90,7 @@ public class DataSource try { dataSourceName = (String)m_properties.getPropertyValue( "Name" ); - XNamingService dbContext = (XNamingService)UnoRuntime.queryInterface( XNamingService.class, + XNamingService dbContext = UnoRuntime.queryInterface( XNamingService.class, m_orb.createInstance( "com.sun.star.sdb.DatabaseContext" ) ); dbContext.revokeObject( dataSourceName ); } diff --git a/qadevOOo/runner/util/db/DatabaseDocument.java b/qadevOOo/runner/util/db/DatabaseDocument.java index bc2683c63678..b045d50f0110 100644 --- a/qadevOOo/runner/util/db/DatabaseDocument.java +++ b/qadevOOo/runner/util/db/DatabaseDocument.java @@ -37,13 +37,13 @@ public class DatabaseDocument m_orb = _orb; m_dataSource = _dataSource; - XDocumentDataSource docDataSource = (XDocumentDataSource)UnoRuntime.queryInterface( + XDocumentDataSource docDataSource = UnoRuntime.queryInterface( XDocumentDataSource.class, m_dataSource.getDataSource() ); - m_databaseDocument = (XOfficeDatabaseDocument)UnoRuntime.queryInterface(XOfficeDatabaseDocument.class, + m_databaseDocument = UnoRuntime.queryInterface(XOfficeDatabaseDocument.class, docDataSource.getDatabaseDocument() ); - m_model = (XModel)UnoRuntime.queryInterface( XModel.class, m_databaseDocument ); - m_storeDoc = (XStorable)UnoRuntime.queryInterface( XStorable.class, m_databaseDocument ); + m_model = UnoRuntime.queryInterface( XModel.class, m_databaseDocument ); + m_storeDoc = UnoRuntime.queryInterface( XStorable.class, m_databaseDocument ); } public DataSource getDataSource() diff --git a/qadevOOo/runner/util/utils.java b/qadevOOo/runner/util/utils.java index 61ebf8480507..65c2f8da97cc 100644 --- a/qadevOOo/runner/util/utils.java +++ b/qadevOOo/runner/util/utils.java @@ -468,7 +468,7 @@ public class utils { try { Object fileacc = msf.createInstance("com.sun.star.comp.ucb.SimpleFileAccess"); - XSimpleFileAccess simpleAccess = (XSimpleFileAccess) UnoRuntime.queryInterface(XSimpleFileAccess.class, + XSimpleFileAccess simpleAccess = UnoRuntime.queryInterface(XSimpleFileAccess.class, fileacc); if (simpleAccess.exists(fileURL)) { exists = true; @@ -494,7 +494,7 @@ public class utils { try { Object fileacc = xMsf.createInstance("com.sun.star.comp.ucb.SimpleFileAccess"); - XSimpleFileAccess simpleAccess = (XSimpleFileAccess) UnoRuntime.queryInterface(XSimpleFileAccess.class, + XSimpleFileAccess simpleAccess = UnoRuntime.queryInterface(XSimpleFileAccess.class, fileacc); if (simpleAccess.exists(fileURL)) { simpleAccess.kill(fileURL); @@ -519,7 +519,7 @@ public class utils { boolean res = false; try { Object fileacc = xMsf.createInstance("com.sun.star.comp.ucb.SimpleFileAccess"); - XSimpleFileAccess simpleAccess = (XSimpleFileAccess) UnoRuntime.queryInterface(XSimpleFileAccess.class, + XSimpleFileAccess simpleAccess = UnoRuntime.queryInterface(XSimpleFileAccess.class, fileacc); if (!simpleAccess.exists(destinaion)) { simpleAccess.copy(source, destinaion); @@ -541,7 +541,7 @@ public class utils { try { Object fileacc = xMsf.createInstance("com.sun.star.comp.ucb.SimpleFileAccess"); - XSimpleFileAccess simpleAccess = (XSimpleFileAccess) UnoRuntime.queryInterface(XSimpleFileAccess.class, + XSimpleFileAccess simpleAccess = UnoRuntime.queryInterface(XSimpleFileAccess.class, fileacc); if (simpleAccess.exists(newF)) { simpleAccess.kill(newF); @@ -681,7 +681,7 @@ public class utils { XURLTransformer xTrans = null; try { Object inst = xMSF.createInstance("com.sun.star.util.URLTransformer"); - xTrans = (XURLTransformer) UnoRuntime.queryInterface(XURLTransformer.class, inst); + xTrans = UnoRuntime.queryInterface(XURLTransformer.class, inst); } catch (com.sun.star.uno.Exception e) { } @@ -734,7 +734,7 @@ public class utils { public static String[] getFilteredPropertyNames(XPropertySet props, short includePropertyAttribute, short excludePropertyAttribute) { Property[] the_props = props.getPropertySetInfo().getProperties(); - ArrayList l = new ArrayList(); + ArrayList<String> l = new ArrayList<String>(); for (int i = 0; i < the_props.length; i++) { boolean exclude = ((the_props[i].Attributes & excludePropertyAttribute) != 0); boolean include = (includePropertyAttribute == 0) || @@ -745,7 +745,7 @@ public class utils { } Collections.sort(l); String[] names = new String[l.size()]; - names = (String[]) l.toArray(names); + names = l.toArray(names); return names; } @@ -899,7 +899,7 @@ public class utils { XPropertySet xPS = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xMSF); XComponentContext xContext = (XComponentContext) UnoRuntime.queryInterface(XComponentContext.class, xPS.getPropertyValue("DefaultContext")); - XMacroExpander xME = (XMacroExpander) UnoRuntime.queryInterface(XMacroExpander.class, + XMacroExpander xME = UnoRuntime.queryInterface(XMacroExpander.class, xContext.getValueByName("/singletons/com.sun.star.util.theMacroExpander")); return xME.expandMacros(expand); } catch (Exception e) { @@ -948,7 +948,7 @@ public class utils { * @throws java.lang.Exception throws <CODE>java.lang.Exception</CODE> on any error */ public static void dispatchURL(XMultiServiceFactory xMSF, XComponent xDoc, String URL) throws java.lang.Exception { - XModel aModel = (XModel) UnoRuntime.queryInterface(XModel.class, xDoc); + XModel aModel = UnoRuntime.queryInterface(XModel.class, xDoc); XController xCont = aModel.getCurrentController(); @@ -966,9 +966,9 @@ public class utils { public static void dispatchURL(XMultiServiceFactory xMSF, XController xCont, String URL) throws java.lang.Exception { try { - XDispatchProvider xDispProv = (XDispatchProvider) UnoRuntime.queryInterface(XDispatchProvider.class, xCont); + XDispatchProvider xDispProv = UnoRuntime.queryInterface(XDispatchProvider.class, xCont); - XURLTransformer xParser = (com.sun.star.util.XURLTransformer) UnoRuntime.queryInterface( + XURLTransformer xParser = UnoRuntime.queryInterface( XURLTransformer.class, xMSF.createInstance("com.sun.star.util.URLTransformer")); |