diff options
author | Sasa Zivkov <sasa.zivkov@sap.com> | 2010-05-19 16:59:28 +0200 |
---|---|---|
committer | Shawn O. Pearce <spearce@spearce.org> | 2010-05-19 14:37:16 -0700 |
commit | f3d8a8ecad614906a2c4ec0077cdb24129da6c6d (patch) | |
tree | 34d041692beff0f392c27869f49b76c0fc2053e6 /org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackPushConnection.java | |
parent | 2e961989e42b1fe7e8bd9eaa7a3d2e88a0d1d001 (diff) | |
download | jgit-f3d8a8ecad614906a2c4ec0077cdb24129da6c6d.tar.gz jgit-f3d8a8ecad614906a2c4ec0077cdb24129da6c6d.zip |
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 <sasa.zivkov@sap.com>
Diffstat (limited to 'org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackPushConnection.java')
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackPushConnection.java | 29 |
1 files changed, 13 insertions, 16 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackPushConnection.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackPushConnection.java index e10cefd3ab..44ccd2d6ad 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackPushConnection.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackPushConnection.java @@ -45,10 +45,12 @@ package org.eclipse.jgit.transport; import java.io.IOException; +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.NoRemoteRepositoryException; import org.eclipse.jgit.errors.NotSupportedException; import org.eclipse.jgit.errors.PackProtocolException; @@ -137,7 +139,7 @@ class BasePackPushConnection extends BasePackConnection implements } catch (TransportException e) { // Fall through. } - return new TransportException(uri, "push not permitted"); + return new TransportException(uri, JGitText.get().pushNotPermitted); } protected void doPush(final ProgressMonitor monitor, @@ -158,8 +160,7 @@ class BasePackPushConnection extends BasePackConnection implements // int b = in.read(); if (0 <= b) - throw new TransportException(uri, "expected EOF;" - + " received '" + (char) b + "' instead"); + throw new TransportException(uri, MessageFormat.format(JGitText.get().expectedEOFReceived, (char) b)); } } } catch (TransportException e) { @@ -201,7 +202,7 @@ class BasePackPushConnection extends BasePackConnection implements } if (monitor.isCancelled()) - throw new TransportException(uri, "push cancelled"); + throw new TransportException(uri, JGitText.get().pushCancelled); pckOut.end(); outNeedsEnd = false; } @@ -252,13 +253,11 @@ class BasePackPushConnection extends BasePackConnection implements throws IOException { final String unpackLine = readStringLongTimeout(); if (!unpackLine.startsWith("unpack ")) - throw new PackProtocolException(uri, "unexpected report line: " - + unpackLine); + throw new PackProtocolException(uri, MessageFormat.format(JGitText.get().unexpectedReportLine, unpackLine)); final String unpackStatus = unpackLine.substring("unpack ".length()); if (!unpackStatus.equals("ok")) - throw new TransportException(uri, - "error occurred during unpacking on the remote end: " - + unpackStatus); + throw new TransportException(uri, MessageFormat.format( + JGitText.get().errorOccurredDuringUnpackingOnTheRemoteEnd, unpackStatus)); String refLine; while ((refLine = pckIn.readString()) != PacketLineIn.END) { @@ -272,16 +271,15 @@ class BasePackPushConnection extends BasePackConnection implements refNameEnd = refLine.indexOf(" ", 3); } if (refNameEnd == -1) - throw new PackProtocolException(uri - + ": unexpected report line: " + refLine); + throw new PackProtocolException(MessageFormat.format(JGitText.get().unexpectedReportLine2 + , uri, refLine)); final String refName = refLine.substring(3, refNameEnd); final String message = (ok ? null : refLine .substring(refNameEnd + 1)); final RemoteRefUpdate rru = refUpdates.get(refName); if (rru == null) - throw new PackProtocolException(uri - + ": unexpected ref report: " + refName); + throw new PackProtocolException(MessageFormat.format(JGitText.get().unexpectedRefReport, uri, refName)); if (ok) { rru.setStatus(Status.OK); } else { @@ -291,9 +289,8 @@ class BasePackPushConnection extends BasePackConnection implements } for (final RemoteRefUpdate rru : refUpdates.values()) { if (rru.getStatus() == Status.AWAITING_REPORT) - throw new PackProtocolException(uri - + ": expected report for ref " + rru.getRemoteName() - + " not received"); + throw new PackProtocolException(MessageFormat.format( + JGitText.get().expectedReportForRefNotReceived , uri, rru.getRemoteName())); } } |