Merge changes Ia3908555,I3bc26847

* changes:
  Silence false null pointer access warnings in PackFile
  Externalize error messages used in ObjectDirectoryInserter
This commit is contained in:
Shawn Pearce 2015-04-08 15:16:51 -04:00 committed by Gerrit Code Review @ Eclipse.org
commit aa94e3f3ae
4 changed files with 12 additions and 3 deletions

View File

@ -258,6 +258,7 @@ indexWriteException=Modified index could not be written
initFailedBareRepoDifferentDirs=When initializing a bare repo with directory {0} and separate git-dir {1} specified both folders must point to the same location
initFailedNonBareRepoSameDirs=When initializing a non-bare repo with directory {0} and separate git-dir {1} specified both folders should not point to the same location
inMemoryBufferLimitExceeded=In-memory buffer limit exceeded
inputDidntMatchLength=Input did not match supplied length. {0} bytes are missing.
inputStreamMustSupportMark=InputStream must support mark()
integerValueOutOfRange=Integer value {0}.{1} out of range
internalRevisionError=internal revision error
@ -536,6 +537,7 @@ truncatedHunkNewLinesMissing=Truncated hunk, at least {0} new lines is missing
truncatedHunkOldLinesMissing=Truncated hunk, at least {0} old lines is missing
tSizeMustBeGreaterOrEqual1=tSize must be >= 1
unableToCheckConnectivity=Unable to check connectivity.
unableToCreateNewObject=Unable to create new object: {0}
unableToStore=Unable to store {0}.
unableToWrite=Unable to write {0}
unencodeableFile=Unencodable file: {0}

View File

@ -317,6 +317,7 @@ public static JGitText get() {
/***/ public String initFailedBareRepoDifferentDirs;
/***/ public String initFailedNonBareRepoSameDirs;
/***/ public String inMemoryBufferLimitExceeded;
/***/ public String inputDidntMatchLength;
/***/ public String inputStreamMustSupportMark;
/***/ public String integerValueOutOfRange;
/***/ public String internalRevisionError;
@ -595,6 +596,7 @@ public static JGitText get() {
/***/ public String truncatedHunkOldLinesMissing;
/***/ public String tSizeMustBeGreaterOrEqual1;
/***/ public String unableToCheckConnectivity;
/***/ public String unableToCreateNewObject;
/***/ public String unableToStore;
/***/ public String unableToWrite;
/***/ public String unencodeableFile;

View File

@ -55,10 +55,12 @@
import java.nio.channels.Channels;
import java.security.DigestOutputStream;
import java.security.MessageDigest;
import java.text.MessageFormat;
import java.util.zip.Deflater;
import java.util.zip.DeflaterOutputStream;
import org.eclipse.jgit.errors.ObjectWritingException;
import org.eclipse.jgit.internal.JGitText;
import org.eclipse.jgit.lib.Config;
import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.lib.ObjectId;
@ -123,7 +125,8 @@ private ObjectId insertOneObject(final File tmp, final ObjectId id)
}
final File dst = db.fileFor(id);
throw new ObjectWritingException("Unable to create new object: " + dst);
throw new ObjectWritingException(MessageFormat
.format(JGitText.get().unableToCreateNewObject, dst));
}
@Override
@ -242,7 +245,7 @@ DeflaterOutputStream compress(final OutputStream out) {
}
private static EOFException shortInput(long missing) {
return new EOFException("Input did not match supplied length. "
+ missing + " bytes are missing.");
return new EOFException(MessageFormat.format(
JGitText.get().inputDidntMatchLength, Long.valueOf(missing)));
}
}

View File

@ -362,6 +362,7 @@ final void copyAsIs(PackOutputStream out, LocalObjectToPack src,
}
}
@SuppressWarnings("null")
private void copyAsIs2(PackOutputStream out, LocalObjectToPack src,
boolean validate, WindowCursor curs) throws IOException,
StoredObjectRepresentationNotAvailableException {
@ -703,6 +704,7 @@ private void onOpenPack() throws IOException {
, getPackFile()));
}
@SuppressWarnings("null")
ObjectLoader load(final WindowCursor curs, long pos)
throws IOException, LargeObjectException {
try {