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 {
|
| 185 | 185 | * @return The method name. |
| 186 | 186 | */ |
| 187 | 187 | 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); |
| 191 | 189 | if (found != null) { |
| 192 | 190 | return found.getClassName().replaceFirst(".*\\.", "") + '#' + found.getMethodName(); |
| 193 | 191 | } else { |
| … |
… |
public final class BugReport implements Serializable {
|
| 198 | 196 | /** |
| 199 | 197 | * Find the method that called the given method on the current stack trace. |
| 200 | 198 | * @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.. |
| 202 | 201 | * @param className The name of the class to search for |
| 203 | 202 | * @param methodName The name of the method to search for |
| 204 | 203 | * @return The class and method name or null if it is unknown. |
| … |
… |
public final class BugReport implements Serializable {
|
| 208 | 207 | for (int i = 0; i < stackTrace.length - offset; i++) { |
| 209 | 208 | StackTraceElement element = stackTrace[i]; |
| 210 | 209 | if (className.equals(element.getClassName()) && methodName.test(element.getMethodName())) { |
| 211 | | StackTraceElement toReturn = stackTrace[i + offset]; |
| 212 | | return toReturn; |
| | 210 | return stackTrace[i + offset]; |
| 213 | 211 | } |
| 214 | 212 | } |
| 215 | 213 | return null; |