feenkcom/jdt2famix

Windows paths are not escaped correcly

Closed this issue · 4 comments

I tried the parser under Windows with Mingw, succeeded to compile it with maven, but, and I have the following issue:
/d/TestsExperiements/jdt2famix/release/jdt2famix.sh
jdt2famix - parsing started - D:\myproject
jdt2famix - importing - D:\TestsExperiements\myproject\common-services\src\main\java\com\container\Helper.java
Exception in thread "main" java.util.regex.PatternSyntaxException: Illegal/unsupported escape sequence near index 4
^D:\myproject/
^
at java.util.regex.Pattern.error(Unknown Source)
at java.util.regex.Pattern.escape(Unknown Source)
at java.util.regex.Pattern.atom(Unknown Source)
at java.util.regex.Pattern.sequence(Unknown Source)
at java.util.regex.Pattern.expr(Unknown Source)
at java.util.regex.Pattern.compile(Unknown Source)
at java.util.regex.Pattern.(Unknown Source)
at java.util.regex.Pattern.compile(Unknown Source)
at java.lang.String.replaceFirst(Unknown Source)
at com.feenk.jdt2famix.injava.InJavaImporter.createSourceAnchor(InJavaImporter.java:781)
at com.feenk.jdt2famix.injava.AstVisitor.visit(AstVisitor.java:122)
at org.eclipse.jdt.core.dom.TypeDeclaration.accept0(TypeDeclaration.java:453)
at org.eclipse.jdt.core.dom.ASTNode.accept(ASTNode.java:2711)
at org.eclipse.jdt.core.dom.ASTNode.acceptChildren(ASTNode.java:2782)
at org.eclipse.jdt.core.dom.CompilationUnit.accept0(CompilationUnit.java:212)
at org.eclipse.jdt.core.dom.ASTNode.accept(ASTNode.java:2711)
at com.feenk.jdt2famix.injava.AstRequestor.acceptAST(AstRequestor.java:17)
at org.eclipse.jdt.core.dom.CompilationUnitResolver.resolve(CompilationUnitResolver.java:1029)
at org.eclipse.jdt.core.dom.CompilationUnitResolver.resolve(CompilationUnitResolver.java:636)
at org.eclipse.jdt.core.dom.ASTParser.createASTs(ASTParser.java:990)
at com.feenk.jdt2famix.Importer.run(Importer.java:32)
at com.feenk.jdt2famix.injava.Main.main(Main.java:25)

Source InJavaImporter.java:781: fileAnchor.setFileName(sourceFilePath.replaceFirst("^"+ignoredRootPath+"/", ""));

girba commented

Thanks. I committed a fix that replaces \ with / (needed anyway). Could you try again?

OK. It works. The MSE is now generated without exception.

girba commented

Great. Could you try to load the MSE in Moose and see if you can see the source code of entities?

I already loaded it.
I can see the code source