Message Boards

BLADE watch task fails on Windows

Federico Stendardi, modified 4 Years ago.

BLADE watch task fails on Windows

New Member Posts: 12 Join Date: 2/3/20 Recent Posts
Hi guys,

I'm trying the blade watch command on my local pc, but it fails with an Exception, here the command line flow:
blade version
blade version 3.9.0.202001232132
blade watch --trace
error: java.util.regex.PatternSyntaxException :: Unexpected internal error near index 1
\

java.util.regex.PatternSyntaxException: Unexpected internal error near index 1
\
        at java.util.regex.Pattern.error(Unknown Source)
        at java.util.regex.Pattern.compile(Unknown Source)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at java.util.regex.Pattern.<init>(Unknown Source)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at java.util.regex.Pattern.compile(Unknown Source)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at java.lang.String.replaceAll(Unknown Source)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at com.liferay.blade.cli.command.WatchCommand._getGradlePath(WatchCommand.java:116)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at com.liferay.blade.cli.command.WatchCommand.access$000(WatchCommand.java:56)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at com.liferay.blade.cli.command.WatchCommand$1.preVisitDirectory(WatchCommand.java:209)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at com.liferay.blade.cli.command.WatchCommand$1.preVisitDirectory(WatchCommand.java:178)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at java.nio.file.Files.walkFileTree(Unknown Source)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at java.nio.file.Files.walkFileTree(Unknown Source)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at com.liferay.blade.cli.command.WatchCommand._getProjectPaths(WatchCommand.java:176)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at com.liferay.blade.cli.command.WatchCommand.execute(WatchCommand.java:79)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at com.liferay.blade.cli.BladeCLI._runCommand(BladeCLI.java:1150)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at com.liferay.blade.cli.BladeCLI.runCommand(BladeCLI.java:519)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at com.liferay.blade.cli.BladeCLI.run(BladeCLI.java:467)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; at com.liferay.blade.cli.BladeCLI.main(BladeCLI.java:123)
</init>
I've checked on github project, and I've found the origin of the bug:
private String _getGradlePath(Path path, Path basePath) {
&nbsp;&nbsp;&nbsp; Path relativePath = basePath.relativize(path);
&nbsp;&nbsp;&nbsp; String gradlePath = ":" + relativePath.toString();
&nbsp;&nbsp;&nbsp; [b]gradlePath = gradlePath.replaceAll(File.separator, ":");[/b]
&nbsp;&nbsp;&nbsp; return gradlePath;
}

The replaceAll method takes a regular expression as input, that on windows fails because File.separator = "\"
the solution is to "escape" the input string:
private String _getGradlePath(Path path, Path basePath) {
&nbsp;&nbsp;&nbsp; Path relativePath = basePath.relativize(path);
&nbsp;&nbsp;&nbsp; String gradlePath = ":" + relativePath.toString();
&nbsp;&nbsp;&nbsp; gradlePath = gradlePath.replaceAll([b]Matcher.quoteReplacement(File.separator)[/b], ":");

&nbsp;&nbsp;&nbsp; return gradlePath;
}
Could you help me to submit this issue to JIRA?
I don't have an account emoticon
thumbnail
Jorge Díaz, modified 4 Years ago.

RE: BLADE watch task fails on Windows

Liferay Master Posts: 753 Join Date: 1/9/14 Recent Posts
You can request for a JIRA account here: https://issues.liferay.com/secure/ContactAdministrators!default.jspa
They should create it in 1-2 days.