summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--org.eclipse.jgit/resources/org/eclipse/jgit/internal/JGitText.properties1
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/ignore/FastIgnoreRule.java5
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/ignore/internal/Strings.java14
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/internal/JGitText.java1
4 files changed, 20 insertions, 1 deletions
diff --git a/org.eclipse.jgit/resources/org/eclipse/jgit/internal/JGitText.properties b/org.eclipse.jgit/resources/org/eclipse/jgit/internal/JGitText.properties
index 0e0b4028b0..2398f54b05 100644
--- a/org.eclipse.jgit/resources/org/eclipse/jgit/internal/JGitText.properties
+++ b/org.eclipse.jgit/resources/org/eclipse/jgit/internal/JGitText.properties
@@ -328,6 +328,7 @@ invalidId=Invalid id: {0}
invalidId0=Invalid id
invalidIdLength=Invalid id length {0}; should be {1}
invalidIgnoreParamSubmodule=Found invalid ignore param for submodule {0}.
+invalidIgnoreRule=Exception caught while parsing ignore rule ''{0}''.
invalidIntegerValue=Invalid integer value: {0}.{1}={2}
invalidKey=Invalid key: {0}
invalidLineInConfigFile=Invalid line in config file
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/ignore/FastIgnoreRule.java b/org.eclipse.jgit/src/org/eclipse/jgit/ignore/FastIgnoreRule.java
index 16a36baf08..892d5ef8f5 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/ignore/FastIgnoreRule.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/ignore/FastIgnoreRule.java
@@ -47,6 +47,8 @@ import static org.eclipse.jgit.ignore.internal.IMatcher.NO_MATCH;
import org.eclipse.jgit.errors.InvalidPatternException;
import org.eclipse.jgit.ignore.internal.IMatcher;
import org.eclipse.jgit.ignore.internal.PathMatcher;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* "Fast" (compared with IgnoreRule) git ignore rule implementation supporting
@@ -57,6 +59,8 @@ import org.eclipse.jgit.ignore.internal.PathMatcher;
* @since 3.6
*/
public class FastIgnoreRule {
+ private final static Logger LOG = LoggerFactory
+ .getLogger(FastIgnoreRule.class);
/**
* Character used as default path separator for ignore entries
@@ -121,6 +125,7 @@ public class FastIgnoreRule {
Character.valueOf(PATH_SEPARATOR), dirOnly);
} catch (InvalidPatternException e) {
m = NO_MATCH;
+ LOG.error(e.getMessage(), e);
}
this.matcher = m;
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/ignore/internal/Strings.java b/org.eclipse.jgit/src/org/eclipse/jgit/ignore/internal/Strings.java
index f5333eeaf4..921339a3f0 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/ignore/internal/Strings.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/ignore/internal/Strings.java
@@ -44,13 +44,16 @@ package org.eclipse.jgit.ignore.internal;
import static java.lang.Character.isLetter;
+import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.regex.Pattern;
+import java.util.regex.PatternSyntaxException;
import org.eclipse.jgit.errors.InvalidPatternException;
import org.eclipse.jgit.ignore.FastIgnoreRule;
+import org.eclipse.jgit.internal.JGitText;
/**
* Various {@link String} related utility methods, written mostly to avoid
@@ -367,7 +370,16 @@ public class Strings {
if (in_brackets > 0)
throw new InvalidPatternException("Not closed bracket?", pattern); //$NON-NLS-1$
- return Pattern.compile(sb.toString());
+ try {
+ return Pattern.compile(sb.toString());
+ } catch (PatternSyntaxException e) {
+ InvalidPatternException patternException = new InvalidPatternException(
+ MessageFormat.format(JGitText.get().invalidIgnoreRule,
+ pattern),
+ pattern);
+ patternException.initCause(e);
+ throw patternException;
+ }
}
/**
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/JGitText.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/JGitText.java
index fdcfb8ecdb..7622603de2 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/JGitText.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/JGitText.java
@@ -387,6 +387,7 @@ public class JGitText extends TranslationBundle {
/***/ public String invalidId0;
/***/ public String invalidIdLength;
/***/ public String invalidIgnoreParamSubmodule;
+ /***/ public String invalidIgnoreRule;
/***/ public String invalidIntegerValue;
/***/ public String invalidKey;
/***/ public String invalidLineInConfigFile;