Browse Source

InvalidLongObjectIdException: Fix formatting of message

The message is formatted as:

  Invalid id: : abcde...

but should be:

  Invalid id: abcde...

Change-Id: Ie15cacdcf2f168edaee262e6cf8061ebfe9d998d
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
stable-4.10
David Pursehouse 7 years ago
parent
commit
899696ed08
  1. 2
      org.eclipse.jgit.lfs.server.test/tst/org/eclipse/jgit/lfs/server/fs/DownloadTest.java
  2. 2
      org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/errors/InvalidLongObjectIdException.java

2
org.eclipse.jgit.lfs.server.test/tst/org/eclipse/jgit/lfs/server/fs/DownloadTest.java

@ -94,7 +94,7 @@ public class DownloadTest extends LfsServerTest {
String TEXT = "test"; String TEXT = "test";
String id = putContent(TEXT).name().replace('f', 'z'); String id = putContent(TEXT).name().replace('f', 'z');
Path f = Paths.get(getTempDirectory().toString(), "download"); Path f = Paths.get(getTempDirectory().toString(), "download");
String error = String.format("Invalid id: : %s", id); String error = String.format("Invalid id: %s", id);
exception.expect(RuntimeException.class); exception.expect(RuntimeException.class);
exception.expectMessage( exception.expectMessage(
formatErrorMessage(SC_UNPROCESSABLE_ENTITY, error)); formatErrorMessage(SC_UNPROCESSABLE_ENTITY, error));

2
org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/errors/InvalidLongObjectIdException.java

@ -80,7 +80,7 @@ public class InvalidLongObjectIdException extends IllegalArgumentException {
private static String asAscii(byte[] bytes, int offset, int length) { private static String asAscii(byte[] bytes, int offset, int length) {
try { try {
return ": " + new String(bytes, offset, length, "US-ASCII"); //$NON-NLS-1$ //$NON-NLS-2$ return new String(bytes, offset, length, "US-ASCII"); //$NON-NLS-1$
} catch (UnsupportedEncodingException e2) { } catch (UnsupportedEncodingException e2) {
return ""; //$NON-NLS-1$ return ""; //$NON-NLS-1$
} catch (StringIndexOutOfBoundsException e2) { } catch (StringIndexOutOfBoundsException e2) {

Loading…
Cancel
Save