diff options
Diffstat (limited to 'org.eclipse.jgit/src/org/eclipse/jgit/lib/Commit.java')
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/lib/Commit.java | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/Commit.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/Commit.java index 65921e53c7..66dd89120c 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/Commit.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/Commit.java @@ -49,7 +49,9 @@ import java.io.ByteArrayInputStream; import java.io.DataInputStream; import java.io.IOException; import java.nio.charset.Charset; +import java.text.MessageFormat; +import org.eclipse.jgit.JGitText; import org.eclipse.jgit.errors.CorruptObjectException; import org.eclipse.jgit.errors.MissingObjectException; @@ -279,18 +281,18 @@ public class Commit implements Treeish { DataInputStream br = new DataInputStream(new ByteArrayInputStream(raw)); String n = br.readLine(); if (n == null || !n.startsWith("tree ")) { - throw new CorruptObjectException(commitId, "no tree"); + throw new CorruptObjectException(commitId, JGitText.get().corruptObjectNotree); } while ((n = br.readLine()) != null && n.startsWith("parent ")) { // empty body } if (n == null || !n.startsWith("author ")) { - throw new CorruptObjectException(commitId, "no author"); + throw new CorruptObjectException(commitId, JGitText.get().corruptObjectNoAuthor); } String rawAuthor = n.substring("author ".length()); n = br.readLine(); if (n == null || !n.startsWith("committer ")) { - throw new CorruptObjectException(commitId, "no committer"); + throw new CorruptObjectException(commitId, JGitText.get().corruptObjectNoCommitter); } String rawCommitter = n.substring("committer ".length()); n = br.readLine(); @@ -298,8 +300,8 @@ public class Commit implements Treeish { encoding = Charset.forName(n.substring("encoding ".length())); else if (n == null || !n.equals("")) { - throw new CorruptObjectException(commitId, - "malformed header:"+n); + throw new CorruptObjectException(commitId, MessageFormat.format( + JGitText.get().corruptObjectMalformedHeader, n)); } byte[] readBuf = new byte[br.available()]; // in-memory stream so this is all bytes left br.read(readBuf); @@ -336,12 +338,12 @@ public class Commit implements Treeish { */ public void commit() throws IOException { if (getCommitId() != null) - throw new IllegalStateException("exists " + getCommitId()); + throw new IllegalStateException(MessageFormat.format(JGitText.get().commitAlreadyExists, getCommitId())); setCommitId(new ObjectWriter(objdb).writeCommit(this)); } public String toString() { - return "Commit[" + ObjectId.toString(getCommitId()) + " " + getAuthor() + "]"; + return "Commit[" + ObjectId.toString(getCommitId()) + " " + getAuthor() + "]"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ } /** |