File path: /sql12/plugins/mssql/src/net/sourceforge/squirrel_sql/plugins/mssql/prefs/PreferencesManager.java | File path: /sql12/plugins/sqlscript/src/net/sourceforge/squirrel_sql/plugins/sqlscript/prefs/SQLScriptPreferencesManager.java | |||
Method name: void loadPrefs()
|
Method name: void loadPrefs()
|
|||
Number of AST nodes: 11 | Number of AST nodes: 11 | |||
1 | try {↵ | 1 | try {↵ | |
2 | XMLBeanReader doc = new XMLBeanReader();↵ | 2 | XMLBeanReader doc = new XMLBeanReader();↵ | |
3 | ↵ | 3 | ↵ | |
4 | File prefFile = PreferenceUtil.getPreferenceFileToReadFrom(plugin);↵ | 4 | File prefFile = PreferenceUtil.getPreferenceFileToReadFrom(plugin);↵ | |
5 | ↵ | 5 | ↵ | |
6 | doc.load(prefFile, MSSQLPreferenceBean.class.getClassLoader());↵ | 6 | doc.load(prefFile, SQLScriptPreferenceBean.class.getClassLoader());↵ | |
7 | ↵ | 7 | ↵ | |
8 | Iterator<?> it = doc.iterator();↵ | 8 | Iterator<?> it = doc.iterator();↵ | |
9 | if (it.hasNext()) {↵ | 9 | if (it.hasNext()) {↵ | |
10 | _prefs = (MSSQLPreferenceBean)it.next();↵ | 10 | _prefs = (SQLScriptPreferenceBean)it.next();↵ | |
11 | }↵ | 11 | }↵ | |
12 | } catch (FileNotFoundException ignore) {↵ | 12 | } catch (FileNotFoundException ignore) {↵ | |
13 | s_log.info(USER_PREFS_FILE_NAME + " not found - will be created");↵ | 13 | s_log.info(USER_PREFS_FILE_NAME + " not found - will be created");↵ | |
14 | } catch (Exception ex) {↵ | 14 | } catch (Exception ex) {↵ | |
15 | s_log.error("Error occured reading from preferences file: "↵ | 15 | s_log.error("Error occured reading from preferences file: "↵ | |
16 | + USER_PREFS_FILE_NAME, ex);↵ | 16 | + USER_PREFS_FILE_NAME, ex);↵ | |
17 | }↵ | 17 | }↵ | |
18 | if (_prefs == null) {↵ | 18 | if (_prefs == null) {↵ | |
19 | _prefs = new MSSQLPreferenceBean();↵ | 19 | _prefs = new SQLScriptPreferenceBean();↵ | |
20 | }↵ | 20 | }↵ | |
21 | _prefs.setClientName(Version.getApplicationName() + "/" + plugin.getDescriptiveName());↵ | 21 | _prefs.setClientName(Version.getApplicationName() + "/" + plugin.getDescriptiveName());↵ | |
22 | _prefs.setClientVersion(Version.getShortVersion() + "/" + plugin.getVersion()); | 22 |
| |
See real code fragment | See real code fragment |
Number of common nesting structure subtrees | 1 |
Number of refactorable cases | 0 |
Number of non-refactorable cases | 1 |
Time elapsed for finding largest common nesting structure subtrees (ms) | 1.0 |
Clones location | Clones are in different classes |
Number of node comparisons | 37 |
Number of mapped statements | 9 |
Number of unmapped statements in the first code fragment | 2 |
Number of unmapped statements in the second code fragment | 2 |
Time elapsed for statement mapping (ms) | 5.4 |
Clone type | Type 2 |
ID | Statement | ID | Statement | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | try | 1 | try | ||||||||||||
2 | XMLBeanReader doc = new XMLBeanReader(); | 2 | XMLBeanReader doc = new XMLBeanReader(); | ||||||||||||
3 | File prefFile = PreferenceUtil.getPreferenceFileToReadFrom(plugin); | 3 | File prefFile = PreferenceUtil.getPreferenceFileToReadFrom(plugin); | ||||||||||||
4 | doc.load(prefFile, MSSQLPreferenceBean.class.getClassLoader()); |
| 4 | doc.load(prefFile, SQLScriptPreferenceBean.class.getClassLoader()); | |||||||||||
5 | Iterator<?> it = doc.iterator(); | 5 | Iterator<?> it = doc.iterator(); | ||||||||||||
6 | if (it.hasNext()) | 6 | if (it.hasNext()) | ||||||||||||
|
| 7 | _prefs = (SQLScriptPreferenceBean)it.next(); | ||||||||||||
7 | _prefs = (MSSQLPreferenceBean)it.next(); |
| | ||||||||||||
8 | if (_prefs == null) |
| 8 | if (_prefs == null) | |||||||||||
|
| 9 | _prefs = new SQLScriptPreferenceBean(); | ||||||||||||
9 | _prefs = new MSSQLPreferenceBean(); |
| | ||||||||||||
10 | _prefs.setClientName(Version.getApplicationName() + "/" + plugin.getDescriptiveName()); |
| 10 | _prefs.setClientName(Version.getApplicationName() + "/" + plugin.getDescriptiveName()); | |||||||||||
11 | _prefs.setClientVersion(Version.getShortVersion() + "/" + plugin.getVersion()); |
| 11 | _prefs.setClientVersion(Version.getShortVersion() + "/" + plugin.getVersion()); |
Row | Violation |
---|---|
1 | Unmatched statement _prefs=(SQLScriptPreferenceBean)it.next(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
2 | Unmatched statement _prefs=(MSSQLPreferenceBean)it.next(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
3 | Type net.sourceforge.squirrel_sql.plugins.mssql.prefs.MSSQLPreferenceBean of variable _prefs does not match with type net.sourceforge.squirrel_sql.plugins.sqlscript.prefs.SQLScriptPreferenceBean of variable _prefs |
4 | Unmatched statement _prefs=new SQLScriptPreferenceBean(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
5 | Unmatched statement _prefs=new MSSQLPreferenceBean(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
6 | Type net.sourceforge.squirrel_sql.plugins.mssql.prefs.MSSQLPreferenceBean of variable _prefs does not match with type net.sourceforge.squirrel_sql.plugins.sqlscript.prefs.SQLScriptPreferenceBean of variable _prefs |
7 | Type net.sourceforge.squirrel_sql.plugins.mssql.prefs.MSSQLPreferenceBean of variable _prefs does not match with type net.sourceforge.squirrel_sql.plugins.sqlscript.prefs.SQLScriptPreferenceBean of variable _prefs |