diff options
author | Noel Grandin <noel@peralex.com> | 2012-06-28 15:19:57 +0200 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2012-06-29 22:03:04 +0200 |
commit | cde7ccee856ad515f0e6f0afe2b1503cf44fb8aa (patch) | |
tree | a6a9c691c4c8499158fad54e4b8584b97db37e80 /framework/qa | |
parent | 3fba4e261f9fef7f1bcdf9af36ac96135f26705f (diff) |
Java5 update - use generics where it makes sense
Change-Id: I3e60bd33127105c1d9da1bb25cea16355850d3fd
Diffstat (limited to 'framework/qa')
12 files changed, 86 insertions, 110 deletions
diff --git a/framework/qa/complex/accelerators/KeyMapping.java b/framework/qa/complex/accelerators/KeyMapping.java index 4a0c28503cba..8573051dd51a 100644 --- a/framework/qa/complex/accelerators/KeyMapping.java +++ b/framework/qa/complex/accelerators/KeyMapping.java @@ -32,28 +32,12 @@ class KeyIdentifierInfo } } -class IdentifierHashMap extends HashMap +class IdentifierHashMap extends HashMap<String,Short> { - public void put(String sIdentifier, Short nCode) - { - super.put(sIdentifier, nCode); - } - public Short get(String sIdentifier) - { - return (Short)super.get(sIdentifier); - } } -class CodeHashMap extends HashMap +class CodeHashMap extends HashMap<Short,String> { - public void put(Short nCode, String sIdentifier) - { - super.put(nCode, sIdentifier); - } - public String get(Short nCode) - { - return (String)super.get(nCode); - } } public class KeyMapping @@ -154,6 +138,6 @@ public class KeyMapping public String mapCode2Identifier(short nCode) { - return (String)aCodeHashMap.get(new Short(nCode)); + return aCodeHashMap.get(new Short(nCode)); } } diff --git a/framework/qa/complex/api_internal/CheckAPI.java b/framework/qa/complex/api_internal/CheckAPI.java index b3934460898e..66f09fa9bd9a 100644 --- a/framework/qa/complex/api_internal/CheckAPI.java +++ b/framework/qa/complex/api_internal/CheckAPI.java @@ -94,7 +94,7 @@ public class CheckAPI { // get the parameters for the internal test String paramList = (String)param.get("ParamList"); - ArrayList p = new ArrayList(); + ArrayList<Object> p = new ArrayList<Object>(); StringTokenizer paramTokens = new StringTokenizer(paramList, " "); while(paramTokens.hasMoreTokens()) { @@ -118,12 +118,12 @@ public class CheckAPI { if ( param.get("job1")==null ) { // get all test jobs from runner service - XPropertyAccess xPropAcc = (XPropertyAccess)UnoRuntime.queryInterface(XPropertyAccess.class, oObj); + XPropertyAccess xPropAcc = UnoRuntime.queryInterface(XPropertyAccess.class, oObj); props = xPropAcc.getPropertyValues(); } else { int index=1; - p = new ArrayList(); + p = new ArrayList<Object>(); while ( param.get("job"+index) != null ) { p.add(param.get("job"+index)); index++; diff --git a/framework/qa/complex/contextMenuInterceptor/ContextMenuInterceptor.java b/framework/qa/complex/contextMenuInterceptor/ContextMenuInterceptor.java index 26468eb53b90..996360df235e 100644 --- a/framework/qa/complex/contextMenuInterceptor/ContextMenuInterceptor.java +++ b/framework/qa/complex/contextMenuInterceptor/ContextMenuInterceptor.java @@ -54,7 +54,7 @@ public class ContextMenuInterceptor implements XContextMenuInterceptor com.sun.star.beans.XPropertySet xSeparator = UnoRuntime.queryInterface(com.sun.star.beans.XPropertySet.class, xMenuElementFactory.createInstance("com.sun.star.ui.ActionTriggerSeparator")); Short aSeparatorType = new Short(ActionTriggerSeparatorType.LINE); - xSeparator.setPropertyValue("SeparatorType", (Object) aSeparatorType); + xSeparator.setPropertyValue("SeparatorType", aSeparatorType); // query sub menu for index container to get access com.sun.star.container.XIndexContainer xSubMenuContainer = @@ -64,7 +64,7 @@ public class ContextMenuInterceptor implements XContextMenuInterceptor xRootMenuEntry.setPropertyValue("Text", ("Help")); xRootMenuEntry.setPropertyValue("CommandURL", ("slot:5410")); xRootMenuEntry.setPropertyValue("HelpURL", ("5410")); - xRootMenuEntry.setPropertyValue("SubContainer", (Object) xSubMenuContainer); + xRootMenuEntry.setPropertyValue("SubContainer", xSubMenuContainer); xRootMenuEntry.setPropertyValue("Image", myBitmap); // create menu entries for the new sub menu @@ -76,7 +76,7 @@ public class ContextMenuInterceptor implements XContextMenuInterceptor xMenuEntry.setPropertyValue("HelpURL", ("5401")); // insert menu entry to sub menu - xSubMenuContainer.insertByIndex(0, (Object) xMenuEntry); + xSubMenuContainer.insertByIndex(0, xMenuEntry); // intialize help/help agent // entry "Help Agent" @@ -86,7 +86,7 @@ public class ContextMenuInterceptor implements XContextMenuInterceptor xMenuEntry.setPropertyValue("HelpURL", ("5962")); // insert menu entry to sub menu - xSubMenuContainer.insertByIndex(1, (Object) xMenuEntry); + xSubMenuContainer.insertByIndex(1, xMenuEntry); // intialize help/tips // entry "Tips" xMenuEntry = UnoRuntime.queryInterface(com.sun.star.beans.XPropertySet.class, xMenuElementFactory.createInstance("com.sun.star.ui.ActionTrigger")); @@ -95,13 +95,13 @@ public class ContextMenuInterceptor implements XContextMenuInterceptor xMenuEntry.setPropertyValue("HelpURL", ("5404")); // insert menu entry to sub menu - xSubMenuContainer.insertByIndex(2, (Object) xMenuEntry); + xSubMenuContainer.insertByIndex(2, xMenuEntry); // add separator into the given context menu - xContextMenu.insertByIndex(0, (Object) xSeparator); + xContextMenu.insertByIndex(0, xSeparator); // add new sub menu into the given context menu - xContextMenu.insertByIndex(0, (Object) xRootMenuEntry); + xContextMenu.insertByIndex(0, xRootMenuEntry); // The controller should execute the modified context menu and stop notifying other // interceptors. diff --git a/framework/qa/complex/dispatches/checkdispatchapi.java b/framework/qa/complex/dispatches/checkdispatchapi.java index 1b6e80cac182..11671ea4e259 100644 --- a/framework/qa/complex/dispatches/checkdispatchapi.java +++ b/framework/qa/complex/dispatches/checkdispatchapi.java @@ -219,7 +219,7 @@ public class checkdispatchapi { final PropertyValue args = new PropertyValue(); args.Name = "ActiveConnection"; - args.Value = (Object) db.defaultConnection(); + args.Value = db.defaultConnection(); XFrame xFrame = impl_createNewFrame(); @@ -401,7 +401,7 @@ public class checkdispatchapi } // check for duplicates (and by the way, if the info item match the requested group) - HashMap aCheckMap = new HashMap(c2); + HashMap<String, String> aCheckMap = new HashMap<String, String>(c2); for (i2 = 0; i2 < c2; ++i2) { DispatchInformation aInfo = lInfos[i2]; diff --git a/framework/qa/complex/framework/autosave/AutoSave.java b/framework/qa/complex/framework/autosave/AutoSave.java index f91f229ed28e..000e99c8e1c8 100644 --- a/framework/qa/complex/framework/autosave/AutoSave.java +++ b/framework/qa/complex/framework/autosave/AutoSave.java @@ -350,7 +350,7 @@ public class AutoSave if (nRetry > 0) { --nRetry; - long nWait = (long)aRandom.nextInt(30000); // 30 sec. + long nWait = aRandom.nextInt(30000); // 30 sec. try { m_aLog.log(Protocol.TYPE_INFO, "sleep for "+nWait+" ms"); @@ -428,7 +428,7 @@ public class AutoSave XInterface xDoc = createBigCalcDoc(); try { - long nWait = (long)aRandom.nextInt(120000); + long nWait = aRandom.nextInt(120000); m_aLog.log(Protocol.TYPE_INFO, "sleep for "+nWait+" ms"); synchronized(this) { diff --git a/framework/qa/complex/framework/recovery/CrashThread.java b/framework/qa/complex/framework/recovery/CrashThread.java index 2d82858cfafe..0daf3bd1f2a5 100644 --- a/framework/qa/complex/framework/recovery/CrashThread.java +++ b/framework/qa/complex/framework/recovery/CrashThread.java @@ -43,13 +43,13 @@ public class CrashThread extends Thread { public void run() { try{ - XModel xModel = (XModel) UnoRuntime.queryInterface(XModel.class, xDoc); + XModel xModel = UnoRuntime.queryInterface(XModel.class, xDoc); XController xController = xModel.getCurrentController(); - XDispatchProvider xDispProv = (XDispatchProvider) UnoRuntime.queryInterface( + XDispatchProvider xDispProv = UnoRuntime.queryInterface( XDispatchProvider.class, xController); - XURLTransformer xParser = (XURLTransformer) UnoRuntime.queryInterface( + XURLTransformer xParser = UnoRuntime.queryInterface( XURLTransformer.class, msf.createInstance( "com.sun.star.util.URLTransformer")); diff --git a/framework/qa/complex/framework/recovery/RecoveryTest.java b/framework/qa/complex/framework/recovery/RecoveryTest.java index 55e040cce196..6285f04a8da9 100644 --- a/framework/qa/complex/framework/recovery/RecoveryTest.java +++ b/framework/qa/complex/framework/recovery/RecoveryTest.java @@ -108,7 +108,7 @@ public class RecoveryTest extends ComplexTestCase { * and the values are com sun.star.awt.Rectangle. * @see com.sun.star.awt.Rectangle */ - private HashMap windowsPosSize = new HashMap(); + private HashMap<String, Rectangle> windowsPosSize = new HashMap<String, Rectangle>(); /** * A function to tell the framework, which test functions are available. @@ -258,17 +258,17 @@ public class RecoveryTest extends ComplexTestCase { while (allComp.hasMoreElements()){ try{ // get all components from the desktop - XComponent xComponent = (XComponent) UnoRuntime.queryInterface( + XComponent xComponent = UnoRuntime.queryInterface( XComponent.class, allComp.nextElement()); - XModel xModel = (XModel) UnoRuntime.queryInterface(XModel.class, xComponent); + XModel xModel = UnoRuntime.queryInterface(XModel.class, xComponent); String frameName = xModel.getCurrentController().getFrame().getName(); // check if this frame was used in creation of test environment if (windowsPosSize.containsKey(frameName)){ - Rectangle oldRect = (Rectangle) windowsPosSize.get(frameName); + Rectangle oldRect = windowsPosSize.get(frameName); XWindow xWindow = xModel.getCurrentController().getFrame().getContainerWindow(); Rectangle newRect = xWindow.getPosSize(); @@ -340,7 +340,7 @@ public class RecoveryTest extends ComplexTestCase { assure("could not get Recovery Window",(oDialog != null)); - XWindow xWindow = (XWindow) UnoRuntime.queryInterface(XWindow.class, oDialog); + XWindow xWindow = UnoRuntime.queryInterface(XWindow.class, oDialog); UITools oUITools = new UITools(xMSF, xWindow); @@ -377,7 +377,7 @@ public class RecoveryTest extends ComplexTestCase { XDialog oDialog = rt.getActiveDialog(xMSF); assure("could not get CrashReporter Dialog", oDialog != null); - XWindow xWindow = (XWindow) UnoRuntime.queryInterface(XWindow.class, oDialog); + XWindow xWindow = UnoRuntime.queryInterface(XWindow.class, oDialog); log.println(oDialog.getTitle()); @@ -442,7 +442,7 @@ public class RecoveryTest extends ComplexTestCase { assure("could not get Recovery Dialog at start of office", (oDialog != null), CONTINUE); - XWindow xWindow = (XWindow) UnoRuntime.queryInterface(XWindow.class, oDialog); + XWindow xWindow = UnoRuntime.queryInterface(XWindow.class, oDialog); log.println("got the following dialog: '" +oDialog.getTitle() + "'"); UITools oUITools = new UITools(xMSF, xWindow); @@ -628,7 +628,7 @@ public class RecoveryTest extends ComplexTestCase { log.println("creating Impress document '" + frameName + "'"); XComponent xImpressDoc = createNewImpressDoc(frameName); if (withContent) fillImpressDocWithContent(xImpressDoc); - positioningDocument((XModel) UnoRuntime.queryInterface(XModel.class, + positioningDocument(UnoRuntime.queryInterface(XModel.class, xImpressDoc)); } @@ -636,7 +636,7 @@ public class RecoveryTest extends ComplexTestCase { log.println("creating Draw document '" + frameName + "'"); XComponent xDrawDoc = createNewDrawDoc(frameName); if (withContent) fillDrawDocWithContent(xDrawDoc); - positioningDocument((XModel) UnoRuntime.queryInterface(XModel.class, + positioningDocument(UnoRuntime.queryInterface(XModel.class, xDrawDoc)); } @@ -644,7 +644,7 @@ public class RecoveryTest extends ComplexTestCase { log.println("creating Calc document '" + frameName + "'"); XSpreadsheetDocument xSpreadsheetDoc = createNewCalcDoc(frameName); if (withContent) fillCalcDocWithContent(xSpreadsheetDoc); - positioningDocument((XModel) UnoRuntime.queryInterface(XModel.class, + positioningDocument(UnoRuntime.queryInterface(XModel.class, xSpreadsheetDoc)); } @@ -690,7 +690,7 @@ public class RecoveryTest extends ComplexTestCase { log.println("creating Math document '" + frameName + "'"); XComponent xMathDoc = createNewMathDoc(frameName); if (withContent) fillMathDocWithContent(xMathDoc); - positioningDocument((XModel) UnoRuntime.queryInterface(XModel.class, + positioningDocument(UnoRuntime.queryInterface(XModel.class, xMathDoc)); } @@ -708,7 +708,7 @@ public class RecoveryTest extends ComplexTestCase { private void fillMathDocWithContent(XComponent xMathDoc){ // setting a formula in document final String expFormula = "sum a cdot b"; - final XPropertySet xPS = (XPropertySet) UnoRuntime.queryInterface + final XPropertySet xPS = UnoRuntime.queryInterface (XPropertySet.class, xMathDoc); try { xPS.setPropertyValue("Formula", expFormula); @@ -742,20 +742,17 @@ public class RecoveryTest extends ComplexTestCase { private void fillImpressDocWithContent(XComponent xImpressDoc){ log.println( "get presentation" ); - XPresentationSupplier oPS = (XPresentationSupplier) - UnoRuntime.queryInterface(XPresentationSupplier.class, xImpressDoc); + XPresentationSupplier oPS = UnoRuntime.queryInterface(XPresentationSupplier.class, xImpressDoc); XInterface oObj = oPS.getPresentation(); log.println( "get custom presentation" ); - XCustomPresentationSupplier oCPS = (XCustomPresentationSupplier) - UnoRuntime.queryInterface( - XCustomPresentationSupplier.class, xImpressDoc); + XCustomPresentationSupplier oCPS = UnoRuntime.queryInterface( + XCustomPresentationSupplier.class, xImpressDoc); XNameContainer xCP = oCPS.getCustomPresentations(); XInterface oInstance = null; - XSingleServiceFactory oSingleMSF = (XSingleServiceFactory) - UnoRuntime.queryInterface(XSingleServiceFactory.class, xCP); + XSingleServiceFactory oSingleMSF = UnoRuntime.queryInterface(XSingleServiceFactory.class, xCP); try{ oInstance = (XInterface) oSingleMSF.createInstance(); @@ -790,11 +787,9 @@ public class RecoveryTest extends ComplexTestCase { } private void fillDrawDocWithContent(XComponent xDrawDoc){ - XDrawPagesSupplier oDPS = (XDrawPagesSupplier) - UnoRuntime.queryInterface(XDrawPagesSupplier.class, xDrawDoc); + XDrawPagesSupplier oDPS = UnoRuntime.queryInterface(XDrawPagesSupplier.class, xDrawDoc); XDrawPages oDPn = oDPS.getDrawPages(); - XIndexAccess oDPi = (XIndexAccess) - UnoRuntime.queryInterface(XIndexAccess.class, oDPn); + XIndexAccess oDPi = UnoRuntime.queryInterface(XIndexAccess.class, oDPn); XDrawPage oDP = null; try { oDP = (XDrawPage) AnyConverter.toObject( @@ -812,7 +807,7 @@ public class RecoveryTest extends ComplexTestCase { //get a Shape log.println( "getting Shape" ); - XShapes oShapes = (XShapes) UnoRuntime.queryInterface + XShapes oShapes = UnoRuntime.queryInterface (XShapes.class, oDP); XInterface oObj = SOF.createShape (xDrawDoc, 5000, 3500, 7500, 5000, "Rectangle"); @@ -824,11 +819,10 @@ public class RecoveryTest extends ComplexTestCase { XShape oShape = SOF.createShape (xDrawDoc, 3000, 4500, 15000, 1000, "Ellipse"); oShapes.add((XShape) oObj); - oShapes.add((XShape) oShape); + oShapes.add(oShape); - XPropertySet oShapeProps = (XPropertySet) - UnoRuntime.queryInterface(XPropertySet.class, oObj); + XPropertySet oShapeProps = UnoRuntime.queryInterface(XPropertySet.class, oObj); XStyle aStyle = null; try { aStyle = (XStyle) AnyConverter.toObject( @@ -853,7 +847,7 @@ public class RecoveryTest extends ComplexTestCase { log.println("creating Writer document '" + frameName + "'"); XTextDocument xTextDoc = createNewWriterDoc(frameName); if (withContent) fillWriterDocWithContent(xTextDoc); - positioningDocument((XModel) UnoRuntime.queryInterface(XModel.class, + positioningDocument(UnoRuntime.queryInterface(XModel.class, xTextDoc)); } @@ -922,7 +916,7 @@ public class RecoveryTest extends ComplexTestCase { XCellRange testRange = oSheet.getCellRangeByName("$A$1:$D$4"); - XSheetCellRange testSheetRange = (XSheetCellRange) UnoRuntime.queryInterface( + XSheetCellRange testSheetRange = UnoRuntime.queryInterface( XSheetCellRange.class, testRange); oSheet.getCellByPosition(1, 1).setValue(1); diff --git a/framework/qa/complex/framework/recovery/RecoveryTools.java b/framework/qa/complex/framework/recovery/RecoveryTools.java index a5ebedae4dd1..3b9646583a9c 100644 --- a/framework/qa/complex/framework/recovery/RecoveryTools.java +++ b/framework/qa/complex/framework/recovery/RecoveryTools.java @@ -73,7 +73,7 @@ public class RecoveryTools { */ public XDialog getActiveDialog( XMultiServiceFactory xMSF){ XWindow xWin = getActiveWindow(xMSF); - return (XDialog) UnoRuntime.queryInterface(XDialog.class, xWin); + return UnoRuntime.queryInterface(XDialog.class, xWin); } public XWindow getActiveWindow( XMultiServiceFactory xMSF){ @@ -84,10 +84,9 @@ public class RecoveryTools { return null; } - XExtendedToolkit tk = (XExtendedToolkit) - UnoRuntime.queryInterface(XExtendedToolkit.class, xToolKit); + XExtendedToolkit tk = UnoRuntime.queryInterface(XExtendedToolkit.class, xToolKit); Object atw = tk.getActiveTopWindow(); - return (XWindow) UnoRuntime.queryInterface(XWindow.class, atw); + return UnoRuntime.queryInterface(XWindow.class, atw); } /** @@ -149,10 +148,10 @@ public class RecoveryTools { throws com.sun.star.io.IOException { try{ - HashMap recFiles = getRecoveryFiles(); + HashMap<String, String> recFiles = getRecoveryFiles(); - String recoveryFolder = (String) recFiles.get("recoveryFolder"); - String recoveryXCU = (String) recFiles.get("recoveryXCU"); + String recoveryFolder = recFiles.get("recoveryFolder"); + String recoveryXCU = recFiles.get("recoveryXCU"); log.println("try to remove content of '" + recoveryFolder + "'"); @@ -174,7 +173,7 @@ public class RecoveryTools { } } - public HashMap getRecoveryFiles() + public HashMap<String, String> getRecoveryFiles() throws com.sun.star.io.IOException { try{ @@ -194,7 +193,7 @@ public class RecoveryTools { String recoveryXCU = utils.getSystemURL(userPath + "/user/registry/data/org/openoffice/Office/Recovery.xcu"); - HashMap recFiles = new HashMap(); + HashMap<String, String> recFiles = new HashMap<String, String>(); recFiles.put("recoveryFolder", recoveryFolder); recFiles.put("recoveryXCU", recoveryXCU); @@ -213,7 +212,7 @@ public class RecoveryTools { */ public boolean closeOffice(XMultiServiceFactory xMSF) { try { - XDesktop desk = (XDesktop) UnoRuntime.queryInterface( + XDesktop desk = UnoRuntime.queryInterface( XDesktop.class, xMSF.createInstance( "com.sun.star.frame.Desktop")); xMSF = null; @@ -322,7 +321,7 @@ public class RecoveryTools { public void copyRecoveryData(boolean backup) throws com.sun.star.io.IOException, java.io.IOException { - HashMap recFiles = null; + HashMap<String, String> recFiles = null; try{ recFiles = getRecoveryFiles(); @@ -331,8 +330,8 @@ public class RecoveryTools { } try{ - String recoveryFolder = (String) recFiles.get("recoveryFolder"); - String recoveryXCU = (String) recFiles.get("recoveryXCU"); + String recoveryFolder = recFiles.get("recoveryFolder"); + String recoveryXCU = recFiles.get("recoveryXCU"); File recFolder = new File(recoveryFolder); File recFolderBackup = new File(recoveryFolder+".recoveryTest"); diff --git a/framework/qa/complex/imageManager/CheckImageManager.java b/framework/qa/complex/imageManager/CheckImageManager.java index e91f8e3e2969..8e43536e6c4f 100644 --- a/framework/qa/complex/imageManager/CheckImageManager.java +++ b/framework/qa/complex/imageManager/CheckImageManager.java @@ -66,7 +66,7 @@ public class CheckImageManager { System.out.println(" **** ImageManager from ModuleUIConfigurationManager *** "); XUIConfigurationManager xManager = null; try { - Object o = (XInterface)xMSF.createInstance( + Object o = xMSF.createInstance( "com.sun.star.ui.ModuleUIConfigurationManagerSupplier"); XModuleUIConfigurationManagerSupplier xMUICMS = UnoRuntime.queryInterface(XModuleUIConfigurationManagerSupplier.class, o); diff --git a/framework/qa/complex/loadAllDocuments/CheckXComponentLoader.java b/framework/qa/complex/loadAllDocuments/CheckXComponentLoader.java index ba6d8250555c..95a8fa591cd4 100644 --- a/framework/qa/complex/loadAllDocuments/CheckXComponentLoader.java +++ b/framework/qa/complex/loadAllDocuments/CheckXComponentLoader.java @@ -114,7 +114,7 @@ public class CheckXComponentLoader private String m_sTestDocPath = null; /** files of m_sTestDocPath to test. */ - private static ArrayList m_lTestFiles = null; + private static ArrayList<String> m_lTestFiles = null; //------------------------------------------- // test environment @@ -187,18 +187,18 @@ public class CheckXComponentLoader // get all files from the given directory // TODO URLHelper should ignore directories! - m_lTestFiles = new ArrayList(); + m_lTestFiles = new ArrayList<String>(); final String sTestDocURL = OfficeFileUrl.getAbsolute(new File("testdocuments")); m_sTestDocPath = graphical.FileHelper.getSystemPathFromFileURL(sTestDocURL); try { - File aBaseDir = new File(m_sTestDocPath); - List lDirContent = URLHelper.getSystemFilesFromDir(aBaseDir.getPath()); - Iterator lList = lDirContent.iterator(); - int nBasePathLength = m_sTestDocPath.length(); + File aBaseDir = new File(m_sTestDocPath); + List<File> lDirContent = URLHelper.getSystemFilesFromDir(aBaseDir.getPath()); + Iterator<File> lList = lDirContent.iterator(); + int nBasePathLength = m_sTestDocPath.length(); while(lList.hasNext()) { - File aFile = (File)lList.next(); + File aFile = lList.next(); // ignore broken links and directories at all if ( @@ -266,10 +266,10 @@ public class CheckXComponentLoader lProps[2].Name = "StatusIndicator"; lProps[2].Value = xIndicator; - Iterator aSnapshot = m_lTestFiles.iterator(); + Iterator<String> aSnapshot = m_lTestFiles.iterator(); while (aSnapshot.hasNext()) { - File aSysFile = new File(m_sTestDocPath, (String)aSnapshot.next()); + File aSysFile = new File(m_sTestDocPath, aSnapshot.next()); String sURL = URLHelper.getFileURLFromSystemPath(aSysFile); if (/*! (sURL.endsWith(".jpg") || @@ -424,11 +424,11 @@ public class CheckXComponentLoader // get a file name as byte array - Iterator aSnapshot = m_lTestFiles.iterator(); + Iterator<String> aSnapshot = m_lTestFiles.iterator(); byte[] baURL = null; while (aSnapshot.hasNext()) { - File aFile = new File(m_sTestDocPath, (String)aSnapshot.next()); + File aFile = new File(m_sTestDocPath, aSnapshot.next()); String sFile = URLHelper.getFileURLFromSystemPath(aFile); // take the first sxw file as stream @@ -591,10 +591,10 @@ public class CheckXComponentLoader lProps[1] = new PropertyValue(); lProps[1].Name = "InputStream"; - Iterator aSnapshot = m_lTestFiles.iterator(); + Iterator<String> aSnapshot = m_lTestFiles.iterator(); while (aSnapshot.hasNext()) { - File aFile = new File(m_sTestDocPath, (String) aSnapshot.next()); + File aFile = new File(m_sTestDocPath, aSnapshot.next()); String sURL = URLHelper.getFileURLFromSystemPath(aFile); // if (sURL.indexOf("CVS") > -1) diff --git a/framework/qa/complex/loadAllDocuments/StreamSimulator.java b/framework/qa/complex/loadAllDocuments/StreamSimulator.java index b923aa8b301b..210cd1da9610 100644 --- a/framework/qa/complex/loadAllDocuments/StreamSimulator.java +++ b/framework/qa/complex/loadAllDocuments/StreamSimulator.java @@ -83,9 +83,8 @@ public class StreamSimulator implements com.sun.star.io.XInputStream , try { - XSimpleFileAccess xHelper = (XSimpleFileAccess) - UnoRuntime.queryInterface(XSimpleFileAccess.class, - xMSF.createInstance("com.sun.star.ucb.SimpleFileAccess")); + XSimpleFileAccess xHelper = UnoRuntime.queryInterface(XSimpleFileAccess.class, + xMSF.createInstance("com.sun.star.ucb.SimpleFileAccess")); if (xHelper == null) throw new com.sun.star.io.NotConnectedException( @@ -94,14 +93,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/framework/qa/complex/path_substitution/PathSubstitutionTest.java b/framework/qa/complex/path_substitution/PathSubstitutionTest.java index ece31d236509..664c0bc7963a 100644 --- a/framework/qa/complex/path_substitution/PathSubstitutionTest.java +++ b/framework/qa/complex/path_substitution/PathSubstitutionTest.java @@ -226,17 +226,17 @@ public class PathSubstitutionTest private class VariableContainer { - public ArrayList varName; - public ArrayList varValue; - public ArrayList substAtBegin; - public ArrayList resubst; + public ArrayList<String> varName; + public ArrayList<String> varValue; + public ArrayList<Boolean> substAtBegin; + public ArrayList<Boolean> resubst; public VariableContainer() { - varName = new ArrayList(); - varValue = new ArrayList(); - substAtBegin = new ArrayList(); - resubst = new ArrayList(); + varName = new ArrayList<String>(); + varValue = new ArrayList<String>(); + substAtBegin = new ArrayList<Boolean>(); + resubst = new ArrayList<Boolean>(); } public void add(String var) @@ -266,27 +266,27 @@ public class PathSubstitutionTest public String getVariable(int i) { - return (String) varName.get(i); + return varName.get(i); } public String getValue(int i) { - return (String) varName.get(i); + return varName.get(i); } public String getValue(String var) { - return (String) varValue.get(varName.indexOf(var)); + return varValue.get(varName.indexOf(var)); } public boolean onlySubstituteAtBegin(int i) { - return ((Boolean) substAtBegin.get(i)).booleanValue(); + return substAtBegin.get(i).booleanValue(); } public boolean canReSubstitute(int i) { - return ((Boolean) resubst.get(i)).booleanValue(); + return resubst.get(i).booleanValue(); } } |