diff options
author | Noel Grandin <noel@peralex.com> | 2015-06-09 10:39:00 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2015-06-09 13:10:42 +0200 |
commit | 0f2007b11b4a0b39bc4e67ade30961f0d533474a (patch) | |
tree | 035698ef3355f9ba17b2844b29ad592fe469dcfc /qadevOOo | |
parent | cc190ef25fb31325b1d3e0dd050e32feef567543 (diff) |
more exception handling cleanup in Java unit tests
Change-Id: I8a826c1b31f99e8d1592f284094ff921ddac74ad
Diffstat (limited to 'qadevOOo')
17 files changed, 118 insertions, 244 deletions
diff --git a/qadevOOo/tests/java/mod/_brdgfctr/BridgeFactory.java b/qadevOOo/tests/java/mod/_brdgfctr/BridgeFactory.java index 334b37f7d231..76c2776b99a2 100644 --- a/qadevOOo/tests/java/mod/_brdgfctr/BridgeFactory.java +++ b/qadevOOo/tests/java/mod/_brdgfctr/BridgeFactory.java @@ -73,10 +73,6 @@ public class BridgeFactory extends TestCase { XInterface oObj = (XInterface) Param.getMSF().createInstance ("com.sun.star.bridge.BridgeFactory") ; - if (oObj == null) - throw new StatusException("Can't create service", - new NullPointerException()); - TestEnvironment tEnv = new TestEnvironment(oObj) ; // select the port diff --git a/qadevOOo/tests/java/mod/_bridgefac/uno/BridgeFactory.java b/qadevOOo/tests/java/mod/_bridgefac/uno/BridgeFactory.java index 985c39e6a19d..fbffeec43f1e 100644 --- a/qadevOOo/tests/java/mod/_bridgefac/uno/BridgeFactory.java +++ b/qadevOOo/tests/java/mod/_bridgefac/uno/BridgeFactory.java @@ -71,10 +71,6 @@ public class BridgeFactory extends TestCase { Param.getMSF().createInstance ("com.sun.star.bridge.BridgeFactory") ; - if (oObj == null) - throw new StatusException("Can't create service", - new NullPointerException()); - TestEnvironment tEnv = new TestEnvironment(oObj) ; // select the port diff --git a/qadevOOo/tests/java/mod/_cached/CachedContentResultSetFactory.java b/qadevOOo/tests/java/mod/_cached/CachedContentResultSetFactory.java index d2a2dbc1251c..0c3db8479ed0 100644 --- a/qadevOOo/tests/java/mod/_cached/CachedContentResultSetFactory.java +++ b/qadevOOo/tests/java/mod/_cached/CachedContentResultSetFactory.java @@ -125,14 +125,9 @@ public class CachedContentResultSetFactory extends TestCase { (OpenMode.ALL, 10000, null, new Property[] {prop}, new NumberedSortingInfo[0])) ; - XDynamicResultSet dynResSet = null; - try { - dynResSet = (XDynamicResultSet) - AnyConverter.toObject(new Type(XDynamicResultSet.class), - cmdProc.execute(cmd, 0, null)); - } catch (com.sun.star.lang.IllegalArgumentException iae) { - throw new StatusException("Couldn't convert Any ",iae); - } + XDynamicResultSet dynResSet = (XDynamicResultSet) + AnyConverter.toObject(new Type(XDynamicResultSet.class), + cmdProc.execute(cmd, 0, null)); XResultSet resSet = dynResSet.getStaticResultSet() ; diff --git a/qadevOOo/tests/java/mod/_cached/CachedContentResultSetStubFactory.java b/qadevOOo/tests/java/mod/_cached/CachedContentResultSetStubFactory.java index 8dd3b159185c..0d5d5d2e689e 100644 --- a/qadevOOo/tests/java/mod/_cached/CachedContentResultSetStubFactory.java +++ b/qadevOOo/tests/java/mod/_cached/CachedContentResultSetStubFactory.java @@ -124,14 +124,9 @@ public class CachedContentResultSetStubFactory extends TestCase { (OpenMode.ALL, 10000, null, new Property[] {prop}, new NumberedSortingInfo[0])) ; - XDynamicResultSet dynResSet = null; - try { - dynResSet = (XDynamicResultSet) - AnyConverter.toObject(new Type(XDynamicResultSet.class), - cmdProc.execute(cmd, 0, null)); - } catch (com.sun.star.lang.IllegalArgumentException iae) { - throw new StatusException("Couldn't convert Any ",iae); - } + XDynamicResultSet dynResSet = (XDynamicResultSet) + AnyConverter.toObject(new Type(XDynamicResultSet.class), + cmdProc.execute(cmd, 0, null)); resSet = dynResSet.getStaticResultSet() ; diff --git a/qadevOOo/tests/java/mod/_dbaccess/OQueryDesign.java b/qadevOOo/tests/java/mod/_dbaccess/OQueryDesign.java index b0a074140978..9daa5b6a28f1 100644 --- a/qadevOOo/tests/java/mod/_dbaccess/OQueryDesign.java +++ b/qadevOOo/tests/java/mod/_dbaccess/OQueryDesign.java @@ -179,55 +179,34 @@ public class OQueryDesign extends TestCase { } // finish method getTestEnvironment - private XInitialization getUnititializedObj(TestParameters Param){ + private XInitialization getUnititializedObj(TestParameters Param) throws Exception { // creating an object which ist not initialized // get a model of a DataSource Object oDBC = null; XMultiServiceFactory xMSF; - try { - xMSF = Param.getMSF(); - oDBC = xMSF.createInstance( "com.sun.star.sdb.DatabaseContext" ); - } - catch( com.sun.star.uno.Exception e ) { - throw new StatusException("Could not instantiate DatabaseContext", e) ; - } + xMSF = Param.getMSF(); + oDBC = xMSF.createInstance( "com.sun.star.sdb.DatabaseContext" ); Object oDataSource = null; - try{ - XNameAccess xNA = UnoRuntime.queryInterface(XNameAccess.class, oDBC); - oDataSource = xNA.getByName(sDataSourceName); - } catch ( com.sun.star.container.NoSuchElementException e){ - throw new StatusException("could not get '" + sDataSourceName + "'" , e) ; - } catch ( com.sun.star.lang.WrappedTargetException e){ - throw new StatusException("could not get '" + sDataSourceName + "'" , e) ; - } + XNameAccess xNA = UnoRuntime.queryInterface(XNameAccess.class, oDBC); + oDataSource = xNA.getByName(sDataSourceName); XDocumentDataSource xDDS = UnoRuntime.queryInterface(XDocumentDataSource.class, oDataSource); XModel xMod = UnoRuntime.queryInterface(XModel.class, xDDS.getDatabaseDocument ()); // get an intaces of QueryDesign - Object oQueryDesign = null; - try{ - oQueryDesign = xMSF.createInstance("com.sun.star.sdb.QueryDesign"); - }catch( com.sun.star.uno.Exception e ) { - throw new StatusException("Could not instantiate QueryDesign", e) ; - } + Object oQueryDesign = xMSF.createInstance("com.sun.star.sdb.QueryDesign"); XController xCont = UnoRuntime.queryInterface(XController.class, oQueryDesign); // marry them all xCont.attachModel(xMod); xMod.connectController(xCont); - try{ - xMod.setCurrentController(xCont); - } catch (com.sun.star.container.NoSuchElementException e){ - throw new StatusException("Could not set controller", e) ; - } + xMod.setCurrentController(xCont); return UnoRuntime.queryInterface(XInitialization.class, oQueryDesign); - } @Override diff --git a/qadevOOo/tests/java/mod/_dbaccess/SbaXGridControl.java b/qadevOOo/tests/java/mod/_dbaccess/SbaXGridControl.java index 6554dc15380e..9edd7b4f4271 100644 --- a/qadevOOo/tests/java/mod/_dbaccess/SbaXGridControl.java +++ b/qadevOOo/tests/java/mod/_dbaccess/SbaXGridControl.java @@ -395,7 +395,7 @@ public class SbaXGridControl extends TestCase { } // finish method getTestEnvironment public static XControlShape createGrid(XComponent oDoc, int height, - int width, int x, int y) { + int width, int x, int y) throws Exception { Size size = new Size(); Point position = new Point(); XControlShape oCShape = null; @@ -406,30 +406,24 @@ public class SbaXGridControl extends TestCase { XMultiServiceFactory.class, oDoc); - try { - Object oInt = oDocMSF.createInstance( - "com.sun.star.drawing.ControlShape"); - Object aCon = oDocMSF.createInstance( - "com.sun.star.form.component.GridControl"); - XPropertySet model_props = UnoRuntime.queryInterface( - XPropertySet.class, aCon); - model_props.setPropertyValue("DefaultControl", - "com.sun.star.form.control.InteractionGridControl"); - aControl = UnoRuntime.queryInterface( - XControlModel.class, aCon); - oCShape = UnoRuntime.queryInterface( - XControlShape.class, oInt); - size.Height = height; - size.Width = width; - position.X = x; - position.Y = y; - oCShape.setSize(size); - oCShape.setPosition(position); - } catch (com.sun.star.uno.Exception e) { - // Some exception occurs.FAILED - System.out.println("Couldn't create Grid" + e); - throw new StatusException("Couldn't create Grid", e); - } + Object oInt = oDocMSF.createInstance( + "com.sun.star.drawing.ControlShape"); + Object aCon = oDocMSF.createInstance( + "com.sun.star.form.component.GridControl"); + XPropertySet model_props = UnoRuntime.queryInterface( + XPropertySet.class, aCon); + model_props.setPropertyValue("DefaultControl", + "com.sun.star.form.control.InteractionGridControl"); + aControl = UnoRuntime.queryInterface( + XControlModel.class, aCon); + oCShape = UnoRuntime.queryInterface( + XControlShape.class, oInt); + size.Height = height; + size.Width = width; + position.X = x; + position.Y = y; + oCShape.setSize(size); + oCShape.setPosition(position); oCShape.setControl(aControl); diff --git a/qadevOOo/tests/java/mod/_defreg/NestedRegistry.java b/qadevOOo/tests/java/mod/_defreg/NestedRegistry.java index dcd8186adca2..c8755cda61d8 100644 --- a/qadevOOo/tests/java/mod/_defreg/NestedRegistry.java +++ b/qadevOOo/tests/java/mod/_defreg/NestedRegistry.java @@ -132,7 +132,7 @@ public class NestedRegistry extends TestCase { @Override public TestEnvironment createTestEnvironment( TestParameters Param, PrintWriter log ) - throws StatusException { + throws Exception { XInterface oObj = null; Object oInterface = null; @@ -144,15 +144,9 @@ public class NestedRegistry extends TestCase { uniq++ ; log.println("creating copies of the registry for XSimpleRegistry"); - try { - String source = utils.getFullTestDocName("XSimpleRegistry.rdb"); - copyFile(source, openF, log) ; - copyFile(source, mergeF, log) ; - } catch (java.io.IOException e) { - log.println("Exception occurred while copying files"); - e.printStackTrace(log); - throw new StatusException("Exception occurred while copying files", e); - } + String source = utils.getFullTestDocName("XSimpleRegistry.rdb"); + copyFile(source, openF, log) ; + copyFile(source, mergeF, log) ; try { XMultiServiceFactory xMSF = Param.getMSF(); diff --git a/qadevOOo/tests/java/mod/_forms/ODatabaseForm.java b/qadevOOo/tests/java/mod/_forms/ODatabaseForm.java index 8070c31a9ece..01bcbd7479a1 100644 --- a/qadevOOo/tests/java/mod/_forms/ODatabaseForm.java +++ b/qadevOOo/tests/java/mod/_forms/ODatabaseForm.java @@ -481,13 +481,7 @@ public class ODatabaseForm extends TestCase { XResultSet the_set = UnoRuntime.queryInterface( XResultSet.class, oObj); - try { - the_set.first(); - } catch (SQLException e) { - log.println("Cann't move cursor to the first row."); - e.printStackTrace(); - throw new StatusException("Can't move cursor to the first row.", e); - } + the_set.first(); tEnv.addObjRelation("Model1", shape1.getControl()); tEnv.addObjRelation("Model2", shape2.getControl()); diff --git a/qadevOOo/tests/java/mod/_fwl/ContentHandlerFactory.java b/qadevOOo/tests/java/mod/_fwl/ContentHandlerFactory.java index 09e40883e43a..25461104707c 100644 --- a/qadevOOo/tests/java/mod/_fwl/ContentHandlerFactory.java +++ b/qadevOOo/tests/java/mod/_fwl/ContentHandlerFactory.java @@ -67,11 +67,6 @@ public class ContentHandlerFactory extends TestCase { oInterface = Param.getMSF().createInstance ("com.sun.star.frame.ContentHandlerFactory") ; - if (oInterface == null) { - log.println("Service wasn't created") ; - throw new StatusException(Status.failed("Service wasn't created")) ; - } - oObj = (XInterface) oInterface ; log.println("ImplName: "+utils.getImplName(oObj)); diff --git a/qadevOOo/tests/java/mod/_lnn/Thesaurus.java b/qadevOOo/tests/java/mod/_lnn/Thesaurus.java index b507ea59d902..d645fa17aae2 100644 --- a/qadevOOo/tests/java/mod/_lnn/Thesaurus.java +++ b/qadevOOo/tests/java/mod/_lnn/Thesaurus.java @@ -67,17 +67,10 @@ public class Thesaurus extends TestCase { */ @Override protected TestEnvironment createTestEnvironment - (TestParameters tParam, PrintWriter log) { + (TestParameters tParam, PrintWriter log) throws Exception { XMultiServiceFactory xMSF = tParam.getMSF(); - XInterface oObj = null; - - try { - oObj = (XInterface)xMSF.createInstance + XInterface oObj = (XInterface)xMSF.createInstance ("com.sun.star.linguistic2.Thesaurus"); - } catch (com.sun.star.uno.Exception e) { - e.printStackTrace(log); - throw new StatusException("Unexpected exception", e); - } String Iname = util.utils.getImplName(oObj); log.println("Implementation Name: "+Iname); diff --git a/qadevOOo/tests/java/mod/_sc/ScAccessibleCell.java b/qadevOOo/tests/java/mod/_sc/ScAccessibleCell.java index ebd9437b4411..5cdeff515443 100644 --- a/qadevOOo/tests/java/mod/_sc/ScAccessibleCell.java +++ b/qadevOOo/tests/java/mod/_sc/ScAccessibleCell.java @@ -115,13 +115,8 @@ public class ScAccessibleCell extends TestCase { try { XSpreadsheets oSheets = xSpreadsheetDoc.getSheets() ; XIndexAccess oIndexSheets = UnoRuntime.queryInterface(XIndexAccess.class, oSheets); - XSpreadsheet oSheet = null; - try { - oSheet = (XSpreadsheet) AnyConverter.toObject( - new Type(XSpreadsheet.class),oIndexSheets.getByIndex(0)); - } catch (com.sun.star.lang.IllegalArgumentException iae) { - throw new StatusException("couldn't get sheet",iae); - } + XSpreadsheet oSheet = (XSpreadsheet) AnyConverter.toObject( + new Type(XSpreadsheet.class),oIndexSheets.getByIndex(0)); xCell = oSheet.getCellByPosition(1, 0) ; xCell.setFormula(text); XColumnRowRange oColumnRowRange = UnoRuntime.queryInterface(XColumnRowRange.class, oSheet); diff --git a/qadevOOo/tests/java/mod/_sc/ScAccessiblePageHeader.java b/qadevOOo/tests/java/mod/_sc/ScAccessiblePageHeader.java index e6060aadb4e0..27e22248b2eb 100644 --- a/qadevOOo/tests/java/mod/_sc/ScAccessiblePageHeader.java +++ b/qadevOOo/tests/java/mod/_sc/ScAccessiblePageHeader.java @@ -95,13 +95,8 @@ public class ScAccessiblePageHeader extends TestCase { try { XSpreadsheets oSheets = xSpreadsheetDoc.getSheets() ; XIndexAccess oIndexSheets = UnoRuntime.queryInterface(XIndexAccess.class, oSheets); - XSpreadsheet oSheet = null; - try { - oSheet = (XSpreadsheet) AnyConverter.toObject( - new Type(XSpreadsheet.class),oIndexSheets.getByIndex(0)); - } catch (com.sun.star.lang.IllegalArgumentException iae) { - throw new StatusException("couldn't get sheet",iae); - } + XSpreadsheet oSheet = (XSpreadsheet) AnyConverter.toObject( + new Type(XSpreadsheet.class),oIndexSheets.getByIndex(0)); xCell = oSheet.getCellByPosition(0, 0) ; xCell.setFormula("ScAccessiblePageHeader"); } catch(com.sun.star.lang.WrappedTargetException e) { diff --git a/qadevOOo/tests/java/mod/_sc/ScAutoFormatsObj.java b/qadevOOo/tests/java/mod/_sc/ScAutoFormatsObj.java index 25683aad9964..7cd2341a9e60 100644 --- a/qadevOOo/tests/java/mod/_sc/ScAutoFormatsObj.java +++ b/qadevOOo/tests/java/mod/_sc/ScAutoFormatsObj.java @@ -106,45 +106,39 @@ public class ScAutoFormatsObj extends TestCase{ @Override public TestEnvironment createTestEnvironment (TestParameters Param, PrintWriter log ) - throws StatusException { + throws Exception { XInterface oObj = null; - try { - // creation of testobject here - // get AutoFormats - XComponent xComp = UnoRuntime.queryInterface - (XComponent.class, xSheetDoc); - oObj = (XInterface) AnyConverter.toObject( - new Type(XInterface.class),Param.getMSF().createInstance - ("com.sun.star.sheet.TableAutoFormats")); - Object secondInstance = SOF.createInstance - (xComp, "com.sun.star.sheet.TableAutoFormat"); - - TestEnvironment tEnv = new TestEnvironment(oObj) ; - - //adding ObjRelation for XNameContainer - tEnv.addObjRelation("SecondInstance",secondInstance); - - // INSTANCEn : _XNameContainer; _XNameReplace - log.println( "adding INSTANCEn as mod relation to environment" ); - int THRCNT = 1; - if ((String)Param.get("THRCNT") != null) { - Integer.parseInt((String)Param.get("THRCNT")); - } - for (int n = 1; n < (THRCNT+1) ;n++ ) { - log.println( "adding INSTANCE" + n - +" as mod relation to environment" ); - tEnv.addObjRelation("INSTANCE" + n, SOF.createInstance(xComp, - "com.sun.star.sheet.TableAutoFormat")); - } - - return tEnv; - } catch (com.sun.star.uno.Exception e) { - log.println ("Exception occurred while creating test Object."); - e.printStackTrace(log); - throw new StatusException("Couldn't create test object", e); + // creation of testobject here + // get AutoFormats + XComponent xComp = UnoRuntime.queryInterface + (XComponent.class, xSheetDoc); + oObj = (XInterface) AnyConverter.toObject( + new Type(XInterface.class),Param.getMSF().createInstance + ("com.sun.star.sheet.TableAutoFormats")); + Object secondInstance = SOF.createInstance + (xComp, "com.sun.star.sheet.TableAutoFormat"); + + TestEnvironment tEnv = new TestEnvironment(oObj) ; + + //adding ObjRelation for XNameContainer + tEnv.addObjRelation("SecondInstance",secondInstance); + + // INSTANCEn : _XNameContainer; _XNameReplace + log.println( "adding INSTANCEn as mod relation to environment" ); + int THRCNT = 1; + if ((String)Param.get("THRCNT") != null) { + Integer.parseInt((String)Param.get("THRCNT")); + } + for (int n = 1; n < (THRCNT+1) ;n++ ) { + log.println( "adding INSTANCE" + n + +" as mod relation to environment" ); + tEnv.addObjRelation("INSTANCE" + n, SOF.createInstance(xComp, + "com.sun.star.sheet.TableAutoFormat")); } + + return tEnv; } } // finish class ScAutoFormatsObj diff --git a/qadevOOo/tests/java/mod/_sc/ScChartObj.java b/qadevOOo/tests/java/mod/_sc/ScChartObj.java index 8e6100c36e4a..d2530fa76296 100644 --- a/qadevOOo/tests/java/mod/_sc/ScChartObj.java +++ b/qadevOOo/tests/java/mod/_sc/ScChartObj.java @@ -201,27 +201,12 @@ public class ScChartObj extends TestCase { // get the TableChart XTableChart oChart = null; - try { - XNameAccess names = (XNameAccess) AnyConverter.toObject( - new Type(XNameAccess.class),UnoRuntime.queryInterface( - XNameAccess.class, oCharts)); - - oChart = (XTableChart) AnyConverter.toObject( - new Type(XTableChart.class),names.getByName("ScChartObj")); - - } catch (com.sun.star.lang.WrappedTargetException e) { - log.println("Couldn't get TableChart"); - e.printStackTrace(log); - throw new StatusException("Couldn't get TableChart", e); - } catch (com.sun.star.container.NoSuchElementException e) { - log.println("Couldn't get TableChart"); - e.printStackTrace(log); - throw new StatusException("Couldn't get TableChart", e); - } catch (com.sun.star.lang.IllegalArgumentException e) { - log.println("Couldn't get TableChart"); - e.printStackTrace(log); - throw new StatusException("Couldn't get TableChart", e); - } + XNameAccess names = (XNameAccess) AnyConverter.toObject( + new Type(XNameAccess.class),UnoRuntime.queryInterface( + XNameAccess.class, oCharts)); + + oChart = (XTableChart) AnyConverter.toObject( + new Type(XTableChart.class),names.getByName("ScChartObj")); log.println("creating a new environment for object"); TestEnvironment tEnv = new TestEnvironment(oChart); diff --git a/qadevOOo/tests/java/mod/_sc/ScDataPilotTableObj.java b/qadevOOo/tests/java/mod/_sc/ScDataPilotTableObj.java index 388d35553140..6440655446d9 100644 --- a/qadevOOo/tests/java/mod/_sc/ScDataPilotTableObj.java +++ b/qadevOOo/tests/java/mod/_sc/ScDataPilotTableObj.java @@ -40,6 +40,7 @@ import com.sun.star.sheet.XSpreadsheets; import com.sun.star.table.CellAddress; import com.sun.star.table.CellRangeAddress; import com.sun.star.uno.AnyConverter; +import com.sun.star.uno.Exception; import com.sun.star.uno.Type; import com.sun.star.uno.UnoRuntime; import com.sun.star.uno.XInterface; @@ -229,7 +230,7 @@ public class ScDataPilotTableObj extends TestCase { * @param srcRange source range * @param tEnv test environment instance */ - private void createTable2(XSpreadsheet oSheet, CellRangeAddress srcRange, TestEnvironment tEnv) + private void createTable2(XSpreadsheet oSheet, CellRangeAddress srcRange, TestEnvironment tEnv) throws Exception { XDataPilotTablesSupplier DPTS = UnoRuntime.queryInterface(XDataPilotTablesSupplier.class, oSheet); log.println("Creating test table object"); @@ -239,53 +240,45 @@ public class ScDataPilotTableObj extends TestCase { XIndexAccess xIA = DPDsc.getDataPilotFields(); int fieldCount = xIA.getCount() - 1; // skip the last field because it's always hidden. - try + for (int i = 0; i < fieldCount; ++i) { - for (int i = 0; i < fieldCount; ++i) + Object o = xIA.getByIndex(i); + XPropertySet fieldPropSet = UnoRuntime.queryInterface( + XPropertySet.class, o); + + if (i == fieldCount - 1) + { + // last field + fieldPropSet.setPropertyValue( + "Function", com.sun.star.sheet.GeneralFunction.SUM); + fieldPropSet.setPropertyValue( + "Orientation", com.sun.star.sheet.DataPilotFieldOrientation.DATA); + } + else if (i%2 == 0) + { + // even number fields + fieldPropSet.setPropertyValue( + "Orientation", com.sun.star.sheet.DataPilotFieldOrientation.COLUMN); + } + else if (i%2 == 1) { - Object o = xIA.getByIndex(i); - XPropertySet fieldPropSet = UnoRuntime.queryInterface( - XPropertySet.class, o); - - if (i == fieldCount - 1) - { - // last field - fieldPropSet.setPropertyValue( - "Function", com.sun.star.sheet.GeneralFunction.SUM); - fieldPropSet.setPropertyValue( - "Orientation", com.sun.star.sheet.DataPilotFieldOrientation.DATA); - } - else if (i%2 == 0) - { - // even number fields - fieldPropSet.setPropertyValue( - "Orientation", com.sun.star.sheet.DataPilotFieldOrientation.COLUMN); - } - else if (i%2 == 1) - { - // odd number fields - fieldPropSet.setPropertyValue( - "Orientation", com.sun.star.sheet.DataPilotFieldOrientation.ROW); - } + // odd number fields + fieldPropSet.setPropertyValue( + "Orientation", com.sun.star.sheet.DataPilotFieldOrientation.ROW); } + } - if (DPT.hasByName("DataPilotTable2")) - DPT.removeByName("DataPilotTable2"); + if (DPT.hasByName("DataPilotTable2")) + DPT.removeByName("DataPilotTable2"); - CellAddress destAddr = new CellAddress(); - destAddr.Sheet = 0; - destAddr.Column = 0; - destAddr.Row = 14; - DPT.insertNewByName("DataPilotTable2", destAddr, DPDsc); + CellAddress destAddr = new CellAddress(); + destAddr.Sheet = 0; + destAddr.Column = 0; + destAddr.Row = 14; + DPT.insertNewByName("DataPilotTable2", destAddr, DPDsc); - Object o = DPT.getByName("DataPilotTable2"); - tEnv.addObjRelation("DATAPILOTTABLE2", o); - } - catch (com.sun.star.uno.Exception e) - { - e.printStackTrace(log); - throw new StatusException("Couldn't create a test environment", e); - } + Object o = DPT.getByName("DataPilotTable2"); + tEnv.addObjRelation("DATAPILOTTABLE2", o); } } diff --git a/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_DatabaseRangesEnumeration.java b/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_DatabaseRangesEnumeration.java index 09a8d5cb64c8..ccd5ee7e8f77 100644 --- a/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_DatabaseRangesEnumeration.java +++ b/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_DatabaseRangesEnumeration.java @@ -33,6 +33,7 @@ import com.sun.star.sheet.XDatabaseRanges; import com.sun.star.sheet.XSpreadsheetDocument; import com.sun.star.table.CellRangeAddress; import com.sun.star.uno.AnyConverter; +import com.sun.star.uno.Exception; import com.sun.star.uno.Type; import com.sun.star.uno.UnoRuntime; import com.sun.star.uno.XInterface; @@ -70,7 +71,7 @@ public class ScIndexEnumeration_DatabaseRangesEnumeration extends TestCase { } @Override - protected TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) { + protected TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) throws Exception { XInterface oObj = null; @@ -81,24 +82,9 @@ public class ScIndexEnumeration_DatabaseRangesEnumeration extends TestCase { log.println("Getting test object ") ; XPropertySet docProps = UnoRuntime.queryInterface(XPropertySet.class, xSheetDoc); - XDatabaseRanges dbRanges = null; - try { - dbRanges = (XDatabaseRanges) AnyConverter.toObject( - new Type(XDatabaseRanges.class), - docProps.getPropertyValue("DatabaseRanges")); - } catch (com.sun.star.lang.WrappedTargetException e) { - e.printStackTrace(log) ; - throw new StatusException( - "Error getting test object from spreadsheet document",e) ; - } catch (com.sun.star.beans.UnknownPropertyException e) { - e.printStackTrace(log) ; - throw new StatusException( - "Error getting test object from spreadsheet document",e) ; - } catch (com.sun.star.lang.IllegalArgumentException e) { - e.printStackTrace(log) ; - throw new StatusException( - "Error getting test object from spreadsheet document",e) ; - } + XDatabaseRanges dbRanges = (XDatabaseRanges) AnyConverter.toObject( + new Type(XDatabaseRanges.class), + docProps.getPropertyValue("DatabaseRanges")); log.println("Adding at least one element for ElementAccess interface"); CellRangeAddress aRange = new CellRangeAddress((short)0, 2, 4, 5, 6); diff --git a/qadevOOo/tests/java/mod/_sfx/AppDispatchProvider.java b/qadevOOo/tests/java/mod/_sfx/AppDispatchProvider.java index b2516f95003a..b6777c7a518a 100644 --- a/qadevOOo/tests/java/mod/_sfx/AppDispatchProvider.java +++ b/qadevOOo/tests/java/mod/_sfx/AppDispatchProvider.java @@ -67,11 +67,6 @@ public class AppDispatchProvider extends TestCase { oInterface = Param.getMSF().createInstance ("com.sun.star.comp.sfx2.AppDispatchProvider") ; - if (oInterface == null) { - log.println("Service wasn't created") ; - throw new StatusException(Status.failed("Service wasn't created")) ; - } - oObj = (XInterface) oInterface ; System.out.println("ImplName: "+utils.getImplName(oObj)); dbg.printInterfaces(oObj); |