### Eclipse Workspace Patch 1.0 #P org.eclipse.jdt.core Index: search/org/eclipse/jdt/internal/core/index/DiskIndex.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/index/DiskIndex.java,v retrieving revision 1.49.4.2 diff -u -r1.49.4.2 DiskIndex.java --- search/org/eclipse/jdt/internal/core/index/DiskIndex.java 4 Aug 2006 14:48:01 -0000 1.49.4.2 +++ search/org/eclipse/jdt/internal/core/index/DiskIndex.java 25 Jan 2007 12:21:42 -0000 @@ -593,7 +593,7 @@ } int largeArraySize = 256; for (int i = 0; i < size; i++) { - char[] word = Util.readUTF(stream); + char[] word = stream.readUTF().toCharArray(); int arrayOffset = stream.readInt(); // if arrayOffset is: // <= 0 then the array size == 1 with the value -> -arrayOffset @@ -733,7 +733,7 @@ int size = file.readInt(); this.categoryOffsets = new HashtableOfIntValues(size); for (int i = 0; i < size; i++) - this.categoryOffsets.put(Util.readUTF(file), file.readInt()); // cache offset to category table + this.categoryOffsets.put(file.readUTF().toCharArray(), file.readInt()); // cache offset to category table this.categoryTables = new HashtableOfObject(3); } synchronized void startQuery() { 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.95.4.1 diff -u -r1.95.4.1 Util.java --- model/org/eclipse/jdt/internal/core/util/Util.java 2 Jul 2006 10:11:54 -0000 1.95.4.1 +++ model/org/eclipse/jdt/internal/core/util/Util.java 25 Jan 2007 12:21:41 -0000 @@ -1708,83 +1708,6 @@ } } /** - * Reads in a string from the specified data input stream. The - * string has been encoded using a modified UTF-8 format. - *

- * The first two bytes are read as if by - * readUnsignedShort. This value gives the number of - * following bytes that are in the encoded string, not - * the length of the resulting string. The following bytes are then - * interpreted as bytes encoding characters in the UTF-8 format - * and are converted into characters. - *

- * This method blocks until all the bytes are read, the end of the - * stream is detected, or an exception is thrown. - * - * @param in a data input stream. - * @return a Unicode string. - * @exception EOFException if the input stream reaches the end - * before all the bytes. - * @exception IOException if an I/O error occurs. - * @exception UTFDataFormatException if the bytes do not represent a - * valid UTF-8 encoding of a Unicode string. - * @see java.io.DataInputStream#readUnsignedShort() - */ - public final static char[] readUTF(DataInput in) throws IOException { - int utflen= in.readUnsignedShort(); - char str[]= new char[utflen]; - int count= 0; - int strlen= 0; - while (count < utflen) { - int c= in.readUnsignedByte(); - int char2, char3; - switch (c >> 4) { - case 0 : - case 1 : - case 2 : - case 3 : - case 4 : - case 5 : - case 6 : - case 7 : - // 0xxxxxxx - count++; - str[strlen++]= (char) c; - break; - case 12 : - case 13 : - // 110x xxxx 10xx xxxx - count += 2; - if (count > utflen) - throw new UTFDataFormatException(); - char2= in.readUnsignedByte(); - if ((char2 & 0xC0) != 0x80) - throw new UTFDataFormatException(); - str[strlen++]= (char) (((c & 0x1F) << 6) | (char2 & 0x3F)); - break; - case 14 : - // 1110 xxxx 10xx xxxx 10xx xxxx - count += 3; - if (count > utflen) - throw new UTFDataFormatException(); - char2= in.readUnsignedByte(); - char3= in.readUnsignedByte(); - if (((char2 & 0xC0) != 0x80) || ((char3 & 0xC0) != 0x80)) - throw new UTFDataFormatException(); - str[strlen++]= (char) (((c & 0x0F) << 12) | ((char2 & 0x3F) << 6) | ((char3 & 0x3F) << 0)); - break; - default : - // 10xx xxxx, 1111 xxxx - throw new UTFDataFormatException(); - } - } - if (strlen < utflen) { - System.arraycopy(str, 0, str= new char[strlen], 0, strlen); - } - return str; - } - - /** * Returns the toString() of the given full path minus the first given number of segments. * The returned string is always a relative path (it has no leading slash) */