File path: /sql12/plugins/firebirdmanager/src/net/sourceforge/squirrel_sql/plugins/firebirdmanager/gui/FirebirdManagerBackupRestoreFrame.java | File path: /sql12/plugins/firebirdmanager/src/net/sourceforge/squirrel_sql/plugins/firebirdmanager/gui/FirebirdManagerBackupRestoreFrame.java | |||
Method name: boolean isBackupInputOK()
|
Method name: boolean isRestoreInputOK()
|
|||
Number of AST nodes: 37 | Number of AST nodes: 37 | |||
1 | StringBuffer bufError = new StringBuffer();↵ | 1 | StringBuffer bufError = new StringBuffer();↵ | |
2 | boolean focusSet = false;↵ | 2 | boolean focusSet = false;↵ | |
3 | if (jtextfieldUsername.getText().trim().length() == 0) {↵ | 3 | if (jtextfieldUsername.getText().trim().length() == 0) {↵ | |
4 | bufError.append(i18n.ERROR_USERNAME_MISSING + CR);↵ | 4 | bufError.append(i18n.ERROR_USERNAME_MISSING + CR);↵ | |
5 | jtextfieldUsername.requestFocusInWindow();↵ | 5 | jtextfieldUsername.requestFocusInWindow();↵ | |
6 | focusSet = true;↵ | 6 | focusSet = true;↵ | |
7 | }↵ | 7 | }↵ | |
8 | if (jtextfieldBckDBHost.getText().trim().length() == 0) {↵ | 8 | if (jtextfieldResDBHost.getText().trim().length() == 0) {↵ | |
9 | bufError.append(i18n.ERROR_SERVER_MISSING + CR);↵ | 9 | bufError.append(i18n.ERROR_SERVER_MISSING + CR);↵ | |
10 | if (!focusSet) {↵ | 10 | if (!focusSet) {↵ | |
11 | jtextfieldBckDBHost.requestFocusInWindow();↵ | 11 | jtextfieldResDBHost.requestFocusInWindow();↵ | |
12 | focusSet = true;↵ | 12 | focusSet = true;↵ | |
13 | }↵ | 13 | }↵ | |
14 | }↵ | 14 | }↵ | |
15 | if (jtextfieldBckPort.getText().trim().length() == 0) {↵ | 15 | if (jtextfieldResPort.getText().trim().length() == 0) {↵ | |
16 | bufError.append(i18n.ERROR_PORT_MISSING + CR);↵ | 16 | bufError.append(i18n.ERROR_PORT_MISSING + CR);↵ | |
17 | if (!focusSet) {↵ | 17 | if (!focusSet) {↵ | |
18 | jtextfieldBckPort.requestFocusInWindow();↵ | 18 | jtextfieldResPort.requestFocusInWindow();↵ | |
19 | focusSet = true;↵ | 19 | focusSet = true;↵ | |
20 | }↵ | 20 | }↵ | |
21 | } else {↵ | 21 | } else {↵ | |
22 | try {↵ | 22 | try {↵ | |
23 | Integer.parseInt(jtextfieldBckPort.getText());↵ | 23 | Integer.parseInt(jtextfieldResPort.getText());↵ | |
24 | } catch (NumberFormatException e) {↵ | 24 | } catch (NumberFormatException e) {↵ | |
25 | bufError.append(i18n.ERROR_PORT_NO_INTEGER + CR);↵ | 25 | bufError.append(i18n.ERROR_PORT_NO_INTEGER + CR);↵ | |
26 | if (!focusSet) {↵ | 26 | if (!focusSet) {↵ | |
27 | jtextfieldBckPort.requestFocusInWindow();↵ | 27 | jtextfieldResPort.requestFocusInWindow();↵ | |
28 | focusSet = true;↵ | 28 | focusSet = true;↵ | |
29 | }↵ | 29 | }↵ | |
30 | }↵ | 30 | }↵ | |
31 | }↵ | 31 | }↵ | |
32 | if (jtextfieldBckDBFile.getText().trim().length() == 0) {↵ | 32 | if (jtextfieldResBackupFile.getText().trim().length() == 0) {↵ | |
33 | bufError.append(i18n.ERROR_FILENAME_DATABASE_MISSING + CR);↵ | 33 | bufError.append(i18n.ERROR_FILENAME_BACKUP_MISSING + CR);↵ | |
34 | if (!focusSet) {↵ | 34 | if (!focusSet) {↵ | |
35 | jtextfieldBckDBFile.requestFocusInWindow();↵ | 35 | jtextfieldResBackupFile.requestFocusInWindow();↵ | |
36 | focusSet = true;↵ | 36 | focusSet = true;↵ | |
37 | }↵ | 37 | }↵ | |
38 | } else if (jtextfieldBckDBHost.getText().trim().equalsIgnoreCase("localhost")) {↵ | 38 | } else if (jtextfieldResDBHost.getText().trim().equalsIgnoreCase("localhost")) {↵ | |
39 | if (!FirebirdManagerHelper.fileExists(jtextfieldBckDBFile.getText())) {↵ | 39 | if (!FirebirdManagerHelper.fileExists(jtextfieldResBackupFile.getText())) {↵ | |
40 | bufError.append(i18n.ERROR_FILENAME_NOT_EXISTS + " " ↵ | 40 | bufError.append(i18n.ERROR_FILENAME_NOT_EXISTS + " " ↵ | |
41 | + jtextfieldBckDBFile.getText() + " " + CR);↵ | 41 | + jtextfieldResBackupFile.getText() + " " + CR);↵ | |
42 | if (!focusSet) {↵ | 42 | if (!focusSet) {↵ | |
43 | jtextfieldBckDBFile.requestFocusInWindow();↵ | 43 | jtextfieldResBackupFile.requestFocusInWindow();↵ | |
44 | focusSet = true;↵ | 44 | focusSet = true;↵ | |
45 | }↵ | 45 | }↵ | |
46 | }↵ | 46 | }↵ | |
47 | }↵ | 47 | }↵ | |
48 | if (jtextfieldBckBackupFile.getText().trim().length() == 0) {↵ | 48 | if (jtextfieldResDBFile.getText().trim().length() == 0) {↵ | |
49 | bufError.append(i18n.ERROR_FILENAME_BACKUP_MISSING + CR);↵ | 49 | bufError.append(i18n.ERROR_FILENAME_DATABASE_MISSING + CR);↵ | |
50 | if (!focusSet) {↵ | 50 | if (!focusSet) {↵ | |
51 | jtextfieldBckBackupFile.requestFocusInWindow();↵ | 51 | jtextfieldResDBFile.requestFocusInWindow();↵ | |
52 | focusSet = true;↵ | 52 | focusSet = true;↵ | |
53 | }↵ | 53 | }↵ | |
54 | }↵ | 54 | } ↵ | |
55 | ↵ | |||
56 | if (bufError.length() != 0) {↵ | 55 | if (bufError.length() != 0) {↵ | |
57 | JOptionPane.showMessageDialog(_application.getMainFrame(), bufError.toString());↵ | 56 | JOptionPane.showMessageDialog(_application.getMainFrame(), bufError.toString());↵ | |
58 | }↵ | 57 | }↵ | |
59 | return bufError.length() == 0; | 58 |
| |
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) | 11.5 |
Clones location | Clones are declared in the same class |
Number of node comparisons | 204 |
Number of mapped statements | 37 |
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) | 31.3 |
Clone type | Type 2 |
ID | Statement | ID | Statement | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | StringBuffer bufError = new StringBuffer(); | 1 | StringBuffer bufError = new StringBuffer(); | |||||||||||
2 | boolean focusSet = false; | 2 | boolean focusSet = false; | |||||||||||
3 | if (jtextfieldUsername.getText().trim().length() == 0) | 3 | if (jtextfieldUsername.getText().trim().length() == 0) | |||||||||||
4 | bufError.append(i18n.ERROR_USERNAME_MISSING + CR); | 4 | bufError.append(i18n.ERROR_USERNAME_MISSING + CR); | |||||||||||
5 | jtextfieldUsername.requestFocusInWindow(); | 5 | jtextfieldUsername.requestFocusInWindow(); | |||||||||||
6 | focusSet = true; | 6 | focusSet = true; | |||||||||||
7 | if (jtextfieldBckDBHost.getText().trim().length() == 0) |
| 7 | if (jtextfieldResDBHost.getText().trim().length() == 0) | ||||||||||
8 | bufError.append(i18n.ERROR_SERVER_MISSING + CR); | 8 | bufError.append(i18n.ERROR_SERVER_MISSING + CR); | |||||||||||
9 | if (!focusSet) | 9 | if (!focusSet) | |||||||||||
10 | jtextfieldBckDBHost.requestFocusInWindow(); |
| 10 | jtextfieldResDBHost.requestFocusInWindow(); | ||||||||||
11 | focusSet = true; | 11 | focusSet = true; | |||||||||||
12 | if (jtextfieldBckPort.getText().trim().length() == 0) |
| 12 | if (jtextfieldResPort.getText().trim().length() == 0) | ||||||||||
13 | bufError.append(i18n.ERROR_PORT_MISSING + CR); | 13 | bufError.append(i18n.ERROR_PORT_MISSING + CR); | |||||||||||
14 | if (!focusSet) | 14 | if (!focusSet) | |||||||||||
15 | jtextfieldBckPort.requestFocusInWindow(); |
| 15 | jtextfieldResPort.requestFocusInWindow(); | ||||||||||
16 | focusSet = true; | 16 | focusSet = true; | |||||||||||
17 | try |
| 17 | try | ||||||||||
18 | Integer.parseInt(jtextfieldBckPort.getText()); |
| 18 | Integer.parseInt(jtextfieldResPort.getText()); | ||||||||||
19 | if (jtextfieldBckDBFile.getText().trim().length() == 0) |
| 19 | if (jtextfieldResBackupFile.getText().trim().length() == 0) | ||||||||||
20 | bufError.append(i18n.ERROR_FILENAME_DATABASE_MISSING + CR); |
| 20 | bufError.append(i18n.ERROR_FILENAME_BACKUP_MISSING + CR); | ||||||||||
21 | if (!focusSet) | 21 | if (!focusSet) | |||||||||||
22 | jtextfieldBckDBFile.requestFocusInWindow(); |
| 22 | jtextfieldResBackupFile.requestFocusInWindow(); | ||||||||||
23 | focusSet = true; | 23 | focusSet = true; | |||||||||||
24 | else if (jtextfieldBckDBHost.getText().trim().equalsIgnoreCase("localhost")) |
| 24 | else if (jtextfieldResDBHost.getText().trim().equalsIgnoreCase("localhost")) | ||||||||||
25 | if (!FirebirdManagerHelper.fileExists(jtextfieldBckDBFile.getText())) |
| 25 | if (!FirebirdManagerHelper.fileExists(jtextfieldResBackupFile.getText())) | ||||||||||
26 | bufError.append(i18n.ERROR_FILENAME_NOT_EXISTS + " " + jtextfieldBckDBFile.getText() + " " + CR); |
| 26 | bufError.append(i18n.ERROR_FILENAME_NOT_EXISTS + " " + jtextfieldResBackupFile.getText() + " " + CR); | ||||||||||
27 | if (!focusSet) | 27 | if (!focusSet) | |||||||||||
28 | jtextfieldBckDBFile.requestFocusInWindow(); |
| 28 | jtextfieldResBackupFile.requestFocusInWindow(); | ||||||||||
29 | focusSet = true; | 29 | focusSet = true; | |||||||||||
30 | if (jtextfieldBckBackupFile.getText().trim().length() == 0) |
| 30 | if (jtextfieldResDBFile.getText().trim().length() == 0) | ||||||||||
31 | bufError.append(i18n.ERROR_FILENAME_BACKUP_MISSING + CR); |
| 31 | bufError.append(i18n.ERROR_FILENAME_DATABASE_MISSING + CR); | ||||||||||
32 | if (!focusSet) | 32 | if (!focusSet) | |||||||||||
33 | jtextfieldBckBackupFile.requestFocusInWindow(); |
| 33 | jtextfieldResDBFile.requestFocusInWindow(); | ||||||||||
34 | focusSet = true; | 34 | focusSet = true; | |||||||||||
35 | if (bufError.length() != 0) | 35 | if (bufError.length() != 0) | |||||||||||
36 | JOptionPane.showMessageDialog(_application.getMainFrame(), bufError.toString()); | 36 | JOptionPane.showMessageDialog(_application.getMainFrame(), bufError.toString()); | |||||||||||
37 | return bufError.length() == 0; | 37 | return bufError.length() == 0; |
Row | Violation |
---|