try {
Integer.parseInt(field.getText());
} catch (NumberFormatException nfe) {
int length = field.getText().length();
if (length > 0) {
JOptionPane.showMessageDialog(this, "Only digits allowed", "Invalid data",
JOptionPane.WARNING_MESSAGE);
// Drop the last character:
field.setText(field.getText().substring(0, length-1));
try {
Integer.parseInt(portField.getText());
} catch (NumberFormatException nfe) {
int length = portField.getText().length();
if (length > 0) {
JOptionPane.showMessageDialog(this, "Only digits allowed", "Invalid data",
JOptionPane.WARNING_MESSAGE);
// Drop the last character:
portField.setText(portField.getText().substring(0, length-1));
Clone fragments detected by clone detection tool
File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/assertions/gui/HTMLAssertionGui.java
|
|
File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/protocol/http/proxy/gui/ProxyControlGui.java
|
Method name:
|
|
Method name:
|
Number of AST nodes: 0
|
|
Number of AST nodes: 0
|
|
1 | try {↵ | | 1 | try {↵
|
2 | Integer.parseInt(field.getText());↵ | | 2 | Integer.parseInt(portField.getText());↵
|
3 | } catch (NumberFormatException nfe) {↵ | | 3 | } catch (NumberFormatException nfe) {↵
|
4 | int length = field.getText().length();↵ | | 4 | int length = portField.getText().length();↵
|
5 | if (length > 0) {↵ | | 5 | if (length > 0) {↵
|
6 | JOptionPane.showMessageDialog(this, "Only digits allowed", "Invalid data",↵ | | 6 | JOptionPane.showMessageDialog(this, "Only digits allowed", "Invalid data",↵
|
7 | JOptionPane.WARNING_MESSAGE);↵ | | 7 | JOptionPane.WARNING_MESSAGE);↵
|
8 | // Drop the last character:↵ | | 8 | // Drop the last character:↵
|
9 | field.setText(field.getText().substring(0, length-1));↵ | | 9 | portField.setText(portField.getText().substring(0, length-1));↵
|
10 | | | 10 |
|
See real code fragment |
|
See real code fragment |
Summary
Number of common nesting structure subtrees | 0 |
Number of refactorable cases | 0 |
Number of non-refactorable cases | 0 |
Time elapsed for finding largest common nesting structure subtrees (ms) | 0.0 |
Clones location | |
Number of node comparisons | 0 |