[Libreoffice-commits] core.git: 4 commits - javaunohelper/com qadevOOo/tests

Noel Grandin noel at peralex.com
Wed Oct 14 06:46:05 PDT 2015


 javaunohelper/com/sun/star/lib/uno/helper/UnoUrl.java |   54 ++++++++----------
 qadevOOo/tests/java/ifc/i18n/_XLocaleData.java        |    8 +-
 qadevOOo/tests/java/ifc/sheet/_XSheetAuditing.java    |    2 
 qadevOOo/tests/java/ifc/sheet/_XSubTotalField.java    |    4 +
 4 files changed, 33 insertions(+), 35 deletions(-)

New commits:
commit 8368a6ec4cd20d5a67d119199e130b9673625986
Author: Noel Grandin <noel at peralex.com>
Date:   Wed Oct 14 15:42:14 2015 +0200

    cid#1326853 EC: Comparing incompatible types for equality
    
    Change-Id: Idcb934cb8dcc89558e474ccff79ce7c1eff7da23

diff --git a/qadevOOo/tests/java/ifc/sheet/_XSubTotalField.java b/qadevOOo/tests/java/ifc/sheet/_XSubTotalField.java
index 7f00495..57fcb48 100644
--- a/qadevOOo/tests/java/ifc/sheet/_XSubTotalField.java
+++ b/qadevOOo/tests/java/ifc/sheet/_XSubTotalField.java
@@ -20,6 +20,8 @@ package ifc.sheet;
 
 import lib.MultiMethodTest;
 
+import java.util.Arrays;
+
 import com.sun.star.sheet.GeneralFunction;
 import com.sun.star.sheet.SubTotalColumn;
 import com.sun.star.sheet.XSubTotalField;
@@ -98,7 +100,7 @@ public class _XSubTotalField extends MultiMethodTest {
         oObj.setSubTotalColumns(columns);
         tRes.tested(
             "setSubTotalColumns()",
-            !STColumns.equals(oObj.getSubTotalColumns()) );
+            !Arrays.equals(STColumns, oObj.getSubTotalColumns()) );
     } // end of getSubTotalColumns
 
 }  // finish class _XSubTotalField
commit f1a3cea1532a5269da0b224fa2d3c51cafdf8ed7
Author: Noel Grandin <noel at peralex.com>
Date:   Wed Oct 14 15:38:50 2015 +0200

    cid#1326849 to cid#1326852 EC: Comparing incompatible types for equality
    
    Change-Id: I11100f394652e6c73b0dce0150c2859ce0aa0073

diff --git a/qadevOOo/tests/java/ifc/i18n/_XLocaleData.java b/qadevOOo/tests/java/ifc/i18n/_XLocaleData.java
index d2ba440..d94daef 100644
--- a/qadevOOo/tests/java/ifc/i18n/_XLocaleData.java
+++ b/qadevOOo/tests/java/ifc/i18n/_XLocaleData.java
@@ -261,7 +261,7 @@ public class _XLocaleData extends MultiMethodTest {
                 if ((str[j].equals(""))) {
                     printit = true;
                 }
-                res &= (!str.equals(""));
+                res &= (!str[j].equals(""));
             }
             if (printit) log.println("FAILED for: language=" + languages[i]
                 + " ; country=" + countries[i]);
@@ -286,7 +286,7 @@ public class _XLocaleData extends MultiMethodTest {
                 if ((str[j].equals(""))) {
                     printit = true;
                 }
-                res &= (!str.equals(""));
+                res &= (!str[j].equals(""));
             }
             if (printit) log.println("FAILED for: language=" + languages[i]
                 + " ; country=" + countries[i]);
@@ -311,7 +311,7 @@ public class _XLocaleData extends MultiMethodTest {
                 if ((str[j].equals(""))) {
                     printit = true;
                 }
-                res &= (!str.equals(""));
+                res &= (!str[j].equals(""));
             }
             if (printit) log.println("FAILED for: language=" + languages[i]
                 + " ; country=" + countries[i]);
@@ -358,7 +358,7 @@ public class _XLocaleData extends MultiMethodTest {
                 if ((str[j].equals(""))) {
                     printit = true;
                 }
-                res &= (!str.equals(""));
+                res &= (!str[j].equals(""));
             }
             if (printit) log.println("FAILED for: language=" + languages[i]
                 + " ; country=" + countries[i]);
commit 8343267884de708b9a4cb07a48bb5392477c690f
Author: Noel Grandin <noel at peralex.com>
Date:   Wed Oct 14 15:26:51 2015 +0200

    cid#1326748 Dm: Dubious method used
    
    Change-Id: I65aeab2e0d726b09c86789c90cc5d56dc5098bf3

diff --git a/qadevOOo/tests/java/ifc/sheet/_XSheetAuditing.java b/qadevOOo/tests/java/ifc/sheet/_XSheetAuditing.java
index f3e5fc1..88aa783 100644
--- a/qadevOOo/tests/java/ifc/sheet/_XSheetAuditing.java
+++ b/qadevOOo/tests/java/ifc/sheet/_XSheetAuditing.java
@@ -117,7 +117,7 @@ public class _XSheetAuditing extends MultiMethodTest {
         requiredMethod("clearArrows()");
         // construct an error: square root from -3
         xPrecedentAddress.setValue(-9);
-        String cellAddress = new String(new byte[]{(byte)(precedentAddress.Column + 65)}) + (precedentAddress.Row+1);
+        String cellAddress = "" + (char)('A' + precedentAddress.Column) + (precedentAddress.Row + 1);
         xAddress.setFormula("=SQRT(" + cellAddress + ")");
         XText xText = UnoRuntime.queryInterface(XText.class, xAddress);
         // correct error in cell:
commit 7974269a84ebf2f1264a0964155d23f9885b1808
Author: Noel Grandin <noel at peralex.com>
Date:   Wed Oct 14 15:19:00 2015 +0200

    cid#1326733 Dm: Dubious method used
    
    there is no point in re-decoding a Java String object, it is already
    UTF-16
    
    Change-Id: Iedc59d457422d32b306782f24cac9b6c2f6b04fe

diff --git a/javaunohelper/com/sun/star/lib/uno/helper/UnoUrl.java b/javaunohelper/com/sun/star/lib/uno/helper/UnoUrl.java
index b0c3135..63ae35e 100644
--- a/javaunohelper/com/sun/star/lib/uno/helper/UnoUrl.java
+++ b/javaunohelper/com/sun/star/lib/uno/helper/UnoUrl.java
@@ -206,40 +206,36 @@ public class UnoUrl {
     private static String decodeUTF8(String s)
         throws com.sun.star.lang.IllegalArgumentException {
 
+        if (!s.contains("%")) {
+            return s;
+        }
         try {
-            if (s.contains("%")) {
-                int length = s.length();
-                ByteBuffer bb = ByteBuffer.allocate(length);
-                for (int i = 0; i < length; i++) {
-                    int ch = s.charAt(i);
-
-                    if (ch == '%') {
-                        if (i+3 > length)
-                            throw new com.sun.star.lang.IllegalArgumentException(
-                                "Incomplete trailing escape (%) pattern");
-                        try {
-                            ch = Integer.parseInt(s.substring(i+1,i+3),16);
-                        } catch (NumberFormatException e) {
-                            throw new com.sun.star.lang.IllegalArgumentException(e);
-                        }
-                        if (ch < 0)
-                            throw new com.sun.star.lang.IllegalArgumentException(
-                                "Illegal hex characters in escape (%) pattern - negative value");
-                        i+=2;
+            int length = s.length();
+            ByteBuffer bb = ByteBuffer.allocate(length);
+            for (int i = 0; i < length; i++) {
+                int ch = s.charAt(i);
+
+                if (ch == '%') {
+                    if (i+3 > length)
+                        throw new com.sun.star.lang.IllegalArgumentException(
+                            "Incomplete trailing escape (%) pattern");
+                    try {
+                        ch = Integer.parseInt(s.substring(i+1,i+3),16);
+                    } catch (NumberFormatException e) {
+                        throw new com.sun.star.lang.IllegalArgumentException(e);
                     }
-
-                    bb.put((byte) (ch & 0xFF));
+                    if (ch < 0)
+                        throw new com.sun.star.lang.IllegalArgumentException(
+                            "Illegal hex characters in escape (%) pattern - negative value");
+                    i+=2;
                 }
 
-                byte[] bytes = new byte[bb.position()];
-                System.arraycopy(bb.array(), 0, bytes, 0, bytes.length);
-                return new String(bytes, "UTF-8");
-
-            } else {
-
-                return new String(s.getBytes(), "UTF-8");
-
+                bb.put((byte) (ch & 0xFF));
             }
+
+            byte[] bytes = new byte[bb.position()];
+            System.arraycopy(bb.array(), 0, bytes, 0, bytes.length);
+            return new String(bytes, "UTF-8");
         } catch (UnsupportedEncodingException e) {
             throw new com.sun.star.lang.IllegalArgumentException(e,
                 "Couldn't convert parameter string to UTF-8 string");


More information about the Libreoffice-commits mailing list