Author: tfennelly
Date: 2010-12-03 11:25:24 -0500 (Fri, 03 Dec 2010)
New Revision: 27150
Modified:
branches/jbosstools-3.2.0.Beta2/smooks/plugins/org.jboss.tools.smooks.templating/src/org/jboss/tools/smooks/templating/template/util/FreeMarkerUtil.java
Log:
https://jira.jboss.org/browse/JBIDE-7781
Modified:
branches/jbosstools-3.2.0.Beta2/smooks/plugins/org.jboss.tools.smooks.templating/src/org/jboss/tools/smooks/templating/template/util/FreeMarkerUtil.java
===================================================================
---
branches/jbosstools-3.2.0.Beta2/smooks/plugins/org.jboss.tools.smooks.templating/src/org/jboss/tools/smooks/templating/template/util/FreeMarkerUtil.java 2010-12-03
16:12:30 UTC (rev 27149)
+++
branches/jbosstools-3.2.0.Beta2/smooks/plugins/org.jboss.tools.smooks.templating/src/org/jboss/tools/smooks/templating/template/util/FreeMarkerUtil.java 2010-12-03
16:25:24 UTC (rev 27150)
@@ -145,18 +145,24 @@
}
}
- private static Pattern varsPattern =
Pattern.compile(".vars\\[\"(.*)\"\\]\\[\"(.*)\"\\]");
+ private static Pattern varsSinglePattern =
Pattern.compile(".vars\\[\"(.*)\"\\]");
+ private static Pattern varsDoublePattern =
Pattern.compile(".vars\\[\"(.*)\"\\]\\[\"(.*)\"\\]");
public static String normalizePath(String srcPath) {
- Matcher matcher = varsPattern.matcher(srcPath);
- if(matcher.matches()) {
- return matcher.group(1) + "/" + matcher.group(2);
+ Matcher doubleMatcher = varsDoublePattern.matcher(srcPath);
+ if(doubleMatcher.matches()) {
+ return doubleMatcher.group(1) + "/" + doubleMatcher.group(2);
} else {
- return srcPath;
+ Matcher singleMatcher = varsSinglePattern.matcher(srcPath);
+ if(singleMatcher.matches()) {
+ return singleMatcher.group(1);
+ } else {
+ return srcPath;
+ }
}
}
public static String[] toPathTokens(String srcPath) {
- Matcher matcher = varsPattern.matcher(srcPath);
+ Matcher matcher = varsDoublePattern.matcher(srcPath);
if(matcher.matches()) {
return (matcher.group(1) + "/" + matcher.group(2)).split("/");
} else if(srcPath.indexOf("/") != -1) {
@@ -172,7 +178,7 @@
}
public static boolean isVarsFormat(String srcPath) {
- Matcher matcher = varsPattern.matcher(srcPath);
+ Matcher matcher = varsDoublePattern.matcher(srcPath);
return matcher.matches();
}
}
\ No newline at end of file