Previous CloneSet | Next CloneSet | Back to Main Report |
Clone Mass | Clones in CloneSet | Parameter Count | Clone Similarity | Syntax Category [Sequence Length] |
---|---|---|---|---|
34 | 2 | 6 | 0.993 | class_body_declaration |
Clone Abstraction | Parameter Bindings |
Clone Instance (Click to see clone) | Line Count | Source Line | Source File |
---|---|---|---|
1 | 34 | 30 | plugins/org.eclipse.jdt.debug/jdi/org/eclipse/jdi/internal/jdwp/JdwpString.java |
2 | 34 | 2359 | plugins/org.eclipse.jdt.debug/jdi/org/eclipse/jdi/internal/spy/VerbosePacketStream.java |
| ||||
/** * Reads String from Jdwp stream. * Read a UTF where length has 4 bytes, and not just 2. * This code was based on the OTI Retysin source for readUTF. */ public static String read(DataInputStream in) throws IOException { int utfSize = in.readInt(); byte utfBytes[] = new byte[utfSize]; in.readFully(utfBytes); /* Guess at buffer size */ StringBuffer strBuffer = new StringBuffer(utfSize / 3 * 2); for (int i = 0; i < utfSize;) { int a = utfBytes[i]& 0xff; if ((a >> 4) < 12) { strBuffer.append((char) a); i++; } else { int b = utfBytes[i + 1]& 0xff; if ((a >> 4) < 14) { if ((b& 0xbf) == 0) { throw new UTFDataFormatException(JDWPMessages.JdwpString_Second_byte_input_does_not_match_UTF_Specification_1); } strBuffer.append((char) (((a& 0x1f) << 6)| (b& 0x3f))); i += 2; } else { int c = utfBytes[i + 2]& 0xff; if ((a& 0xef) > 0) { if (((b& 0xbf) == 0) || ((c& 0xbf) == 0)) { throw new UTFDataFormatException(JDWPMessages.JdwpString_Second_or_third_byte_input_does_not_mach_UTF_Specification_2); } strBuffer.append((char) (((a& 0x0f) << 12)| ((b& 0x3f) << 6)| (c& 0x3f))); i += 3; } else { throw new UTFDataFormatException(JDWPMessages.JdwpString_Input_does_not_match_UTF_Specification_3); } } } } return strBuffer.toString(); } |
| ||||
/** * Reads String from Jdwp stream. * Read a UTF where length has 4 bytes, and not just 2. * This code was based on the OTI Retysin source for readUTF. */ private static String readString(DataInputStream in) throws IOException { int utfSize = in.readInt(); byte utfBytes[] = new byte[utfSize]; in.readFully(utfBytes); /* Guess at buffer size */ StringBuffer strBuffer = new StringBuffer(utfSize / 3 * 2); for (int i = 0; i < utfSize;) { int a = utfBytes[i]& 0xff; if ((a >> 4) < 12) { strBuffer.append((char) a); i++; } else { int b = utfBytes[i + 1]& 0xff; if ((a >> 4) < 14) { if ((b& 0xbf) == 0) { throw new UTFDataFormatException(TcpIpSpyMessages.VerbosePacketStream_Second_byte_input_does_not_match_UTF_Specification_287); } strBuffer.append((char) (((a& 0x1f) << 6)| (b& 0x3f))); i += 2; } else { int c = utfBytes[i + 2]& 0xff; if ((a& 0xef) > 0) { if (((b& 0xbf) == 0) || ((c& 0xbf) == 0)) { throw new UTFDataFormatException(TcpIpSpyMessages.VerbosePacketStream_Second_or_third_byte_input_does_not_mach_UTF_Specification__288); } strBuffer.append((char) (((a& 0x0f) << 12)| ((b& 0x3f) << 6)| (c& 0x3f))); i += 3; } else { throw new UTFDataFormatException(TcpIpSpyMessages.VerbosePacketStream_Input_does_not_match_UTF_Specification_289); } } } } return strBuffer.toString(); } |
| |||
[[#variablea06992c0]]static String [[#variablea0699240]](DataInputStream in) throws IOException { int utfSize = in.readInt(); byte utfBytes[] = new byte[utfSize]; in.readFully(utfBytes); /* Guess at buffer size */ StringBuffer strBuffer = new StringBuffer(utfSize / 3 * 2); for (int i = 0; i < utfSize;) { int a = utfBytes[i]&0xff; if ((a >> 4) < 12) { strBuffer.append((char) a); i++; } else { int b = utfBytes[i + 1]&0xff; if ((a >> 4) < 14) { if ((b&0xbf) == 0) { throw new UTFDataFormatException( [[#variablea06991c0]]. [[#variablea0699140]]); } strBuffer.append((char) (((a&0x1f) << 6)|(b&0x3f))); i += 2; } else { int c = utfBytes[i + 2]&0xff; if ((a&0xef) > 0) { if (((b&0xbf) == 0) || ((c&0xbf) == 0)) { throw new UTFDataFormatException( [[#variablea06991c0]]. [[#variablea06990c0]]); } strBuffer.append((char) (((a&0x0f) << 12)|((b&0x3f) << 6)|(c&0x3f))); i += 3; } else { throw new UTFDataFormatException( [[#variablea06991c0]]. [[#variablea0699040]]); } } } } return strBuffer.toString(); } |
CloneAbstraction |
Parameter Index | Clone Instance | Parameter Name | Value |
---|---|---|---|
1 | 1 | [[#a06992c0]] | /** * Reads String from Jdwp stream. * Read a UTF where length has 4 bytes, and not just 2. * This code was based on the OTI Retysin source for readUTF. */ public |
1 | 2 | [[#a06992c0]] | /** * Reads String from Jdwp stream. * Read a UTF where length has 4 bytes, and not just 2. * This code was based on the OTI Retysin source for readUTF. */ private |
2 | 1 | [[#a0699240]] | read |
2 | 2 | [[#a0699240]] | readString |
3 | 1 | [[#a06991c0]] | JDWPMessages |
3 | 2 | [[#a06991c0]] | TcpIpSpyMessages |
4 | 1 | [[#a0699140]] | JdwpString_Second_byte_input_does_not_match_UTF_Specification_1 |
4 | 2 | [[#a0699140]] | VerbosePacketStream_Second_byte_input_does_not_match_UTF_Specification_287 |
5 | 1 | [[#a06990c0]] | JdwpString_Second_or_third_byte_input_does_not_mach_UTF_Specification_2 |
5 | 2 | [[#a06990c0]] | VerbosePacketStream_Second_or_third_byte_input_does_not_mach_UTF_Specification__288 |
6 | 1 | [[#a0699040]] | JdwpString_Input_does_not_match_UTF_Specification_3 |
6 | 2 | [[#a0699040]] | VerbosePacketStream_Input_does_not_match_UTF_Specification_289 |