From f3d8a8ecad614906a2c4ec0077cdb24129da6c6d Mon Sep 17 00:00:00 2001 From: Sasa Zivkov Date: Wed, 19 May 2010 16:59:28 +0200 Subject: Externalize strings from JGit The strings are externalized into the root resource bundles. The resource bundles are stored under the new "resources" source folder to get proper maven build. Strings from tests are, in general, not externalized. Only in cases where it was necessary to make the test pass the strings were externalized. This was typically necessary in cases where e.getMessage() was used in assert and the exception message was slightly changed due to reuse of the externalized strings. Change-Id: Ic0f29c80b9a54fcec8320d8539a3e112852a1f7b Signed-off-by: Sasa Zivkov --- .../org/eclipse/jgit/transport/WalkRemoteObjectDatabase.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'org.eclipse.jgit/src/org/eclipse/jgit/transport/WalkRemoteObjectDatabase.java') diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/WalkRemoteObjectDatabase.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/WalkRemoteObjectDatabase.java index 2aa644ce8b..f1743b378d 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/WalkRemoteObjectDatabase.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/WalkRemoteObjectDatabase.java @@ -50,10 +50,12 @@ import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; +import java.text.MessageFormat; import java.util.ArrayList; import java.util.Collection; import java.util.Map; +import org.eclipse.jgit.JGitText; import org.eclipse.jgit.errors.TransportException; import org.eclipse.jgit.lib.Constants; import org.eclipse.jgit.lib.ObjectId; @@ -198,7 +200,7 @@ abstract class WalkRemoteObjectDatabase { * deletion is not supported, or deletion failed. */ void deleteFile(final String path) throws IOException { - throw new IOException("Deleting '" + path + "' not supported."); + throw new IOException(MessageFormat.format(JGitText.get().deletingNotSupported, path)); } /** @@ -230,7 +232,7 @@ abstract class WalkRemoteObjectDatabase { */ OutputStream writeFile(final String path, final ProgressMonitor monitor, final String monitorTask) throws IOException { - throw new IOException("Writing of '" + path + "' not supported."); + throw new IOException(MessageFormat.format(JGitText.get().writingNotSupported, path)); } /** @@ -428,7 +430,7 @@ abstract class WalkRemoteObjectDatabase { } catch (FileNotFoundException notPacked) { // Perhaps it wasn't worthwhile, or is just an older repository. } catch (IOException e) { - throw new TransportException(getURI(), "error in packed-refs", e); + throw new TransportException(getURI(), JGitText.get().errorInPackedRefs, e); } } @@ -449,7 +451,7 @@ abstract class WalkRemoteObjectDatabase { } if (line.charAt(0) == '^') { if (last == null) - throw new TransportException("Peeled line before ref."); + throw new TransportException(JGitText.get().peeledLineBeforeRef); final ObjectId id = ObjectId.fromString(line.substring(1)); last = new ObjectIdRef.PeeledTag(Ref.Storage.PACKED, last .getName(), last.getObjectId(), id); @@ -459,7 +461,7 @@ abstract class WalkRemoteObjectDatabase { final int sp = line.indexOf(' '); if (sp < 0) - throw new TransportException("Unrecognized ref: " + line); + throw new TransportException(MessageFormat.format(JGitText.get().unrecognizedRef, line)); final ObjectId id = ObjectId.fromString(line.substring(0, sp)); final String name = line.substring(sp + 1); if (peeled) -- cgit v1.2.3