Commit 926ba83d authored by andrei's avatar andrei
Browse files

quickfix for bug 308066 (accessing with non existing offset to the document info)

parent 0709c15c
/* $Id: BytecodeClassFileEditor.java,v 1.8 2008-05-15 21:31:58 andrei Exp $ */ /* $Id: BytecodeClassFileEditor.java,v 1.9 2008-07-02 19:18:35 andrei Exp $ */
package de.loskutov.bco.editors; package de.loskutov.bco.editors;
...@@ -65,11 +65,11 @@ public class BytecodeClassFileEditor extends ClassFileEditor ...@@ -65,11 +65,11 @@ public class BytecodeClassFileEditor extends ClassFileEditor
ClassFileDocumentProvider.InputChangeListener { ClassFileDocumentProvider.InputChangeListener {
private Composite fViewerComposite; private Composite fViewerComposite;
private InputUpdater fInputUpdater; private final InputUpdater fInputUpdater;
public static final String ID = "de.loskutov.bco.editors.BytecodeClassFileEditor"; public static final String ID = "de.loskutov.bco.editors.BytecodeClassFileEditor";
public static final String MARK = "// class version "; public static final String MARK = "// class version ";
/** the modes (flags) for the decompiler */ /** the modes (flags) for the decompiler */
private BitSet decompilerFlags; private final BitSet decompilerFlags;
/** is not null only on class files with decompiled source */ /** is not null only on class files with decompiled source */
private static BytecodeSourceMapper sourceMapper; private static BytecodeSourceMapper sourceMapper;
private BytecodeDocumentProvider fClassFileDocumentProvider; private BytecodeDocumentProvider fClassFileDocumentProvider;
...@@ -338,11 +338,13 @@ public class BytecodeClassFileEditor extends ClassFileEditor ...@@ -338,11 +338,13 @@ public class BytecodeClassFileEditor extends ClassFileEditor
getEditorInput()); getEditorInput());
try { try {
// XXX have test if the requested line is from bytecode or sourcecode?!? // XXX have test if the requested line is from bytecode or sourcecode?!?
int lineAtOffset = document.getLineOfOffset(offset); if(document.getLength() > offset){
// get DecompiledMethod from line, then get JavaElement with same int lineAtOffset = document.getLineOfOffset(offset);
// signature, because we do not have offsets or lines in the class file, // get DecompiledMethod from line, then get JavaElement with same
// only java elements... // signature, because we do not have offsets or lines in the class file,
result = getSourceMapper().findElement(classFile, lineAtOffset); // only java elements...
result = getSourceMapper().findElement(classFile, lineAtOffset);
}
} catch (BadLocationException e) { } catch (BadLocationException e) {
BytecodeOutlinePlugin.log(e, IStatus.ERROR); BytecodeOutlinePlugin.log(e, IStatus.ERROR);
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment