int ch; try { ch = KeyEvent.class.getField("VK_".concat(key)) .getInt(null); } catch(Exception e) { Log.log(Log.ERROR,DefaultInputHandler.class, "Invalid key stroke: " + keyStroke); return null; } return KeyStroke.getKeyStroke(ch,modifiers);
int ch; try { ch = KeyEvent.class.getField("VK_".concat(key)) .getInt(null); } catch(Exception e) { Log.log(Log.ERROR,DefaultInputHandler.class, "Invalid key stroke: " + keyStroke); return null; } return new Key(modifiersToString(modifiers),ch,'\0');
Clone fragments detected by clone detection tool
File path: /jEdit-4.2/src/org/gjt/sp/jedit/gui/DefaultInputHandler.java File path: /jEdit-4.2/src/org/gjt/sp/jedit/gui/KeyEventTranslator.java
Method name: KeyStroke parseKeyStroke(String) Method name: Key parseKey(String)
Number of AST nodes: 4 Number of AST nodes: 4
1
int ch;
1
int ch;
2
			try
2
			try
3
			{
3
			{
4
				ch = KeyEvent.class.getField("VK_".concat(key))
4
				ch = KeyEvent.class.getField("VK_".concat(key))
5
					.getInt(null);
5
					.getInt(null);
6
			}
6
			}
7
			catch(Exception e)
7
			catch(Exception e)
8
			{
8
			{
9
				Log.log(Log.ERROR,DefaultInputHandler.class,
9
				Log.log(Log.ERROR,DefaultInputHandler.class,
10
					"Invalid key stroke: "
10
					"Invalid key stroke: "
11
					+ keyStroke);
11
					+ keyStroke);
12
				return null;
12
				return null;
13
			}
13
			}
14
			return KeyStroke.getKeyStroke(ch,modifiers);
14
			return new Key(modifiersToString(modifiers),ch,'\0');
Summary
Number of common nesting structure subtrees1
Number of refactorable cases1
Number of non-refactorable cases0
Time elapsed for finding largest common nesting structure subtrees (ms)0.4
Clones locationClones are in different classes
Number of node comparisons9
  1. {Refactorable}
    Mapping Summary
    Number of mapped statements3
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)0.9
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    29
    int ch;
    28
    int ch;
    30
    try
    29
    try
    31
    ch = KeyEvent.class.getField("VK_".concat(key)).getInt(null);
    30
    ch = KeyEvent.class.getField("VK_".concat(key)).getInt(null);
                                                                                                                      
    31
    return new Key(modifiersToString(modifiers), ch, '\0');
    32
    return KeyStroke.getKeyStroke(ch, modifiers);
                                                                                                    
    Precondition Violations (0)
    Row Violation