Ask Questions and Find Answers
Important:
Ask is now read-only. You can review any existing questions and answers, but not add anything new.
But - don't panic! While ask is no more, we've replaced it with discuss - the new Liferay Discussion Forum! Read more here here or just visit the site here:
discuss.liferay.com
BLADE watch task fails on Windows
Hi guys,
I'm trying the blade watch command on my local pc, but it fails with an Exception, here the command line flow:
The replaceAll method takes a regular expression as input, that on windows fails because File.separator = "\"
the solution is to "escape" the input string:
I don't have an account
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.202001232132blade watch --traceerror: 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)
at java.util.regex.Pattern.<init>(Unknown Source)
at java.util.regex.Pattern.compile(Unknown Source)
at java.lang.String.replaceAll(Unknown Source)
at com.liferay.blade.cli.command.WatchCommand._getGradlePath(WatchCommand.java:116)
at com.liferay.blade.cli.command.WatchCommand.access$000(WatchCommand.java:56)
at com.liferay.blade.cli.command.WatchCommand$1.preVisitDirectory(WatchCommand.java:209)
at com.liferay.blade.cli.command.WatchCommand$1.preVisitDirectory(WatchCommand.java:178)
at java.nio.file.Files.walkFileTree(Unknown Source)
at java.nio.file.Files.walkFileTree(Unknown Source)
at com.liferay.blade.cli.command.WatchCommand._getProjectPaths(WatchCommand.java:176)
at com.liferay.blade.cli.command.WatchCommand.execute(WatchCommand.java:79)
at com.liferay.blade.cli.BladeCLI._runCommand(BladeCLI.java:1150)
at com.liferay.blade.cli.BladeCLI.runCommand(BladeCLI.java:519)
at com.liferay.blade.cli.BladeCLI.run(BladeCLI.java:467)
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) {
Path relativePath = basePath.relativize(path);
String gradlePath = ":" + relativePath.toString(); [b]gradlePath = gradlePath.replaceAll(File.separator, ":");[/b]
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) {
Path relativePath = basePath.relativize(path);
String gradlePath = ":" + relativePath.toString(); gradlePath = gradlePath.replaceAll([b]Matcher.quoteReplacement(File.separator)[/b], ":"); return gradlePath;
}
Could you help me to submit this issue to JIRA? I don't have an account
You can request for a JIRA account here: https://issues.liferay.com/secure/ContactAdministrators!default.jspa
They should create it in 1-2 days.
They should create it in 1-2 days.