7067
diff --git a/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/JDIStackFrame.java b/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/JDIStackFrame.java index 068168c..1a5121d 100644 --- a/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/JDIStackFrame.java +++ b/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/JDIStackFrame.java
@@ -94,6 +94,11 @@ * Whether this stack frame has been declared out of synch */ private boolean fIsOutOfSynch= false; + + /** + * Local cache for source name debug attribute + */ + private String fSourceName; /** * Creates a new stack frame in the given thread. @@ -765,16 +770,25 @@ * @see IJavaStackFrame#getSourceName() */ public String getSourceName() throws DebugException { - try { - Location l = getUnderlyingMethod().location(); - if (l != null) { - return l.sourceName(); + if (fSourceName == null) { + try { + Location l = getUnderlyingMethod().location(); + if (l != null) { + fSourceName = l.sourceName(); + } + } catch (AbsentInformationException e) { + fSourceName = ""; + } catch (NativeMethodException e) { + fSourceName = ""; + } catch (RuntimeException e) { + targetRequestFailed(MessageFormat.format(JDIDebugModelMessages.getString("JDIStackFrame.exception_retrieving_source_name"), new String[] {e.toString()}), e); //$NON-NLS-1$ } - } catch (AbsentInformationException e) { - } catch (RuntimeException e) { - targetRequestFailed(MessageFormat.format(JDIDebugModelMessages.getString("JDIStackFrame.exception_retrieving_source_name"), new String[] {e.toString()}), e); //$NON-NLS-1$ } - return null; + if (fSourceName == null || fSourceName.length() == 0) { + return null; + } else { + return fSourceName; + } } protected boolean isTopStackFrame() throws DebugException {