From 881c030fc1e69cffc99b2360c986f516e61f01ab Mon Sep 17 00:00:00 2001 From: Robert Antoni Buj i Gelonch Date: Sun, 12 Oct 2014 12:08:44 +0200 Subject: runner: Concatenating null strings in Java (JDK 1.5+) JLS, Section 15.18.1.1: If the reference is null, it is converted to the string "null". http://docs.oracle.com/javase/specs/jls/se5.0/html/expressions.html#15.18.1.1 Change-Id: Idae09c02b24da38ec6f3475fd0af35ef48a2405b Reviewed-on: https://gerrit.libreoffice.org/11930 Reviewed-by: Noel Grandin Tested-by: Noel Grandin --- qadevOOo/runner/util/UITools.java | 27 ++++----------------------- 1 file changed, 4 insertions(+), 23 deletions(-) diff --git a/qadevOOo/runner/util/UITools.java b/qadevOOo/runner/util/UITools.java index 3f4701be4823..dfff8356910e 100644 --- a/qadevOOo/runner/util/UITools.java +++ b/qadevOOo/runner/util/UITools.java @@ -28,14 +28,15 @@ import com.sun.star.accessibility.XAccessibleContext; import com.sun.star.accessibility.XAccessibleEditableText; import com.sun.star.accessibility.XAccessibleText; import com.sun.star.accessibility.XAccessibleValue; + import com.sun.star.awt.XWindow; import com.sun.star.frame.XModel; import com.sun.star.lang.XMultiServiceFactory; import com.sun.star.text.XTextDocument; + import com.sun.star.uno.UnoRuntime; import com.sun.star.uno.XInterface; - /** * This class supports some functions to handle easily accessible objects */ @@ -69,7 +70,6 @@ public class UITools { return AccessibilityTools.getAccessibleObject(xWindow); } - private static String getString(XInterface xInt) { XAccessibleText oText = UnoRuntime.queryInterface(XAccessibleText.class, xInt); @@ -128,7 +128,6 @@ public class UITools { * @param buttonName is name name of the button to click * @throws java.lang.Exception if something fail */ - public void clickButton(String buttonName) throws java.lang.Exception { @@ -148,15 +147,12 @@ public class UITools { } } - - /** * Helper method: returns the entry manes of a List-Box * @param ListBoxName the name of the listbox * @return the listbox entry names * @throws java.lang.Exception if something fail */ - public String[] getListBoxItems(String ListBoxName) throws java.lang.Exception { @@ -209,7 +205,6 @@ public class UITools { return Items.toArray(ret); } - /** * set a value to a named check box * @param CheckBoxName the name of the check box @@ -236,8 +231,6 @@ public class UITools { } } - - /** * returns the message of a Basic-MessageBox * @return the message of a Basic-MessageBox @@ -246,30 +239,18 @@ public class UITools { public String getMsgBoxText() throws java.lang.Exception { - String cMessage = null; try{ XAccessibleContext xMessage =AccessibilityTools.getAccessibleObjectForRole(mXRoot, AccessibleRole.LABEL); XInterface xMessageInterface = UnoRuntime.queryInterface(XInterface.class, xMessage); - cMessage += (getString(xMessageInterface)); - - return cMessage; + return getString(xMessageInterface); } catch (Exception e) { throw new Exception("Could not get message from Basic-MessageBox:", e); } } - - - - - - - - - /** * Prints the accessible tree to the logWriter only if debugIsActive * is set to true @@ -280,4 +261,4 @@ public class UITools { AccessibilityTools.printAccessibleTree(log, mXRoot, debugIsActive); } -} +} \ No newline at end of file -- cgit