- Timestamp:
- 2016-08-26T19:59:23+02:00 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/tools/bugreport/BugReport.java
r10899 r10902 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(); … … 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 … … 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 }
Note:
See TracChangeset
for help on using the changeset viewer.