On Fri, 29 Mar 2013 15:48:57 -0000, l...@apache.org wrote:
Author: luc
Date: Fri Mar 29 15:48:57 2013
New Revision: 1462504

URL: http://svn.apache.org/r1462504
Log:
Fixed findbugs warning.

This one should stay.
We agreed that "ResizableDoubleArray" should not be synchronized at the CM level. Instead of adding "synchronized" keywords, it is rather all the others that must be removed (but we decided no to do it before 4.0 in order to not break user code
that potentially rely on the existing, but broken, synchronization).

Best regards,
Gilles


Modified:


commons/proper/math/trunk/src/main/java/org/apache/commons/math3/util/ResizableDoubleArray.java

Modified:

commons/proper/math/trunk/src/main/java/org/apache/commons/math3/util/ResizableDoubleArray.java
URL:

http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math3/util/ResizableDoubleArray.java?rev=1462504&r1=1462503&r2=1462504&view=diff

==============================================================================
---

commons/proper/math/trunk/src/main/java/org/apache/commons/math3/util/ResizableDoubleArray.java
(original)
+++

commons/proper/math/trunk/src/main/java/org/apache/commons/math3/util/ResizableDoubleArray.java
Fri Mar 29 15:48:57 2013
@@ -934,7 +934,15 @@ public class ResizableDoubleArray implem
      * @since 3.1
      */
     public double compute(MathArrays.Function f) {
-        return f.evaluate(internalArray, startIndex, numElements);
+        final double[] array;
+        final int start;
+        final int num;
+        synchronized(this) {
+            array = internalArray;
+            start = startIndex;
+            num   = numElements;
+        }
+        return f.evaluate(array, start, num);
     }

     /**


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org

Reply via email to