From 061483d56aceefab05cd37d65c645450c5ac4b85 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Wed, 19 Oct 2011 08:12:29 +0200 Subject: [PATCH] fix bug in GlobUtil --- scm-core/src/main/java/sonia/scm/util/GlobUtil.java | 4 ++-- .../src/test/java/sonia/scm/util/GlobUtilTest.java | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/scm-core/src/main/java/sonia/scm/util/GlobUtil.java b/scm-core/src/main/java/sonia/scm/util/GlobUtil.java index 4ca53fc318..95bd06fda6 100644 --- a/scm-core/src/main/java/sonia/scm/util/GlobUtil.java +++ b/scm-core/src/main/java/sonia/scm/util/GlobUtil.java @@ -34,7 +34,7 @@ package sonia.scm.util; /** - * Util for pattern matching with glob + * Util for pattern matching with glob * (http://en.wikipedia.org/wiki/Glob_%28programming%29) syntax. * * @author Sebastian Sdorra @@ -190,6 +190,6 @@ public class GlobUtil */ public static boolean matches(String glob, String value) { - return value.matches(convertGlobToRegEx(value)); + return value.matches(convertGlobToRegEx(glob)); } } diff --git a/scm-core/src/test/java/sonia/scm/util/GlobUtilTest.java b/scm-core/src/test/java/sonia/scm/util/GlobUtilTest.java index cd2a6ecb0a..b40dc0c029 100644 --- a/scm-core/src/test/java/sonia/scm/util/GlobUtilTest.java +++ b/scm-core/src/test/java/sonia/scm/util/GlobUtilTest.java @@ -66,11 +66,11 @@ public class GlobUtilTest @Test public void matchesTest() { - assertTrue(GlobUtil.matches("/test/path/somefile.txt", "/test/path/*")); - assertTrue(GlobUtil.matches("/test/path/somefile.txt", "*/somefile.txt")); - assertTrue(GlobUtil.matches("asd", "a*d")); - assertTrue(GlobUtil.matches("asd", "a?d")); - assertFalse(GlobUtil.matches("asd", "a\\*d")); - assertFalse(GlobUtil.matches("asd", "a\\?d")); + assertTrue(GlobUtil.matches("/test/path/*", "/test/path/somefile.txt")); + assertTrue(GlobUtil.matches("*/somefile.txt", "/test/path/somefile.txt")); + assertTrue(GlobUtil.matches("a*d", "asd")); + assertTrue(GlobUtil.matches("a?d", "asd")); + assertFalse(GlobUtil.matches("a\\*d", "asd")); + assertFalse(GlobUtil.matches("a\\?d", "asd")); } }