This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

FYI: java.io: Use correct lock for chained writers


Chained Readers and Writers should synchronize on the existing lock used by their inferior. In some cases we were not doing this. I'm checking in this patch to fix it.

Regards

Bryce

2004-07-20  Bryce McKinlay  <mckinlay@redhat.com>

	* java/io/BufferedWriter.java (BufferedWriter): Use existing lock
	of chained Writer when calling super-constructor.
	* java/io/FilterWriter.java (FilterWriter): Likewise.
	* java/io/PrintWriter.java (PrintWriter): Likewise.

Index: BufferedWriter.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/io/BufferedWriter.java,v
retrieving revision 1.13
diff -u -r1.13 BufferedWriter.java
--- BufferedWriter.java	20 Apr 2004 18:15:44 -0000	1.13
+++ BufferedWriter.java	20 Jul 2004 15:37:08 -0000
@@ -103,7 +103,7 @@
    */
   public BufferedWriter (Writer out, int size)
   {
-    super(out);
+    super(out.lock);
     this.out = out;
     this.buffer = new char[size];
     this.count = 0;
Index: FilterWriter.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/io/FilterWriter.java,v
retrieving revision 1.8
diff -u -r1.8 FilterWriter.java
--- FilterWriter.java	23 Mar 2003 19:11:19 -0000	1.8
+++ FilterWriter.java	20 Jul 2004 15:37:08 -0000
@@ -72,7 +72,7 @@
     */
   protected FilterWriter(Writer out)
   {
-    super(out);
+    super(out.lock);
     this.out = out;
   }
 
Index: PrintWriter.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/io/PrintWriter.java,v
retrieving revision 1.11
diff -u -r1.11 PrintWriter.java
--- PrintWriter.java	20 May 2003 09:13:19 -0000	1.11
+++ PrintWriter.java	20 Jul 2004 15:37:09 -0000
@@ -86,7 +86,7 @@
    */
   public PrintWriter(Writer wr)
   {
-    super(wr);
+    super(wr.lock);
     this.out = wr;
   }
 
@@ -102,7 +102,7 @@
    */
   public PrintWriter(Writer wr, boolean autoflush)
   {
-    super(wr);
+    super(wr.lock);
     this.out = wr;
     this.autoflush = autoflush;
   }

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]