This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
method to be added: org.netbeans.spi.debugger.jpda.EditorContext.updateTimeStamp (timeStamp, URL) bug to be fixed: 49625 - After debug-fix, source does not match code In order to implement fix&continue action correctly I need to update timeStamp for uploaded sources.
Index: ant/antsrc/org/netbeans/modules/debugger/jpda/ant/JPDAReload.java =================================================================== RCS file: /cvs/debuggerjpda/ant/antsrc/org/netbeans/modules/debugger/jpda/ant/JPDAReload.java,v retrieving revision 1.7 diff -r1.7 JPDAReload.java 32a33,37 > import org.openide.filesystems.FileObject; > import org.openide.filesystems.FileStateInvalidException; > import org.openide.filesystems.FileUtil; > import org.openide.loaders.DataObject; > 36,37c41,44 < import org.openide.filesystems.FileObject; < import org.openide.filesystems.FileUtil; --- > import org.netbeans.api.java.classpath.ClassPath; > import org.netbeans.api.java.queries.SourceForBinaryQuery; > import org.netbeans.spi.java.classpath.support.ClassPathSupport; > import org.netbeans.spi.debugger.jpda.EditorContext; 84c91,93 < --- > EditorContext editorContext = (EditorContext) DebuggerManager. > getDebuggerManager ().lookupFirst (null, EditorContext.class); > 97a107,108 > String url = classToSourceURL (fo); > editorContext.updateTimeStamp (debugger, url); 123a135,153 > } > > private String classToSourceURL (FileObject fo) { > try { > ClassPath cp = ClassPath.getClassPath (fo, ClassPath.EXECUTE); > FileObject root = cp.findOwnerRoot (fo); > String resourceName = cp.getResourceName (fo, '/', false); > int i = resourceName.indexOf ('$'); > if (i > 0) > resourceName = resourceName.substring (0, i); > FileObject[] sRoots = SourceForBinaryQuery.findSourceRoots > (root.getURL ()).getRoots (); > ClassPath sourcePath = ClassPathSupport.createClassPath (sRoots); > FileObject rfo = sourcePath.findResource (resourceName + ".java"); > return rfo.getURL ().toExternalForm (); > } catch (FileStateInvalidException ex) { > ex.printStackTrace (); > return null; > } Index: ant/src/org/netbeans/modules/debugger/projects/EditorContextImpl.java =================================================================== RCS file: /cvs/debuggerjpda/ant/src/org/netbeans/modules/debugger/projects/EditorContextImpl.java,v retrieving revision 1.4 diff -r1.4 EditorContextImpl.java 18a19,32 > import java.net.URL; > import java.net.MalformedURLException; > import java.util.Collection; > import java.util.HashMap; > import java.util.HashSet; > import java.util.Iterator; > import java.util.Map; > import java.util.Set; > import javax.swing.event.ChangeEvent; > import javax.swing.event.ChangeListener; > import javax.swing.event.DocumentEvent; > import javax.swing.event.DocumentListener; > import javax.swing.text.Document; > import javax.swing.text.StyledDocument; 21,22d34 < import org.netbeans.spi.debugger.jpda.EditorContext; < 43,58d54 < < import java.net.URL; < import java.net.MalformedURLException; < import java.util.Collection; < import java.util.HashMap; < import java.util.HashSet; < import java.util.Iterator; < import java.util.Map; < import java.util.Set; < import javax.swing.event.ChangeEvent; < import javax.swing.event.ChangeListener; < import javax.swing.event.DocumentEvent; < import javax.swing.event.DocumentListener; < import javax.swing.text.Document; < import javax.swing.text.StyledDocument; < import org.netbeans.api.debugger.jpda.LineBreakpoint; 65a62,65 > import org.netbeans.spi.debugger.jpda.EditorContext; > import org.netbeans.api.debugger.jpda.LineBreakpoint; > > 187c187 < Object a, --- > Object annotation, 190c190 < DebuggerAnnotation annotation = (DebuggerAnnotation) a; --- > DebuggerAnnotation a = (DebuggerAnnotation) annotation; 192,193c192,193 < return annotation.getLine ().getLineNumber () + 1; < String url = (String) annotationToURL.get (annotation); --- > return a.getLine ().getLineNumber () + 1; > String url = (String) annotationToURL.get (a); 195c195,206 < return lineSet.getOriginalLineNumber (annotation.getLine ()) + 1; --- > return lineSet.getOriginalLineNumber (a.getLine ()) + 1; > } > > /** > * Updates timeStamp for gived url. > * > * @param timeStamp time stamp to be updated > * @param url an url > */ > public void updateTimeStamp (Object timeStamp, String url) { > Registry registry = (Registry) timeStampToRegistry.get (timeStamp); > registry.register (getDataObject (url)); Index: api/src/org/netbeans/spi/debugger/jpda/EditorContext.java =================================================================== RCS file: /cvs/debuggerjpda/api/src/org/netbeans/spi/debugger/jpda/EditorContext.java,v retrieving revision 1.5 diff -r1.5 EditorContext.java 74a75,82 > > /** > * Updates timeStamp for gived url. > * > * @param timeStamp time stamp to be updated > * @param url an url > */ > public abstract void updateTimeStamp (Object timeStamp, String url);
I have not found a way how to write regular Unit test for this stuff. EditorContext & SourcePathProvider implements bridge to Java module, src hierarchy, and projects modules. I have not find a way how to setup environment for all these modules, how to open project there and setup source hierarchy. Thats why I have created separate issue to track this problem, and I will work with this teams to fix it - 50969.
Closing this issue then.