From 2c92f46814aa8524a633b7083de3cb4e2d5ab06c Mon Sep 17 00:00:00 2001 From: Reinhard Pointner Date: Mon, 28 Apr 2014 13:48:52 +0000 Subject: [PATCH] * fix script compatibility issue --- source/net/filebot/cli/ScriptShellMethods.java | 8 ++++++++ .../net/filebot/format/ExpressionFormatMethods.java | 12 +++++++----- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/source/net/filebot/cli/ScriptShellMethods.java b/source/net/filebot/cli/ScriptShellMethods.java index edcc7dd1..0e129d05 100644 --- a/source/net/filebot/cli/ScriptShellMethods.java +++ b/source/net/filebot/cli/ScriptShellMethods.java @@ -265,6 +265,14 @@ public class ScriptShellMethods { 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 requestParameters) throws IOException { + return WebRequest.fetch(self, 0, requestParameters, null); + } + public static ByteBuffer post(URL self, Map parameters, Map requestParameters) throws IOException { return WebRequest.post(self, parameters, requestParameters); } diff --git a/source/net/filebot/format/ExpressionFormatMethods.java b/source/net/filebot/format/ExpressionFormatMethods.java index 64d76e56..ddb20620 100644 --- a/source/net/filebot/format/ExpressionFormatMethods.java +++ b/source/net/filebot/format/ExpressionFormatMethods.java @@ -185,11 +185,13 @@ public class ExpressionFormatMethods { * Find a matcher that matches the given pattern (case-insensitive) */ public static Matcher findMatch(String self, String pattern) { - if (pattern == null) - return null; - - Matcher matcher = compile(pattern, CASE_INSENSITIVE | UNICODE_CHARACTER_CLASS).matcher(self); - return matcher.find() ? matcher.reset() : null; + if (pattern != null) { + Matcher matcher = compile(pattern, CASE_INSENSITIVE | UNICODE_CHARACTER_CLASS).matcher(self); + if (matcher.find()) { + return matcher.reset(); + } + } + return null; } /**