File path: /sql12/fw/src/net/sourceforge/squirrel_sql/fw/datasetviewer/cellcomponent/DataTypeBinary.java | File path: /sql12/fw/src/net/sourceforge/squirrel_sql/fw/datasetviewer/cellcomponent/DataTypeBlob.java | |||
Method name: String importObject(FileInputStream)
|
Method name: String importObject(FileInputStream)
|
|||
Number of AST nodes: 9 | Number of AST nodes: 9 | |||
1 | int fileSize = inStream.available();↵ | 1 | int fileSize = inStream.available();↵ | |
2 | ↵ | |||
3 | byte[] buf = new byte[fileSize];↵ | 2 | byte[] buf = new byte[fileSize];↵ | |
4 | ↵ | |||
5 | int count = inStream.read(buf);↵ | 3 | int count = inStream.read(buf);↵ | |
6 | ↵ | |||
7 | if (count != fileSize)↵ | 4 | if (count != fileSize) {↵ | |
8 | throw new IOException(↵ | 5 | throw new IOException(↵ | |
9 | "Could read only "+ count +↵ | 6 | "Could read only "+ count +↵ | |
10 | " bytes from a total file size of " + fileSize +↵ | 7 | " bytes from a total file size of " + fileSize +↵ | |
11 | ". Import failed.");↵ | 8 | ". Import failed.");↵ | |
12 | ↵ | 9 | }↵ | |
13 | // Convert bytes to Bytes↵ | 10 | // Convert bytes to Bytes↵ | |
14 | Byte[] bBytes = new Byte[count];↵ | 11 | Byte[] bBytes = new Byte[count];↵ | |
15 | for (int i=0; i<count; i++) {↵ | 12 | for (int i=0; i<count; i++) {↵ | |
16 | bBytes[i] = Byte.valueOf(buf[i]);↵ | 13 | bBytes[i] = Byte.valueOf(buf[i]);↵ | |
17 | }↵ | |||
18 | ↵ | 14 | }↵ | |
19 | // return the text converted from the file ↵ | 15 | // return the text converted from the file ↵ | |
20 | return BinaryDisplayConverter.convertToString(bBytes,↵ | 16 | return BinaryDisplayConverter.convertToString(bBytes,↵ | |
21 | BinaryDisplayConverter.HEX, false); | 17 | BinaryDisplayConverter.HEX, false); | |
See real code fragment | See real code fragment |
Number of common nesting structure subtrees | 1 |
Number of refactorable cases | 1 |
Number of non-refactorable cases | 0 |
Time elapsed for finding largest common nesting structure subtrees (ms) | 0.7 |
Clones location | Clones are in different classes having the same super class |
Number of node comparisons | 35 |
Number of mapped statements | 9 |
Number of unmapped statements in the first code fragment | 0 |
Number of unmapped statements in the second code fragment | 0 |
Time elapsed for statement mapping (ms) | 3.1 |
Clone type | Type 1 |
ID | Statement | ID | Statement | |
---|---|---|---|---|
1 | int fileSize = inStream.available(); | 1 | int fileSize = inStream.available(); | |
2 | byte[] buf = new byte[fileSize]; | 2 | byte[] buf = new byte[fileSize]; | |
3 | int count = inStream.read(buf); | 3 | int count = inStream.read(buf); | |
4 | if (count != fileSize) | 4 | if (count != fileSize) | |
5 | throw new IOException("Could read only " + count + " bytes from a total file size of " + fileSize + ". Import failed."); | 5 | throw new IOException("Could read only " + count + " bytes from a total file size of " + fileSize + ". Import failed."); | |
6 | Byte[] bBytes = new Byte[count]; | 6 | Byte[] bBytes = new Byte[count]; | |
7 | for (int i = 0; i < count; i++) | 7 | for (int i = 0; i < count; i++) | |
8 | bBytes[i] = Byte.valueOf(buf[i]); | 8 | bBytes[i] = Byte.valueOf(buf[i]); | |
9 | return BinaryDisplayConverter.convertToString(bBytes, BinaryDisplayConverter.HEX, false); | 9 | return BinaryDisplayConverter.convertToString(bBytes, BinaryDisplayConverter.HEX, false); |
Row | Violation |
---|