diff options
author | Han-Wen Nienhuys <hanwen@google.com> | 2019-03-26 11:22:56 +0100 |
---|---|---|
committer | Matthias Sohn <matthias.sohn@sap.com> | 2019-03-29 17:34:17 -0400 |
commit | bbff3ff008a309210ad93647efb1401c5f43e07d (patch) | |
tree | 13eee4eb541a90f4093e6a9eb210e866ae158764 | |
parent | dae26b43d184d52d2a4d11fe2d6026fd7af49bc2 (diff) | |
download | jgit-bbff3ff008a309210ad93647efb1401c5f43e07d.tar.gz jgit-bbff3ff008a309210ad93647efb1401c5f43e07d.zip |
Clarify error message for invalid Windows characters
Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
Change-Id: I20c37d70fc78d745f83b9ce702777535b16b8dfe
-rw-r--r-- | org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ObjectCheckerTest.java | 18 | ||||
-rw-r--r-- | org.eclipse.jgit/resources/org/eclipse/jgit/internal/JGitText.properties | 4 |
2 files changed, 17 insertions, 5 deletions
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ObjectCheckerTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ObjectCheckerTest.java index 531c918e9b..16ad70d383 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ObjectCheckerTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ObjectCheckerTest.java @@ -1678,7 +1678,6 @@ public class ObjectCheckerTest { rejectName('>'); rejectName(':'); rejectName('"'); - rejectName('/'); rejectName('\\'); rejectName('|'); rejectName('?'); @@ -1693,7 +1692,8 @@ public class ObjectCheckerTest { checkOneName("te" + c + "st"); fail("incorrectly accepted with " + c); } catch (CorruptObjectException e) { - assertEquals("name contains '" + c + "'", e.getMessage()); + + assertEquals("char '" + c + "' not allowed in Windows filename", e.getMessage()); } } @@ -1703,7 +1703,19 @@ public class ObjectCheckerTest { checkOneName("te" + ((char) c) + "st"); fail("incorrectly accepted with 0x" + h); } catch (CorruptObjectException e) { - assertEquals("name contains byte 0x" + h, e.getMessage()); + assertEquals("byte 0x" + h + " not allowed in Windows filename", e.getMessage()); + } + } + + + @Test + public void testRejectInvalidCharacter() { + try { + checkOneName("te/st"); + fail("incorrectly accepted with /"); + } catch (CorruptObjectException e) { + + assertEquals("name contains '/'", e.getMessage()); } } 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 c1d777bc18..9d221c92f9 100644 --- a/org.eclipse.jgit/resources/org/eclipse/jgit/internal/JGitText.properties +++ b/org.eclipse.jgit/resources/org/eclipse/jgit/internal/JGitText.properties @@ -175,8 +175,8 @@ corruptObjectInvalidType=invalid type corruptObjectInvalidType2=invalid type {0} corruptObjectMalformedHeader=malformed header: {0} corruptObjectMissingEmail=missing email -corruptObjectNameContainsByte=name contains byte 0x%x -corruptObjectNameContainsChar=name contains '%c' +corruptObjectNameContainsByte=byte 0x%x not allowed in Windows filename +corruptObjectNameContainsChar=char '%c' not allowed in Windows filename corruptObjectNameContainsNullByte=name contains byte 0x00 corruptObjectNameContainsSlash=name contains '/' corruptObjectNameDot=invalid name '.' |