com.sun.jdi.AbsentInformationException Java Examples

The following examples show how to use com.sun.jdi.AbsentInformationException. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DynamothCollector.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
private void processClassPrepareEvent() throws AbsentInformationException {
	EventRequestManager erm = vm.eventRequestManager();
	List<ReferenceType> referenceTypes = vm.classesByName(this.location.getContainingClassName());
	// List listOfLocations =
	// referenceTypes.get(0).locationsOfLine(this.location.getLineNumber());

	int loc = this.location.getLineNumber();
	List listOfLocations = null;

	do {
		listOfLocations = referenceTypes.get(0).locationsOfLine(loc);
		loc--;
	} while (loc > 0 && listOfLocations.isEmpty());

	if (listOfLocations.size() == 0) {
		throw new RuntimeException("Buggy class not found " + this.location);
	}
	com.sun.jdi.Location jdiLocation = (com.sun.jdi.Location) listOfLocations.get(0);
	this.buggyMethod = jdiLocation.method().name();
	breakpointSuspicious = erm.createBreakpointRequest(jdiLocation);
	breakpointSuspicious.setEnabled(true);
	initSpoon();
	this.initExecutionTime = System.currentTimeMillis();
}
 
Example #2
Source File: CallStackTableModel.java    From netbeans with Apache License 2.0 6 votes vote down vote up
public Object getValueAt (Object row, String columnID) throws 
UnknownTypeException {
    if (row instanceof CallStackFrame) {
        if (CALL_STACK_FRAME_LOCATION_COLUMN_ID.equals (columnID))
            try {
                return ((CallStackFrame) row).getSourceName (
                    null // default stratumn for current csf is used
                );
            } catch (AbsentInformationException e) {
                return NbBundle.getMessage (
                    CallStackTableModel.class, 
                    "MSG_Callstack_NoInformation"
                );
            }
    }
    throw new UnknownTypeException (row);
}
 
Example #3
Source File: SourceMapper.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Return a File cooresponding to the source of this location.
 * Return null if not available.
 */
File sourceFile(Location loc) {
    try {
        String filename = loc.sourceName();
        String refName = loc.declaringType().name();
        int iDot = refName.lastIndexOf('.');
        String pkgName = (iDot >= 0)? refName.substring(0, iDot+1) : "";
        String full = pkgName.replace('.', File.separatorChar) + filename;
        for (int i= 0; i < dirs.length; ++i) {
            File path = new File(dirs[i], full);
            if (path.exists()) {
                return path;
            }
        }
        return null;
    } catch (AbsentInformationException e) {
        return null;
    }
}
 
Example #4
Source File: SourceMapper.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Return a File cooresponding to the source of this location.
 * Return null if not available.
 */
File sourceFile(Location loc) {
    try {
        String filename = loc.sourceName();
        String refName = loc.declaringType().name();
        int iDot = refName.lastIndexOf('.');
        String pkgName = (iDot >= 0)? refName.substring(0, iDot+1) : "";
        String full = pkgName.replace('.', File.separatorChar) + filename;
        for (int i= 0; i < dirs.length; ++i) {
            File path = new File(dirs[i], full);
            if (path.exists()) {
                return path;
            }
        }
        return null;
    } catch (AbsentInformationException e) {
        return null;
    }
}
 
Example #5
Source File: SourcePath.java    From netbeans with Apache License 2.0 6 votes vote down vote up
public boolean sourceAvailable (
    CallStackFrame csf,
    String stratumn
) {
    String url = getClassURL(((CallStackFrameImpl) csf).getClassType(), stratumn);
    if (url != null) {
        return true;
    }
    try {
        return sourceAvailable (
            convertSlash (csf.getSourcePath (stratumn)), true
        );
    } catch (AbsentInformationException e) {
        return sourceAvailable (
            convertClassNameToRelativePath (csf.getClassName ()), true
        );
    }
}
 
Example #6
Source File: DebuggingActionsProvider.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private static void popToHere (final CallStackFrame frame) {
    try {
        JPDAThread t = frame.getThread ();
        CallStackFrame[] stack = t.getCallStack ();
        int i, k = stack.length;
        if (k < 2) return ;
        for (i = 0; i < k; i++)
            if (stack [i].equals (frame)) {
                if (i > 0) {
                    stack [i - 1].popFrame ();
                }
                return;
            }
    } catch (AbsentInformationException ex) {
    }
}
 
Example #7
Source File: BaseComponentBreakpointImpl.java    From netbeans with Apache License 2.0 6 votes vote down vote up
final protected void navigateToCustomCode(final JPDAThread thread) {
    CallStackFrame callStackFrame = null;
    try {
        CallStackFrame[] callStack = thread.getCallStack();
        for (CallStackFrame csf : callStack) {
            String cn = csf.getClassName();
            if (JavaComponentInfo.isCustomType(cn)) {
                callStackFrame = csf;
                break;
            }
        }
    } catch (AbsentInformationException ex) {
    }
    if (callStackFrame != null) {
        ((JPDAThreadImpl) thread).getDebugger().setPreferredTopFrame(callStackFrame);
    }
}
 
Example #8
Source File: SourceMapper.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Return a File cooresponding to the source of this location.
 * Return null if not available.
 */
File sourceFile(Location loc) {
    try {
        String filename = loc.sourceName();
        String refName = loc.declaringType().name();
        int iDot = refName.lastIndexOf('.');
        String pkgName = (iDot >= 0)? refName.substring(0, iDot+1) : "";
        String full = pkgName.replace('.', File.separatorChar) + filename;
        for (int i= 0; i < dirs.length; ++i) {
            File path = new File(dirs[i], full);
            if (path.exists()) {
                return path;
            }
        }
        return null;
    } catch (AbsentInformationException e) {
        return null;
    }
}
 
Example #9
Source File: TruffleAccess.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private CurrentPCInfo getCurrentPosition(JPDADebugger debugger, JPDAThread thread) {
    try {
        CallStackFrame csf = thread.getCallStack(0, 1)[0];
        LocalVariable[] localVariables = csf.getLocalVariables();
        ExecutionHaltedInfo haltedInfo = ExecutionHaltedInfo.get(localVariables);
        //JPDAClassType debugAccessor = TruffleDebugManager.getDebugAccessorJPDAClass(debugger);
        ObjectVariable sourcePositionVar = haltedInfo.sourcePositions;
        SourcePosition sp = getSourcePosition(debugger, sourcePositionVar);
        
        ObjectVariable frameInfoVar = haltedInfo.frameInfo;
        ObjectVariable frame = (ObjectVariable) frameInfoVar.getField(VAR_FRAME);
        ObjectVariable topVars = (ObjectVariable) frameInfoVar.getField(VAR_TOP_VARS);
        TruffleScope[] scopes = createScopes(debugger, topVars);
        ObjectVariable stackTrace = (ObjectVariable) frameInfoVar.getField(VAR_STACK_TRACE);
        String topFrameDescription = (String) frameInfoVar.getField(VAR_TOP_FRAME).createMirrorObject();
        ObjectVariable thisObject = null;// TODO: (ObjectVariable) frameInfoVar.getField("thisObject");
        TruffleStackFrame topFrame = new TruffleStackFrame(debugger, thread, 0, frame, topFrameDescription, null/*code*/, scopes, thisObject, true);
        TruffleStackInfo stack = new TruffleStackInfo(debugger, thread, stackTrace);
        return new CurrentPCInfo(haltedInfo.stepCmd, thread, sp, scopes, topFrame, stack, depth -> {
            return getTruffleAST(debugger, (JPDAThreadImpl) thread, depth, sp, stack);
        });
    } catch (AbsentInformationException | IllegalStateException ex) {
        Exceptions.printStackTrace(ex);
        return null;
    }
}
 
Example #10
Source File: DeadlockDetectorImpl.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private ObjectVariable[] checkForThreadJoin(JPDAThread thread, ObjectVariable[] ownedMonitors) {
    CallStackFrame[] callStack;
    try {
        callStack = thread.getCallStack(0, 2);
    } catch (AbsentInformationException ex) {
        return ownedMonitors;
    }
    if (callStack.length < 2) {
        return ownedMonitors;
    }
    if (Thread.class.getName().equals(callStack[1].getClassName()) && "join".equals(callStack[1].getMethodName())) {    // NOI18N
        // This current thread is the "owned" monitor, it's joning the contended monitor.
        ObjectVariable[] ownedMonitorsWithThread = Arrays.copyOf(ownedMonitors, ownedMonitors.length + 1);
        ownedMonitorsWithThread[ownedMonitors.length] = (ObjectVariable) ((JPDAThreadImpl) thread).getDebugger().getVariable(((JPDAThreadImpl) thread).getThreadReference());
        return ownedMonitorsWithThread;
    } else {
        return ownedMonitors;
    }
}
 
Example #11
Source File: JPDADebuggerImpl.java    From netbeans with Apache License 2.0 6 votes vote down vote up
/**
 * Test whether we should stop here according to the smart-stepping rules.
 */
StopOrStep stopHere(JPDAThread t) {
    CallStackFrame topFrame = null;
    try {
        CallStackFrame[] topFrameArr = t.getCallStack(0, 1);
        if (topFrameArr.length > 0) {
            topFrame = topFrameArr[0];
        }
    } catch (AbsentInformationException aiex) {}
    if (topFrame != null) {
        return getCompoundSmartSteppingListener().stopAt
                    (lookupProvider, topFrame, getSmartSteppingFilter());
    } else {
        return getCompoundSmartSteppingListener().stopHere
                    (lookupProvider, t, getSmartSteppingFilter()) ?
                StopOrStep.stop() : StopOrStep.skip();
    }
}
 
Example #12
Source File: JPDADebuggerImpl.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private PropertyChangeEvent updateCurrentCallStackFrameNoFire (JPDAThread thread) {
    CallStackFrame oldSF;
    CallStackFrame newSF;
    if ((thread == null) || (thread.getStackDepth () < 1)) {
        newSF = null;
    } else {
        try {
            CallStackFrame[] csfs = thread.getCallStack(0, 1);
            if (csfs.length > 0) {
                newSF = csfs[0];
            } else {
                newSF = null;
            }
        } catch (AbsentInformationException e) {
            newSF = null;
        }
    }
    oldSF = setCurrentCallStackFrameNoFire(newSF);
    if (oldSF == newSF) {
        return null;
    } else {
        return new PropertyChangeEvent(this, PROP_CURRENT_CALL_STACK_FRAME,
                                       oldSF, newSF);
    }
}
 
Example #13
Source File: JPDADebuggerImpl.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private CallStackFrame getTopFrame(JPDAThread thread) {
    CallStackFrame callStackFrame;
    if (preferredTopFrame != null) {
        callStackFrame = preferredTopFrame;
        preferredTopFrame = null;
        return callStackFrame;
    }
    if ((thread == null) || (thread.getStackDepth () < 1)) {
        callStackFrame = null;
    } else {
        try {
            CallStackFrame[] csfs = thread.getCallStack(0, 1);
            if (csfs.length > 0) {
                callStackFrame = csfs[0];
            } else {
                callStackFrame = null;
            }
        } catch (AbsentInformationException e) {
            callStackFrame = null;
        }
    }
    return callStackFrame;
}
 
Example #14
Source File: CallStackFrameImpl.java    From netbeans with Apache License 2.0 6 votes vote down vote up
/**
* Returns name of file of this frame.
*
* @return name of file of this frame
* @throws NoInformationException if informations about source are not included or some other error
*   occurres.
*/
public synchronized String getSourceName (String stratum) throws AbsentInformationException {
    if (!valid && sfLocation == null) return "";
    assert !Mutex.EVENT.isReadAccess();
    try {
        Location l = getStackFrameLocation();
        return LocationWrapper.sourceName(l, stratum);
    } catch (InvalidStackFrameExceptionWrapper ex) {
        // this stack frame is not available or information in it is not available
        valid = false;
        return "";
    } catch (InternalExceptionWrapper ex) {
        return "";
    } catch (VMDisconnectedExceptionWrapper ex) {
        return "";
    }
}
 
Example #15
Source File: CallStackFrameImpl.java    From netbeans with Apache License 2.0 6 votes vote down vote up
/**
 * Returns source path of file this frame is stopped in or null.
 *
 * @return source path of file this frame is stopped in or null
 */
public synchronized String getSourcePath (String stratum) throws AbsentInformationException {
    if (!valid && sfLocation == null) return "";
    assert !Mutex.EVENT.isReadAccess();
    try {
        Location l = getStackFrameLocation();
        return LocationWrapper.sourcePath(l, stratum);
    } catch (InvalidStackFrameExceptionWrapper ex) {
        // this stack frame is not available or information in it is not available
        valid = false;
        return "";
    } catch (InternalExceptionWrapper ex) {
        return "";
    } catch (VMDisconnectedExceptionWrapper ex) {
        return "";
    }
}
 
Example #16
Source File: SourceMapper.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Return a File cooresponding to the source of this location.
 * Return null if not available.
 */
File sourceFile(Location loc) {
    try {
        String filename = loc.sourceName();
        String refName = loc.declaringType().name();
        int iDot = refName.lastIndexOf('.');
        String pkgName = (iDot >= 0)? refName.substring(0, iDot+1) : "";
        String full = pkgName.replace('.', File.separatorChar) + filename;
        for (int i= 0; i < dirs.length; ++i) {
            File path = new File(dirs[i], full);
            if (path.exists()) {
                return path;
            }
        }
        return null;
    } catch (AbsentInformationException e) {
        return null;
    }
}
 
Example #17
Source File: GetObjectLockCount.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
private static void addBreakpoint(VirtualMachine vm, ReferenceType refType) {
    Location breakpointLocation = null;
    List<Location> locs;
    try {
        locs = refType.allLineLocations();
        for (Location loc: locs) {
            if (loc.method().name().equals(METHOD_NAME)) {
                breakpointLocation = loc;
                break;
            }
        }
    } catch (AbsentInformationException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    if (breakpointLocation != null) {
        EventRequestManager evtReqMgr = vm.eventRequestManager();
        BreakpointRequest bReq = evtReqMgr.createBreakpointRequest(breakpointLocation);
        bReq.setSuspendPolicy(BreakpointRequest.SUSPEND_ALL);
        bReq.enable();
    }
}
 
Example #18
Source File: SourceMapper.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Return a File cooresponding to the source of this location.
 * Return null if not available.
 */
File sourceFile(Location loc) {
    try {
        String filename = loc.sourceName();
        String refName = loc.declaringType().name();
        int iDot = refName.lastIndexOf('.');
        String pkgName = (iDot >= 0)? refName.substring(0, iDot+1) : "";
        String full = pkgName.replace('.', File.separatorChar) + filename;
        for (int i= 0; i < dirs.length; ++i) {
            File path = new File(dirs[i], full);
            if (path.exists()) {
                return path;
            }
        }
        return null;
    } catch (AbsentInformationException e) {
        return null;
    }
}
 
Example #19
Source File: SourceMapper.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Return a File cooresponding to the source of this location.
 * Return null if not available.
 */
File sourceFile(Location loc) {
    try {
        String filename = loc.sourceName();
        String refName = loc.declaringType().name();
        int iDot = refName.lastIndexOf('.');
        String pkgName = (iDot >= 0)? refName.substring(0, iDot+1) : "";
        String full = pkgName.replace('.', File.separatorChar) + filename;
        for (int i= 0; i < dirs.length; ++i) {
            File path = new File(dirs[i], full);
            if (path.exists()) {
                return path;
            }
        }
        return null;
    } catch (AbsentInformationException e) {
        return null;
    }
}
 
Example #20
Source File: StackTraceRequestHandler.java    From java-debug with Eclipse Public License 1.0 6 votes vote down vote up
private Types.StackFrame convertDebuggerStackFrameToClient(StackFrame stackFrame, int frameId, IDebugAdapterContext context)
        throws URISyntaxException, AbsentInformationException {
    Location location = stackFrame.location();
    Method method = location.method();
    Types.Source clientSource = this.convertDebuggerSourceToClient(location, context);
    String methodName = formatMethodName(method, true, true);
    int lineNumber = AdapterUtils.convertLineNumber(location.lineNumber(), context.isDebuggerLinesStartAt1(), context.isClientLinesStartAt1());
    // Line number returns -1 if the information is not available; specifically, always returns -1 for native methods.
    if (lineNumber < 0) {
        if (method.isNative()) {
            // For native method, display a tip text "native method" in the Call Stack View.
            methodName += "[native method]";
        } else {
            // For other unavailable method, such as lambda expression's built-in methods run/accept/apply,
            // display "Unknown Source" in the Call Stack View.
            clientSource = null;
        }
    }
    return new Types.StackFrame(frameId, methodName, clientSource, lineNumber, context.isClientColumnsStartAt1() ? 1 : 0);
}
 
Example #21
Source File: StackTraceRequestHandler.java    From java-debug with Eclipse Public License 1.0 6 votes vote down vote up
private Types.Source convertDebuggerSourceToClient(Location location, IDebugAdapterContext context) throws URISyntaxException {
    final String fullyQualifiedName = location.declaringType().name();
    String sourceName = "";
    String relativeSourcePath = "";
    try {
        // When the .class file doesn't contain source information in meta data,
        // invoking Location#sourceName() would throw AbsentInformationException.
        sourceName = location.sourceName();
        relativeSourcePath = location.sourcePath();
    } catch (AbsentInformationException e) {
        String enclosingType = AdapterUtils.parseEnclosingType(fullyQualifiedName);
        sourceName = enclosingType.substring(enclosingType.lastIndexOf('.') + 1) + ".java";
        relativeSourcePath = enclosingType.replace('.', File.separatorChar) + ".java";
    }

    return convertDebuggerSourceToClient(fullyQualifiedName, sourceName, relativeSourcePath, context);
}
 
Example #22
Source File: JdtUtils.java    From java-debug with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Given a stack frame, find the target java project that the associated source file belongs to.
 *
 * @param stackFrame
 *                  the stack frame.
 * @param containers
 *                  the source container list.
 * @return the java project.
 */
public static IJavaProject findProject(StackFrame stackFrame, ISourceContainer[] containers) {
    Location location = stackFrame.location();
    try {
        Object sourceElement = findSourceElement(location.sourcePath(), containers);
        if (sourceElement instanceof IResource) {
            return JavaCore.create(((IResource) sourceElement).getProject());
        } else if (sourceElement instanceof IClassFile) {
            IJavaProject javaProject = ((IClassFile) sourceElement).getJavaProject();
            if (javaProject != null) {
                return javaProject;
            }
        }
    } catch (AbsentInformationException e) {
        // When the compiled .class file doesn't contain debug source information, return null.
    }
    return null;
}
 
Example #23
Source File: SourceMapper.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Return a File cooresponding to the source of this location.
 * Return null if not available.
 */
File sourceFile(Location loc) {
    try {
        String filename = loc.sourceName();
        String refName = loc.declaringType().name();
        int iDot = refName.lastIndexOf('.');
        String pkgName = (iDot >= 0)? refName.substring(0, iDot+1) : "";
        String full = pkgName.replace('.', File.separatorChar) + filename;
        for (int i= 0; i < dirs.length; ++i) {
            File path = new File(dirs[i], full);
            if (path.exists()) {
                return path;
            }
        }
        return null;
    } catch (AbsentInformationException e) {
        return null;
    }
}
 
Example #24
Source File: SourceMapper.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Return a File cooresponding to the source of this location.
 * Return null if not available.
 */
File sourceFile(Location loc) {
    try {
        String filename = loc.sourceName();
        String refName = loc.declaringType().name();
        int iDot = refName.lastIndexOf('.');
        String pkgName = (iDot >= 0)? refName.substring(0, iDot+1) : "";
        String full = pkgName.replace('.', File.separatorChar) + filename;
        for (int i= 0; i < dirs.length; ++i) {
            File path = new File(dirs[i], full);
            if (path.exists()) {
                return path;
            }
        }
        return null;
    } catch (AbsentInformationException e) {
        return null;
    }
}
 
Example #25
Source File: SourceMapper.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Return a File cooresponding to the source of this location.
 * Return null if not available.
 */
File sourceFile(Location loc) {
    try {
        String filename = loc.sourceName();
        String refName = loc.declaringType().name();
        int iDot = refName.lastIndexOf('.');
        String pkgName = (iDot >= 0)? refName.substring(0, iDot+1) : "";
        String full = pkgName.replace('.', File.separatorChar) + filename;
        for (int i= 0; i < dirs.length; ++i) {
            File path = new File(dirs[i], full);
            if (path.exists()) {
                return path;
            }
        }
        return null;
    } catch (AbsentInformationException e) {
        return null;
    }
}
 
Example #26
Source File: SourceMapper.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Return a File cooresponding to the source of this location.
 * Return null if not available.
 */
File sourceFile(Location loc) {
    try {
        String filename = loc.sourceName();
        String refName = loc.declaringType().name();
        int iDot = refName.lastIndexOf('.');
        String pkgName = (iDot >= 0)? refName.substring(0, iDot+1) : "";
        String full = pkgName.replace('.', File.separatorChar) + filename;
        for (int i= 0; i < dirs.length; ++i) {
            File path = new File(dirs[i], full);
            if (path.exists()) {
                return path;
            }
        }
        return null;
    } catch (AbsentInformationException e) {
        return null;
    }
}
 
Example #27
Source File: SourceMapper.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Return a File cooresponding to the source of this location.
 * Return null if not available.
 */
File sourceFile(Location loc) {
    try {
        String filename = loc.sourceName();
        String refName = loc.declaringType().name();
        int iDot = refName.lastIndexOf('.');
        String pkgName = (iDot >= 0)? refName.substring(0, iDot+1) : "";
        String full = pkgName.replace('.', File.separatorChar) + filename;
        for (int i= 0; i < dirs.length; ++i) {
            File path = new File(dirs[i], full);
            if (path.exists()) {
                return path;
            }
        }
        return null;
    } catch (AbsentInformationException e) {
        return null;
    }
}
 
Example #28
Source File: SourceMapper.java    From jdk8u-dev-jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Return a File cooresponding to the source of this location.
 * Return null if not available.
 */
File sourceFile(Location loc) {
    try {
        String filename = loc.sourceName();
        String refName = loc.declaringType().name();
        int iDot = refName.lastIndexOf('.');
        String pkgName = (iDot >= 0)? refName.substring(0, iDot+1) : "";
        String full = pkgName.replace('.', File.separatorChar) + filename;
        for (int i= 0; i < dirs.length; ++i) {
            File path = new File(dirs[i], full);
            if (path.exists()) {
                return path;
            }
        }
        return null;
    } catch (AbsentInformationException e) {
        return null;
    }
}
 
Example #29
Source File: SourceMapper.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Return a File cooresponding to the source of this location.
 * Return null if not available.
 */
File sourceFile(Location loc) {
    try {
        String filename = loc.sourceName();
        String refName = loc.declaringType().name();
        int iDot = refName.lastIndexOf('.');
        String pkgName = (iDot >= 0)? refName.substring(0, iDot+1) : "";
        String full = pkgName.replace('.', File.separatorChar) + filename;
        for (int i= 0; i < dirs.length; ++i) {
            File path = new File(dirs[i], full);
            if (path.exists()) {
                return path;
            }
        }
        return null;
    } catch (AbsentInformationException e) {
        return null;
    }
}
 
Example #30
Source File: StackFrameUtility.java    From java-debug with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Get the StackFrame associated source file path.
 *
 * @param frame
 *            StackFrame for the source path
 * @return the source file path
 */
public static String getSourcePath(StackFrame frame) {
    try {
        return frame.location().sourcePath();
    } catch (AbsentInformationException e) {
        // Ignore it
    }
    return null;
}