public static float getFloat(Object o, float defaultValue) {
try {
if (o == null) {
return defaultValue;
}
if (o instanceof Number) {
return ((Number) o).floatValue();
}
return Float.parseFloat(o.toString());
} catch (NumberFormatException e) {
return defaultValue;
public static double getDouble(Object o, double defaultValue) {
try {
if (o == null) {
return defaultValue;
}
if (o instanceof Number) {
return ((Number) o).doubleValue();
}
return Double.parseDouble(o.toString());
} catch (NumberFormatException e) {
return defaultValue;
Clone fragments detected by clone detection tool
File path: /jakarta-jmeter-2.3.2/src/org/apache/jorphan/util/Converter.java
|
|
File path: /jakarta-jmeter-2.3.2/src/org/apache/jorphan/util/Converter.java
|
Method name:
|
|
Method name:
|
Number of AST nodes: 0
|
|
Number of AST nodes: 0
|
|
1 | public static float getFloat(Object o, float defaultValue) {↵ | | 1 | public static double getDouble(Object o, double defaultValue) {↵
|
2 | try {↵ | | 2 | try {↵
|
3 | if (o == null) {↵ | | 3 | if (o == null) {↵
|
4 | return defaultValue;↵ | | 4 | return defaultValue;↵
|
5 | }↵ | | 5 | }↵
|
6 | if (o instanceof Number) {↵ | | 6 | if (o instanceof Number) {↵
|
7 | return ((Number) o).floatValue();↵ | | 7 | return ((Number) o).doubleValue();↵
|
8 | }↵ | | 8 | }↵
|
9 | return Float.parseFloat(o.toString());↵ | | 9 | return Double.parseDouble(o.toString());↵
|
10 | } catch (NumberFormatException e) {↵ | | 10 | } catch (NumberFormatException e) {↵
|
11 | return defaultValue;↵ | | 11 | return defaultValue;↵
|
12 | | | 12 |
|
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 |