diff options
author | mkersten <mkersten> | 2003-02-18 07:26:58 +0000 |
---|---|---|
committer | mkersten <mkersten> | 2003-02-18 07:26:58 +0000 |
commit | ab6b18d68794cfee99eaf1f2a914c501eb596f9d (patch) | |
tree | 917a8c7d8fda9e40932ca9613879d69376f68a1f /asm | |
parent | fd1aaf0ccd8631a022affbf51bfff9e9dfa0d71a (diff) | |
download | aspectj-ab6b18d68794cfee99eaf1f2a914c501eb596f9d.tar.gz aspectj-ab6b18d68794cfee99eaf1f2a914c501eb596f9d.zip |
Fixed failing unit tests. Involved making paths work right in structure model,
and updating for differences in the 1.1 model.
Diffstat (limited to 'asm')
-rw-r--r-- | asm/src/org/aspectj/asm/StructureModel.java | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/asm/src/org/aspectj/asm/StructureModel.java b/asm/src/org/aspectj/asm/StructureModel.java index 831f90f84..e58159087 100644 --- a/asm/src/org/aspectj/asm/StructureModel.java +++ b/asm/src/org/aspectj/asm/StructureModel.java @@ -15,6 +15,7 @@ package org.aspectj.asm; import java.io.File; +import java.io.IOException; import java.io.Serializable; import java.util.*; @@ -117,7 +118,7 @@ public class StructureModel implements Serializable { if (!isValid() || sourceFilePath == null) { return StructureModel.NO_STRUCTURE; } else { - String correctedPath = sourceFilePath.replace('\\', '/'); + String correctedPath = sourceFilePath;//.replace('\\', '/'); StructureNode node = (StructureNode)getFileMap().get(correctedPath);//findFileNode(filePath, model); if (node != null) { return node; @@ -135,7 +136,7 @@ public class StructureModel implements Serializable { * @return a new structure node for the file if it was not found in the model */ public StructureNode findNodeForSourceLine(String sourceFilePath, int lineNumber) { - String correctedPath = sourceFilePath.replace('\\', '/'); + String correctedPath = sourceFilePath;//.replace('\\', '/'); StructureNode node = findNodeForSourceLineHelper(root, correctedPath, lineNumber); if (node != null) { return node; @@ -173,16 +174,20 @@ public class StructureModel implements Serializable { } private boolean matches(StructureNode node, String sourceFilePath, int lineNumber) { - return node != null - && node.getSourceLocation() != null - && node.getSourceLocation().getSourceFile().getAbsolutePath().equals(sourceFilePath) - && ((node.getSourceLocation().getLine() <= lineNumber - && node.getSourceLocation().getEndLine() >= lineNumber) - || - (lineNumber <= 1 - && node instanceof ProgramElementNode - && ((ProgramElementNode)node).getProgramElementKind().isSourceFileKind()) - ); + try { + return node != null + && node.getSourceLocation() != null + && node.getSourceLocation().getSourceFile().getCanonicalPath().equals(sourceFilePath) + && ((node.getSourceLocation().getLine() <= lineNumber + && node.getSourceLocation().getEndLine() >= lineNumber) + || + (lineNumber <= 1 + && node instanceof ProgramElementNode + && ((ProgramElementNode)node).getProgramElementKind().isSourceFileKind()) + ); + } catch (IOException ioe) { + return false; + } } private boolean hasMoreSpecificChild(StructureNode node, String sourceFilePath, int lineNumber) { |