Patch: PR 21372 (FileChannel.tryLock())
Andrew Overholt
overholt@redhat.com
Wed May 4 00:50:00 GMT 2005
Sorry for the spam, but here's an updated version of the toString
re-implementation (what I intended to send the first time) that uses
StringBuffer.
Andrew
-------------- next part --------------
2005-05-03 Andrew Overholt <overholt@redhat.com>
* java/nio/channels/FileLock.java (toString): Re-implement using
StringBuffer.
Index: java/nio/channels/FileLock.java
===================================================================
RCS file: /cvsroot/gcc/gcc/libjava/java/nio/channels/FileLock.java,v
retrieving revision 1.5
diff -u -p -r1.5 FileLock.java
--- java/nio/channels/FileLock.java 3 May 2005 22:38:15 -0000 1.5
+++ java/nio/channels/FileLock.java 4 May 2005 00:23:32 -0000
@@ -132,16 +132,16 @@ public abstract class FileLock
*/
public final String toString()
{
- String toReturn = getClass().getName() +
- "[" + position + ":" + size;
- if (shared)
- toReturn += " shared";
- else
- toReturn += " exclusive";
- if (isValid())
- toReturn += " valid]";
- else
- toReturn += " invalid]";
- return toReturn;
+ StringBuffer buf = new StringBuffer(getClass().getName());
+ buf.append("[" + position + ":" + size);
+ if (shared)
+ buf.append(" shared");
+ else
+ buf.append(" exclusive");
+ if (isValid())
+ buf.append(" valid]");
+ else
+ buf.append(" invalid]");
+ return buf.toString();
}
}
More information about the Java-patches
mailing list