aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit/src/org/eclipse/jgit/transport/FetchProcess.java
diff options
context:
space:
mode:
authorSasa Zivkov <sasa.zivkov@sap.com>2010-05-19 16:59:28 +0200
committerShawn O. Pearce <spearce@spearce.org>2010-05-19 14:37:16 -0700
commitf3d8a8ecad614906a2c4ec0077cdb24129da6c6d (patch)
tree34d041692beff0f392c27869f49b76c0fc2053e6 /org.eclipse.jgit/src/org/eclipse/jgit/transport/FetchProcess.java
parent2e961989e42b1fe7e8bd9eaa7a3d2e88a0d1d001 (diff)
downloadjgit-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/FetchProcess.java')
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/transport/FetchProcess.java35
1 files changed, 17 insertions, 18 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/FetchProcess.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/FetchProcess.java
index b86f86d2f9..fc203f69c8 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/FetchProcess.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/FetchProcess.java
@@ -48,6 +48,7 @@ import java.io.File;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.Writer;
+import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
@@ -57,6 +58,7 @@ import java.util.Iterator;
import java.util.Map;
import java.util.Set;
+import org.eclipse.jgit.JGitText;
import org.eclipse.jgit.errors.MissingObjectException;
import org.eclipse.jgit.errors.NotSupportedException;
import org.eclipse.jgit.errors.TransportException;
@@ -122,8 +124,8 @@ class FetchProcess {
final Set<Ref> matched = new HashSet<Ref>();
for (final RefSpec spec : toFetch) {
if (spec.getSource() == null)
- throw new TransportException(
- "Source ref not specified for refspec: " + spec);
+ throw new TransportException(MessageFormat.format(
+ JGitText.get().sourceRefNotSpecifiedForRefspec, spec));
if (spec.isWildcard())
expandWildcard(spec, matched);
@@ -181,8 +183,8 @@ class FetchProcess {
u.update(walk);
result.add(u);
} catch (IOException err) {
- throw new TransportException("Failure updating tracking ref "
- + u.getLocalName() + ": " + err.getMessage(), err);
+ throw new TransportException(MessageFormat.format(
+ JGitText.get().failureUpdatingTrackingRef, u.getLocalName(), err.getMessage()), err);
}
}
@@ -190,8 +192,8 @@ class FetchProcess {
try {
updateFETCH_HEAD(result);
} catch (IOException err) {
- throw new TransportException("Failure updating FETCH_HEAD: "
- + err.getMessage(), err);
+ throw new TransportException(MessageFormat.format(
+ JGitText.get().failureUpdatingFETCH_HEAD, err.getMessage()), err);
}
}
}
@@ -207,7 +209,7 @@ class FetchProcess {
if (transport.isCheckFetchedObjects()
&& !conn.didFetchTestConnectivity() && !askForIsComplete())
throw new TransportException(transport.getURI(),
- "peer did not supply a complete object graph");
+ JGitText.get().peerDidNotSupplyACompleteObjectGraph);
}
private void closeConnection(final FetchResult result) {
@@ -301,7 +303,7 @@ class FetchProcess {
} catch (MissingObjectException e) {
return false;
} catch (IOException e) {
- throw new TransportException("Unable to check connectivity.", e);
+ throw new TransportException(JGitText.get().unableToCheckConnectivity, e);
}
}
@@ -317,8 +319,7 @@ class FetchProcess {
throws TransportException {
final Ref src = conn.getRef(spec.getSource());
if (src == null) {
- throw new TransportException("Remote does not have "
- + spec.getSource() + " available for fetch.");
+ throw new TransportException(MessageFormat.format(JGitText.get().remoteDoesNotHaveSpec, spec.getSource()));
}
if (matched.add(src))
want(src, spec);
@@ -376,9 +377,8 @@ class FetchProcess {
} catch (IOException err) {
// Bad symbolic ref? That is the most likely cause.
//
- throw new TransportException("Cannot resolve"
- + " local tracking ref " + spec.getDestination()
- + " for updating.", err);
+ throw new TransportException( MessageFormat.format(
+ JGitText.get().cannotResolveLocalTrackingRefForUpdating, spec.getDestination()), err);
}
}
@@ -432,13 +432,12 @@ class FetchProcess {
case FORCED:
break;
default:
- throw new TransportException(transport.getURI(),
- "Cannot delete stale tracking ref " + name + ": "
- + u.getResult().name());
+ throw new TransportException(transport.getURI(), MessageFormat.format(
+ JGitText.get().cannotDeleteStaleTrackingRef2, name, u.getResult().name()));
}
} catch (IOException e) {
- throw new TransportException(transport.getURI(),
- "Cannot delete stale tracking ref " + name, e);
+ throw new TransportException(transport.getURI(), MessageFormat.format(
+ JGitText.get().cannotDeleteStaleTrackingRef, name), e);
}
}