Ticket #13318: patch-fix-13318-tests.patch

File patch-fix-13318-tests.patch, 2.1 KB (added by michael2402, 9 years ago)
  • src/org/openstreetmap/josm/tools/bugreport/BugReport.java

    diff --git a/src/org/openstreetmap/josm/tools/bugreport/BugReport.java b/src/org/openstreetmap/josm/tools/bugreport/BugReport.java
    index c2be905..bf6db66 100644
    a b public final class BugReport implements Serializable {  
    185185     * @return The method name.
    186186     */
    187187    public static String getCallingMethod(int offset) {
    188         String className = BugReport.class.getName();
    189         String methodName = "getCallingMethod";
    190         StackTraceElement found = getCallingMethod(offset, className, methodName::equals);
     188        StackTraceElement found = getCallingMethod(offset + 1, BugReport.class.getName(), "getCallingMethod"::equals);
    191189        if (found != null) {
    192190            return found.getClassName().replaceFirst(".*\\.", "") + '#' + found.getMethodName();
    193191        } else {
    public final class BugReport implements Serializable {  
    198196    /**
    199197     * Find the method that called the given method on the current stack trace.
    200198     * @param offset
    201      *           How many methods to look back in the stack trace. 1 gives the method calling this method, 0 gives you getCallingMethod().
     199     *           How many methods to look back in the stack trace.
     200     *           1 gives the method calling this method, 0 gives you the method with the given name..
    202201     * @param className The name of the class to search for
    203202     * @param methodName The name of the method to search for
    204203     * @return The class and method name or null if it is unknown.
    public final class BugReport implements Serializable {  
    208207        for (int i = 0; i < stackTrace.length - offset; i++) {
    209208            StackTraceElement element = stackTrace[i];
    210209            if (className.equals(element.getClassName()) && methodName.test(element.getMethodName())) {
    211                 StackTraceElement toReturn = stackTrace[i + offset];
    212                 return toReturn;
     210                return stackTrace[i + offset];
    213211            }
    214212        }
    215213        return null;