commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nia...@apache.org
Subject svn commit: r1004079 - in /commons/proper/io/trunk/src/java/org/apache/commons/io: input/CountingInputStream.java output/CountingOutputStream.java
Date Mon, 04 Oct 2010 01:11:28 GMT
Author: niallp
Date: Mon Oct  4 01:11:27 2010
New Revision: 1004079

URL: http://svn.apache.org/viewvc?rev=1004079&view=rev
Log:
IO-201 Fix inconsistent synchronization

Modified:
    commons/proper/io/trunk/src/java/org/apache/commons/io/input/CountingInputStream.java
    commons/proper/io/trunk/src/java/org/apache/commons/io/output/CountingOutputStream.java

Modified: commons/proper/io/trunk/src/java/org/apache/commons/io/input/CountingInputStream.java
URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/java/org/apache/commons/io/input/CountingInputStream.java?rev=1004079&r1=1004078&r2=1004079&view=diff
==============================================================================
--- commons/proper/io/trunk/src/java/org/apache/commons/io/input/CountingInputStream.java
(original)
+++ commons/proper/io/trunk/src/java/org/apache/commons/io/input/CountingInputStream.java
Mon Oct  4 01:11:27 2010
@@ -55,7 +55,7 @@ public class CountingInputStream extends
      * @see java.io.InputStream#skip(long)
      */
     @Override
-    public long skip(final long length) throws IOException {
+    public synchronized long skip(final long length) throws IOException {
         final long skip = super.skip(length);
         this.count += skip;
         return skip;
@@ -68,7 +68,7 @@ public class CountingInputStream extends
      * @since Commons IO 2.0
      */
     @Override
-    protected void afterRead(int n) {
+    protected synchronized void afterRead(int n) {
         if (n != -1) {
             this.count += n;
         }
@@ -85,7 +85,7 @@ public class CountingInputStream extends
      * @return the number of bytes accumulated
      * @throws ArithmeticException if the byte count is too large
      */
-    public synchronized int getCount() {
+    public int getCount() {
         long result = getByteCount();
         if (result > Integer.MAX_VALUE) {
             throw new ArithmeticException("The byte count " + result + " is too large to
be converted to an int");
@@ -103,7 +103,7 @@ public class CountingInputStream extends
      * @return the count previous to resetting
      * @throws ArithmeticException if the byte count is too large
      */
-    public synchronized int resetCount() {
+    public int resetCount() {
         long result = resetByteCount();
         if (result > Integer.MAX_VALUE) {
             throw new ArithmeticException("The byte count " + result + " is too large to
be converted to an int");

Modified: commons/proper/io/trunk/src/java/org/apache/commons/io/output/CountingOutputStream.java
URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/java/org/apache/commons/io/output/CountingOutputStream.java?rev=1004079&r1=1004078&r2=1004079&view=diff
==============================================================================
--- commons/proper/io/trunk/src/java/org/apache/commons/io/output/CountingOutputStream.java
(original)
+++ commons/proper/io/trunk/src/java/org/apache/commons/io/output/CountingOutputStream.java
Mon Oct  4 01:11:27 2010
@@ -50,7 +50,7 @@ public class CountingOutputStream extend
      * @since Commons IO 2.0
      */
     @Override
-    protected void beforeWrite(int n) {
+    protected synchronized void beforeWrite(int n) {
         count += n;
     }
 
@@ -65,7 +65,7 @@ public class CountingOutputStream extend
      * @return the number of bytes accumulated
      * @throws ArithmeticException if the byte count is too large
      */
-    public synchronized int getCount() {
+    public int getCount() {
         long result = getByteCount();
         if (result > Integer.MAX_VALUE) {
             throw new ArithmeticException("The byte count " + result + " is too large to
be converted to an int");
@@ -83,7 +83,7 @@ public class CountingOutputStream extend
      * @return the count previous to resetting
      * @throws ArithmeticException if the byte count is too large
      */
-    public synchronized int resetCount() {
+    public int resetCount() {
         long result = resetByteCount();
         if (result > Integer.MAX_VALUE) {
             throw new ArithmeticException("The byte count " + result + " is too large to
be converted to an int");



Mime
View raw message