public class IntegerPropertyConverter implements Converter { private static final String ATT_NAME = "name"; // $NON-NLS-1$ /** * Returns the converter version; used to check for possible * incompatibilities */ public static String getVersion() { return "$Revision: 493779 $"; // $NON-NLS-1$ } /* * (non-Javadoc) * * @see com.thoughtworks.xstream.converters.Converter#canConvert(java.lang.Class) */ public boolean canConvert(Class arg0) { return arg0.equals(IntegerProperty.class); } /* * (non-Javadoc) * * @see com.thoughtworks.xstream.converters.Converter#marshal(java.lang.Object, * com.thoughtworks.xstream.io.HierarchicalStreamWriter, * com.thoughtworks.xstream.converters.MarshallingContext) */ public void marshal(Object obj, HierarchicalStreamWriter writer, MarshallingContext arg2) { IntegerProperty prop = (IntegerProperty) obj; writer.addAttribute(ATT_NAME, ConversionHelp.encode(prop.getName())); writer.setValue(prop.getStringValue()); } /* * (non-Javadoc) * * @see com.thoughtworks.xstream.converters.Converter#unmarshal(com.thoughtworks.xstream.io.HierarchicalStreamReader, * com.thoughtworks.xstream.converters.UnmarshallingContext) */ public Object unmarshal(HierarchicalStreamReader reader, UnmarshallingContext arg1) { IntegerProperty prop = new IntegerProperty(ConversionHelp.decode(reader.getAttribute(ATT_NAME)), Integer .parseInt(reader.getValue())); return prop;
public class StringPropertyConverter implements Converter { private static final String ATT_NAME = "name"; // $NON-NLS-1$ /** * Returns the converter version; used to check for possible * incompatibilities */ public static String getVersion() { return "$Revision: 493779 $"; // $NON-NLS-1$ } /* * (non-Javadoc) * * @see com.thoughtworks.xstream.converters.Converter#canConvert(java.lang.Class) */ public boolean canConvert(Class arg0) { return StringProperty.class.equals(arg0); } /* * (non-Javadoc) * * @see com.thoughtworks.xstream.converters.Converter#marshal(java.lang.Object, * com.thoughtworks.xstream.io.HierarchicalStreamWriter, * com.thoughtworks.xstream.converters.MarshallingContext) */ public void marshal(Object obj, HierarchicalStreamWriter writer, MarshallingContext arg2) { StringProperty prop = (StringProperty) obj; writer.addAttribute(ATT_NAME, ConversionHelp.encode(prop.getName())); writer.setValue(ConversionHelp.encode(prop.getStringValue())); } /* * (non-Javadoc) * * @see com.thoughtworks.xstream.converters.Converter#unmarshal(com.thoughtworks.xstream.io.HierarchicalStreamReader, * com.thoughtworks.xstream.converters.UnmarshallingContext) */ public Object unmarshal(HierarchicalStreamReader reader, UnmarshallingContext arg1) { StringProperty prop = new StringProperty(ConversionHelp.decode(reader.getAttribute(ATT_NAME)), ConversionHelp .decode(reader.getValue())); return prop;
Clone fragments detected by clone detection tool
File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/save/converters/IntegerPropertyConverter.java File path: /jakarta-jmeter-2.3.2/src/org/apache/jmeter/save/converters/StringPropertyConverter.java
Method name: Method name:
Number of AST nodes: 0 Number of AST nodes: 0
1
public class IntegerPropertyConverter implements Converter {
1
public class StringPropertyConverter implements Converter {
2
    
2
    
3
	private static final String ATT_NAME = "name"; // $NON-NLS-1$
3
private static final String ATT_NAME = "name"; // $NON-NLS-1$
4
    /**
4
    /**
5
	 * Returns the converter version; used to check for possible
5
	 * Returns the converter version; used to check for possible
6
	 * incompatibilities
6
	 * incompatibilities
7
	 */
7
	 */
8
	public static String getVersion() {
8
	public static String getVersion() {
9
		return "$Revision: 493779 $"; // $NON-NLS-1$
9
		return "$Revision: 493779 $"; // $NON-NLS-1$
10
	}
10
	}
11
	/*
11
	/*
12
	 * (non-Javadoc)
12
	 * (non-Javadoc)
13
	 * 
13
	 * 
14
	 * @see com.thoughtworks.xstream.converters.Converter#canConvert(java.lang.Class)
14
	 * @see com.thoughtworks.xstream.converters.Converter#canConvert(java.lang.Class)
15
	 */
15
	 */
16
	public boolean canConvert(Class arg0) {
16
	public boolean canConvert(Class arg0) {
17
		return arg0.equals(IntegerProperty.class);
17
		return StringProperty.class.equals(arg0);
18
	}
18
	}
19
	/*
19
	/*
20
	 * (non-Javadoc)
20
	 * (non-Javadoc)
21
	 * 
21
	 * 
22
	 * @see com.thoughtworks.xstream.converters.Converter#marshal(java.lang.Object,
22
	 * @see com.thoughtworks.xstream.converters.Converter#marshal(java.lang.Object,
23
	 *      com.thoughtworks.xstream.io.HierarchicalStreamWriter,
23
	 *      com.thoughtworks.xstream.io.HierarchicalStreamWriter,
24
	 *      com.thoughtworks.xstream.converters.MarshallingContext)
24
	 *      com.thoughtworks.xstream.converters.MarshallingContext)
25
	 */
25
	 */
26
	public void marshal(Object obj, HierarchicalStreamWriter writer, MarshallingContext arg2) {
26
	public void marshal(Object obj, HierarchicalStreamWriter writer, MarshallingContext arg2) {
27
		IntegerProperty prop = (IntegerProperty) obj;
27
		StringProperty prop = (StringProperty) obj;
28
		writer.addAttribute(ATT_NAME, ConversionHelp.encode(prop.getName()));
28
		writer.addAttribute(ATT_NAME, ConversionHelp.encode(prop.getName()));
29
		writer.setValue(prop.getStringValue());
29
		writer.setValue(ConversionHelp.encode(prop.getStringValue()));
30
	}
30
	}
31
	/*
31
	/*
32
	 * (non-Javadoc)
32
	 * (non-Javadoc)
33
	 * 
33
	 * 
34
	 * @see com.thoughtworks.xstream.converters.Converter#unmarshal(com.thoughtworks.xstream.io.HierarchicalStreamReader,
34
	 * @see com.thoughtworks.xstream.converters.Converter#unmarshal(com.thoughtworks.xstream.io.HierarchicalStreamReader,
35
	 *      com.thoughtworks.xstream.converters.UnmarshallingContext)
35
	 *      com.thoughtworks.xstream.converters.UnmarshallingContext)
36
	 */
36
	 */
37
	public Object unmarshal(HierarchicalStreamReader reader, UnmarshallingContext arg1) {
37
	public Object unmarshal(HierarchicalStreamReader reader, UnmarshallingContext arg1) {
38
		IntegerProperty prop = new IntegerProperty(ConversionHelp.decode(reader.getAttribute(ATT_NAME)), Integer
38
		StringProperty prop = new StringProperty(ConversionHelp.decode(reader.getAttribute(ATT_NAME)), 
39
				.parseInt
39
ConversionHelp
40
(reader.getValue()));
40
				.decode(reader.getValue()));
41
		return prop;
41
		return prop;
42
	
42
	
Summary
Number of common nesting structure subtrees0
Number of refactorable cases0
Number of non-refactorable cases0
Time elapsed for finding largest common nesting structure subtrees (ms)0.0
Clones location
Number of node comparisons0