summaryrefslogtreecommitdiff
path: root/qadevOOo
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2017-01-16 15:24:56 +0100
committerMichael Stahl <mstahl@redhat.com>2017-01-16 15:37:45 +0100
commite5a502392431a49fe8c60eccf75fc150178f6c07 (patch)
tree908c9e7549c22ca09a92910ba44b20d255d75080 /qadevOOo
parent0bb8bcf1f8ea7b0e54eb52dc53b986d0485fa07c (diff)
qadevOOo: remove silly exception catching from util.FormTools
What's the point of catching an exception and then continuing onwards in a unit test? Change-Id: I100dfcaa9a4fdd5398cf4ac38426ec4397451b8e
Diffstat (limited to 'qadevOOo')
-rw-r--r--qadevOOo/runner/util/FormTools.java180
-rw-r--r--qadevOOo/tests/java/ifc/drawing/_XControlShape.java4
-rw-r--r--qadevOOo/tests/java/ifc/view/_XControlAccess.java4
-rw-r--r--qadevOOo/tests/java/mod/_forms/OFormsCollection.java4
-rw-r--r--qadevOOo/tests/java/mod/_forms/OScrollBarModel.java4
-rw-r--r--qadevOOo/tests/java/mod/_forms/OSpinButtonModel.java5
-rw-r--r--qadevOOo/tests/java/mod/_svx/AccessibleControlShape.java4
-rw-r--r--qadevOOo/tests/java/mod/_sw/SwXTextView.java4
-rw-r--r--qadevOOo/tests/java/mod/_toolkit/TabController.java6
9 files changed, 99 insertions, 116 deletions
diff --git a/qadevOOo/runner/util/FormTools.java b/qadevOOo/runner/util/FormTools.java
index dd68221cdf2e..2189612cd171 100644
--- a/qadevOOo/runner/util/FormTools.java
+++ b/qadevOOo/runner/util/FormTools.java
@@ -57,33 +57,29 @@ public class FormTools {
* @return the created XControlShape
*/
public static XControlShape createControlShape( XComponent oDoc, int height,
- int width, int x, int y, String kind ) {
+ int width, int x, int y, String kind )
+ throws com.sun.star.uno.Exception
+ {
Size size = new Size();
Point position = new Point();
XControlShape oCShape = null;
XControlModel aControl = null;
- //get MSF
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);
- 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 );
- 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 instance "+ e );
- }
+ Object oInt = oDocMSF.createInstance("com.sun.star.drawing.ControlShape");
+ Object aCon = oDocMSF.createInstance("com.sun.star.form.component."+kind);
+ 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 );
+ size.Height = height;
+ size.Width = width;
+ position.X = x;
+ position.Y = y;
+ oCShape.setSize(size);
+ oCShape.setPosition(position);
oCShape.setControl(aControl);
@@ -91,35 +87,29 @@ public class FormTools {
} // finish createControlShape
public static XControlShape createUnoControlShape( XComponent oDoc, int height,
- int width, int x, int y, String kind, String defControl ) {
+ int width, int x, int y, String kind, String defControl )
+ throws com.sun.star.uno.Exception
+ {
Size size = new Size();
Point position = new Point();
XControlShape oCShape = null;
XControlModel aControl = null;
- //get MSF
- 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);
- 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 );
- 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 instance "+ e );
- }
+ XMultiServiceFactory oDocMSF = UnoRuntime.queryInterface( XMultiServiceFactory.class, oDoc );
+
+ Object oInt = oDocMSF.createInstance("com.sun.star.drawing.ControlShape");
+ Object aCon = oDocMSF.createInstance("com.sun.star.form.component."+kind);
+ 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 );
+ size.Height = height;
+ size.Width = width;
+ position.X = x;
+ position.Y = y;
+ oCShape.setSize(size);
+ oCShape.setPosition(position);
oCShape.setControl(aControl);
@@ -127,53 +117,43 @@ public class FormTools {
} // finish createControlShape
public static XControlShape createControlShapeWithDefaultControl( XComponent oDoc, int height,
- int width, int x, int y, String kind ) {
+ int width, int x, int y, String kind )
+ throws com.sun.star.uno.Exception
+ {
Size size = new Size();
Point position = new Point();
XControlShape oCShape = null;
XControlModel aControl = null;
- //get MSF
- 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 = 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);
+ XMultiServiceFactory oDocMSF = UnoRuntime.queryInterface( XMultiServiceFactory.class, oDoc );
+ Object oInt = oDocMSF.createInstance("com.sun.star.drawing.ControlShape");
+ Object aCon = oDocMSF.createInstance("com.sun.star.form.component."+kind);
- } catch ( com.sun.star.uno.Exception e ) {
- // Some exception occurs.FAILED
- System.out.println( "Couldn't create instance "+ e );
- }
+ 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);
return oCShape;
} // finish createControlShape
- public static XInterface createControl( XComponent oDoc, String kind ) {
-
+ public static XInterface createControl( XComponent oDoc, String kind )
+ throws com.sun.star.uno.Exception
+ {
XInterface oControl = null;
- XMultiServiceFactory oDocMSF = UnoRuntime.queryInterface( XMultiServiceFactory.class, oDoc );
+ XMultiServiceFactory oDocMSF = UnoRuntime.queryInterface( XMultiServiceFactory.class, oDoc );
- try{
- oControl = (XInterface) oDocMSF.createInstance(
+ oControl = (XInterface) oDocMSF.createInstance(
"com.sun.star.form.component."+kind);
- } catch ( Exception e ) {
- // Some exception occurs.FAILED
- System.out.println( "Couldn't create instance "+ kind + ": "+ e );
- }
return oControl;
} // finish createControl
@@ -193,46 +173,37 @@ public class FormTools {
} //finish getIndexedForms
public static void insertForm ( XComponent aDoc, XNameContainer Forms,
- String aName ) {
- try {
- XInterface oControl = createControl(aDoc, "Form");
- XForm oForm = UnoRuntime.queryInterface(XForm.class, oControl);
- Forms.insertByName(aName,oForm);
- } catch ( Exception e ) {
- throw new IllegalArgumentException( "Couldn't insert Form", e );
- }
+ String aName )
+ throws com.sun.star.uno.Exception
+ {
+ XInterface oControl = createControl(aDoc, "Form");
+ XForm oForm = UnoRuntime.queryInterface(XForm.class, oControl);
+ Forms.insertByName(aName,oForm);
}
public static XControlShape insertControlShape( XComponent oDoc, int height,
- int width, int x, int y, String kind ) {
-
+ int width, int x, int y, String kind )
+ throws com.sun.star.uno.Exception
+ {
XControlShape aShape = createControlShape(oDoc,height,width,x,y,kind);
XDrawPage oDP = DrawTools.getDrawPage(oDoc,0);
DrawTools.getShapes(oDP).add(aShape);
return aShape;
}
- public static XLoadable bindForm( XTextDocument aDoc ) {
+ public static XLoadable bindForm( XTextDocument aDoc )
+ throws com.sun.star.uno.Exception
+ {
XLoadable formLoader = null;
- try {
- Object aForm = FormTools.getIndexedForms(WriterTools.getDrawPage(aDoc)).getByIndex(0);
- XForm the_form = null;
- try {
- the_form = (XForm) AnyConverter.toObject(new Type(XForm.class), aForm);
- } catch (com.sun.star.lang.IllegalArgumentException iae) {
- System.out.println("### Couldn't convert Any");
- }
- XPropertySet formProps = UnoRuntime.queryInterface(XPropertySet.class, the_form);
- formProps.setPropertyValue("DataSourceName","Bibliography");
- formProps.setPropertyValue("Command","biblio");
- formProps.setPropertyValue("CommandType",Integer.valueOf(com.sun.star.sdb.CommandType.TABLE));
- formLoader = UnoRuntime.queryInterface(XLoadable.class, the_form);
- }
- catch (Exception ex) {
- System.out.println("Exception: "+ex);
- ex.printStackTrace(System.err);
- }
+ Object aForm = FormTools.getIndexedForms(WriterTools.getDrawPage(aDoc)).getByIndex(0);
+ XForm the_form = null;
+ the_form = (XForm) AnyConverter.toObject(new Type(XForm.class), aForm);
+ XPropertySet formProps = UnoRuntime.queryInterface(XPropertySet.class, the_form);
+ formProps.setPropertyValue("DataSourceName","Bibliography");
+ formProps.setPropertyValue("Command","biblio");
+ formProps.setPropertyValue("CommandType",Integer.valueOf(com.sun.star.sdb.CommandType.TABLE));
+ formLoader = UnoRuntime.queryInterface(XLoadable.class, the_form);
return formLoader;
}
@@ -286,8 +257,9 @@ public class FormTools {
return UnoRuntime.queryInterface(XLoadable.class, the_form);
}
- public static void switchDesignOf(XMultiServiceFactory xMSF, XTextDocument aDoc) {
- try {
+ public static void switchDesignOf(XMultiServiceFactory xMSF, XTextDocument aDoc)
+ throws com.sun.star.uno.Exception
+ {
com.sun.star.frame.XController aController = aDoc.getCurrentController();
com.sun.star.frame.XFrame aFrame = aController.getFrame();
com.sun.star.frame.XDispatchProvider aDispProv = UnoRuntime.queryInterface(com.sun.star.frame.XDispatchProvider.class,aFrame);
@@ -310,10 +282,6 @@ public class FormTools {
com.sun.star.beans.PropertyValue[] noArgs = new com.sun.star.beans.PropertyValue[0];
aDisp.dispatch(aURL, noArgs);
util.utils.waitForEventIdle(xMSF); // async dispatch
- } catch (Exception e) {
- System.out.println("******* Mist");
- e.printStackTrace();
- }
}
}
diff --git a/qadevOOo/tests/java/ifc/drawing/_XControlShape.java b/qadevOOo/tests/java/ifc/drawing/_XControlShape.java
index f0e5ca2d6d9f..fadf945a8676 100644
--- a/qadevOOo/tests/java/ifc/drawing/_XControlShape.java
+++ b/qadevOOo/tests/java/ifc/drawing/_XControlShape.java
@@ -68,7 +68,9 @@ public class _XControlShape extends MultiMethodTest {
* <li> <code> getControl() </code> </li>
* </ul>
*/
- public void _setControl() {
+ public void _setControl()
+ throws com.sun.star.uno.Exception
+ {
requiredMethod("getControl()") ;
XInterface oNewControl = FormTools.createControl
diff --git a/qadevOOo/tests/java/ifc/view/_XControlAccess.java b/qadevOOo/tests/java/ifc/view/_XControlAccess.java
index 26d9d3a681ea..65287304c1a0 100644
--- a/qadevOOo/tests/java/ifc/view/_XControlAccess.java
+++ b/qadevOOo/tests/java/ifc/view/_XControlAccess.java
@@ -64,7 +64,9 @@ public class _XControlAccess extends MultiMethodTest {
* is returned. <p>
* @throws StatusException If the relation was not found.
*/
- public void _getControl(){
+ public void _getControl()
+ throws com.sun.star.uno.Exception
+ {
boolean bResult = true;
try {
XComponent oDoc = (XComponent)tEnv.getObjRelation("DOCUMENT");
diff --git a/qadevOOo/tests/java/mod/_forms/OFormsCollection.java b/qadevOOo/tests/java/mod/_forms/OFormsCollection.java
index f608b5d0c7cf..00bc2e21b8b2 100644
--- a/qadevOOo/tests/java/mod/_forms/OFormsCollection.java
+++ b/qadevOOo/tests/java/mod/_forms/OFormsCollection.java
@@ -117,7 +117,9 @@ public class OFormsCollection extends TestCase {
*/
@Override
protected TestEnvironment createTestEnvironment(TestParameters Param,
- PrintWriter log) {
+ PrintWriter log)
+ throws com.sun.star.uno.Exception
+ {
XInterface oObj = null;
XDrawPage oDP = null;
diff --git a/qadevOOo/tests/java/mod/_forms/OScrollBarModel.java b/qadevOOo/tests/java/mod/_forms/OScrollBarModel.java
index ddd5d209899d..cd6c241618cb 100644
--- a/qadevOOo/tests/java/mod/_forms/OScrollBarModel.java
+++ b/qadevOOo/tests/java/mod/_forms/OScrollBarModel.java
@@ -64,7 +64,9 @@ public class OScrollBarModel extends TestCase {
}
@Override
- protected TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) {
+ protected TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log)
+ throws com.sun.star.uno.Exception
+ {
XInterface oObj = null;
diff --git a/qadevOOo/tests/java/mod/_forms/OSpinButtonModel.java b/qadevOOo/tests/java/mod/_forms/OSpinButtonModel.java
index 0a3ec02c6155..d4864f285a3a 100644
--- a/qadevOOo/tests/java/mod/_forms/OSpinButtonModel.java
+++ b/qadevOOo/tests/java/mod/_forms/OSpinButtonModel.java
@@ -69,8 +69,9 @@ public class OSpinButtonModel extends TestCase {
* Adds spin button into text and retrieves it's control model.
*/
@Override
- protected TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) {
-
+ protected TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log)
+ throws com.sun.star.uno.Exception
+ {
XInterface oObj = null;
XControlShape aShape = FormTools.createControlShape(
diff --git a/qadevOOo/tests/java/mod/_svx/AccessibleControlShape.java b/qadevOOo/tests/java/mod/_svx/AccessibleControlShape.java
index 4886436b9cf0..8f55793f09e5 100644
--- a/qadevOOo/tests/java/mod/_svx/AccessibleControlShape.java
+++ b/qadevOOo/tests/java/mod/_svx/AccessibleControlShape.java
@@ -62,7 +62,9 @@ public class AccessibleControlShape extends TestCase {
@Override
protected TestEnvironment createTestEnvironment
- (TestParameters tParam, PrintWriter log) {
+ (TestParameters tParam, PrintWriter log)
+ throws com.sun.star.uno.Exception
+ {
XInterface oObj = null;
diff --git a/qadevOOo/tests/java/mod/_sw/SwXTextView.java b/qadevOOo/tests/java/mod/_sw/SwXTextView.java
index 9c8ea4b0ed05..bbb8d6662d46 100644
--- a/qadevOOo/tests/java/mod/_sw/SwXTextView.java
+++ b/qadevOOo/tests/java/mod/_sw/SwXTextView.java
@@ -116,7 +116,9 @@ public class SwXTextView extends TestCase {
*/
@Override
public TestEnvironment createTestEnvironment( TestParameters tParam,
- PrintWriter log )throws StatusException {
+ PrintWriter log )
+ throws com.sun.star.uno.Exception
+ {
// creation of testobject here
diff --git a/qadevOOo/tests/java/mod/_toolkit/TabController.java b/qadevOOo/tests/java/mod/_toolkit/TabController.java
index 7f361567f893..0f483bb04b6f 100644
--- a/qadevOOo/tests/java/mod/_toolkit/TabController.java
+++ b/qadevOOo/tests/java/mod/_toolkit/TabController.java
@@ -59,7 +59,9 @@ public class TabController extends TestCase {
@Override
public TestEnvironment createTestEnvironment(TestParameters param,
- PrintWriter log) {
+ PrintWriter log)
+ throws com.sun.star.uno.Exception
+ {
XInterface oObj = null;
XControl xCtrl1 = null;
XTabControllerModel tabCtrlModel = null;
@@ -121,4 +123,4 @@ public class TabController extends TestCase {
return tEnv;
}
-} \ No newline at end of file
+}