Browse Source

Clarify error message for invalid Windows characters

Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
Change-Id: I20c37d70fc78d745f83b9ce702777535b16b8dfe
stable-5.4
Han-Wen Nienhuys 6 years ago committed by Matthias Sohn
parent
commit
bbff3ff008
  1. 18
      org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ObjectCheckerTest.java
  2. 4
      org.eclipse.jgit/resources/org/eclipse/jgit/internal/JGitText.properties

18
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('/');
rejectName('\\'); rejectName('\\');
rejectName('|'); rejectName('|');
rejectName('?'); rejectName('?');
@ -1693,7 +1692,8 @@ public class ObjectCheckerTest {
checkOneName("te" + c + "st"); checkOneName("te" + c + "st");
fail("incorrectly accepted with " + c); fail("incorrectly accepted with " + c);
} catch (CorruptObjectException e) { } 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"); checkOneName("te" + ((char) c) + "st");
fail("incorrectly accepted with 0x" + h); fail("incorrectly accepted with 0x" + h);
} catch (CorruptObjectException e) { } 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());
} }
} }

4
org.eclipse.jgit/resources/org/eclipse/jgit/internal/JGitText.properties

@ -175,8 +175,8 @@ corruptObjectInvalidType=invalid type
corruptObjectInvalidType2=invalid type {0} corruptObjectInvalidType2=invalid type {0}
corruptObjectMalformedHeader=malformed header: {0} corruptObjectMalformedHeader=malformed header: {0}
corruptObjectMissingEmail=missing email corruptObjectMissingEmail=missing email
corruptObjectNameContainsByte=name contains byte 0x%x corruptObjectNameContainsByte=byte 0x%x not allowed in Windows filename
corruptObjectNameContainsChar=name contains '%c' corruptObjectNameContainsChar=char '%c' not allowed in Windows filename
corruptObjectNameContainsNullByte=name contains byte 0x00 corruptObjectNameContainsNullByte=name contains byte 0x00
corruptObjectNameContainsSlash=name contains '/' corruptObjectNameContainsSlash=name contains '/'
corruptObjectNameDot=invalid name '.' corruptObjectNameDot=invalid name '.'

Loading…
Cancel
Save