chart2/qa/TestCaseOldAPI.java               |   19 +++----------------
 qadevOOo/runner/util/utils.java             |   10 ++++++++++
 qadevOOo/tests/java/ifc/table/_XCell.java   |    3 ++-
 xmerge/source/bridge/java/XMergeBridge.java |   20 +++++++++++++++++++-
 4 files changed, 34 insertions(+), 18 deletions(-)

New commits:
commit 177183f692f42f6a0cf5ee66f1b7e1c31a616140
Author: Stephan Bergmann <sberg...@redhat.com>
Date:   Wed Nov 4 21:42:51 2015 +0100

    Proper fix for coverity#1326893
    
    FindBugs' FE.FE_FLOATING_POINT_EQUALITY is about double value inaccuracies, 
not
    about NaN or negative zero (which is the topic of java.lang.Double.equals 
vs.
    ==).
    
    Reuse existing qa.TestCaseOldAPI.approxEqual method, moved to util.utils.
    
    Change-Id: I65f7bb1faf921e1c4035bb96aeff1eaf2cfb3153

diff --git a/chart2/qa/TestCaseOldAPI.java b/chart2/qa/TestCaseOldAPI.java
index e58a045..613ba48 100644
--- a/chart2/qa/TestCaseOldAPI.java
+++ b/chart2/qa/TestCaseOldAPI.java
@@ -32,8 +32,8 @@ import com.sun.star.awt.*;
 import com.sun.star.container.*;
 import com.sun.star.util.XCloseable;
 import com.sun.star.util.CloseVetoException;
-
 import com.sun.star.uno.AnyConverter;
+import util.utils;
 
 /**
  * The following Complex Test will test the
@@ -360,7 +360,7 @@ public class TestCaseOldAPI extends ComplexTestCase {
             assure( "AutoMax is on", ! AnyConverter.toBoolean( 
xProp.getPropertyValue( "AutoMax" )) );
 
             assure( "Maximum value invalid",
-                    approxEqual(
+                    utils.approxEqual(
                         AnyConverter.toDouble( xProp.getPropertyValue( "Max" 
)),
                         nNewMax ));
 
@@ -369,7 +369,7 @@ public class TestCaseOldAPI extends ComplexTestCase {
 
             xProp.setPropertyValue( "Origin", new Double( nNewOrigin ));
             assure( "Origin invalid",
-                    approxEqual(
+                    utils.approxEqual(
                         AnyConverter.toDouble( xProp.getPropertyValue( 
"Origin" )),
                         nNewOrigin ));
             xProp.setPropertyValue( "AutoOrigin", Boolean.TRUE);
@@ -942,19 +942,6 @@ public class TestCaseOldAPI extends ComplexTestCase {
         return aResult;
     }
 
-
-
-    /// see rtl/math.hxx
-    private boolean approxEqual( double a, double b )
-    {
-        if( a == b )
-            return true;
-        double x = a - b;
-        return (x < 0.0 ? -x : x)
-            < ((a < 0.0 ? -a : a) * (1.0 / (16777216.0 * 16777216.0)));
-    }
-
-
     /** returns true if a and b differ no more than tolerance.
 
         @param tolerance
diff --git a/qadevOOo/runner/util/utils.java b/qadevOOo/runner/util/utils.java
index dc1b63c..dc019a4 100644
--- a/qadevOOo/runner/util/utils.java
+++ b/qadevOOo/runner/util/utils.java
@@ -874,4 +874,14 @@ public class utils {
      * Default short wait time for the Office
      */
     public static final int DEFAULT_SHORT_WAIT_MS = 500;
+
+    /// see rtl/math.hxx
+    public static boolean approxEqual( double a, double b )
+    {
+        if( a == b )
+            return true;
+        double x = a - b;
+        return (x < 0.0 ? -x : x)
+            < ((a < 0.0 ? -a : a) * (1.0 / (16777216.0 * 16777216.0)));
+    }
 }
diff --git a/qadevOOo/tests/java/ifc/table/_XCell.java 
b/qadevOOo/tests/java/ifc/table/_XCell.java
index 353e8d6b..e81776c 100644
--- a/qadevOOo/tests/java/ifc/table/_XCell.java
+++ b/qadevOOo/tests/java/ifc/table/_XCell.java
@@ -19,6 +19,7 @@
 package ifc.table;
 
 import lib.MultiMethodTest;
+import util.utils;
 
 import com.sun.star.table.CellContentType;
 import com.sun.star.table.XCell;
@@ -149,7 +150,7 @@ public class _XCell extends MultiMethodTest {
         oObj.setValue(inValue) ;
         double cellValue = oObj.getValue() ;
 
-        boolean result = Double.valueOf(cellValue).equals(inValue);
+        boolean result = utils.approxEqual(cellValue, inValue);
         tRes.tested("setValue()", result);
     } // end setValue()
 }
commit 5a29db7a9945c4cd095799451a6c563d5aeeed57
Author: jan iversen <j...@documentfoundation.org>
Date:   Wed Nov 4 18:06:29 2015 +0100

    Solved CID 1326472, 1326473, 1326474
    
    Coverity requires that allocated objects (use of new)
    are directly release, by foo = null;
    The gc will do this automatically at some point in time,
    so this will simply release the resource a bit earlier,
    which can save problems if the function is called in a tight
    loop.
    
    Updated to add close() before clearing the variable, this would
    normally be done by gc, but now a bit earlier. The assignment to
    null is not needed specifically, but Coverity calls it a leak if
    not assigned.
    
    Forgot .close();
    
    Change-Id: Id273e7f36778c1691b260d28e741c6e32148c9d9

diff --git a/xmerge/source/bridge/java/XMergeBridge.java 
b/xmerge/source/bridge/java/XMergeBridge.java
index 06d3b4b..5793f4f 100644
--- a/xmerge/source/bridge/java/XMergeBridge.java
+++ b/xmerge/source/bridge/java/XMergeBridge.java
@@ -437,6 +437,7 @@ public class XMergeBridge {
                                 docOut.write(fos);
                                 fos.flush();
                                 fos.close();
+                                fos = null;
                                 i++;
 
                             }
@@ -446,6 +447,12 @@ public class XMergeBridge {
                     ConverterInfoMgr.removeByJar(jarName);
                 }
                 catch (Exception ex1) {
+                    /* Satisfy coverity */
+                    newxos.flush();
+                    newxos.close();
+                    newxos = null;
+                    xis.close();
+                    xis    = null;
                     IOException ex2 = new IOException();
                     ex2.initCause(ex1);
                     throw ex2;
@@ -480,13 +487,24 @@ public class XMergeBridge {
                     System.out.println("\nERROR : Stack Overflow. \n Increase 
of the JRE by adding the following line to the end of the javarc file \n 
\"-Xss1m\"\n");
                 }
                 catch (Exception ex1) {
+                    /* Satisfy coverity */
+                    newxos.flush();
+                    newxos.close();
+                    newxos = null;
+                    xis.close();
+                    xis    = null;
                     IOException ex2 = new IOException();
                     ex2.initCause(ex1);
                     throw ex2;
                 }
 
             }
-
+            /* Satisfy coverity */
+            newxos.flush();
+            newxos.close();
+            newxos = null;
+            xis.close();
+            xis    = null;
         }
 
         private String getPath(URI uri){
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to