CloneSet217


Previous CloneSetNext CloneSetBack to Main Report
Clone
Mass
Clones in
CloneSet
Parameter
Count
Clone
Similarity
Syntax Category
[Sequence Length]
34260.993class_body_declaration
Clone AbstractionParameter Bindings
Clone Instance
(Click to see clone)
Line CountSource Line
Source File
13430
plugins/org.eclipse.jdt.debug/jdi/org/eclipse/jdi/internal/jdwp/JdwpString.java
2342359
plugins/org.eclipse.jdt.debug/jdi/org/eclipse/jdi/internal/spy/VerbosePacketStream.java
Clone Instance
1
Line Count
34
Source Line
30
Source File
plugins/org.eclipse.jdt.debug/jdi/org/eclipse/jdi/internal/jdwp/JdwpString.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();
        }


Clone Instance
2
Line Count
34
Source Line
2359
Source File
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.
         */
        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();
        }


Clone AbstractionParameter Count: 6Parameter Bindings

 [[#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 Bindings
Parameter
Index
Clone
Instance
Parameter
Name
Value
11[[#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 
12[[#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 
21[[#a0699240]]
read 
22[[#a0699240]]
readString 
31[[#a06991c0]]
JDWPMessages 
32[[#a06991c0]]
TcpIpSpyMessages 
41[[#a0699140]]
JdwpString_Second_byte_input_does_not_match_UTF_Specification_1 
42[[#a0699140]]
VerbosePacketStream_Second_byte_input_does_not_match_UTF_Specification_287 
51[[#a06990c0]]
JdwpString_Second_or_third_byte_input_does_not_mach_UTF_Specification_2 
52[[#a06990c0]]
VerbosePacketStream_Second_or_third_byte_input_does_not_mach_UTF_Specification__288 
61[[#a0699040]]
JdwpString_Input_does_not_match_UTF_Specification_3 
62[[#a0699040]]
VerbosePacketStream_Input_does_not_match_UTF_Specification_289