### Eclipse Workspace Patch 1.0 #P org.eclipse.jdt.core Index: model/org/eclipse/jdt/internal/core/util/Util.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/Util.java,v retrieving revision 1.102 diff -u -r1.102 Util.java --- model/org/eclipse/jdt/internal/core/util/Util.java 11 Jan 2007 15:31:38 -0000 1.102 +++ model/org/eclipse/jdt/internal/core/util/Util.java 25 Jan 2007 15:21:15 -0000 @@ -1712,13 +1712,17 @@ * @see java.io.DataInputStream#readUnsignedShort() */ public final static char[] readUTF(DataInput in) throws IOException { + //return in.readUTF().toCharArray(); int utflen= in.readUnsignedShort(); + byte byteArr[]= new byte[utflen]; char str[]= new char[utflen]; - int count= 0; + int count = 0; int strlen= 0; + int c, char2, char3; + + in.readFully(byteArr, 0, utflen); while (count < utflen) { - int c= in.readUnsignedByte(); - int char2, char3; + c = byteArr[count] & 0xff; switch (c >> 4) { case 0 : case 1 : @@ -1738,7 +1742,7 @@ count += 2; if (count > utflen) throw new UTFDataFormatException(); - char2= in.readUnsignedByte(); + char2 = byteArr[count-1]; if ((char2 & 0xC0) != 0x80) throw new UTFDataFormatException(); str[strlen++]= (char) (((c & 0x1F) << 6) | (char2 & 0x3F)); @@ -1748,8 +1752,8 @@ count += 3; if (count > utflen) throw new UTFDataFormatException(); - char2= in.readUnsignedByte(); - char3= in.readUnsignedByte(); + char2 = byteArr[count-2]; + char3 = byteArr[count-1]; if (((char2 & 0xC0) != 0x80) || ((char3 & 0xC0) != 0x80)) throw new UTFDataFormatException(); str[strlen++]= (char) (((c & 0x0F) << 12) | ((char2 & 0x3F) << 6) | ((char3 & 0x3F) << 0));