diff options
Diffstat (limited to 'qadevOOo/runner/util')
-rw-r--r-- | qadevOOo/runner/util/BasicMacroTools.java | 10 | ||||
-rw-r--r-- | qadevOOo/runner/util/DBTools.java | 15 | ||||
-rw-r--r-- | qadevOOo/runner/util/DesktopTools.java | 4 | ||||
-rw-r--r-- | qadevOOo/runner/util/FormTools.java | 18 | ||||
-rw-r--r-- | qadevOOo/runner/util/FrameDsc.java | 3 | ||||
-rw-r--r-- | qadevOOo/runner/util/SOfficeFactory.java | 8 | ||||
-rw-r--r-- | qadevOOo/runner/util/SysUtils.java | 6 | ||||
-rw-r--r-- | qadevOOo/runner/util/UITools.java | 14 | ||||
-rw-r--r-- | qadevOOo/runner/util/ValueChanger.java | 2 | ||||
-rw-r--r-- | qadevOOo/runner/util/ValueComparer.java | 8 | ||||
-rw-r--r-- | qadevOOo/runner/util/WaitUnreachable.java | 4 | ||||
-rw-r--r-- | qadevOOo/runner/util/WriterTools.java | 6 | ||||
-rw-r--r-- | qadevOOo/runner/util/XMLTools.java | 35 | ||||
-rw-r--r-- | qadevOOo/runner/util/db/DataSource.java | 2 | ||||
-rw-r--r-- | qadevOOo/runner/util/dbg.java | 11 | ||||
-rw-r--r-- | qadevOOo/runner/util/utils.java | 10 |
16 files changed, 71 insertions, 85 deletions
diff --git a/qadevOOo/runner/util/BasicMacroTools.java b/qadevOOo/runner/util/BasicMacroTools.java index 313ed1b0f565..ffb4538254d6 100644 --- a/qadevOOo/runner/util/BasicMacroTools.java +++ b/qadevOOo/runner/util/BasicMacroTools.java @@ -55,7 +55,7 @@ public class BasicMacroTools { Object DocLibCont = null; try { - XPropertySet xDocProps = (XPropertySet) UnoRuntime.queryInterface( + XPropertySet xDocProps = UnoRuntime.queryInterface( XPropertySet.class, xDoc); DocLibCont = xDocProps.getPropertyValue("BasicLibraries"); } catch (com.sun.star.uno.Exception e) { @@ -63,7 +63,7 @@ public class BasicMacroTools { "Couldn't get BasicLibraries-Container from document: " + e.toString()); } - mLCxNA = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, + mLCxNA = UnoRuntime.queryInterface(XNameAccess.class, DocLibCont); mLCxLC = UnoRuntime.queryInterface( @@ -95,7 +95,7 @@ public class BasicMacroTools { "Couldn't create ApplicationScriptLibraryContainer" + e.toString()); } - mLCxNA = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, + mLCxNA = UnoRuntime.queryInterface(XNameAccess.class, ASLC); mLCxLC = UnoRuntime.queryInterface( @@ -237,10 +237,10 @@ public class BasicMacroTools { "com.sun.star.configuration.ConfigurationUpdateAccess", ProvArgs); - XPropertySet oSecureProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, oSecure); + XPropertySet oSecureProps = UnoRuntime.queryInterface(XPropertySet.class, oSecure); Object oScripting = oSecureProps.getPropertyValue("Scripting"); - XPropertySet oScriptingSettings = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, oScripting); + XPropertySet oScriptingSettings = UnoRuntime.queryInterface(XPropertySet.class, oScripting); oScriptingSettings.setPropertyValue("SecureURL", new String[]{secureURL}); oScriptingSettings.setPropertyValue("OfficeBasic", new Integer(2)); diff --git a/qadevOOo/runner/util/DBTools.java b/qadevOOo/runner/util/DBTools.java index 30c1b230548f..98e699cef28b 100644 --- a/qadevOOo/runner/util/DBTools.java +++ b/qadevOOo/runner/util/DBTools.java @@ -166,8 +166,7 @@ public class DBTools { * class fields. */ public DataSourceInfo(Object dataSource) { - XPropertySet xProps = (XPropertySet) - UnoRuntime.queryInterface(XPropertySet.class, dataSource) ; + XPropertySet xProps = UnoRuntime.queryInterface(XPropertySet.class, dataSource) ; try { Name = (String)xProps.getPropertyValue("Name") ; @@ -244,7 +243,7 @@ public class DBTools { { Object src = src = xMSF.createInstance("com.sun.star.sdb.DataSource") ; - XPropertySet props = (XPropertySet) UnoRuntime.queryInterface + XPropertySet props = UnoRuntime.queryInterface (XPropertySet.class, src) ; if (Name != null) props.setPropertyValue("Name", Name) ; @@ -340,8 +339,7 @@ public class DBTools { XInterface newSource = (XInterface) xMSF.createInstance ("com.sun.star.sdb.DataSource") ; - XPropertySet xSrcProp = (XPropertySet) - UnoRuntime.queryInterface(XPropertySet.class, newSource); + XPropertySet xSrcProp = UnoRuntime.queryInterface(XPropertySet.class, newSource); xSrcProp.setPropertyValue("URL", "sdbc:text:" + dirToUrl(dbDir)); @@ -383,8 +381,7 @@ public class DBTools { XInterface newSource = (XInterface) xMSF.createInstance ("com.sun.star.sdb.DataSource") ; - XPropertySet xSrcProp = (XPropertySet) - UnoRuntime.queryInterface(XPropertySet.class, newSource); + XPropertySet xSrcProp = UnoRuntime.queryInterface(XPropertySet.class, newSource); xSrcProp.setPropertyValue("URL", "sdbc:dbase:" + dirToUrl(dbDir)); dbContext.registerObject(contextName, newSource) ; @@ -444,14 +441,14 @@ public class DBTools { String existURL = null ; - XNameAccess na = (XNameAccess) UnoRuntime.queryInterface + XNameAccess na = UnoRuntime.queryInterface (XNameAccess.class, dbContext) ; Object src = null ; if (na.hasByName("APITestDatabase")) { src = dbContext.getRegisteredObject("APITestDatabase") ; - XPropertySet srcPs = (XPropertySet) UnoRuntime.queryInterface + XPropertySet srcPs = UnoRuntime.queryInterface (XPropertySet.class, src) ; existURL = (String) srcPs.getPropertyValue("URL") ; diff --git a/qadevOOo/runner/util/DesktopTools.java b/qadevOOo/runner/util/DesktopTools.java index e24037f6c622..791052ffa768 100644 --- a/qadevOOo/runner/util/DesktopTools.java +++ b/qadevOOo/runner/util/DesktopTools.java @@ -181,7 +181,7 @@ public class DesktopTools */ public static String getDocumentType(XComponent xComponent) { - XServiceInfo sInfo = (XServiceInfo) UnoRuntime.queryInterface( + XServiceInfo sInfo = UnoRuntime.queryInterface( XServiceInfo.class, xComponent); if (sInfo == null) @@ -413,7 +413,7 @@ public class DesktopTools XViewSettingsSupplier oVSSupp = UnoRuntime.queryInterface(XViewSettingsSupplier.class, oCont); XInterface oViewSettings = oVSSupp.getViewSettings(); - XPropertySet oViewProp = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, oViewSettings); + XPropertySet oViewProp = UnoRuntime.queryInterface(XPropertySet.class, oViewSettings); oViewProp.setPropertyValue("ZoomType", new Short(com.sun.star.view.DocumentZoomType.ENTIRE_PAGE)); diff --git a/qadevOOo/runner/util/FormTools.java b/qadevOOo/runner/util/FormTools.java index 7bafd75047df..032fe7eff2b0 100644 --- a/qadevOOo/runner/util/FormTools.java +++ b/qadevOOo/runner/util/FormTools.java @@ -70,8 +70,7 @@ public class FormTools { try{ Object oInt = oDocMSF.createInstance("com.sun.star.drawing.ControlShape"); Object aCon = oDocMSF.createInstance("com.sun.star.form.component."+kind); - XPropertySet model_props = (XPropertySet) - UnoRuntime.queryInterface(XPropertySet.class,aCon); + XPropertySet model_props = UnoRuntime.queryInterface(XPropertySet.class,aCon); model_props.setPropertyValue("DefaultControl","com.sun.star.form.control."+kind); aControl = UnoRuntime.queryInterface( XControlModel.class, aCon ); oCShape = UnoRuntime.queryInterface( XControlShape.class, oInt ); @@ -105,8 +104,7 @@ public class FormTools { try{ Object oInt = oDocMSF.createInstance("com.sun.star.drawing.ControlShape"); Object aCon = oDocMSF.createInstance("com.sun.star.form.component."+kind); - XPropertySet model_props = (XPropertySet) - UnoRuntime.queryInterface(XPropertySet.class,aCon); + XPropertySet model_props = UnoRuntime.queryInterface(XPropertySet.class,aCon); model_props.setPropertyValue("DefaultControl","com.sun.star.awt."+defControl); aControl = UnoRuntime.queryInterface( XControlModel.class, aCon ); oCShape = UnoRuntime.queryInterface( XControlShape.class, oInt ); @@ -198,7 +196,7 @@ public class FormTools { String aName ) { try { XInterface oControl = createControl(aDoc, "Form"); - XForm oForm = (XForm) UnoRuntime.queryInterface(XForm.class, oControl); + XForm oForm = UnoRuntime.queryInterface(XForm.class, oControl); Forms.insertByName(aName,oForm); } catch ( Exception e ) { throw new IllegalArgumentException( "Couldn't insert Form" ); @@ -225,7 +223,7 @@ public class FormTools { } catch (com.sun.star.lang.IllegalArgumentException iae) { System.out.println("### Couldn't convert Any"); } - XPropertySet formProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, the_form); + XPropertySet formProps = UnoRuntime.queryInterface(XPropertySet.class, the_form); formProps.setPropertyValue("DataSourceName","Bibliography"); formProps.setPropertyValue("Command","biblio"); formProps.setPropertyValue("CommandType",new Integer(com.sun.star.sdb.CommandType.TABLE)); @@ -254,7 +252,7 @@ public class FormTools { XForm the_form = (XForm) AnyConverter.toObject(new Type(XForm.class), FormTools.getIndexedForms(WriterTools.getDrawPage(aDoc)).getByIndex(0)); - XPropertySet formProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, the_form); + XPropertySet formProps = UnoRuntime.queryInterface(XPropertySet.class, the_form); formProps.setPropertyValue("DataSourceName",sourceName); formProps.setPropertyValue("Command",tableName); formProps.setPropertyValue("CommandType",new Integer(com.sun.star.sdb.CommandType.TABLE)); @@ -267,7 +265,7 @@ public class FormTools { try { XForm the_form = (XForm) FormTools.getForms(WriterTools.getDrawPage(aDoc)).getByName(formName); - XPropertySet formProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, the_form); + XPropertySet formProps = UnoRuntime.queryInterface(XPropertySet.class, the_form); formProps.setPropertyValue("DataSourceName","Bibliography"); formProps.setPropertyValue("Command","biblio"); formProps.setPropertyValue("CommandType",new Integer(com.sun.star.sdb.CommandType.TABLE)); @@ -297,7 +295,7 @@ public class FormTools { XForm the_form = (XForm) AnyConverter.toObject(new Type(XForm.class), FormTools.getForms(WriterTools.getDrawPage(aDoc)).getByName(formName)); - XPropertySet formProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, the_form); + XPropertySet formProps = UnoRuntime.queryInterface(XPropertySet.class, the_form); formProps.setPropertyValue("DataSourceName",sourceName); formProps.setPropertyValue("Command",tableName); formProps.setPropertyValue("CommandType",new Integer(com.sun.star.sdb.CommandType.TABLE)); @@ -322,7 +320,7 @@ public class FormTools { atrans.parseStrict(aURLA); aURL = aURLA[0]; - com.sun.star.frame.XDispatch aDisp = (com.sun.star.frame.XDispatch)aDispProv.queryDispatch(aURL, "", + com.sun.star.frame.XDispatch aDisp = aDispProv.queryDispatch(aURL, "", com.sun.star.frame.FrameSearchFlag.SELF | com.sun.star.frame.FrameSearchFlag.CHILDREN); diff --git a/qadevOOo/runner/util/FrameDsc.java b/qadevOOo/runner/util/FrameDsc.java index e5448afa651c..e1c8fc7b0dd4 100644 --- a/qadevOOo/runner/util/FrameDsc.java +++ b/qadevOOo/runner/util/FrameDsc.java @@ -94,8 +94,7 @@ public class FrameDsc extends InstDescr { XTextFrame TF = (XTextFrame)UnoRuntime.queryInterface( ifcClass, SrvObj ); - XPropertySet oPropSet = (XPropertySet) - UnoRuntime.queryInterface( XPropertySet.class, SrvObj ); + XPropertySet oPropSet = UnoRuntime.queryInterface( XPropertySet.class, SrvObj ); try { diff --git a/qadevOOo/runner/util/SOfficeFactory.java b/qadevOOo/runner/util/SOfficeFactory.java index 327b271c946c..df8b0ddfcf64 100644 --- a/qadevOOo/runner/util/SOfficeFactory.java +++ b/qadevOOo/runner/util/SOfficeFactory.java @@ -386,7 +386,7 @@ public class SOfficeFactory { Object oInt = oDocMSF.createInstance( "com.sun.star.sheet.Spreadsheet"); - XSpreadsheet oSpreadsheet = (XSpreadsheet) UnoRuntime.queryInterface(XSpreadsheet.class, oInt); + XSpreadsheet oSpreadsheet = UnoRuntime.queryInterface(XSpreadsheet.class, oInt); return oSpreadsheet; } @@ -402,7 +402,7 @@ public class SOfficeFactory { } public static String getUniqueName(XInterface oInterface, String prefix) { - XNameAccess oNameAccess = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, oInterface); + XNameAccess oNameAccess = UnoRuntime.queryInterface(XNameAccess.class, oInterface); if (oNameAccess == null) { return null; } @@ -473,7 +473,7 @@ public class SOfficeFactory { XMultiServiceFactory oDocMSF = UnoRuntime.queryInterface(XMultiServiceFactory.class, oDoc); try { - oInstance = (Object) oDocMSF.createInstance(kind); + oInstance = oDocMSF.createInstance(kind); } catch (Exception e) { // Some exception occures.FAILED System.out.println("Couldn't create instance " + kind + ": " + e); @@ -609,7 +609,7 @@ public class SOfficeFactory { // query for XServiceInfo public Object queryXServiceInfo(Object oObj) { if (oObj != null) { - XServiceInfo oInfo = (XServiceInfo) UnoRuntime.queryInterface( + XServiceInfo oInfo = UnoRuntime.queryInterface( XServiceInfo.class, oObj); System.out.println("!!!! XServiceInfo n.a. !!!! "); } else { diff --git a/qadevOOo/runner/util/SysUtils.java b/qadevOOo/runner/util/SysUtils.java index 78abc9502883..68166bb3e3bf 100644 --- a/qadevOOo/runner/util/SysUtils.java +++ b/qadevOOo/runner/util/SysUtils.java @@ -33,9 +33,9 @@ import com.sun.star.datatransfer.*; public class SysUtils { public static String getJavaPath() { - String cp = (String) System.getProperty("java.class.path"); - String jh = (String) System.getProperty("java.home"); - String fs = (String) System.getProperty("file.separator"); + String cp = System.getProperty("java.class.path"); + String jh = System.getProperty("java.home"); + String fs = System.getProperty("file.separator"); jh = jh + fs + "bin" + fs; jh = jh + "java -classpath "+cp; return jh; diff --git a/qadevOOo/runner/util/UITools.java b/qadevOOo/runner/util/UITools.java index bb35f80fd87e..779d1a861831 100644 --- a/qadevOOo/runner/util/UITools.java +++ b/qadevOOo/runner/util/UITools.java @@ -353,8 +353,7 @@ public class UITools { XAccessible xChild = xList.getAccessibleChild(i); XAccessibleContext xChildCont = xChild.getAccessibleContext(); - XInterface xChildInterface = (XInterface) - UnoRuntime.queryInterface(XInterface.class, xChildCont); + XInterface xChildInterface = UnoRuntime.queryInterface(XInterface.class, xChildCont); Items.add(xChildInterface); } catch (com.sun.star.lang.IndexOutOfBoundsException e) { @@ -416,8 +415,7 @@ public class UITools { XAccessible xChild = xList.getAccessibleChild(i); XAccessibleContext xChildCont = xChild.getAccessibleContext(); - XInterface xChildInterface = (XInterface) - UnoRuntime.queryInterface(XInterface.class, xChildCont); + XInterface xChildInterface = UnoRuntime.queryInterface(XInterface.class, xChildCont); Items.add(getString(xChildInterface)); } catch (com.sun.star.lang.IndexOutOfBoundsException e) { @@ -468,7 +466,7 @@ public class UITools { try{ XInterface xNumericField =mAT.getAccessibleObjectForRole( mXRoot, AccessibleRole.TEXT, NumericFieldName); - return (String) getString(xNumericField); + return getString(xNumericField); } catch (Exception e) { throw new Exception("Could get value from NumericField '" @@ -563,8 +561,7 @@ public class UITools { XAccessible xChild = xFrame.getAccessibleChild(i); XAccessibleContext xChildCont = xChild.getAccessibleContext(); - XInterface xChildInterface = (XInterface) - UnoRuntime.queryInterface(XInterface.class, xChildCont); + XInterface xChildInterface = UnoRuntime.queryInterface(XInterface.class, xChildCont); TextFieldText += (getString(xChildInterface)); } catch (com.sun.star.lang.IndexOutOfBoundsException e) { @@ -639,8 +636,7 @@ public class UITools { XAccessibleContext xMessage =mAT.getAccessibleObjectForRole(mXRoot, AccessibleRole.LABEL); - XInterface xMessageInterface = (XInterface) - UnoRuntime.queryInterface(XInterface.class, xMessage); + XInterface xMessageInterface = UnoRuntime.queryInterface(XInterface.class, xMessage); cMessage += (getString(xMessageInterface)); diff --git a/qadevOOo/runner/util/ValueChanger.java b/qadevOOo/runner/util/ValueChanger.java index 00c86ff4138e..6e18ee84c4a5 100644 --- a/qadevOOo/runner/util/ValueChanger.java +++ b/qadevOOo/runner/util/ValueChanger.java @@ -965,7 +965,7 @@ public class ValueChanger { private static boolean isStructure(Object val) { boolean result = true ; - Class clazz = val.getClass() ; + Class<?> clazz = val.getClass() ; Method[] meth = clazz.getDeclaredMethods() ; for (int i = 0; i < meth.length; i++) { diff --git a/qadevOOo/runner/util/ValueComparer.java b/qadevOOo/runner/util/ValueComparer.java index 3ce1719156d5..d4535bc6fde7 100644 --- a/qadevOOo/runner/util/ValueComparer.java +++ b/qadevOOo/runner/util/ValueComparer.java @@ -98,7 +98,7 @@ public class ValueComparer { if((op1.getClass().getComponentType() == op2.getClass().getComponentType()) && (Array.getLength(op1) == Array.getLength(op2))) { - Class zClass = op1.getClass().getComponentType(); + Class<?> zClass = op1.getClass().getComponentType(); for(int i = 0; i < Array.getLength(op1); ++ i) result = result & compareObjects(Array.get(op1, i), Array.get(op2, i)); @@ -113,11 +113,11 @@ public class ValueComparer { return op1 == op2; } - static boolean compareUntil(Class zClass, Class untilClass, Object op1, Object op2) throws Exception { + static boolean compareUntil(Class<?> zClass, Class<?> untilClass, Object op1, Object op2) throws Exception { boolean result = true; // write inherited members first - Class superClass = zClass.getSuperclass(); + Class<?> superClass = zClass.getSuperclass(); if(superClass != null && superClass != untilClass) result = result & compareUntil(superClass, untilClass, op1, op2); @@ -245,7 +245,7 @@ public class ValueComparer { compareEnums((Enum)op1, (Enum)op2); else if(op1.getClass() == String.class && op2.getClass() == String.class) // is it a String ? - result = ((String)op1).equals((String)op2); + result = ((String)op1).equals(op2); else // otherwise it must be a struct result = compareStructs(op1, op2); diff --git a/qadevOOo/runner/util/WaitUnreachable.java b/qadevOOo/runner/util/WaitUnreachable.java index 33e383be95de..56046397e123 100644 --- a/qadevOOo/runner/util/WaitUnreachable.java +++ b/qadevOOo/runner/util/WaitUnreachable.java @@ -47,7 +47,7 @@ public final class WaitUnreachable { */ public WaitUnreachable(Object obj) { this.obj = obj; - queue = new ReferenceQueue(); + queue = new ReferenceQueue<Object>(); ref = new PhantomReference<Object>(obj, queue); } @@ -113,6 +113,6 @@ public final class WaitUnreachable { } private Object obj; - private final ReferenceQueue queue; + private final ReferenceQueue<Object> queue; private final PhantomReference<Object> ref; } diff --git a/qadevOOo/runner/util/WriterTools.java b/qadevOOo/runner/util/WriterTools.java index 7b6b0cc8d18b..164bdf52e4c9 100644 --- a/qadevOOo/runner/util/WriterTools.java +++ b/qadevOOo/runner/util/WriterTools.java @@ -69,7 +69,7 @@ public class WriterTools { try { XDrawPageSupplier oDPS = UnoRuntime.queryInterface( XDrawPageSupplier.class, aDoc); - oDP = (XDrawPage) oDPS.getDrawPage(); + oDP = oDPS.getDrawPage(); } catch (Exception e) { throw new IllegalArgumentException("Couldn't get drawpage"); } @@ -82,7 +82,7 @@ public class WriterTools { int vpos, int width, int height, String pic, String name) { try { - Object oGObject = (XInterface) xMSF.createInstance( + Object oGObject = xMSF.createInstance( "com.sun.star.text.GraphicObject"); XText the_text = aDoc.getText(); @@ -91,7 +91,7 @@ public class WriterTools { XTextContent.class, oGObject); the_text.insertTextContent(the_cursor, the_content, true); - XPropertySet oProps = (XPropertySet) UnoRuntime.queryInterface( + XPropertySet oProps = UnoRuntime.queryInterface( XPropertySet.class, oGObject); String fullURL = util.utils.getFullTestURL(pic); diff --git a/qadevOOo/runner/util/XMLTools.java b/qadevOOo/runner/util/XMLTools.java index bfaa6b53f405..2e53cc993be6 100644 --- a/qadevOOo/runner/util/XMLTools.java +++ b/qadevOOo/runner/util/XMLTools.java @@ -20,10 +20,10 @@ package util; import java.io.PrintWriter; import java.util.ArrayList; -import java.util.Enumeration; +import java.util.HashMap; import java.util.HashSet; import java.util.Hashtable; -import java.util.Vector; +import java.util.Iterator; import com.sun.star.beans.PropertyValue; import com.sun.star.document.XExporter; @@ -369,8 +369,8 @@ public class XMLTools { * appropriate message is output. */ public static class XMLTagsChecker extends XMLWellFormChecker { - protected Hashtable tags = new Hashtable() ; - protected Hashtable chars = new Hashtable() ; + protected HashMap<String,String> tags = new HashMap<String,String>() ; + protected HashMap<String,String> chars = new HashMap<String,String>() ; protected boolean allOK = true ; public XMLTagsChecker(PrintWriter log) { @@ -407,7 +407,7 @@ public class XMLTools { public void startElement(String name, XAttributeList attrs) { super.startElement(name, attrs) ; if (tags.containsKey(name)) { - String outerTag = (String) tags.get(name); + String outerTag = tags.get(name); if (!outerTag.equals("")) { boolean isInTag = false ; for (int i = 0; i < tagStack.size(); i++) { @@ -430,7 +430,7 @@ public class XMLTools { super.characters(ch) ; if (chars.containsKey(ch)) { - String outerTag = (String) chars.get(ch); + String outerTag = chars.get(ch); if (!outerTag.equals("")) { boolean isInTag = false ; for (int i = 0; i < tagStack.size(); i++) { @@ -456,21 +456,21 @@ public class XMLTools { public boolean checkTags() { allOK &= isWellFormed() ; - Enumeration<String> badTags = tags.keys() ; - Enumeration<String> badChars = chars.keys() ; + Iterator<String> badTags = tags.keySet().iterator() ; + Iterator<String> badChars = chars.keySet().iterator() ; - if (badTags.hasMoreElements()) { + if (badTags.hasNext()) { allOK = false ; log.println("Required tags were not found in export :") ; - while(badTags.hasMoreElements()) { - log.println(" <" + badTags.nextElement() + ">") ; + while(badTags.hasNext()) { + log.println(" <" + badTags.next() + ">") ; } } - if (badChars.hasMoreElements()) { + if (badChars.hasNext()) { allOK = false ; log.println("Required characters were not found in export :") ; - while(badChars.hasMoreElements()) { - log.println(" <" + badChars.nextElement() + ">") ; + while(badChars.hasNext()) { + log.println(" <" + badChars.next() + ">") ; } } reset(); @@ -772,8 +772,7 @@ public class XMLTools { XActiveDataSource xADS = UnoRuntime.queryInterface(XActiveDataSource.class,Writer); xADS.setOutputStream(xPipeOutput); - XDocumentHandler handler = (XDocumentHandler) - UnoRuntime.queryInterface(XDocumentHandler.class,Writer); + XDocumentHandler handler = UnoRuntime.queryInterface(XDocumentHandler.class,Writer); Any arg = new Any(new Type(XDocumentHandler.class),handler); @@ -817,7 +816,7 @@ public class XMLTools { XInterface oWriter = (XInterface)xMSF.createInstance( "com.sun.star.xml.sax.Writer"); XActiveDataSource xWriterDS = UnoRuntime.queryInterface(XActiveDataSource.class, oWriter); - XDocumentHandler xDocHandWriter = (XDocumentHandler) UnoRuntime.queryInterface + XDocumentHandler xDocHandWriter = UnoRuntime.queryInterface (XDocumentHandler.class, oWriter) ; if (xFacc.exists(fileURL)) @@ -919,7 +918,7 @@ public class XMLTools { "com.sun.star.comp." + docType + ".XML" + importType + "Importer"); XImporter xImp = UnoRuntime.queryInterface (XImporter.class, oImp) ; - XDocumentHandler xDocHandImp = (XDocumentHandler) UnoRuntime.queryInterface + XDocumentHandler xDocHandImp = UnoRuntime.queryInterface (XDocumentHandler.class, oImp) ; xImp.setTargetDocument(xDoc) ; diff --git a/qadevOOo/runner/util/db/DataSource.java b/qadevOOo/runner/util/db/DataSource.java index 4c612fb08969..e92f81a19168 100644 --- a/qadevOOo/runner/util/db/DataSource.java +++ b/qadevOOo/runner/util/db/DataSource.java @@ -47,7 +47,7 @@ public class DataSource { m_dataSource = UnoRuntime.queryInterface( XDataSource.class, m_orb.createInstance( "com.sun.star.sdb.DataSource" ) ); - m_properties = (XPropertySet)UnoRuntime.queryInterface( XPropertySet.class, + m_properties = UnoRuntime.queryInterface( XPropertySet.class, m_dataSource ); Object[] descriptorProperties = new Object[] { diff --git a/qadevOOo/runner/util/dbg.java b/qadevOOo/runner/util/dbg.java index 95abe526a9a3..a97d6b12b4c2 100644 --- a/qadevOOo/runner/util/dbg.java +++ b/qadevOOo/runner/util/dbg.java @@ -77,8 +77,7 @@ public class dbg { */ public static Type[] getInterfaceTypes(XInterface xTarget) { Type[] types = null; - XTypeProvider xTypeProvider = (XTypeProvider) - UnoRuntime.queryInterface( XTypeProvider.class, xTarget); + XTypeProvider xTypeProvider = UnoRuntime.queryInterface( XTypeProvider.class, xTarget); if( xTypeProvider != null ) types = xTypeProvider.getTypes(); return types; @@ -116,7 +115,7 @@ public class dbg { */ public static void printInterfaceInfo(Type aType) { try { - Class zClass = aType.getZClass(); + Class<?> zClass = aType.getZClass(); Method[] methods = zClass.getDeclaredMethods(); for (int i=0; i<methods.length; i++) { System.out.println("\t" + methods[i].getReturnType().getName() @@ -297,8 +296,7 @@ public class dbg { * @param aObject A UNO object. */ public static void getSuppServices (Object aObject) { - XServiceInfo xSI = (XServiceInfo) - UnoRuntime.queryInterface(XServiceInfo.class,aObject); + XServiceInfo xSI = UnoRuntime.queryInterface(XServiceInfo.class,aObject); printArray(xSI.getSupportedServiceNames()); String str="Therein not Supported Service"; boolean notSupportedServices = false; @@ -319,8 +317,7 @@ public class dbg { */ public static String getImplID( XInterface xTarget ) { String str = ""; - XTypeProvider xTypeProvider = (XTypeProvider) - UnoRuntime.queryInterface( XTypeProvider.class, xTarget); + XTypeProvider xTypeProvider = UnoRuntime.queryInterface( XTypeProvider.class, xTarget); if( xTypeProvider != null ) { byte[] id = xTypeProvider.getImplementationId(); str = "ImplementationID: "; diff --git a/qadevOOo/runner/util/utils.java b/qadevOOo/runner/util/utils.java index 65c2f8da97cc..c584db16eaa0 100644 --- a/qadevOOo/runner/util/utils.java +++ b/qadevOOo/runner/util/utils.java @@ -262,7 +262,7 @@ public class utils { // get a folder wich is located in the user dir try { - userPath = (String) getOfficeSettingsValue(msf, "UserConfig"); + userPath = getOfficeSettingsValue(msf, "UserConfig"); } catch (Exception e) { System.out.println("Couldn't get Office User Path"); e.printStackTrace(); @@ -605,7 +605,7 @@ public class utils { public static String getImplName(Object aObject) { String res = "Error getting Implementation name"; try { - XServiceInfo xSI = (XServiceInfo) UnoRuntime.queryInterface(XServiceInfo.class, aObject); + XServiceInfo xSI = UnoRuntime.queryInterface(XServiceInfo.class, aObject); res = xSI.getImplementationName(); } catch (Exception e) { res = "Error getting Implementation name ( " + e + " )"; @@ -693,7 +693,7 @@ public class utils { public static String getOfficeURL(XMultiServiceFactory msf) { try { Object settings = msf.createInstance("com.sun.star.util.PathSettings"); - XPropertySet settingProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, settings); + XPropertySet settingProps = UnoRuntime.queryInterface(XPropertySet.class, settings); String path = (String) settingProps.getPropertyValue("Module"); return path; } catch (Exception e) { @@ -896,8 +896,8 @@ public class utils { */ public static String expandMacro(XMultiServiceFactory xMSF, String expand) throws java.lang.Exception { try { - XPropertySet xPS = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xMSF); - XComponentContext xContext = (XComponentContext) UnoRuntime.queryInterface(XComponentContext.class, + XPropertySet xPS = UnoRuntime.queryInterface(XPropertySet.class, xMSF); + XComponentContext xContext = UnoRuntime.queryInterface(XComponentContext.class, xPS.getPropertyValue("DefaultContext")); XMacroExpander xME = UnoRuntime.queryInterface(XMacroExpander.class, xContext.getValueByName("/singletons/com.sun.star.util.theMacroExpander")); |