* fix script compatibility issue

This commit is contained in:
Reinhard Pointner 2014-04-28 13:48:52 +00:00
parent b315e9e9ea
commit 2c92f46814
2 changed files with 15 additions and 5 deletions

View File

@ -265,6 +265,14 @@ public class ScriptShellMethods {
return Charset.forName("UTF-8").decode(self.duplicate()).toString(); return Charset.forName("UTF-8").decode(self.duplicate()).toString();
} }
public static ByteBuffer get(URL self) throws IOException {
return WebRequest.fetch(self, 0, null, null);
}
public static ByteBuffer get(URL self, Map<String, String> requestParameters) throws IOException {
return WebRequest.fetch(self, 0, requestParameters, null);
}
public static ByteBuffer post(URL self, Map<String, ?> parameters, Map<String, String> requestParameters) throws IOException { public static ByteBuffer post(URL self, Map<String, ?> parameters, Map<String, String> requestParameters) throws IOException {
return WebRequest.post(self, parameters, requestParameters); return WebRequest.post(self, parameters, requestParameters);
} }

View File

@ -185,11 +185,13 @@ public class ExpressionFormatMethods {
* Find a matcher that matches the given pattern (case-insensitive) * Find a matcher that matches the given pattern (case-insensitive)
*/ */
public static Matcher findMatch(String self, String pattern) { public static Matcher findMatch(String self, String pattern) {
if (pattern == null) if (pattern != null) {
return null; Matcher matcher = compile(pattern, CASE_INSENSITIVE | UNICODE_CHARACTER_CLASS).matcher(self);
if (matcher.find()) {
Matcher matcher = compile(pattern, CASE_INSENSITIVE | UNICODE_CHARACTER_CLASS).matcher(self); return matcher.reset();
return matcher.find() ? matcher.reset() : null; }
}
return null;
} }
/** /**