Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'org.eclipse.jgit/src/org/eclipse')
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/JGitText.java420
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/api/CommitCommand.java20
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/api/ConcurrentRefUpdateException.java11
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/api/GitCommand.java8
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/api/LogCommand.java12
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/diff/DiffFormatter.java3
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/diff/MyersDiff.java13
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCache.java37
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheBuilder.java14
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheEditor.java10
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheEntry.java16
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/errors/CheckoutConflictException.java7
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/errors/CompoundException.java4
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/errors/CorruptObjectException.java4
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/errors/EntryExistsException.java5
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/errors/IncorrectObjectTypeException.java4
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/errors/InvalidObjectIdException.java5
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/errors/MissingBundlePrerequisiteException.java3
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/errors/MissingObjectException.java4
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/errors/NoClosingBracketException.java6
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/errors/PackInvalidException.java5
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/errors/RepositoryNotFoundException.java5
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/errors/RevWalkException.java3
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/errors/UnmergedPathException.java4
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/fnmatch/AbstractHead.java4
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/fnmatch/GroupHead.java8
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/lib/AbbreviatedObjectId.java8
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/lib/BinaryDelta.java6
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/lib/BlobBasedConfig.java10
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/lib/Commit.java16
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/lib/Config.java42
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/lib/Constants.java28
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/lib/DeltaOfsPackedObjectLoader.java3
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/lib/DeltaPackedObjectLoader.java6
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/lib/FileBasedConfig.java10
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/lib/GitIndex.java32
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/lib/IndexTreeWalker.java9
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/lib/LockFile.java7
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/lib/MutableObjectId.java6
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectChecker.java6
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectDirectory.java8
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectWriter.java8
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/lib/PackFile.java35
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/lib/PackIndex.java6
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/lib/PackIndexV2.java3
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/lib/PackIndexWriter.java6
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/lib/PackIndexWriterV1.java3
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/lib/PackReverseIndex.java16
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java17
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/lib/PersonIdent.java10
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/lib/RefDirectory.java23
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/lib/RefUpdate.java6
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/lib/ReflogReader.java9
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java26
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/lib/Tag.java16
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/lib/Tree.java12
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/lib/TreeIterator.java4
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/lib/UnpackedObjectLoader.java19
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/lib/WholePackedObjectLoader.java6
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/lib/WindowCache.java18
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/lib/WorkDirCheckout.java6
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/lib/WriteTree.java8
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/merge/MergeStrategy.java5
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/merge/Merger.java9
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/nls/NLS.java3
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/nls/TranslationBundle.java19
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/patch/CombinedHunkHeader.java10
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/patch/FileHeader.java9
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/patch/HunkHeader.java14
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/patch/Patch.java7
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/revplot/PlotCommitList.java4
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/revplot/PlotWalk.java3
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/revwalk/MergeBaseGenerator.java4
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/revwalk/ObjectWalk.java13
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevFlag.java8
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevObjectList.java5
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevWalk.java16
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/revwalk/StartGenerator.java6
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/revwalk/filter/AndRevFilter.java5
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/revwalk/filter/AuthorRevFilter.java3
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/revwalk/filter/CommitterRevFilter.java3
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/revwalk/filter/MessageRevFilter.java3
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/revwalk/filter/OrRevFilter.java5
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/revwalk/filter/PatternMatchRevFilter.java3
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/revwalk/filter/RevFilter.java3
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/transport/AmazonS3.java31
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/transport/BaseConnection.java5
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackConnection.java11
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackFetchConnection.java5
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackPushConnection.java29
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/transport/BundleFetchConnection.java14
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/transport/BundleWriter.java6
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/transport/Daemon.java3
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/transport/FetchProcess.java35
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/transport/IndexPack.java62
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/transport/PacketLineIn.java12
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/transport/PushProcess.java14
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/transport/ReceivePack.java18
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/transport/RefSpec.java19
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/transport/RemoteRefUpdate.java8
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/transport/SideBandInputStream.java6
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/transport/SideBandOutputStream.java12
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/transport/SshTransport.java7
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/transport/TagOpt.java6
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/transport/Transport.java18
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportAmazonS3.java13
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportBundleFile.java5
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportBundleStream.java5
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportGitAnon.java7
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportGitSsh.java10
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportHttp.java48
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportLocal.java9
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/transport/URIish.java3
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java12
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/transport/WalkEncryption.java9
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/transport/WalkFetchConnection.java53
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/transport/WalkPushConnection.java13
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/transport/WalkRemoteObjectDatabase.java12
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/treewalk/WorkingTreeIterator.java4
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/treewalk/filter/AndTreeFilter.java5
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/treewalk/filter/OrTreeFilter.java5
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/treewalk/filter/PathFilter.java3
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/treewalk/filter/PathFilterGroup.java5
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/treewalk/filter/PathSuffixFilter.java3
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/util/Base64.java19
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/util/HttpSupport.java9
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/util/IO.java11
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/util/RawSubStringPattern.java3
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/util/StringUtils.java8
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/util/TemporaryBuffer.java7
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/util/io/DisabledOutputStream.java4
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/util/io/InterruptTimer.java8
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/util/io/TimeoutInputStream.java7
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/util/io/TimeoutOutputStream.java7
134 files changed, 1257 insertions, 620 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/JGitText.java b/org.eclipse.jgit/src/org/eclipse/jgit/JGitText.java
new file mode 100644
index 0000000000..fbc17aad8e
--- /dev/null
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/JGitText.java
@@ -0,0 +1,420 @@
+/*
+ * Copyright (C) 2010, Sasa Zivkov <sasa.zivkov@sap.com>
+ * and other copyright owners as documented in the project's IP log.
+ *
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Distribution License v1.0 which
+ * accompanies this distribution, is reproduced below, and is
+ * available at http://www.eclipse.org/org/documents/edl-v10.php
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or
+ * without modification, are permitted provided that the following
+ * conditions are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ *
+ * - Neither the name of the Eclipse Foundation, Inc. nor the
+ * names of its contributors may be used to endorse or promote
+ * products derived from this software without specific prior
+ * written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package org.eclipse.jgit;
+
+import org.eclipse.jgit.nls.NLS;
+import org.eclipse.jgit.nls.TranslationBundle;
+
+/**
+ * Translation bundle for JGit core
+ */
+public class JGitText extends TranslationBundle {
+
+ /**
+ * @return an instance of this translation bundle
+ */
+ public static JGitText get() {
+ return NLS.getBundleFor(JGitText.class);
+ }
+
+ /***/ public String DIRCChecksumMismatch;
+ /***/ public String DIRCExtensionIsTooLargeAt;
+ /***/ public String DIRCExtensionNotSupportedByThisVersion;
+ /***/ public String DIRCHasTooManyEntries;
+ /***/ public String JRELacksMD5Implementation;
+ /***/ public String URINotSupported;
+ /***/ public String URLNotFound;
+ /***/ public String aNewObjectIdIsRequired;
+ /***/ public String advertisementCameBefore;
+ /***/ public String advertisementOfCameBefore;
+ /***/ public String amazonS3ActionFailed;
+ /***/ public String amazonS3ActionFailedGivingUp;
+ /***/ public String anExceptionOccurredWhileTryingToAddTheIdOfHEAD;
+ /***/ public String anSSHSessionHasBeenAlreadyCreated;
+ /***/ public String atLeastOnePathIsRequired;
+ /***/ public String atLeastTwoFiltersNeeded;
+ /***/ public String badBase64InputCharacterAt;
+ /***/ public String badEntryDelimiter;
+ /***/ public String badEntryName;
+ /***/ public String badEscape;
+ /***/ public String badGroupHeader;
+ /***/ public String badObjectType;
+ /***/ public String badSectionEntry;
+ /***/ public String base64InputNotProperlyPadded;
+ /***/ public String baseLengthIncorrect;
+ /***/ public String blobNotFound;
+ /***/ public String blobNotFoundForPath;
+ /***/ public String cannotBeCombined;
+ /***/ public String cannotCombineTreeFilterWithRevFilter;
+ /***/ public String cannotCommitWriteTo;
+ /***/ public String cannotConnectPipes;
+ /***/ public String cannotConvertScriptToText;
+ /***/ public String cannotCreateConfig;
+ /***/ public String cannotCreateDirectory;
+ /***/ public String cannotCreateHEAD;
+ /***/ public String cannotDeleteFile;
+ /***/ public String cannotDeleteStaleTrackingRef2;
+ /***/ public String cannotDeleteStaleTrackingRef;
+ /***/ public String cannotDetermineProxyFor;
+ /***/ public String cannotDownload;
+ /***/ public String cannotExecute;
+ /***/ public String cannotGet;
+ /***/ public String cannotListRefs;
+ /***/ public String cannotLock;
+ /***/ public String cannotLockFile;
+ /***/ public String cannotLockPackIn;
+ /***/ public String cannotMatchOnEmptyString;
+ /***/ public String cannotMoveIndexTo;
+ /***/ public String cannotMovePackTo;
+ /***/ public String cannotOpenService;
+ /***/ public String cannotParseGitURIish;
+ /***/ public String cannotRead;
+ /***/ public String cannotReadBlob;
+ /***/ public String cannotReadCommit;
+ /***/ public String cannotReadFile;
+ /***/ public String cannotReadHEAD;
+ /***/ public String cannotReadObject;
+ /***/ public String cannotReadTree;
+ /***/ public String cannotResolveLocalTrackingRefForUpdating;
+ /***/ public String cannotStoreObjects;
+ /***/ public String cannotUnloadAModifiedTree;
+ /***/ public String cannotWorkWithOtherStagesThanZeroRightNow;
+ /***/ public String cantFindObjectInReversePackIndexForTheSpecifiedOffset;
+ /***/ public String cantPassMeATree;
+ /***/ public String channelMustBeInRange0_255;
+ /***/ public String characterClassIsNotSupported;
+ /***/ public String checkoutConflictWithFile;
+ /***/ public String checkoutConflictWithFiles;
+ /***/ public String classCastNotA;
+ /***/ public String collisionOn;
+ /***/ public String commandWasCalledInTheWrongState;
+ /***/ public String commitAlreadyExists;
+ /***/ public String commitMessageNotSpecified;
+ /***/ public String commitOnRepoWithoutHEADCurrentlyNotSupported;
+ /***/ public String compressingObjects;
+ /***/ public String connectionFailed;
+ /***/ public String connectionTimeOut;
+ /***/ public String contextMustBeNonNegative;
+ /***/ public String corruptObjectBadStream;
+ /***/ public String corruptObjectBadStreamCorruptHeader;
+ /***/ public String corruptObjectGarbageAfterSize;
+ /***/ public String corruptObjectIncorrectLength;
+ /***/ public String corruptObjectInvalidEntryMode;
+ /***/ public String corruptObjectInvalidMode2;
+ /***/ public String corruptObjectInvalidMode3;
+ /***/ public String corruptObjectInvalidMode;
+ /***/ public String corruptObjectInvalidType2;
+ /***/ public String corruptObjectInvalidType;
+ /***/ public String corruptObjectMalformedHeader;
+ /***/ public String corruptObjectNegativeSize;
+ /***/ public String corruptObjectNoAuthor;
+ /***/ public String corruptObjectNoCommitter;
+ /***/ public String corruptObjectNoHeader;
+ /***/ public String corruptObjectNoObject;
+ /***/ public String corruptObjectNoTagName;
+ /***/ public String corruptObjectNoTaggerBadHeader;
+ /***/ public String corruptObjectNoTaggerHeader;
+ /***/ public String corruptObjectNoType;
+ /***/ public String corruptObjectNotree;
+ /***/ public String corruptObjectPackfileChecksumIncorrect;
+ /***/ public String corruptionDetectedReReadingAt;
+ /***/ public String couldNotDeleteLockFileShouldNotHappen;
+ /***/ public String couldNotDeleteTemporaryIndexFileShouldNotHappen;
+ /***/ public String couldNotLockHEAD;
+ /***/ public String couldNotReadIndexInOneGo;
+ /***/ public String couldNotRenameDeleteOldIndex;
+ /***/ public String couldNotRenameTemporaryIndexFileToIndex;
+ /***/ public String couldNotURLEncodeToUTF8;
+ /***/ public String couldNotWriteFile;
+ /***/ public String countingObjects;
+ /***/ public String creatingDeltasIsNotImplemented;
+ /***/ public String daemonAlreadyRunning;
+ /***/ public String deletingNotSupported;
+ /***/ public String destinationIsNotAWildcard;
+ /***/ public String dirCacheDoesNotHaveABackingFile;
+ /***/ public String dirCacheFileIsNotLocked;
+ /***/ public String dirCacheIsNotLocked;
+ /***/ public String doesNotHandleMode;
+ /***/ public String downloadCancelled;
+ /***/ public String downloadCancelledDuringIndexing;
+ /***/ public String duplicateAdvertisementsOf;
+ /***/ public String duplicateRef;
+ /***/ public String duplicateRemoteRefUpdateIsIllegal;
+ /***/ public String duplicateStagesNotAllowed;
+ /***/ public String eitherGIT_DIRorGIT_WORK_TREEmustBePassed;
+ /***/ public String emptyPathNotPermitted;
+ /***/ public String encryptionError;
+ /***/ public String endOfFileInEscape;
+ /***/ public String entryNotFoundByPath;
+ /***/ public String errorDecodingFromFile;
+ /***/ public String errorEncodingFromFile;
+ /***/ public String errorInBase64CodeReadingStream;
+ /***/ public String errorInPackedRefs;
+ /***/ public String errorInvalidProtocolWantedOldNewRef;
+ /***/ public String errorListing;
+ /***/ public String errorOccurredDuringUnpackingOnTheRemoteEnd;
+ /***/ public String errorReadingInfoRefs;
+ /***/ public String exceptionCaughtDuringExecutionOfCommitCommand;
+ /***/ public String exceptionOccuredDuringAddingOfOptionToALogCommand;
+ /***/ public String expectedACKNAKFoundEOF;
+ /***/ public String expectedACKNAKGot;
+ /***/ public String expectedBooleanStringValue;
+ /***/ public String expectedCharacterEncodingGuesses;
+ /***/ public String expectedEOFReceived;
+ /***/ public String expectedGot;
+ /***/ public String expectedPktLineWithService;
+ /***/ public String expectedReceivedContentType;
+ /***/ public String expectedReportForRefNotReceived;
+ /***/ public String failedUpdatingRefs;
+ /***/ public String failureDueToOneOfTheFollowing;
+ /***/ public String failureUpdatingFETCH_HEAD;
+ /***/ public String failureUpdatingTrackingRef;
+ /***/ public String fileCannotBeDeleted;
+ /***/ public String fileIsTooBigForThisConvenienceMethod;
+ /***/ public String fileIsTooLarge;
+ /***/ public String fileModeNotSetForPath;
+ /***/ public String flagIsDisposed;
+ /***/ public String flagNotFromThis;
+ /***/ public String flagsAlreadyCreated;
+ /***/ public String funnyRefname;
+ /***/ public String hugeIndexesAreNotSupportedByJgitYet;
+ /***/ public String hunkBelongsToAnotherFile;
+ /***/ public String hunkDisconnectedFromFile;
+ /***/ public String hunkHeaderDoesNotMatchBodyLineCountOf;
+ /***/ public String illegalArgumentNotA;
+ /***/ public String illegalStateExists;
+ /***/ public String improperlyPaddedBase64Input;
+ /***/ public String inMemoryBufferLimitExceeded;
+ /***/ public String incorrectHashFor;
+ /***/ public String incorrectOBJECT_ID_LENGTH;
+ /***/ public String incorrectObjectType_COMMITnorTREEnorBLOBnorTAG;
+ /***/ public String indexFileIsInUse;
+ /***/ public String indexFileIsTooLargeForJgit;
+ /***/ public String indexSignatureIsInvalid;
+ /***/ public String integerValueOutOfRange;
+ /***/ public String internalRevisionError;
+ /***/ public String interruptedWriting;
+ /***/ public String invalidAdvertisementOf;
+ /***/ public String invalidAncestryLength;
+ /***/ public String invalidBooleanValue;
+ /***/ public String invalidChannel;
+ /***/ public String invalidCharacterInBase64Data;
+ /***/ public String invalidCommitParentNumber;
+ /***/ public String invalidEncryption;
+ /***/ public String invalidGitType;
+ /***/ public String invalidId;
+ /***/ public String invalidIdLength;
+ /***/ public String invalidIntegerValue;
+ /***/ public String invalidKey;
+ /***/ public String invalidLineInConfigFile;
+ /***/ public String invalidModeFor;
+ /***/ public String invalidModeForPath;
+ /***/ public String invalidObject;
+ /***/ public String invalidOldIdSent;
+ /***/ public String invalidPacketLineHeader;
+ /***/ public String invalidPath;
+ /***/ public String invalidRefName;
+ /***/ public String invalidStageForPath;
+ /***/ public String invalidTagOption;
+ /***/ public String invalidTimeout;
+ /***/ public String invalidURL;
+ /***/ public String invalidWildcards;
+ /***/ public String invalidWindowSize;
+ /***/ public String isAStaticFlagAndHasNorevWalkInstance;
+ /***/ public String kNotInRange;
+ /***/ public String lengthExceedsMaximumArraySize;
+ /***/ public String listingAlternates;
+ /***/ public String localObjectsIncomplete;
+ /***/ public String localRefIsMissingObjects;
+ /***/ public String lockCountMustBeGreaterOrEqual1;
+ /***/ public String lockError;
+ /***/ public String lockOnNotClosed;
+ /***/ public String lockOnNotHeld;
+ /***/ public String malformedpersonIdentString;
+ /***/ public String mergeStrategyAlreadyExistsAsDefault;
+ /***/ public String missingAccesskey;
+ /***/ public String missingForwardImageInGITBinaryPatch;
+ /***/ public String missingObject;
+ /***/ public String missingPrerequisiteCommits;
+ /***/ public String missingSecretkey;
+ /***/ public String mixedStagesNotAllowed;
+ /***/ public String multipleMergeBasesFor;
+ /***/ public String need2Arguments;
+ /***/ public String needPackOut;
+ /***/ public String needsAtLeastOneEntry;
+ /***/ public String needsWorkdir;
+ /***/ public String newlineInQuotesNotAllowed;
+ /***/ public String noApplyInDelete;
+ /***/ public String noClosingBracket;
+ /***/ public String noHEADExistsAndNoExplicitStartingRevisionWasSpecified;
+ /***/ public String noHMACsupport;
+ /***/ public String noSuchRef;
+ /***/ public String noXMLParserAvailable;
+ /***/ public String notABoolean;
+ /***/ public String notABundle;
+ /***/ public String notADIRCFile;
+ /***/ public String notAGitDirectory;
+ /***/ public String notAPACKFile;
+ /***/ public String notARef;
+ /***/ public String notASCIIString;
+ /***/ public String notAValidPack;
+ /***/ public String notFound;
+ /***/ public String notValid;
+ /***/ public String nothingToFetch;
+ /***/ public String nothingToPush;
+ /***/ public String objectAtHasBadZlibStream;
+ /***/ public String objectAtPathDoesNotHaveId;
+ /***/ public String objectIsCorrupt;
+ /***/ public String objectIsNotA;
+ /***/ public String objectNotFoundIn;
+ /***/ public String offsetWrittenDeltaBaseForObjectNotFoundInAPack;
+ /***/ public String onlyOneFetchSupported;
+ /***/ public String onlyOneOperationCallPerConnectionIsSupported;
+ /***/ public String openFilesMustBeAtLeast1;
+ /***/ public String openingConnection;
+ /***/ public String outputHasAlreadyBeenStarted;
+ /***/ public String packChecksumMismatch;
+ /***/ public String packCorruptedWhileWritingToFilesystem;
+ /***/ public String packDoesNotMatchIndex;
+ /***/ public String packFileInvalid;
+ /***/ public String packHasUnresolvedDeltas;
+ /***/ public String packObjectCountMismatch;
+ /***/ public String packTooLargeForIndexVersion1;
+ /***/ public String packetSizeMustBeAtLeast;
+ /***/ public String packetSizeMustBeAtMost;
+ /***/ public String packfileCorruptionDetected;
+ /***/ public String packfileIsTruncated;
+ /***/ public String packingCancelledDuringObjectsWriting;
+ /***/ public String pathIsNotInWorkingDir;
+ /***/ public String peeledLineBeforeRef;
+ /***/ public String peerDidNotSupplyACompleteObjectGraph;
+ /***/ public String prefixRemote;
+ /***/ public String problemWithResolvingPushRefSpecsLocally;
+ /***/ public String progressMonUploading;
+ /***/ public String propertyIsAlreadyNonNull;
+ /***/ public String pushCancelled;
+ /***/ public String pushIsNotSupportedForBundleTransport;
+ /***/ public String pushNotPermitted;
+ /***/ public String rawLogMessageDoesNotParseAsLogEntry;
+ /***/ public String readTimedOut;
+ /***/ public String readingObjectsFromLocalRepositoryFailed;
+ /***/ public String receivingObjects;
+ /***/ public String refUpdateReturnCodeWas;
+ /***/ public String reflogsNotYetSupportedByRevisionParser;
+ /***/ public String remoteConfigHasNoURIAssociated;
+ /***/ public String remoteDoesNotHaveSpec;
+ /***/ public String remoteDoesNotSupportSmartHTTPPush;
+ /***/ public String remoteHungUpUnexpectedly;
+ /***/ public String remoteNameCantBeNull;
+ /***/ public String repositoryAlreadyExists;
+ /***/ public String repositoryNotFound;
+ /***/ public String requiredHashFunctionNotAvailable;
+ /***/ public String resolvingDeltas;
+ /***/ public String serviceNotPermitted;
+ /***/ public String shortCompressedStreamAt;
+ /***/ public String shortReadOfBlock;
+ /***/ public String shortReadOfOptionalDIRCExtensionExpectedAnotherBytes;
+ /***/ public String shortSkipOfBlock;
+ /***/ public String smartHTTPPushDisabled;
+ /***/ public String sourceDestinationMustMatch;
+ /***/ public String sourceIsNotAWildcard;
+ /***/ public String sourceRefDoesntResolveToAnyObject;
+ /***/ public String sourceRefNotSpecifiedForRefspec;
+ /***/ public String staleRevFlagsOn;
+ /***/ public String startingReadStageWithoutWrittenRequestDataPendingIsNotSupported;
+ /***/ public String statelessRPCRequiresOptionToBeEnabled;
+ /***/ public String symlinkCannotBeWrittenAsTheLinkTarget;
+ /***/ public String tSizeMustBeGreaterOrEqual1;
+ /***/ public String theFactoryMustNotBeNull;
+ /***/ public String timerAlreadyTerminated;
+ /***/ public String topologicalSortRequired;
+ /***/ public String transportExceptionBadRef;
+ /***/ public String transportExceptionEmptyRef;
+ /***/ public String transportExceptionInvalid;
+ /***/ public String transportExceptionMissingAssumed;
+ /***/ public String transportExceptionReadRef;
+ /***/ public String treeEntryAlreadyExists;
+ /***/ public String treeIteratorDoesNotSupportRemove;
+ /***/ public String truncatedHunkLinesMissingForAncestor;
+ /***/ public String truncatedHunkNewLinesMissing;
+ /***/ public String truncatedHunkOldLinesMissing;
+ /***/ public String unableToCheckConnectivity;
+ /***/ public String unableToLockTag;
+ /***/ public String unableToStore;
+ /***/ public String unableToWrite;
+ /***/ public String unencodeableFile;
+ /***/ public String unexpectedEndOfConfigFile;
+ /***/ public String unexpectedHunkTrailer;
+ /***/ public String unexpectedOddResult;
+ /***/ public String unexpectedRefReport;
+ /***/ public String unexpectedReportLine2;
+ /***/ public String unexpectedReportLine;
+ /***/ public String unknownDIRCVersion;
+ /***/ public String unknownHost;
+ /***/ public String unknownIndexVersionOrCorruptIndex;
+ /***/ public String unknownObjectType;
+ /***/ public String unknownRepositoryFormat2;
+ /***/ public String unknownRepositoryFormat;
+ /***/ public String unmergedPath;
+ /***/ public String unpackError;
+ /***/ public String unreadablePackIndex;
+ /***/ public String unrecognizedRef;
+ /***/ public String unsupportedCommand0;
+ /***/ public String unsupportedEncryptionAlgorithm;
+ /***/ public String unsupportedEncryptionVersion;
+ /***/ public String unsupportedOperationNotAddAtEnd;
+ /***/ public String unsupportedPackIndexVersion;
+ /***/ public String unsupportedPackVersion;
+ /***/ public String updatingRefFailed;
+ /***/ public String userConfigFileInvalid;
+ /***/ public String walkFailure;
+ /***/ public String windowSizeMustBeLesserThanLimit;
+ /***/ public String windowSizeMustBePowerOf2;
+ /***/ public String writeTimedOut;
+ /***/ public String writerAlreadyInitialized;
+ /***/ public String writingNotPermitted;
+ /***/ public String writingNotSupported;
+ /***/ public String writingObjects;
+ /***/ public String wrongDecompressedLength;
+}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/CommitCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/CommitCommand.java
index 7501509d11..542c821451 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/api/CommitCommand.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/CommitCommand.java
@@ -43,7 +43,9 @@
package org.eclipse.jgit.api;
import java.io.IOException;
+import java.text.MessageFormat;
+import org.eclipse.jgit.JGitText;
import org.eclipse.jgit.dircache.DirCache;
import org.eclipse.jgit.errors.UnmergedPathException;
import org.eclipse.jgit.lib.Commit;
@@ -112,7 +114,7 @@ public class CommitCommand extends GitCommand<RevCommit> {
Ref head = repo.getRef(Constants.HEAD);
if (head == null)
throw new NoHeadException(
- "Commit on repo without HEAD currently not supported");
+ JGitText.get().commitOnRepoWithoutHEADCurrentlyNotSupported);
// determine the current HEAD and the commit it is referring to
ObjectId parentID = repo.resolve(Constants.HEAD + "^{commit}");
@@ -153,15 +155,11 @@ public class CommitCommand extends GitCommand<RevCommit> {
case REJECTED:
case LOCK_FAILURE:
throw new ConcurrentRefUpdateException(
- "Could lock HEAD during commit", ru.getRef(), rc);
+ JGitText.get().couldNotLockHEAD, ru.getRef(), rc);
default:
- throw new JGitInternalException(
- "Updating the ref "
- + Constants.HEAD
- + " to "
- + commitId.toString()
- + " failed. ReturnCode from RefUpdate.update() was "
- + rc);
+ throw new JGitInternalException(MessageFormat.format(
+ JGitText.get().updatingRefFailed
+ , Constants.HEAD, commitId.toString(), rc));
}
} finally {
index.unlock();
@@ -173,7 +171,7 @@ public class CommitCommand extends GitCommand<RevCommit> {
throw e;
} catch (IOException e) {
throw new JGitInternalException(
- "Exception caught during execution of commit command", e);
+ JGitText.get().exceptionCaughtDuringExecutionOfCommitCommand, e);
}
}
@@ -188,7 +186,7 @@ public class CommitCommand extends GitCommand<RevCommit> {
if (message == null)
// as long as we don't suppport -C option we have to have
// an explicit message
- throw new NoMessageException("commit message not specified");
+ throw new NoMessageException(JGitText.get().commitMessageNotSpecified);
if (committer == null)
committer = new PersonIdent(repo);
if (author == null)
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/ConcurrentRefUpdateException.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/ConcurrentRefUpdateException.java
index c5d9fe68dd..02bb494f66 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/api/ConcurrentRefUpdateException.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/ConcurrentRefUpdateException.java
@@ -37,6 +37,9 @@
*/
package org.eclipse.jgit.api;
+import java.text.MessageFormat;
+
+import org.eclipse.jgit.JGitText;
import org.eclipse.jgit.lib.Ref;
import org.eclipse.jgit.lib.RefUpdate;
@@ -53,16 +56,16 @@ public class ConcurrentRefUpdateException extends GitAPIException {
ConcurrentRefUpdateException(String message, Ref ref,
RefUpdate.Result rc, Throwable cause) {
- super((rc == null) ? message : message
- + ". RefUpdate return code was: " + rc, cause);
+ super((rc == null) ? message : message + ". "
+ + MessageFormat.format(JGitText.get().refUpdateReturnCodeWas, rc), cause);
this.rc = rc;
this.ref = ref;
}
ConcurrentRefUpdateException(String message, Ref ref,
RefUpdate.Result rc) {
- super((rc == null) ? message : message
- + ". RefUpdate return code was: " + rc);
+ super((rc == null) ? message : message + ". "
+ + MessageFormat.format(JGitText.get().refUpdateReturnCodeWas, rc));
this.rc = rc;
this.ref = ref;
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/GitCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/GitCommand.java
index 4df5b4437b..ece467aa07 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/api/GitCommand.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/GitCommand.java
@@ -37,8 +37,10 @@
*/
package org.eclipse.jgit.api;
+import java.text.MessageFormat;
import java.util.concurrent.Callable;
+import org.eclipse.jgit.JGitText;
import org.eclipse.jgit.lib.Repository;
/**
@@ -110,8 +112,8 @@ public abstract class GitCommand<T> implements Callable<T> {
*/
protected void checkCallable() {
if (!callable)
- throw new IllegalStateException("Command "
- + this.getClass().getName()
- + " was called in the wrong state");
+ throw new IllegalStateException(MessageFormat.format(
+ JGitText.get().commandWasCalledInTheWrongState
+ , this.getClass().getName()));
}
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/LogCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/LogCommand.java
index 4ce57201d3..414fac4f38 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/api/LogCommand.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/LogCommand.java
@@ -43,7 +43,9 @@
package org.eclipse.jgit.api;
import java.io.IOException;
+import java.text.MessageFormat;
+import org.eclipse.jgit.JGitText;
import org.eclipse.jgit.errors.IncorrectObjectTypeException;
import org.eclipse.jgit.errors.MissingObjectException;
import org.eclipse.jgit.lib.AnyObjectId;
@@ -97,13 +99,13 @@ public class LogCommand extends GitCommand<Iterable<RevCommit>> {
ObjectId headId = repo.resolve(Constants.HEAD);
if (headId == null)
throw new NoHeadException(
- "No HEAD exists and no explicit starting revision was specified");
+ JGitText.get().noHEADExistsAndNoExplicitStartingRevisionWasSpecified);
add(headId);
} catch (IOException e) {
// all exceptions thrown by add() shouldn't occur and represent
// severe low-level exception which are therefore wrapped
throw new JGitInternalException(
- "An exception occured while trying to add the Id of HEAD",
+ JGitText.get().anExceptionOccurredWhileTryingToAddTheIdOfHEAD,
e);
}
}
@@ -214,9 +216,9 @@ public class LogCommand extends GitCommand<Iterable<RevCommit>> {
} catch (IncorrectObjectTypeException e) {
throw e;
} catch (IOException e) {
- throw new JGitInternalException(
- "Exception occured during adding of " + start
- + " as option to a Log command", e);
+ throw new JGitInternalException(MessageFormat.format(
+ JGitText.get().exceptionOccuredDuringAddingOfOptionToALogCommand
+ , start), e);
}
}
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/diff/DiffFormatter.java b/org.eclipse.jgit/src/org/eclipse/jgit/diff/DiffFormatter.java
index 115d9baff3..2d552d40d9 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/diff/DiffFormatter.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/diff/DiffFormatter.java
@@ -50,6 +50,7 @@ import java.io.IOException;
import java.io.OutputStream;
import java.util.List;
+import org.eclipse.jgit.JGitText;
import org.eclipse.jgit.patch.FileHeader;
/**
@@ -75,7 +76,7 @@ public class DiffFormatter {
*/
public void setContext(final int lineCount) {
if (lineCount < 0)
- throw new IllegalArgumentException("context must be >= 0");
+ throw new IllegalArgumentException(JGitText.get().contextMustBeNonNegative);
context = lineCount;
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/diff/MyersDiff.java b/org.eclipse.jgit/src/org/eclipse/jgit/diff/MyersDiff.java
index 055729961b..6a4b44bff1 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/diff/MyersDiff.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/diff/MyersDiff.java
@@ -44,6 +44,9 @@
package org.eclipse.jgit.diff;
+import java.text.MessageFormat;
+
+import org.eclipse.jgit.JGitText;
import org.eclipse.jgit.util.IntList;
import org.eclipse.jgit.util.LongList;
@@ -292,21 +295,21 @@ public class MyersDiff {
final int getIndex(int d, int k) {
// TODO: remove
if (((d + k - middleK) % 2) == 1)
- throw new RuntimeException("odd: " + d + " + " + k + " - " + middleK);
+ throw new RuntimeException(MessageFormat.format(JGitText.get().unexpectedOddResult, d, k, middleK));
return (d + k - middleK) / 2;
}
final int getX(int d, int k) {
// TODO: remove
if (k < beginK || k > endK)
- throw new RuntimeException("k " + k + " not in " + beginK + " - " + endK);
+ throw new RuntimeException(MessageFormat.format(JGitText.get().kNotInRange, k, beginK, endK));
return x.get(getIndex(d, k));
}
final long getSnake(int d, int k) {
// TODO: remove
if (k < beginK || k > endK)
- throw new RuntimeException("k " + k + " not in " + beginK + " - " + endK);
+ throw new RuntimeException(MessageFormat.format(JGitText.get().kNotInRange, k, beginK, endK));
return snake.get(getIndex(d, k));
}
@@ -520,7 +523,7 @@ if (k < beginK || k > endK)
*/
public static void main(String[] args) {
if (args.length != 2) {
- System.err.println("Need 2 arguments");
+ System.err.println(JGitText.get().need2Arguments);
System.exit(1);
}
try {
@@ -532,4 +535,4 @@ if (k < beginK || k > endK)
e.printStackTrace();
}
}
-} \ No newline at end of file
+}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCache.java b/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCache.java
index 3a8abc1a73..42fea48520 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCache.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCache.java
@@ -56,9 +56,11 @@ import java.io.OutputStream;
import java.io.UnsupportedEncodingException;
import java.security.DigestOutputStream;
import java.security.MessageDigest;
+import java.text.MessageFormat;
import java.util.Arrays;
import java.util.Comparator;
+import org.eclipse.jgit.JGitText;
import org.eclipse.jgit.errors.CorruptObjectException;
import org.eclipse.jgit.errors.UnmergedPathException;
import org.eclipse.jgit.lib.Constants;
@@ -200,7 +202,7 @@ public class DirCache {
throws CorruptObjectException, IOException {
final DirCache c = new DirCache(indexLocation);
if (!c.lock())
- throw new IOException("Cannot lock " + indexLocation);
+ throw new IOException(MessageFormat.format(JGitText.get().cannotLock, indexLocation));
try {
c.read();
@@ -319,7 +321,7 @@ public class DirCache {
*/
public void read() throws IOException, CorruptObjectException {
if (liveFile == null)
- throw new IOException("DirCache does not have a backing file");
+ throw new IOException(JGitText.get().dirCacheDoesNotHaveABackingFile);
if (!liveFile.exists())
clear();
else if (liveFile.lastModified() != lastModified) {
@@ -363,13 +365,13 @@ public class DirCache {
IO.readFully(in, hdr, 0, 12);
md.update(hdr, 0, 12);
if (!is_DIRC(hdr))
- throw new CorruptObjectException("Not a DIRC file.");
+ throw new CorruptObjectException(JGitText.get().notADIRCFile);
final int ver = NB.decodeInt32(hdr, 4);
if (ver != 2)
- throw new CorruptObjectException("Unknown DIRC version " + ver);
+ throw new CorruptObjectException(MessageFormat.format(JGitText.get().unknownDIRCVersion, ver));
entryCnt = NB.decodeInt32(hdr, 8);
if (entryCnt < 0)
- throw new CorruptObjectException("DIRC has too many entries.");
+ throw new CorruptObjectException(JGitText.get().DIRCHasTooManyEntries);
// Load the individual file entries.
//
@@ -398,9 +400,8 @@ public class DirCache {
switch (NB.decodeInt32(hdr, 0)) {
case EXT_TREE: {
if (Integer.MAX_VALUE < sz) {
- throw new CorruptObjectException("DIRC extension "
- + formatExtensionName(hdr) + " is too large at "
- + sz + " bytes.");
+ throw new CorruptObjectException(MessageFormat.format(JGitText.get().DIRCExtensionIsTooLargeAt
+ , formatExtensionName(hdr), sz));
}
final byte[] raw = new byte[(int) sz];
IO.readFully(in, raw, 0, raw.length);
@@ -421,16 +422,15 @@ public class DirCache {
// _required_ to understand this index format.
// Since we did not trap it above we must abort.
//
- throw new CorruptObjectException("DIRC extension "
- + formatExtensionName(hdr)
- + " not supported by this version.");
+ throw new CorruptObjectException(MessageFormat.format(JGitText.get().DIRCExtensionNotSupportedByThisVersion
+ , formatExtensionName(hdr)));
}
}
}
final byte[] exp = md.digest();
if (!Arrays.equals(exp, hdr)) {
- throw new CorruptObjectException("DIRC checksum mismatch");
+ throw new CorruptObjectException(JGitText.get().DIRCChecksumMismatch);
}
}
@@ -441,9 +441,8 @@ public class DirCache {
while (0 < sz) {
int n = in.read(b, 0, (int) Math.min(b.length, sz));
if (n < 0) {
- throw new EOFException("Short read of optional DIRC extension "
- + formatExtensionName(hdr) + "; expected another " + sz
- + " bytes within the section.");
+ throw new EOFException(MessageFormat.format(JGitText.get().shortReadOfOptionalDIRCExtensionExpectedAnotherBytes
+ , formatExtensionName(hdr), sz));
}
md.update(b, 0, n);
sz -= n;
@@ -475,7 +474,7 @@ public class DirCache {
*/
public boolean lock() throws IOException {
if (liveFile == null)
- throw new IOException("DirCache does not have a backing file");
+ throw new IOException(JGitText.get().dirCacheDoesNotHaveABackingFile);
final LockFile tmp = new LockFile(liveFile);
if (tmp.lock()) {
tmp.setNeedStatInformation(true);
@@ -585,10 +584,10 @@ public class DirCache {
private void requireLocked(final LockFile tmp) {
if (liveFile == null)
- throw new IllegalStateException("DirCache is not locked");
+ throw new IllegalStateException(JGitText.get().dirCacheIsNotLocked);
if (tmp == null)
- throw new IllegalStateException("DirCache "
- + liveFile.getAbsolutePath() + " not locked.");
+ throw new IllegalStateException(MessageFormat.format(JGitText.get().dirCacheFileIsNotLocked
+ , liveFile.getAbsolutePath()));
}
/**
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheBuilder.java b/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheBuilder.java
index 69f5444c64..e6b6197819 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheBuilder.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheBuilder.java
@@ -45,8 +45,10 @@
package org.eclipse.jgit.dircache;
import java.io.IOException;
+import java.text.MessageFormat;
import java.util.Arrays;
+import org.eclipse.jgit.JGitText;
import org.eclipse.jgit.lib.AnyObjectId;
import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.lib.WindowCursor;
@@ -101,8 +103,8 @@ public class DirCacheBuilder extends BaseDirCacheEditor {
*/
public void add(final DirCacheEntry newEntry) {
if (newEntry.getRawMode() == 0)
- throw new IllegalArgumentException("FileMode not set for path "
- + newEntry.getPathString());
+ throw new IllegalArgumentException(MessageFormat.format(JGitText.get().fileModeNotSetForPath
+ , newEntry.getPathString()));
beforeAdd(newEntry);
fastAdd(newEntry);
}
@@ -214,9 +216,9 @@ public class DirCacheBuilder extends BaseDirCacheEditor {
final int peStage = lastEntry.getStage();
final int dceStage = newEntry.getStage();
if (peStage == dceStage)
- throw bad(newEntry, "Duplicate stages not allowed");
+ throw bad(newEntry, JGitText.get().duplicateStagesNotAllowed);
if (peStage == 0 || dceStage == 0)
- throw bad(newEntry, "Mixed stages not allowed");
+ throw bad(newEntry, JGitText.get().mixedStagesNotAllowed);
if (peStage > dceStage)
sorted = false;
}
@@ -237,9 +239,9 @@ public class DirCacheBuilder extends BaseDirCacheEditor {
final int peStage = pe.getStage();
final int ceStage = ce.getStage();
if (peStage == ceStage)
- throw bad(ce, "Duplicate stages not allowed");
+ throw bad(ce, JGitText.get().duplicateStagesNotAllowed);
if (peStage == 0 || ceStage == 0)
- throw bad(ce, "Mixed stages not allowed");
+ throw bad(ce, JGitText.get().mixedStagesNotAllowed);
}
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheEditor.java b/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheEditor.java
index 85ad8b4d79..77e9d51e05 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheEditor.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheEditor.java
@@ -45,11 +45,13 @@
package org.eclipse.jgit.dircache;
import java.io.IOException;
+import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
+import org.eclipse.jgit.JGitText;
import org.eclipse.jgit.lib.Constants;
/**
@@ -149,8 +151,8 @@ public class DirCacheEditor extends BaseDirCacheEditor {
ent = new DirCacheEntry(e.path);
e.apply(ent);
if (ent.getRawMode() == 0)
- throw new IllegalArgumentException("FileMode not set"
- + " for path " + ent.getPathString());
+ throw new IllegalArgumentException(MessageFormat.format(JGitText.get().fileModeNotSetForPath
+ , ent.getPathString()));
} else {
ent = cache.getEntry(eIdx);
e.apply(ent);
@@ -241,7 +243,7 @@ public class DirCacheEditor extends BaseDirCacheEditor {
}
public void apply(final DirCacheEntry ent) {
- throw new UnsupportedOperationException("No apply in delete");
+ throw new UnsupportedOperationException(JGitText.get().noApplyInDelete);
}
}
@@ -271,7 +273,7 @@ public class DirCacheEditor extends BaseDirCacheEditor {
}
public void apply(final DirCacheEntry ent) {
- throw new UnsupportedOperationException("No apply in delete");
+ throw new UnsupportedOperationException(JGitText.get().noApplyInDelete);
}
}
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheEntry.java b/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheEntry.java
index 415de095b2..afa6bef05b 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheEntry.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheEntry.java
@@ -51,8 +51,10 @@ import java.io.InputStream;
import java.io.OutputStream;
import java.nio.ByteBuffer;
import java.security.MessageDigest;
+import java.text.MessageFormat;
import java.util.Arrays;
+import org.eclipse.jgit.JGitText;
import org.eclipse.jgit.lib.AnyObjectId;
import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.lib.FileMode;
@@ -145,7 +147,7 @@ public class DirCacheEntry {
for (;;) {
final int c = in.read();
if (c < 0)
- throw new EOFException("Short read of block.");
+ throw new EOFException(JGitText.get().shortReadOfBlock);
if (c == 0)
break;
tmp.write(c);
@@ -229,11 +231,11 @@ public class DirCacheEntry {
*/
public DirCacheEntry(final byte[] newPath, final int stage) {
if (!isValidPath(newPath))
- throw new IllegalArgumentException("Invalid path: "
- + toString(newPath));
+ throw new IllegalArgumentException(MessageFormat.format(JGitText.get().invalidPath
+ , toString(newPath)));
if (stage < 0 || 3 < stage)
- throw new IllegalArgumentException("Invalid stage " + stage
- + " for path " + toString(newPath));
+ throw new IllegalArgumentException(MessageFormat.format(JGitText.get().invalidStageForPath
+ , stage, toString(newPath)));
info = new byte[INFO_LEN];
infoOffset = 0;
@@ -397,8 +399,8 @@ public class DirCacheEntry {
switch (mode.getBits() & FileMode.TYPE_MASK) {
case FileMode.TYPE_MISSING:
case FileMode.TYPE_TREE:
- throw new IllegalArgumentException("Invalid mode " + mode
- + " for path " + getPathString());
+ throw new IllegalArgumentException(MessageFormat.format(JGitText.get().invalidModeForPath
+ , mode, getPathString()));
}
NB.encodeInt32(info, infoOffset + P_MODE, mode.getBits());
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/errors/CheckoutConflictException.java b/org.eclipse.jgit/src/org/eclipse/jgit/errors/CheckoutConflictException.java
index b602033dc0..7c6560a3ec 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/errors/CheckoutConflictException.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/errors/CheckoutConflictException.java
@@ -46,6 +46,9 @@
package org.eclipse.jgit.errors;
import java.io.IOException;
+import java.text.MessageFormat;
+
+import org.eclipse.jgit.JGitText;
/**
* Exception thrown if a conflict occurs during a merge checkout.
@@ -59,7 +62,7 @@ public class CheckoutConflictException extends IOException {
* @param file
*/
public CheckoutConflictException(String file) {
- super("Checkout conflict with file: " + file);
+ super(MessageFormat.format(JGitText.get().checkoutConflictWithFile, file));
}
/**
@@ -68,7 +71,7 @@ public class CheckoutConflictException extends IOException {
* @param files
*/
public CheckoutConflictException(String[] files) {
- super("Checkout conflict with files: " + buildList(files));
+ super(MessageFormat.format(JGitText.get().checkoutConflictWithFiles, buildList(files)));
}
private static String buildList(String[] files) {
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/errors/CompoundException.java b/org.eclipse.jgit/src/org/eclipse/jgit/errors/CompoundException.java
index edee6084b3..1c432a817d 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/errors/CompoundException.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/errors/CompoundException.java
@@ -48,13 +48,15 @@ import java.util.Collection;
import java.util.Collections;
import java.util.List;
+import org.eclipse.jgit.JGitText;
+
/** An exception detailing multiple reasons for failure. */
public class CompoundException extends Exception {
private static final long serialVersionUID = 1L;
private static String format(final Collection<Throwable> causes) {
final StringBuilder msg = new StringBuilder();
- msg.append("Failure due to one of the following:");
+ msg.append(JGitText.get().failureDueToOneOfTheFollowing);
for (final Throwable c : causes) {
msg.append(" ");
msg.append(c.getMessage());
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/errors/CorruptObjectException.java b/org.eclipse.jgit/src/org/eclipse/jgit/errors/CorruptObjectException.java
index f42b0d7e19..939dc21604 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/errors/CorruptObjectException.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/errors/CorruptObjectException.java
@@ -47,7 +47,9 @@
package org.eclipse.jgit.errors;
import java.io.IOException;
+import java.text.MessageFormat;
+import org.eclipse.jgit.JGitText;
import org.eclipse.jgit.lib.AnyObjectId;
import org.eclipse.jgit.lib.ObjectId;
@@ -76,7 +78,7 @@ public class CorruptObjectException extends IOException {
* @param why
*/
public CorruptObjectException(final ObjectId id, final String why) {
- super("Object " + id.name() + " is corrupt: " + why);
+ super(MessageFormat.format(JGitText.get().objectIsCorrupt, id.name(), why));
}
/**
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/errors/EntryExistsException.java b/org.eclipse.jgit/src/org/eclipse/jgit/errors/EntryExistsException.java
index 893ee9ceb2..d7e587e3d0 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/errors/EntryExistsException.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/errors/EntryExistsException.java
@@ -45,6 +45,9 @@
package org.eclipse.jgit.errors;
import java.io.IOException;
+import java.text.MessageFormat;
+
+import org.eclipse.jgit.JGitText;
/**
* Attempt to add an entry to a tree that already exists.
@@ -59,6 +62,6 @@ public class EntryExistsException extends IOException {
* @param name workdir relative file name
*/
public EntryExistsException(final String name) {
- super("Tree entry \"" + name + "\" already exists.");
+ super(MessageFormat.format(JGitText.get().treeEntryAlreadyExists, name));
}
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/errors/IncorrectObjectTypeException.java b/org.eclipse.jgit/src/org/eclipse/jgit/errors/IncorrectObjectTypeException.java
index 7cf1de214f..0dac326f40 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/errors/IncorrectObjectTypeException.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/errors/IncorrectObjectTypeException.java
@@ -47,7 +47,9 @@
package org.eclipse.jgit.errors;
import java.io.IOException;
+import java.text.MessageFormat;
+import org.eclipse.jgit.JGitText;
import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.lib.ObjectId;
@@ -69,7 +71,7 @@ public class IncorrectObjectTypeException extends IOException {
* @param type object type
*/
public IncorrectObjectTypeException(final ObjectId id, final String type) {
- super("Object " + id.name() + " is not a " + type + ".");
+ super(MessageFormat.format(JGitText.get().objectIsNotA, id.name(), type));
}
/**
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/errors/InvalidObjectIdException.java b/org.eclipse.jgit/src/org/eclipse/jgit/errors/InvalidObjectIdException.java
index e6577213ee..96c75f5558 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/errors/InvalidObjectIdException.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/errors/InvalidObjectIdException.java
@@ -46,6 +46,9 @@
package org.eclipse.jgit.errors;
import java.io.UnsupportedEncodingException;
+import java.text.MessageFormat;
+
+import org.eclipse.jgit.JGitText;
/**
* Thrown when an invalid object id is passed in as an argument.
@@ -61,7 +64,7 @@ public class InvalidObjectIdException extends IllegalArgumentException {
* @param length of the sequence of invalid bytes.
*/
public InvalidObjectIdException(byte[] bytes, int offset, int length) {
- super("Invalid id" + asAscii(bytes, offset, length));
+ super(MessageFormat.format(JGitText.get().invalidId, asAscii(bytes, offset, length)));
}
private static String asAscii(byte[] bytes, int offset, int length) {
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/errors/MissingBundlePrerequisiteException.java b/org.eclipse.jgit/src/org/eclipse/jgit/errors/MissingBundlePrerequisiteException.java
index 2d399543a0..63b0e200ca 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/errors/MissingBundlePrerequisiteException.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/errors/MissingBundlePrerequisiteException.java
@@ -46,6 +46,7 @@ package org.eclipse.jgit.errors;
import java.util.Map;
+import org.eclipse.jgit.JGitText;
import org.eclipse.jgit.lib.ObjectId;
import org.eclipse.jgit.transport.URIish;
@@ -57,7 +58,7 @@ public class MissingBundlePrerequisiteException extends TransportException {
private static String format(final Map<ObjectId, String> missingCommits) {
final StringBuilder r = new StringBuilder();
- r.append("missing prerequisite commits:");
+ r.append(JGitText.get().missingPrerequisiteCommits);
for (final Map.Entry<ObjectId, String> e : missingCommits.entrySet()) {
r.append("\n ");
r.append(e.getKey().name());
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/errors/MissingObjectException.java b/org.eclipse.jgit/src/org/eclipse/jgit/errors/MissingObjectException.java
index 41cacb84ad..1d193e18c7 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/errors/MissingObjectException.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/errors/MissingObjectException.java
@@ -47,7 +47,9 @@
package org.eclipse.jgit.errors;
import java.io.IOException;
+import java.text.MessageFormat;
+import org.eclipse.jgit.JGitText;
import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.lib.ObjectId;
@@ -65,7 +67,7 @@ public class MissingObjectException extends IOException {
* @param type object type
*/
public MissingObjectException(final ObjectId id, final String type) {
- super("Missing " + type + " " + id.name());
+ super(MessageFormat.format(JGitText.get().missingObject, type, id.name()));
}
/**
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/errors/NoClosingBracketException.java b/org.eclipse.jgit/src/org/eclipse/jgit/errors/NoClosingBracketException.java
index 623dfa6ec6..25cf800fa7 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/errors/NoClosingBracketException.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/errors/NoClosingBracketException.java
@@ -46,6 +46,10 @@
package org.eclipse.jgit.errors;
+import java.text.MessageFormat;
+
+import org.eclipse.jgit.JGitText;
+
/**
* Thrown when a pattern contains a character group which is open to the right
* side or a character class which is open to the right side.
@@ -72,7 +76,7 @@ public class NoClosingBracketException extends InvalidPatternException {
private static String createMessage(final int indexOfOpeningBracket,
final String openingBracket, final String closingBracket) {
- return String.format("No closing %s found for %s at index %s.",
+ return MessageFormat.format(JGitText.get().noClosingBracket,
closingBracket, openingBracket,
Integer.valueOf(indexOfOpeningBracket));
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/errors/PackInvalidException.java b/org.eclipse.jgit/src/org/eclipse/jgit/errors/PackInvalidException.java
index a34b80db81..59354ddb70 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/errors/PackInvalidException.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/errors/PackInvalidException.java
@@ -45,6 +45,9 @@ package org.eclipse.jgit.errors;
import java.io.File;
import java.io.IOException;
+import java.text.MessageFormat;
+
+import org.eclipse.jgit.JGitText;
/** Thrown when a PackFile previously failed and is known to be unusable */
public class PackInvalidException extends IOException {
@@ -57,6 +60,6 @@ public class PackInvalidException extends IOException {
* path of the invalid pack file.
*/
public PackInvalidException(final File path) {
- super("Pack file invalid: " + path.getAbsolutePath());
+ super(MessageFormat.format(JGitText.get().packFileInvalid, path.getAbsolutePath()));
}
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/errors/RepositoryNotFoundException.java b/org.eclipse.jgit/src/org/eclipse/jgit/errors/RepositoryNotFoundException.java
index c745e7326e..d00a766880 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/errors/RepositoryNotFoundException.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/errors/RepositoryNotFoundException.java
@@ -44,6 +44,9 @@
package org.eclipse.jgit.errors;
import java.io.File;
+import java.text.MessageFormat;
+
+import org.eclipse.jgit.JGitText;
/** Indicates a local repository does not exist. */
public class RepositoryNotFoundException extends TransportException {
@@ -94,6 +97,6 @@ public class RepositoryNotFoundException extends TransportException {
}
private static String message(final String location) {
- return "repository not found: " + location;
+ return MessageFormat.format(JGitText.get().repositoryNotFound, location);
}
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/errors/RevWalkException.java b/org.eclipse.jgit/src/org/eclipse/jgit/errors/RevWalkException.java
index 0ad41ed173..7b9c70736b 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/errors/RevWalkException.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/errors/RevWalkException.java
@@ -44,6 +44,7 @@
package org.eclipse.jgit.errors;
+import org.eclipse.jgit.JGitText;
import org.eclipse.jgit.revwalk.RevWalk;
/**
@@ -65,6 +66,6 @@ public class RevWalkException extends RuntimeException {
* the checked exception that describes why the walk failed.
*/
public RevWalkException(final Throwable cause) {
- super("Walk failure.", cause);
+ super(JGitText.get().walkFailure, cause);
}
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/errors/UnmergedPathException.java b/org.eclipse.jgit/src/org/eclipse/jgit/errors/UnmergedPathException.java
index 51e651ca5e..ccc960e967 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/errors/UnmergedPathException.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/errors/UnmergedPathException.java
@@ -44,7 +44,9 @@
package org.eclipse.jgit.errors;
import java.io.IOException;
+import java.text.MessageFormat;
+import org.eclipse.jgit.JGitText;
import org.eclipse.jgit.dircache.DirCacheEntry;
/**
@@ -62,7 +64,7 @@ public class UnmergedPathException extends IOException {
* the first non-zero stage of the unmerged path.
*/
public UnmergedPathException(final DirCacheEntry dce) {
- super("Unmerged path: " + dce.getPathString());
+ super(MessageFormat.format(JGitText.get().unmergedPath, dce.getPathString()));
entry = dce;
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/fnmatch/AbstractHead.java b/org.eclipse.jgit/src/org/eclipse/jgit/fnmatch/AbstractHead.java
index 42182965a0..cff542be2e 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/fnmatch/AbstractHead.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/fnmatch/AbstractHead.java
@@ -46,6 +46,8 @@ package org.eclipse.jgit.fnmatch;
import java.util.List;
+import org.eclipse.jgit.JGitText;
+
abstract class AbstractHead implements Head {
private List<Head> newHeads = null;
@@ -64,7 +66,7 @@ abstract class AbstractHead implements Head {
*/
public final void setNewHeads(List<Head> newHeads) {
if (this.newHeads != null)
- throw new IllegalStateException("Property is already non null");
+ throw new IllegalStateException(JGitText.get().propertyIsAlreadyNonNull);
this.newHeads = newHeads;
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/fnmatch/GroupHead.java b/org.eclipse.jgit/src/org/eclipse/jgit/fnmatch/GroupHead.java
index 79f64f859e..ffa34a7104 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/fnmatch/GroupHead.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/fnmatch/GroupHead.java
@@ -44,11 +44,13 @@
package org.eclipse.jgit.fnmatch;
+import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
+import org.eclipse.jgit.JGitText;
import org.eclipse.jgit.errors.InvalidPatternException;
final class GroupHead extends AbstractHead {
@@ -112,9 +114,9 @@ final class GroupHead extends AbstractHead {
characterClasses.add(LetterPattern.INSTANCE);
characterClasses.add(DigitPattern.INSTANCE);
} else {
- final String message = String.format(
- "The character class %s is not supported.",
- characterClass);
+ final String message = String.format(MessageFormat.format(
+ JGitText.get().characterClassIsNotSupported,
+ characterClass));
throw new InvalidPatternException(message, wholePattern);
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/AbbreviatedObjectId.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/AbbreviatedObjectId.java
index 9d9174111b..a150e8fea1 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/AbbreviatedObjectId.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/AbbreviatedObjectId.java
@@ -43,6 +43,9 @@
package org.eclipse.jgit.lib;
+import java.text.MessageFormat;
+
+import org.eclipse.jgit.JGitText;
import org.eclipse.jgit.errors.InvalidObjectIdException;
import org.eclipse.jgit.util.NB;
import org.eclipse.jgit.util.RawParseUtils;
@@ -74,7 +77,8 @@ public final class AbbreviatedObjectId {
public static final AbbreviatedObjectId fromString(final byte[] buf,
final int offset, final int end) {
if (end - offset > Constants.OBJECT_ID_STRING_LENGTH)
- throw new IllegalArgumentException("Invalid id");
+ throw new IllegalArgumentException(MessageFormat.format(JGitText.get().invalidIdLength
+ , end - offset, Constants.OBJECT_ID_STRING_LENGTH));
return fromHexString(buf, offset, end);
}
@@ -87,7 +91,7 @@ public final class AbbreviatedObjectId {
*/
public static final AbbreviatedObjectId fromString(final String str) {
if (str.length() > Constants.OBJECT_ID_STRING_LENGTH)
- throw new IllegalArgumentException("Invalid id: " + str);
+ throw new IllegalArgumentException(MessageFormat.format(JGitText.get().invalidId, str));
final byte[] b = Constants.encodeASCII(str);
return fromHexString(b, 0, b.length);
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/BinaryDelta.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/BinaryDelta.java
index 461e6d4026..a59b335330 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/BinaryDelta.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/BinaryDelta.java
@@ -44,6 +44,8 @@
package org.eclipse.jgit.lib;
+import org.eclipse.jgit.JGitText;
+
/**
* Recreate a stream from a base stream and a GIT pack delta.
* <p>
@@ -78,7 +80,7 @@ public class BinaryDelta {
shift += 7;
} while ((c & 0x80) != 0);
if (base.length != baseLen)
- throw new IllegalArgumentException("base length incorrect");
+ throw new IllegalArgumentException(JGitText.get().baseLengthIncorrect);
// Length of the resulting object (a variable length int).
//
@@ -132,7 +134,7 @@ public class BinaryDelta {
// cmd == 0 has been reserved for future encoding but
// for now its not acceptable.
//
- throw new IllegalArgumentException("unsupported command 0");
+ throw new IllegalArgumentException(JGitText.get().unsupportedCommand0);
}
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/BlobBasedConfig.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/BlobBasedConfig.java
index 0a4222fc38..b05942b02c 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/BlobBasedConfig.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/BlobBasedConfig.java
@@ -47,7 +47,9 @@ package org.eclipse.jgit.lib;
import java.io.FileNotFoundException;
import java.io.IOException;
+import java.text.MessageFormat;
+import org.eclipse.jgit.JGitText;
import org.eclipse.jgit.errors.ConfigInvalidException;
import org.eclipse.jgit.treewalk.TreeWalk;
import org.eclipse.jgit.util.RawParseUtils;
@@ -91,7 +93,7 @@ public class BlobBasedConfig extends Config {
super(base);
final ObjectLoader loader = r.openBlob(objectId);
if (loader == null)
- throw new IOException("Blob not found: " + objectId);
+ throw new IOException(MessageFormat.format(JGitText.get().blobNotFound, objectId));
fromText(RawParseUtils.decode(loader.getBytes()));
}
@@ -118,12 +120,12 @@ public class BlobBasedConfig extends Config {
final Repository r = commit.getRepository();
final TreeWalk tree = TreeWalk.forPath(r, path, treeId);
if (tree == null)
- throw new FileNotFoundException("Entry not found by path: " + path);
+ throw new FileNotFoundException(MessageFormat.format(JGitText.get().entryNotFoundByPath, path));
final ObjectId blobId = tree.getObjectId(0);
final ObjectLoader loader = tree.getRepository().openBlob(blobId);
if (loader == null)
- throw new IOException("Blob not found: " + blobId + " for path: "
- + path);
+ throw new IOException(MessageFormat.format(JGitText.get().blobNotFoundForPath
+ , blobId, path));
fromText(RawParseUtils.decode(loader.getBytes()));
}
}
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$
}
/**
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/Config.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/Config.java
index 062c1c3974..7c5af1e648 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/Config.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/Config.java
@@ -50,6 +50,7 @@
package org.eclipse.jgit.lib;
+import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
@@ -59,6 +60,7 @@ import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.atomic.AtomicReference;
+import org.eclipse.jgit.JGitText;
import org.eclipse.jgit.errors.ConfigInvalidException;
import org.eclipse.jgit.util.StringUtils;
@@ -210,8 +212,8 @@ public class Config {
final long val = getLong(section, subsection, name, defaultValue);
if (Integer.MIN_VALUE <= val && val <= Integer.MAX_VALUE)
return (int) val;
- throw new IllegalArgumentException("Integer value " + section + "."
- + name + " out of range");
+ throw new IllegalArgumentException(MessageFormat.format(JGitText.get().integerValueOutOfRange
+ , section, name));
}
/**
@@ -257,8 +259,8 @@ public class Config {
try {
return mul * Long.parseLong(n);
} catch (NumberFormatException nfe) {
- throw new IllegalArgumentException("Invalid integer value: "
- + section + "." + name + "=" + str);
+ throw new IllegalArgumentException(MessageFormat.format(JGitText.get().invalidIntegerValue
+ , section, name, str));
}
}
@@ -303,8 +305,8 @@ public class Config {
try {
return StringUtils.toBoolean(n);
} catch (IllegalArgumentException err) {
- throw new IllegalArgumentException("Invalid boolean value: "
- + section + "." + name + "=" + n);
+ throw new IllegalArgumentException(MessageFormat.format(JGitText.get().invalidBooleanValue
+ , section, name, n));
}
}
@@ -819,7 +821,7 @@ public class Config {
input = in.read();
}
if (']' != input)
- throw new ConfigInvalidException("Bad group header");
+ throw new ConfigInvalidException(JGitText.get().badGroupHeader);
e.suffix = "";
} else if (last != null) {
@@ -835,7 +837,7 @@ public class Config {
e.value = readValue(in, false, -1);
} else
- throw new ConfigInvalidException("Invalid line in config file");
+ throw new ConfigInvalidException(JGitText.get().invalidLineInConfigFile);
}
state.set(newState(newEntries));
@@ -862,7 +864,7 @@ public class Config {
for (;;) {
int c = in.read();
if (c < 0)
- throw new ConfigInvalidException("Unexpected end of config file");
+ throw new ConfigInvalidException(JGitText.get().unexpectedEndOfConfigFile);
if (']' == c) {
in.reset();
@@ -873,7 +875,7 @@ public class Config {
for (;;) {
c = in.read();
if (c < 0)
- throw new ConfigInvalidException("Unexpected end of config file");
+ throw new ConfigInvalidException(JGitText.get().unexpectedEndOfConfigFile);
if ('"' == c) {
in.reset();
@@ -882,7 +884,7 @@ public class Config {
if (' ' == c || '\t' == c)
continue; // Skipped...
- throw new ConfigInvalidException("Bad section entry: " + name);
+ throw new ConfigInvalidException(MessageFormat.format(JGitText.get().badSectionEntry, name));
}
break;
}
@@ -890,7 +892,7 @@ public class Config {
if (Character.isLetterOrDigit((char) c) || '.' == c || '-' == c)
name.append((char) c);
else
- throw new ConfigInvalidException("Bad section entry: " + name);
+ throw new ConfigInvalidException(MessageFormat.format(JGitText.get().badSectionEntry, name));
}
return name.toString();
}
@@ -901,7 +903,7 @@ public class Config {
for (;;) {
int c = in.read();
if (c < 0)
- throw new ConfigInvalidException("Unexpected end of config file");
+ throw new ConfigInvalidException(JGitText.get().unexpectedEndOfConfigFile);
if ('=' == c)
break;
@@ -910,7 +912,7 @@ public class Config {
for (;;) {
c = in.read();
if (c < 0)
- throw new ConfigInvalidException("Unexpected end of config file");
+ throw new ConfigInvalidException(JGitText.get().unexpectedEndOfConfigFile);
if ('=' == c)
break;
@@ -922,7 +924,7 @@ public class Config {
if (' ' == c || '\t' == c)
continue; // Skipped...
- throw new ConfigInvalidException("Bad entry delimiter");
+ throw new ConfigInvalidException(JGitText.get().badEntryDelimiter);
}
break;
}
@@ -937,7 +939,7 @@ public class Config {
name.append((char) c);
break;
} else
- throw new ConfigInvalidException("Bad entry name: " + name);
+ throw new ConfigInvalidException(MessageFormat.format(JGitText.get().badEntryName, name));
}
return name.toString();
}
@@ -950,13 +952,13 @@ public class Config {
int c = in.read();
if (c < 0) {
if (value.length() == 0)
- throw new ConfigInvalidException("Unexpected end of config file");
+ throw new ConfigInvalidException(JGitText.get().unexpectedEndOfConfigFile);
break;
}
if ('\n' == c) {
if (quote)
- throw new ConfigInvalidException("Newline in quotes not allowed");
+ throw new ConfigInvalidException(JGitText.get().newlineInQuotesNotAllowed);
in.reset();
break;
}
@@ -985,7 +987,7 @@ public class Config {
c = in.read();
switch (c) {
case -1:
- throw new ConfigInvalidException("End of file in escape");
+ throw new ConfigInvalidException(JGitText.get().endOfFileInEscape);
case '\n':
continue;
case 't':
@@ -1004,7 +1006,7 @@ public class Config {
value.append('"');
continue;
default:
- throw new ConfigInvalidException("Bad escape: " + ((char) c));
+ throw new ConfigInvalidException(MessageFormat.format(JGitText.get().badEscape, ((char) c)));
}
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/Constants.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/Constants.java
index 348905dd12..37836f3246 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/Constants.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/Constants.java
@@ -49,7 +49,9 @@ import java.nio.ByteBuffer;
import java.nio.charset.Charset;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
+import java.text.MessageFormat;
+import org.eclipse.jgit.JGitText;
import org.eclipse.jgit.errors.CorruptObjectException;
import org.eclipse.jgit.util.MutableInteger;
@@ -327,8 +329,8 @@ public final class Constants {
try {
return MessageDigest.getInstance(HASH_FUNCTION);
} catch (NoSuchAlgorithmException nsae) {
- throw new RuntimeException("Required hash function "
- + HASH_FUNCTION + " not available.", nsae);
+ throw new RuntimeException(MessageFormat.format(
+ JGitText.get().requiredHashFunctionNotAvailable, HASH_FUNCTION), nsae);
}
}
@@ -349,7 +351,7 @@ public final class Constants {
case OBJ_TAG:
return TYPE_TAG;
default:
- throw new IllegalArgumentException("Bad object type: " + typeCode);
+ throw new IllegalArgumentException(MessageFormat.format(JGitText.get().badObjectType, typeCode));
}
}
@@ -373,7 +375,7 @@ public final class Constants {
case OBJ_TAG:
return ENCODED_TYPE_TAG;
default:
- throw new IllegalArgumentException("Bad object type: " + typeCode);
+ throw new IllegalArgumentException(MessageFormat.format(JGitText.get().badObjectType, typeCode));
}
}
@@ -408,7 +410,7 @@ public final class Constants {
|| typeString[position + 2] != 'o'
|| typeString[position + 3] != 'b'
|| typeString[position + 4] != endMark)
- throw new CorruptObjectException(id, "invalid type");
+ throw new CorruptObjectException(id, JGitText.get().corruptObjectInvalidType);
offset.value = position + 5;
return Constants.OBJ_BLOB;
@@ -419,7 +421,7 @@ public final class Constants {
|| typeString[position + 4] != 'i'
|| typeString[position + 5] != 't'
|| typeString[position + 6] != endMark)
- throw new CorruptObjectException(id, "invalid type");
+ throw new CorruptObjectException(id, JGitText.get().corruptObjectInvalidType);
offset.value = position + 7;
return Constants.OBJ_COMMIT;
@@ -428,7 +430,7 @@ public final class Constants {
case 'a':
if (typeString[position + 2] != 'g'
|| typeString[position + 3] != endMark)
- throw new CorruptObjectException(id, "invalid type");
+ throw new CorruptObjectException(id, JGitText.get().corruptObjectInvalidType);
offset.value = position + 4;
return Constants.OBJ_TAG;
@@ -436,19 +438,19 @@ public final class Constants {
if (typeString[position + 2] != 'e'
|| typeString[position + 3] != 'e'
|| typeString[position + 4] != endMark)
- throw new CorruptObjectException(id, "invalid type");
+ throw new CorruptObjectException(id, JGitText.get().corruptObjectInvalidType);
offset.value = position + 5;
return Constants.OBJ_TREE;
default:
- throw new CorruptObjectException(id, "invalid type");
+ throw new CorruptObjectException(id, JGitText.get().corruptObjectInvalidType);
}
default:
- throw new CorruptObjectException(id, "invalid type");
+ throw new CorruptObjectException(id, JGitText.get().corruptObjectInvalidType);
}
} catch (ArrayIndexOutOfBoundsException bad) {
- throw new CorruptObjectException(id, "invalid type");
+ throw new CorruptObjectException(id, JGitText.get().corruptObjectInvalidType);
}
}
@@ -481,7 +483,7 @@ public final class Constants {
for (int k = r.length - 1; k >= 0; k--) {
final char c = s.charAt(k);
if (c > 127)
- throw new IllegalArgumentException("Not ASCII string: " + s);
+ throw new IllegalArgumentException(MessageFormat.format(JGitText.get().notASCIIString, s));
r[k] = (byte) c;
}
return r;
@@ -512,7 +514,7 @@ public final class Constants {
static {
if (OBJECT_ID_LENGTH != newMessageDigest().getDigestLength())
- throw new LinkageError("Incorrect OBJECT_ID_LENGTH.");
+ throw new LinkageError(JGitText.get().incorrectOBJECT_ID_LENGTH);
CHARSET = Charset.forName(CHARACTER_ENCODING);
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/DeltaOfsPackedObjectLoader.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/DeltaOfsPackedObjectLoader.java
index 0b7c6c45f8..d0e98a2a92 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/DeltaOfsPackedObjectLoader.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/DeltaOfsPackedObjectLoader.java
@@ -48,6 +48,7 @@ package org.eclipse.jgit.lib;
import java.io.IOException;
+import org.eclipse.jgit.JGitText;
import org.eclipse.jgit.errors.CorruptObjectException;
/** Reads a deltified object which uses an offset to find its base. */
@@ -75,7 +76,7 @@ class DeltaOfsPackedObjectLoader extends DeltaPackedObjectLoader {
final ObjectId id = pack.findObjectForOffset(deltaBase);
if (id == null)
throw new CorruptObjectException(
- "Offset-written delta base for object not found in a pack");
+ JGitText.get().offsetWrittenDeltaBaseForObjectNotFoundInAPack);
return id;
}
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/DeltaPackedObjectLoader.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/DeltaPackedObjectLoader.java
index b42549943a..bbc1c62a8a 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/DeltaPackedObjectLoader.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/DeltaPackedObjectLoader.java
@@ -47,8 +47,10 @@
package org.eclipse.jgit.lib;
import java.io.IOException;
+import java.text.MessageFormat;
import java.util.zip.DataFormatException;
+import org.eclipse.jgit.JGitText;
import org.eclipse.jgit.errors.CorruptObjectException;
/** Reader for a deltified object stored in a pack file. */
@@ -93,8 +95,8 @@ abstract class DeltaPackedObjectLoader extends PackedObjectLoader {
pack.saveCache(objectOffset, cachedBytes, objectType);
} catch (DataFormatException dfe) {
final CorruptObjectException coe;
- coe = new CorruptObjectException("Object at " + objectOffset
- + " in " + pack.getPackFile() + " has bad zlib stream");
+ coe = new CorruptObjectException(MessageFormat.format(JGitText.get().objectAtHasBadZlibStream,
+ objectOffset, pack.getPackFile()));
coe.initCause(dfe);
throw coe;
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/FileBasedConfig.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/FileBasedConfig.java
index 315c4670ad..eb00917917 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/FileBasedConfig.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/FileBasedConfig.java
@@ -52,7 +52,9 @@ package org.eclipse.jgit.lib;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
+import java.text.MessageFormat;
+import org.eclipse.jgit.JGitText;
import org.eclipse.jgit.errors.ConfigInvalidException;
import org.eclipse.jgit.util.IO;
import org.eclipse.jgit.util.RawParseUtils;
@@ -110,11 +112,11 @@ public class FileBasedConfig extends Config {
} catch (FileNotFoundException noFile) {
clear();
} catch (IOException e) {
- final IOException e2 = new IOException("Cannot read " + getFile());
+ final IOException e2 = new IOException(MessageFormat.format(JGitText.get().cannotReadFile, getFile()));
e2.initCause(e);
throw e2;
} catch (ConfigInvalidException e) {
- throw new ConfigInvalidException("Cannot read " + getFile(), e);
+ throw new ConfigInvalidException(MessageFormat.format(JGitText.get().cannotReadFile, getFile()), e);
}
}
@@ -134,12 +136,12 @@ public class FileBasedConfig extends Config {
final byte[] out = Constants.encode(toText());
final LockFile lf = new LockFile(getFile());
if (!lf.lock())
- throw new IOException("Cannot lock " + getFile());
+ throw new IOException(MessageFormat.format(JGitText.get().cannotLockFile, getFile()));
try {
lf.setNeedStatInformation(true);
lf.write(out);
if (!lf.commit())
- throw new IOException("Cannot commit write to " + getFile());
+ throw new IOException(MessageFormat.format(JGitText.get().cannotCommitWriteTo, getFile()));
} finally {
lf.unlock();
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/GitIndex.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/GitIndex.java
index bba18408c8..0203d5d44a 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/GitIndex.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/GitIndex.java
@@ -59,6 +59,7 @@ import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.nio.channels.FileChannel;
import java.security.MessageDigest;
+import java.text.MessageFormat;
import java.util.Comparator;
import java.util.Date;
import java.util.Iterator;
@@ -66,6 +67,7 @@ import java.util.Map;
import java.util.Stack;
import java.util.TreeMap;
+import org.eclipse.jgit.JGitText;
import org.eclipse.jgit.dircache.DirCache;
import org.eclipse.jgit.errors.CorruptObjectException;
import org.eclipse.jgit.errors.NotSupportedException;
@@ -238,7 +240,8 @@ public class GitIndex {
buffer.order(ByteOrder.BIG_ENDIAN);
int j = channel.read(buffer);
if (j != buffer.capacity())
- throw new IOException("Could not read index in one go, only "+j+" out of "+buffer.capacity()+" read");
+ throw new IOException(MessageFormat.format(JGitText.get().couldNotReadIndexInOneGo
+ , j, buffer.capacity()));
buffer.flip();
header = new Header(buffer);
entries.clear();
@@ -266,7 +269,7 @@ public class GitIndex {
File tmpIndex = new File(cacheFile.getAbsoluteFile() + ".tmp");
File lock = new File(cacheFile.getAbsoluteFile() + ".lock");
if (!lock.createNewFile())
- throw new IOException("Index file is in use");
+ throw new IOException(JGitText.get().indexFileIsInUse);
try {
FileOutputStream fileOutputStream = new FileOutputStream(tmpIndex);
FileChannel fc = fileOutputStream.getChannel();
@@ -298,10 +301,10 @@ public class GitIndex {
if (cacheFile.exists())
if (!cacheFile.delete())
throw new IOException(
- "Could not rename delete old index");
+ JGitText.get().couldNotRenameDeleteOldIndex);
if (!tmpIndex.renameTo(cacheFile))
throw new IOException(
- "Could not rename temporary index file to index");
+ JGitText.get().couldNotRenameTemporaryIndexFileToIndex);
changed = false;
statDirty = false;
lastCacheTime = cacheFile.lastModified();
@@ -309,10 +312,10 @@ public class GitIndex {
} finally {
if (!lock.delete())
throw new IOException(
- "Could not delete lock file. Should not happen");
+ JGitText.get().couldNotDeleteLockFileShouldNotHappen);
if (tmpIndex.exists() && !tmpIndex.delete())
throw new IOException(
- "Could not delete temporary index file. Should not happen");
+ JGitText.get().couldNotDeleteTemporaryIndexFileShouldNotHappen);
}
}
@@ -320,7 +323,7 @@ public class GitIndex {
for (Iterator i = entries.values().iterator(); i.hasNext();) {
Entry e = (Entry) i.next();
if (e.getStage() != 0) {
- throw new NotSupportedException("Cannot work with other stages than zero right now. Won't write corrupt index.");
+ throw new NotSupportedException(JGitText.get().cannotWorkWithOtherStagesThanZeroRightNow);
}
}
}
@@ -339,7 +342,7 @@ public class GitIndex {
static byte[] makeKey(File wd, File f) {
if (!f.getPath().startsWith(wd.getPath()))
- throw new Error("Path is not in working dir");
+ throw new Error(JGitText.get().pathIsNotInWorkingDir);
String relName = Repository.stripWorkDir(wd, f);
return Constants.encode(relName);
}
@@ -608,7 +611,8 @@ public class GitIndex {
if (!file.isDirectory())
return true;
} else {
- System.out.println("Does not handle mode "+mode+" ("+file+")");
+ System.out.println(MessageFormat.format(JGitText.get().doesNotHandleMode
+ , mode, file));
return true;
}
}
@@ -781,11 +785,11 @@ public class GitIndex {
version = buf.getInt();
entries = buf.getInt();
if (signature != 0x44495243)
- throw new CorruptObjectException("Index signature is invalid: "
- + signature);
+ throw new CorruptObjectException(MessageFormat.format(
+ JGitText.get().indexSignatureIsInvalid, signature));
if (version != 2)
- throw new CorruptObjectException(
- "Unknown index version (or corrupt index):" + version);
+ throw new CorruptObjectException(MessageFormat.format(
+ JGitText.get().unknownIndexVersionOrCorruptIndex, version));
}
void write(ByteBuffer buf) {
@@ -877,7 +881,7 @@ public class GitIndex {
ByteBuffer buffer = ByteBuffer.wrap(bytes);
int j = channel.write(buffer);
if (j != bytes.length)
- throw new IOException("Could not write file " + file);
+ throw new IOException(MessageFormat.format(JGitText.get().couldNotWriteFile, file));
channel.close();
if (config_filemode() && File_hasExecute()) {
if (FileMode.EXECUTABLE_FILE.equals(e.mode)) {
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/IndexTreeWalker.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/IndexTreeWalker.java
index b1ee94eff7..12f9af727d 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/IndexTreeWalker.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/IndexTreeWalker.java
@@ -48,6 +48,7 @@ package org.eclipse.jgit.lib;
import java.io.File;
import java.io.IOException;
+import org.eclipse.jgit.JGitText;
import org.eclipse.jgit.lib.GitIndex.Entry;
/**
@@ -143,8 +144,8 @@ public class IndexTreeWalker {
private void visitEntry(TreeEntry t1, TreeEntry t2,
Entry i) throws IOException {
- assert t1 != null || t2 != null || i != null : "Needs at least one entry";
- assert root != null : "Needs workdir";
+ assert t1 != null || t2 != null || i != null : JGitText.get().needsAtLeastOneEntry;
+ assert root != null : JGitText.get().needsWorkdir;
if (t1 != null && t1.getParent() == null)
t1 = null;
@@ -169,8 +170,8 @@ public class IndexTreeWalker {
private void finishVisitTree(TreeEntry t1, TreeEntry t2, int curIndexPos)
throws IOException {
- assert t1 != null || t2 != null : "Needs at least one entry";
- assert root != null : "Needs workdir";
+ assert t1 != null || t2 != null : JGitText.get().needsAtLeastOneEntry;
+ assert root != null : JGitText.get().needsWorkdir;
if (t1 != null && t1.getParent() == null)
t1 = null;
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/LockFile.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/LockFile.java
index bd773c4705..13f158dedf 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/LockFile.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/LockFile.java
@@ -54,6 +54,9 @@ import java.io.IOException;
import java.io.OutputStream;
import java.nio.channels.FileLock;
import java.nio.channels.OverlappingFileLockException;
+import java.text.MessageFormat;
+
+import org.eclipse.jgit.JGitText;
/**
* Git style file locking and replacement.
@@ -330,7 +333,7 @@ public class LockFile {
private void requireLock() {
if (os == null) {
unlock();
- throw new IllegalStateException("Lock on " + ref + " not held.");
+ throw new IllegalStateException(MessageFormat.format(JGitText.get().lockOnNotHeld, ref));
}
}
@@ -382,7 +385,7 @@ public class LockFile {
public boolean commit() {
if (os != null) {
unlock();
- throw new IllegalStateException("Lock on " + ref + " not closed.");
+ throw new IllegalStateException(MessageFormat.format(JGitText.get().lockOnNotClosed, ref));
}
saveStatInformation();
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/MutableObjectId.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/MutableObjectId.java
index a6680d0551..2e0e0118f0 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/MutableObjectId.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/MutableObjectId.java
@@ -46,6 +46,9 @@
package org.eclipse.jgit.lib;
+import java.text.MessageFormat;
+
+import org.eclipse.jgit.JGitText;
import org.eclipse.jgit.errors.InvalidObjectIdException;
import org.eclipse.jgit.util.NB;
import org.eclipse.jgit.util.RawParseUtils;
@@ -162,7 +165,8 @@ public class MutableObjectId extends AnyObjectId {
*/
public void fromString(final String str) {
if (str.length() != Constants.OBJECT_ID_STRING_LENGTH)
- throw new IllegalArgumentException("Invalid id: " + str);
+ throw new IllegalArgumentException(MessageFormat.format(
+ JGitText.get().invalidId, str));
fromHexString(Constants.encodeASCII(str), 0);
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectChecker.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectChecker.java
index 5906802d18..f32ae59510 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectChecker.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectChecker.java
@@ -48,6 +48,9 @@ import static org.eclipse.jgit.util.RawParseUtils.match;
import static org.eclipse.jgit.util.RawParseUtils.nextLF;
import static org.eclipse.jgit.util.RawParseUtils.parseBase10;
+import java.text.MessageFormat;
+
+import org.eclipse.jgit.JGitText;
import org.eclipse.jgit.errors.CorruptObjectException;
import org.eclipse.jgit.util.MutableInteger;
@@ -123,7 +126,8 @@ public class ObjectChecker {
checkBlob(raw);
break;
default:
- throw new CorruptObjectException("Invalid object type: " + objType);
+ throw new CorruptObjectException(MessageFormat.format(
+ JGitText.get().corruptObjectInvalidType2, objType));
}
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectDirectory.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectDirectory.java
index 024bd15b03..06700ebe1d 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectDirectory.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectDirectory.java
@@ -48,6 +48,7 @@ import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
+import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
@@ -59,6 +60,7 @@ import java.util.Map;
import java.util.Set;
import java.util.concurrent.atomic.AtomicReference;
+import org.eclipse.jgit.JGitText;
import org.eclipse.jgit.errors.PackMismatchException;
import org.eclipse.jgit.lib.RepositoryCache.FileKey;
import org.eclipse.jgit.util.FS;
@@ -175,13 +177,13 @@ public class ObjectDirectory extends ObjectDatabase {
final String i = idx.getName();
if (p.length() != 50 || !p.startsWith("pack-") || !p.endsWith(".pack"))
- throw new IOException("Not a valid pack " + pack);
+ throw new IOException(MessageFormat.format(JGitText.get().notAValidPack, pack));
if (i.length() != 49 || !i.startsWith("pack-") || !i.endsWith(".idx"))
- throw new IOException("Not a valid pack " + idx);
+ throw new IOException(MessageFormat.format(JGitText.get().notAValidPack, idx));
if (!p.substring(0, 45).equals(i.substring(0, 45)))
- throw new IOException("Pack " + pack + "does not match index");
+ throw new IOException(MessageFormat.format(JGitText.get().packDoesNotMatchIndex, pack));
insertPack(new PackFile(idx, pack));
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectWriter.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectWriter.java
index b75328330f..ea57a0215e 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectWriter.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectWriter.java
@@ -53,9 +53,11 @@ import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStreamWriter;
import java.security.MessageDigest;
+import java.text.MessageFormat;
import java.util.zip.Deflater;
import java.util.zip.DeflaterOutputStream;
+import org.eclipse.jgit.JGitText;
import org.eclipse.jgit.errors.ObjectWritingException;
/**
@@ -147,10 +149,8 @@ public class ObjectWriter {
final ObjectId id = e.getId();
if (id == null)
- throw new ObjectWritingException("Object at path \""
- + e.getFullName() + "\" does not have an id assigned."
- + " All object ids must be assigned prior"
- + " to writing a tree.");
+ throw new ObjectWritingException(MessageFormat.format(
+ JGitText.get().objectAtPathDoesNotHaveId, e.getFullName()));
e.getMode().copyTo(o);
o.write(' ');
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/PackFile.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/PackFile.java
index 63f5162631..8f4e691630 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/PackFile.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/PackFile.java
@@ -52,6 +52,7 @@ import java.io.OutputStream;
import java.io.RandomAccessFile;
import java.nio.MappedByteBuffer;
import java.nio.channels.FileChannel.MapMode;
+import java.text.MessageFormat;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
@@ -60,6 +61,7 @@ import java.util.zip.CRC32;
import java.util.zip.CheckedOutputStream;
import java.util.zip.DataFormatException;
+import org.eclipse.jgit.JGitText;
import org.eclipse.jgit.errors.CorruptObjectException;
import org.eclipse.jgit.errors.PackInvalidException;
import org.eclipse.jgit.errors.PackMismatchException;
@@ -135,7 +137,7 @@ public class PackFile implements Iterable<PackIndex.MutableEntry> {
if (packChecksum == null)
packChecksum = idx.packChecksum;
else if (!Arrays.equals(packChecksum, idx.packChecksum))
- throw new PackMismatchException("Pack checksum mismatch");
+ throw new PackMismatchException(JGitText.get().packChecksumMismatch);
loadedIdx = idx;
} catch (IOException e) {
@@ -261,7 +263,7 @@ public class PackFile implements Iterable<PackIndex.MutableEntry> {
final WindowCursor curs) throws DataFormatException, IOException {
final byte[] dstbuf = new byte[totalSize];
if (curs.inflate(this, position, dstbuf, 0) != totalSize)
- throw new EOFException("Short compressed stream at " + position);
+ throw new EOFException(MessageFormat.format(JGitText.get().shortCompressedStreamAt, position));
return dstbuf;
}
@@ -289,15 +291,15 @@ public class PackFile implements Iterable<PackIndex.MutableEntry> {
final ObjectId id = findObjectForOffset(objectOffset);
final long expected = idx.findCRC32(id);
if (computed != expected)
- throw new CorruptObjectException("Object at " + objectOffset
- + " in " + getPackFile() + " has bad zlib stream");
+ throw new CorruptObjectException(MessageFormat.format(
+ JGitText.get().objectAtHasBadZlibStream, objectOffset, getPackFile()));
} else {
try {
curs.inflateVerify(this, dataOffset);
} catch (DataFormatException dfe) {
final CorruptObjectException coe;
- coe = new CorruptObjectException("Object at " + objectOffset
- + " in " + getPackFile() + " has bad zlib stream");
+ coe = new CorruptObjectException(MessageFormat.format(
+ JGitText.get().objectAtHasBadZlibStream, objectOffset, getPackFile()));
coe.initCause(dfe);
throw coe;
}
@@ -433,24 +435,23 @@ public class PackFile implements Iterable<PackIndex.MutableEntry> {
IO.readFully(fd.getChannel(), 0, buf, 0, 12);
if (RawParseUtils.match(buf, 0, Constants.PACK_SIGNATURE) != 4)
- throw new IOException("Not a PACK file.");
+ throw new IOException(JGitText.get().notAPACKFile);
final long vers = NB.decodeUInt32(buf, 4);
final long packCnt = NB.decodeUInt32(buf, 8);
if (vers != 2 && vers != 3)
- throw new IOException("Unsupported pack version " + vers + ".");
+ throw new IOException(MessageFormat.format(JGitText.get().unsupportedPackVersion, vers));
if (packCnt != idx.getObjectCount())
- throw new PackMismatchException("Pack object count mismatch:"
- + " pack " + packCnt
- + " index " + idx.getObjectCount()
- + ": " + getPackFile());
+ throw new PackMismatchException(MessageFormat.format(
+ JGitText.get().packObjectCountMismatch, packCnt, idx.getObjectCount(), getPackFile()));
IO.readFully(fd.getChannel(), length - 20, buf, 0, 20);
if (!Arrays.equals(buf, packChecksum))
- throw new PackMismatchException("Pack checksum mismatch:"
- + " pack " + ObjectId.fromRaw(buf).name()
- + " index " + ObjectId.fromRaw(idx.packChecksum).name()
- + ": " + getPackFile());
+ throw new PackMismatchException(MessageFormat.format(
+ JGitText.get().packObjectCountMismatch
+ , ObjectId.fromRaw(buf).name()
+ , ObjectId.fromRaw(idx.packChecksum).name()
+ , getPackFile()));
}
private PackedObjectLoader reader(final WindowCursor curs,
@@ -494,7 +495,7 @@ public class PackFile implements Iterable<PackIndex.MutableEntry> {
(int) dataSize, ObjectId.fromRaw(ib));
}
default:
- throw new IOException("Unknown object type " + typeCode + ".");
+ throw new IOException(MessageFormat.format(JGitText.get().unknownObjectType, typeCode));
}
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/PackIndex.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/PackIndex.java
index 2043145b89..25b4f569c1 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/PackIndex.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/PackIndex.java
@@ -48,8 +48,10 @@ import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
+import java.text.MessageFormat;
import java.util.Iterator;
+import org.eclipse.jgit.JGitText;
import org.eclipse.jgit.errors.MissingObjectException;
import org.eclipse.jgit.util.IO;
import org.eclipse.jgit.util.NB;
@@ -92,14 +94,14 @@ public abstract class PackIndex implements Iterable<PackIndex.MutableEntry> {
case 2:
return new PackIndexV2(fd);
default:
- throw new IOException("Unsupported pack index version " + v);
+ throw new IOException(MessageFormat.format(JGitText.get().unsupportedPackIndexVersion, v));
}
}
return new PackIndexV1(fd, hdr);
} catch (IOException ioe) {
final String path = idxFile.getAbsolutePath();
final IOException err;
- err = new IOException("Unreadable pack index: " + path);
+ err = new IOException(MessageFormat.format(JGitText.get().unreadablePackIndex, path));
err.initCause(ioe);
throw err;
} finally {
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/PackIndexV2.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/PackIndexV2.java
index eb644c51c4..128b2df8cb 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/PackIndexV2.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/PackIndexV2.java
@@ -49,6 +49,7 @@ import java.util.Arrays;
import java.util.Iterator;
import java.util.NoSuchElementException;
+import org.eclipse.jgit.JGitText;
import org.eclipse.jgit.errors.MissingObjectException;
import org.eclipse.jgit.util.IO;
import org.eclipse.jgit.util.NB;
@@ -111,7 +112,7 @@ class PackIndexV2 extends PackIndex {
final long nameLen = bucketCnt * Constants.OBJECT_ID_LENGTH;
if (nameLen > Integer.MAX_VALUE)
- throw new IOException("Index file is too large for jgit");
+ throw new IOException(JGitText.get().indexFileIsTooLargeForJgit);
final int intNameLen = (int) nameLen;
final byte[] raw = new byte[intNameLen];
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/PackIndexWriter.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/PackIndexWriter.java
index 5fcf71a781..4d2714bc55 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/PackIndexWriter.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/PackIndexWriter.java
@@ -48,8 +48,10 @@ import java.io.BufferedOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.security.DigestOutputStream;
+import java.text.MessageFormat;
import java.util.List;
+import org.eclipse.jgit.JGitText;
import org.eclipse.jgit.transport.PackedObjectInfo;
import org.eclipse.jgit.util.NB;
@@ -131,8 +133,8 @@ public abstract class PackIndexWriter {
case 2:
return new PackIndexWriterV2(dst);
default:
- throw new IllegalArgumentException(
- "Unsupported pack index version " + version);
+ throw new IllegalArgumentException(MessageFormat.format(
+ JGitText.get().unsupportedPackIndexVersion, version));
}
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/PackIndexWriterV1.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/PackIndexWriterV1.java
index b3be5480c9..eb44b3a8c7 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/PackIndexWriterV1.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/PackIndexWriterV1.java
@@ -47,6 +47,7 @@ package org.eclipse.jgit.lib;
import java.io.IOException;
import java.io.OutputStream;
+import org.eclipse.jgit.JGitText;
import org.eclipse.jgit.transport.PackedObjectInfo;
import org.eclipse.jgit.util.NB;
@@ -73,7 +74,7 @@ class PackIndexWriterV1 extends PackIndexWriter {
for (final PackedObjectInfo oe : entries) {
if (!canStore(oe))
- throw new IOException("Pack too large for index version 1");
+ throw new IOException(JGitText.get().packTooLargeForIndexVersion1);
NB.encodeInt32(tmp, 0, (int) oe.getOffset());
oe.copyRawTo(tmp, 4);
out.write(tmp);
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/PackReverseIndex.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/PackReverseIndex.java
index c0ed7b29a6..f4f57aed43 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/PackReverseIndex.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/PackReverseIndex.java
@@ -43,8 +43,10 @@
package org.eclipse.jgit.lib;
+import java.text.MessageFormat;
import java.util.Arrays;
+import org.eclipse.jgit.JGitText;
import org.eclipse.jgit.errors.CorruptObjectException;
import org.eclipse.jgit.lib.PackIndex.MutableEntry;
@@ -94,7 +96,7 @@ class PackReverseIndex {
if (n32 > Integer.MAX_VALUE || n64 > Integer.MAX_VALUE
|| cnt > 0xffffffffL)
throw new IllegalArgumentException(
- "Huge indexes are not supported by jgit, yet");
+ JGitText.get().hugeIndexesAreNotSupportedByJgitYet);
offsets32 = new int[(int) n32];
offsets64 = new long[(int) n64];
@@ -166,9 +168,9 @@ class PackReverseIndex {
if (offset <= Integer.MAX_VALUE) {
final int i32 = Arrays.binarySearch(offsets32, (int) offset);
if (i32 < 0)
- throw new CorruptObjectException(
- "Can't find object in (reverse) pack index for the specified offset "
- + offset);
+ throw new CorruptObjectException(MessageFormat.format(
+ JGitText.get().cantFindObjectInReversePackIndexForTheSpecifiedOffset
+ , offset));
if (i32 + 1 == offsets32.length) {
if (offsets64.length > 0)
@@ -179,9 +181,9 @@ class PackReverseIndex {
} else {
final int i64 = Arrays.binarySearch(offsets64, offset);
if (i64 < 0)
- throw new CorruptObjectException(
- "Can't find object in (reverse) pack index for the specified offset "
- + offset);
+ throw new CorruptObjectException(MessageFormat.format(
+ JGitText.get().cantFindObjectInReversePackIndexForTheSpecifiedOffset
+ , offset));
if (i64 + 1 == offsets64.length)
return maxOffset;
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java
index 4a205fffbe..48f41a5586 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/PackWriter.java
@@ -54,6 +54,7 @@ import java.util.Iterator;
import java.util.List;
import java.util.zip.Deflater;
+import org.eclipse.jgit.JGitText;
import org.eclipse.jgit.errors.IncorrectObjectTypeException;
import org.eclipse.jgit.errors.MissingObjectException;
import org.eclipse.jgit.revwalk.ObjectWalk;
@@ -103,7 +104,7 @@ public class PackWriter {
*
* @see #preparePack(Collection, Collection)
*/
- public static final String COUNTING_OBJECTS_PROGRESS = "Counting objects";
+ public static final String COUNTING_OBJECTS_PROGRESS = JGitText.get().countingObjects;
/**
* Title of {@link ProgressMonitor} task used during searching for objects
@@ -111,7 +112,7 @@ public class PackWriter {
*
* @see #writePack(OutputStream)
*/
- public static final String SEARCHING_REUSE_PROGRESS = "Compressing objects";
+ public static final String SEARCHING_REUSE_PROGRESS = JGitText.get().compressingObjects;
/**
* Title of {@link ProgressMonitor} task used during writing out pack
@@ -119,7 +120,7 @@ public class PackWriter {
*
* @see #writePack(OutputStream)
*/
- public static final String WRITING_OBJECTS_PROGRESS = "Writing objects";
+ public static final String WRITING_OBJECTS_PROGRESS = JGitText.get().writingObjects;
/**
* Default value of deltas reuse option.
@@ -605,7 +606,7 @@ public class PackWriter {
for (ObjectToPack otp : list) {
if (initMonitor.isCancelled())
throw new IOException(
- "Packing cancelled during objects writing");
+ JGitText.get().packingCancelledDuringObjectsWriting);
reuseLoaders.clear();
searchForReuse(reuseLoaders, otp);
initMonitor.update(1);
@@ -688,7 +689,7 @@ public class PackWriter {
for (ObjectToPack otp : list) {
if (writeMonitor.isCancelled())
throw new IOException(
- "Packing cancelled during objects writing");
+ JGitText.get().packingCancelledDuringObjectsWriting);
if (!otp.isWritten())
writeObject(otp);
}
@@ -727,7 +728,7 @@ public class PackWriter {
reuse.endCopyRawData();
}
} else if (otp.isDeltaRepresentation()) {
- throw new IOException("creating deltas is not implemented");
+ throw new IOException(JGitText.get().creatingDeltasIsNotImplemented);
} else {
writeWholeObjectDeflate(otp);
}
@@ -886,11 +887,11 @@ public class PackWriter {
objectsLists[object.getType()].add(otp);
} catch (ArrayIndexOutOfBoundsException x) {
throw new IncorrectObjectTypeException(object,
- "COMMIT nor TREE nor BLOB nor TAG");
+ JGitText.get().incorrectObjectType_COMMITnorTREEnorBLOBnorTAG);
} catch (UnsupportedOperationException x) {
// index pointing to "dummy" empty list
throw new IncorrectObjectTypeException(object,
- "COMMIT nor TREE nor BLOB nor TAG");
+ JGitText.get().incorrectObjectType_COMMITnorTREEnorBLOBnorTAG);
}
objectsMap.add(otp);
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/PersonIdent.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/PersonIdent.java
index 0bc2e7a2df..522f8477b1 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/PersonIdent.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/PersonIdent.java
@@ -45,11 +45,13 @@
package org.eclipse.jgit.lib;
+import java.text.MessageFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
import java.util.TimeZone;
+import org.eclipse.jgit.JGitText;
import org.eclipse.jgit.util.SystemReader;
/**
@@ -197,13 +199,13 @@ public class PersonIdent {
public PersonIdent(final String in) {
final int lt = in.indexOf('<');
if (lt == -1) {
- throw new IllegalArgumentException("Malformed PersonIdent string"
- + " (no < was found): " + in);
+ throw new IllegalArgumentException(MessageFormat.format(
+ JGitText.get().malformedpersonIdentString, in));
}
final int gt = in.indexOf('>', lt);
if (gt == -1) {
- throw new IllegalArgumentException("Malformed PersonIdent string"
- + " (no > was found): " + in);
+ throw new IllegalArgumentException(MessageFormat.format(
+ JGitText.get().malformedpersonIdentString, in));
}
final int sp = in.indexOf(' ', gt + 2);
if (sp == -1) {
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/RefDirectory.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/RefDirectory.java
index faebbf67cc..5ba186955f 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/RefDirectory.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/RefDirectory.java
@@ -67,11 +67,13 @@ import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
+import java.text.MessageFormat;
import java.util.Arrays;
import java.util.Map;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicReference;
+import org.eclipse.jgit.JGitText;
import org.eclipse.jgit.errors.ObjectWritingException;
import org.eclipse.jgit.revwalk.RevObject;
import org.eclipse.jgit.revwalk.RevTag;
@@ -493,7 +495,8 @@ public class RefDirectory extends RefDatabase {
if (packed.contains(name)) {
LockFile lck = new LockFile(packedRefsFile);
if (!lck.lock())
- throw new IOException("Cannot lock " + packedRefsFile);
+ throw new IOException(MessageFormat.format(
+ JGitText.get().cannotLockFile, packedRefsFile));
try {
PackedRefList cur = readPackedRefs(0, 0);
int idx = cur.find(name);
@@ -574,7 +577,7 @@ public class RefDirectory extends RefDatabase {
if (dir.exists())
throw err;
if (!dir.mkdirs() && !dir.isDirectory())
- throw new IOException("Cannot create directory " + dir);
+ throw new IOException(MessageFormat.format(JGitText.get().cannotCreateDirectory, dir));
out = new FileOutputStream(log, true);
}
try {
@@ -677,7 +680,7 @@ public class RefDirectory extends RefDatabase {
if (p.charAt(0) == '^') {
if (last == null)
- throw new IOException("Peeled line before ref.");
+ throw new IOException(JGitText.get().peeledLineBeforeRef);
ObjectId id = ObjectId.fromString(p.substring(1));
last = new ObjectIdRef.PeeledTag(PACKED, last.getName(), last
@@ -721,18 +724,16 @@ public class RefDirectory extends RefDatabase {
try {
lck.write(content);
} catch (IOException ioe) {
- throw new ObjectWritingException("Unable to write " + name,
- ioe);
+ throw new ObjectWritingException(MessageFormat.format(JGitText.get().unableToWrite, name), ioe);
}
try {
lck.waitForStatChange();
} catch (InterruptedException e) {
lck.unlock();
- throw new ObjectWritingException("Interrupted writing "
- + name);
+ throw new ObjectWritingException(MessageFormat.format(JGitText.get().interruptedWriting, name));
}
if (!lck.commit())
- throw new ObjectWritingException("Unable to write " + name);
+ throw new ObjectWritingException(MessageFormat.format(JGitText.get().unableToWrite, name));
packedRefs.compareAndSet(oldPackedList, new PackedRefList(refs,
content.length, lck.getCommitLastModified()));
@@ -795,7 +796,7 @@ public class RefDirectory extends RefDatabase {
n--;
if (n < 6) {
String content = RawParseUtils.decode(buf, 0, n);
- throw new IOException("Not a ref: " + name + ": " + content);
+ throw new IOException(MessageFormat.format(JGitText.get().notARef, name, content));
}
final String target = RawParseUtils.decode(buf, 5, n);
return newSymbolicRef(modified, name, target);
@@ -811,7 +812,7 @@ public class RefDirectory extends RefDatabase {
while (0 < n && Character.isWhitespace(buf[n - 1]))
n--;
String content = RawParseUtils.decode(buf, 0, n);
- throw new IOException("Not a ref: " + name + ": " + content);
+ throw new IOException(MessageFormat.format(JGitText.get().notARef, name, content));
}
return new LooseUnpeeled(modified, name, id);
}
@@ -889,7 +890,7 @@ public class RefDirectory extends RefDatabase {
static void delete(final File file, final int depth) throws IOException {
if (!file.delete() && file.isFile())
- throw new IOException("File cannot be deleted: " + file);
+ throw new IOException(MessageFormat.format(JGitText.get().fileCannotBeDeleted, file));
File dir = file.getParentFile();
for (int i = 0; i < depth; ++i) {
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/RefUpdate.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/RefUpdate.java
index 553266284b..89f59150a0 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/RefUpdate.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/RefUpdate.java
@@ -45,7 +45,9 @@
package org.eclipse.jgit.lib;
import java.io.IOException;
+import java.text.MessageFormat;
+import org.eclipse.jgit.JGitText;
import org.eclipse.jgit.errors.MissingObjectException;
import org.eclipse.jgit.revwalk.RevCommit;
import org.eclipse.jgit.revwalk.RevObject;
@@ -395,7 +397,7 @@ public abstract class RefUpdate {
private void requireCanDoUpdate() {
if (newValue == null)
- throw new IllegalStateException("A NewObjectId is required.");
+ throw new IllegalStateException(JGitText.get().aNewObjectIdIsRequired);
}
/**
@@ -524,7 +526,7 @@ public abstract class RefUpdate {
*/
public Result link(String target) throws IOException {
if (!target.startsWith(Constants.R_REFS))
- throw new IllegalArgumentException("Not " + Constants.R_REFS);
+ throw new IllegalArgumentException(MessageFormat.format(JGitText.get().illegalArgumentNotA, Constants.R_REFS));
if (getRefDatabase().isNameConflicting(getName()))
return Result.LOCK_FAILURE;
try {
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/ReflogReader.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/ReflogReader.java
index b394f34bb7..4c5503f321 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/ReflogReader.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/ReflogReader.java
@@ -51,6 +51,7 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
+import org.eclipse.jgit.JGitText;
import org.eclipse.jgit.util.IO;
import org.eclipse.jgit.util.RawParseUtils;
@@ -75,24 +76,24 @@ public class ReflogReader {
pos += Constants.OBJECT_ID_STRING_LENGTH;
if (raw[pos++] != ' ')
throw new IllegalArgumentException(
- "Raw log message does not parse as log entry");
+ JGitText.get().rawLogMessageDoesNotParseAsLogEntry);
newId = ObjectId.fromString(raw, pos);
pos += Constants.OBJECT_ID_STRING_LENGTH;
if (raw[pos++] != ' ') {
throw new IllegalArgumentException(
- "Raw log message does not parse as log entry");
+ JGitText.get().rawLogMessageDoesNotParseAsLogEntry);
}
who = RawParseUtils.parsePersonIdentOnly(raw, pos);
int p0 = RawParseUtils.next(raw, pos, '\t'); // personident has no
// \t
if (p0 == -1) {
throw new IllegalArgumentException(
- "Raw log message does not parse as log entry");
+ JGitText.get().rawLogMessageDoesNotParseAsLogEntry);
}
int p1 = RawParseUtils.nextLF(raw, p0);
if (p1 == -1) {
throw new IllegalArgumentException(
- "Raw log message does not parse as log entry");
+ JGitText.get().rawLogMessageDoesNotParseAsLogEntry);
}
comment = RawParseUtils.decode(raw, p0, p1 - 1);
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java
index 9f4bb100f8..e4d857bf8d 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java
@@ -48,6 +48,7 @@ package org.eclipse.jgit.lib;
import java.io.File;
import java.io.IOException;
+import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
@@ -61,6 +62,7 @@ import java.util.Vector;
import java.util.concurrent.atomic.AtomicInteger;
import org.eclipse.jgit.dircache.DirCache;
+import org.eclipse.jgit.JGitText;
import org.eclipse.jgit.errors.ConfigInvalidException;
import org.eclipse.jgit.errors.IncorrectObjectTypeException;
import org.eclipse.jgit.errors.RevisionSyntaxException;
@@ -191,7 +193,7 @@ public class Repository {
if (d != null)
gitDir = d;
else
- throw new IllegalArgumentException("Either GIT_DIR or GIT_WORK_TREE must be passed to Repository constructor");
+ throw new IllegalArgumentException(JGitText.get().eitherGIT_DIRorGIT_WORK_TREEmustBePassed);
}
userConfig = SystemReader.getInstance().openUserConfig();
@@ -226,8 +228,8 @@ public class Repository {
final String repositoryFormatVersion = getConfig().getString(
"core", null, "repositoryFormatVersion");
if (!"0".equals(repositoryFormatVersion)) {
- throw new IOException("Unknown repository format \""
- + repositoryFormatVersion + "\"; expected \"0\".");
+ throw new IOException(MessageFormat.format(
+ JGitText.get().unknownRepositoryFormat2, repositoryFormatVersion));
}
}
}
@@ -236,9 +238,8 @@ public class Repository {
try {
userConfig.load();
} catch (ConfigInvalidException e1) {
- IOException e2 = new IOException("User config file "
- + userConfig.getFile().getAbsolutePath() + " invalid: "
- + e1);
+ IOException e2 = new IOException(MessageFormat.format(
+ JGitText.get().userConfigFileInvalid, userConfig.getFile().getAbsolutePath(), e1));
e2.initCause(e1);
throw e2;
}
@@ -248,7 +249,7 @@ public class Repository {
try {
config.load();
} catch (ConfigInvalidException e1) {
- IOException e2 = new IOException("Unknown repository format");
+ IOException e2 = new IOException(JGitText.get().unknownRepositoryFormat);
e2.initCause(e1);
throw e2;
}
@@ -279,8 +280,7 @@ public class Repository {
public void create(boolean bare) throws IOException {
final RepositoryConfig cfg = getConfig();
if (cfg.getFile().exists()) {
- throw new IllegalStateException("Repository already exists: "
- + gitDir);
+ throw new IllegalStateException(MessageFormat.format(JGitText.get().repositoryAlreadyExists, gitDir));
}
gitDir.mkdirs();
refs.create();
@@ -506,7 +506,7 @@ public class Repository {
default:
throw new IncorrectObjectTypeException(id,
- "COMMIT nor TREE nor BLOB nor TAG");
+ JGitText.get().incorrectObjectType_COMMITnorTREEnorBLOBnorTAG);
}
}
@@ -727,7 +727,7 @@ public class Repository {
pnum = Integer.parseInt(parentnum);
} catch (NumberFormatException e) {
throw new RevisionSyntaxException(
- "Invalid commit parent number",
+ JGitText.get().invalidCommitParentNumber,
revstr);
}
if (pnum != 0) {
@@ -853,7 +853,7 @@ public class Repository {
dist = Integer.parseInt(distnum);
} catch (NumberFormatException e) {
throw new RevisionSyntaxException(
- "Invalid ancestry length", revstr);
+ JGitText.get().invalidAncestryLength, revstr);
}
while (dist > 0) {
final ObjectId[] parents = ((Commit) ref).getParentIds();
@@ -877,7 +877,7 @@ public class Repository {
}
}
if (time != null)
- throw new RevisionSyntaxException("reflogs not yet supported by revision parser", revstr);
+ throw new RevisionSyntaxException(JGitText.get().reflogsNotYetSupportedByRevisionParser, revstr);
i = m - 1;
break;
default:
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/Tag.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/Tag.java
index 35ccf773cf..5b3531eb1f 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/Tag.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/Tag.java
@@ -48,7 +48,9 @@ import java.io.BufferedReader;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
+import java.text.MessageFormat;
+import org.eclipse.jgit.JGitText;
import org.eclipse.jgit.errors.CorruptObjectException;
import org.eclipse.jgit.errors.ObjectWritingException;
@@ -135,18 +137,18 @@ public class Tag {
new ByteArrayInputStream(raw)));
String n = br.readLine();
if (n == null || !n.startsWith("object ")) {
- throw new CorruptObjectException(tagId, "no object");
+ throw new CorruptObjectException(tagId, JGitText.get().corruptObjectNoObject);
}
objId = ObjectId.fromString(n.substring(7));
n = br.readLine();
if (n == null || !n.startsWith("type ")) {
- throw new CorruptObjectException(tagId, "no type");
+ throw new CorruptObjectException(tagId, JGitText.get().corruptObjectNoType);
}
type = n.substring("type ".length());
n = br.readLine();
if (n == null || !n.startsWith("tag ")) {
- throw new CorruptObjectException(tagId, "no tag name");
+ throw new CorruptObjectException(tagId, JGitText.get().corruptObjectNoTagName);
}
tag = n.substring("tag ".length());
n = br.readLine();
@@ -154,13 +156,13 @@ public class Tag {
// We should see a "tagger" header here, but some repos have tags
// without it.
if (n == null)
- throw new CorruptObjectException(tagId, "no tagger header");
+ throw new CorruptObjectException(tagId, JGitText.get().corruptObjectNoTaggerHeader);
if (n.length()>0)
if (n.startsWith("tagger "))
tagger = new PersonIdent(n.substring("tagger ".length()));
else
- throw new CorruptObjectException(tagId, "no tagger/bad header");
+ throw new CorruptObjectException(tagId, JGitText.get().corruptObjectNoTaggerBadHeader);
// Message should start with an empty line, but
StringBuilder tempMessage = new StringBuilder();
@@ -196,7 +198,7 @@ public class Tag {
*/
public void tag() throws IOException {
if (getTagId() != null)
- throw new IllegalStateException("exists " + getTagId());
+ throw new IllegalStateException(MessageFormat.format(JGitText.get().illegalStateExists, getTagId()));
final ObjectId id;
final RefUpdate ru;
@@ -212,7 +214,7 @@ public class Tag {
ru.setNewObjectId(id);
ru.setRefLogMessage("tagged " + getTag(), false);
if (ru.forceUpdate() == RefUpdate.Result.LOCK_FAILURE)
- throw new ObjectWritingException("Unable to lock tag " + getTag());
+ throw new ObjectWritingException(MessageFormat.format(JGitText.get().unableToLockTag, getTag()));
}
public String toString() {
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/Tree.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/Tree.java
index 61607cba95..2aa3098f17 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/Tree.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/Tree.java
@@ -46,7 +46,9 @@
package org.eclipse.jgit.lib;
import java.io.IOException;
+import java.text.MessageFormat;
+import org.eclipse.jgit.JGitText;
import org.eclipse.jgit.errors.CorruptObjectException;
import org.eclipse.jgit.errors.EntryExistsException;
import org.eclipse.jgit.errors.MissingObjectException;
@@ -245,7 +247,7 @@ public class Tree extends TreeEntry implements Treeish {
*/
public void unload() {
if (isModified())
- throw new IllegalStateException("Cannot unload a modified tree.");
+ throw new IllegalStateException(JGitText.get().cannotUnloadAModifiedTree);
contents = null;
}
@@ -555,14 +557,14 @@ public class Tree extends TreeEntry implements Treeish {
while (rawPtr < rawSize) {
int c = raw[rawPtr++];
if (c < '0' || c > '7')
- throw new CorruptObjectException(getId(), "invalid entry mode");
+ throw new CorruptObjectException(getId(), JGitText.get().corruptObjectInvalidEntryMode);
int mode = c - '0';
for (;;) {
c = raw[rawPtr++];
if (' ' == c)
break;
else if (c < '0' || c > '7')
- throw new CorruptObjectException(getId(), "invalid mode");
+ throw new CorruptObjectException(getId(), JGitText.get().corruptObjectInvalidMode);
mode <<= 3;
mode += c - '0';
}
@@ -589,8 +591,8 @@ public class Tree extends TreeEntry implements Treeish {
else if (FileMode.GITLINK.equals(mode))
ent = new GitlinkTreeEntry(this, id, name);
else
- throw new CorruptObjectException(getId(), "Invalid mode: "
- + Integer.toOctalString(mode));
+ throw new CorruptObjectException(getId(), MessageFormat.format(
+ JGitText.get().corruptObjectInvalidMode2, Integer.toOctalString(mode)));
temp[nextIndex++] = ent;
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/TreeIterator.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/TreeIterator.java
index 937baf6cc5..1f46c8f1b9 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/TreeIterator.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/TreeIterator.java
@@ -47,6 +47,8 @@ package org.eclipse.jgit.lib;
import java.io.IOException;
import java.util.Iterator;
+import org.eclipse.jgit.JGitText;
+
/**
* A tree iterator iterates over a tree and all its members recursing into
* subtrees according to order.
@@ -204,6 +206,6 @@ public class TreeIterator implements Iterator<TreeEntry> {
public void remove() {
throw new IllegalStateException(
- "TreeIterator does not support remove()");
+ JGitText.get().treeIteratorDoesNotSupportRemove);
}
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/UnpackedObjectLoader.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/UnpackedObjectLoader.java
index 96a1f80241..cd2eb38ef1 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/UnpackedObjectLoader.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/UnpackedObjectLoader.java
@@ -50,6 +50,7 @@ import java.io.IOException;
import java.util.zip.DataFormatException;
import java.util.zip.Inflater;
+import org.eclipse.jgit.JGitText;
import org.eclipse.jgit.errors.CorruptObjectException;
import org.eclipse.jgit.util.IO;
import org.eclipse.jgit.util.MutableInteger;
@@ -118,25 +119,25 @@ public class UnpackedObjectLoader extends ObjectLoader {
hdr.length - avail);
if (uncompressed == 0) {
throw new CorruptObjectException(id,
- "bad stream, corrupt header");
+ JGitText.get().corruptObjectBadStreamCorruptHeader);
}
avail += uncompressed;
} catch (DataFormatException dfe) {
final CorruptObjectException coe;
- coe = new CorruptObjectException(id, "bad stream");
+ coe = new CorruptObjectException(id, JGitText.get().corruptObjectBadStream);
coe.initCause(dfe);
throw coe;
}
if (avail < 5)
- throw new CorruptObjectException(id, "no header");
+ throw new CorruptObjectException(id, JGitText.get().corruptObjectNoHeader);
final MutableInteger p = new MutableInteger();
objectType = Constants.decodeTypeString(id, hdr, (byte) ' ', p);
objectSize = RawParseUtils.parseBase10(hdr, p.value, p);
if (objectSize < 0)
- throw new CorruptObjectException(id, "negative size");
+ throw new CorruptObjectException(id, JGitText.get().corruptObjectNegativeSize);
if (hdr[p.value++] != 0)
- throw new CorruptObjectException(id, "garbage after size");
+ throw new CorruptObjectException(id, JGitText.get().corruptObjectGarbageAfterSize);
bytes = new byte[objectSize];
if (p.value < avail)
System.arraycopy(hdr, p.value, bytes, 0, avail - p.value);
@@ -161,7 +162,7 @@ public class UnpackedObjectLoader extends ObjectLoader {
objectType = typeCode;
break;
default:
- throw new CorruptObjectException(id, "invalid type");
+ throw new CorruptObjectException(id, JGitText.get().corruptObjectInvalidType);
}
objectSize = size;
@@ -182,17 +183,17 @@ public class UnpackedObjectLoader extends ObjectLoader {
p += uncompressed;
if (uncompressed == 0 && !inf.finished()) {
throw new CorruptObjectException(id,
- "bad stream, corrupt header");
+ JGitText.get().corruptObjectBadStreamCorruptHeader);
}
}
} catch (DataFormatException dfe) {
final CorruptObjectException coe;
- coe = new CorruptObjectException(id, "bad stream");
+ coe = new CorruptObjectException(id, JGitText.get().corruptObjectBadStream);
coe.initCause(dfe);
throw coe;
}
if (p != objectSize)
- throw new CorruptObjectException(id, "incorrect length");
+ throw new CorruptObjectException(id, JGitText.get().corruptObjectIncorrectLength);
}
@Override
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/WholePackedObjectLoader.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/WholePackedObjectLoader.java
index 5005d37f18..fcfa57339e 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/WholePackedObjectLoader.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/WholePackedObjectLoader.java
@@ -46,8 +46,10 @@
package org.eclipse.jgit.lib;
import java.io.IOException;
+import java.text.MessageFormat;
import java.util.zip.DataFormatException;
+import org.eclipse.jgit.JGitText;
import org.eclipse.jgit.errors.CorruptObjectException;
/** Reader for a non-delta (just deflated) object in a pack file. */
@@ -84,8 +86,8 @@ class WholePackedObjectLoader extends PackedObjectLoader {
pack.saveCache(objectOffset, cachedBytes, objectType);
} catch (DataFormatException dfe) {
final CorruptObjectException coe;
- coe = new CorruptObjectException("Object at " + objectOffset
- + " in " + pack.getPackFile() + " has bad zlib stream");
+ coe = new CorruptObjectException(MessageFormat.format(JGitText.get().objectAtHasBadZlibStream,
+ objectOffset, pack.getPackFile()));
coe.initCause(dfe);
throw coe;
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/WindowCache.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/WindowCache.java
index b2c79c1089..a44a30ee2d 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/WindowCache.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/WindowCache.java
@@ -53,6 +53,8 @@ import java.util.concurrent.atomic.AtomicLong;
import java.util.concurrent.atomic.AtomicReferenceArray;
import java.util.concurrent.locks.ReentrantLock;
+import org.eclipse.jgit.JGitText;
+
/**
* Caches slices of a {@link PackFile} in memory for faster read access.
* <p>
@@ -121,9 +123,9 @@ import java.util.concurrent.locks.ReentrantLock;
public class WindowCache {
private static final int bits(int newSize) {
if (newSize < 4096)
- throw new IllegalArgumentException("Invalid window size");
+ throw new IllegalArgumentException(JGitText.get().invalidWindowSize);
if (Integer.bitCount(newSize) != 1)
- throw new IllegalArgumentException("Window size must be power of 2");
+ throw new IllegalArgumentException(JGitText.get().windowSizeMustBePowerOf2);
return Integer.numberOfTrailingZeros(newSize);
}
@@ -247,9 +249,9 @@ public class WindowCache {
tableSize = tableSize(cfg);
final int lockCount = lockCount(cfg);
if (tableSize < 1)
- throw new IllegalArgumentException("tSize must be >= 1");
+ throw new IllegalArgumentException(JGitText.get().tSizeMustBeGreaterOrEqual1);
if (lockCount < 1)
- throw new IllegalArgumentException("lockCount must be >= 1");
+ throw new IllegalArgumentException(JGitText.get().lockCountMustBeGreaterOrEqual1);
queue = new ReferenceQueue<ByteWindow>();
clock = new AtomicLong(1);
@@ -278,9 +280,9 @@ public class WindowCache {
openBytes = new AtomicLong();
if (maxFiles < 1)
- throw new IllegalArgumentException("Open files must be >= 1");
+ throw new IllegalArgumentException(JGitText.get().openFilesMustBeAtLeast1);
if (maxBytes < windowSize)
- throw new IllegalArgumentException("Window size must be < limit");
+ throw new IllegalArgumentException(JGitText.get().windowSizeMustBeLesserThanLimit);
}
int getOpenFiles() {
@@ -343,9 +345,9 @@ public class WindowCache {
final int wsz = cfg.getPackedGitWindowSize();
final long limit = cfg.getPackedGitLimit();
if (wsz <= 0)
- throw new IllegalArgumentException("Invalid window size");
+ throw new IllegalArgumentException(JGitText.get().invalidWindowSize);
if (limit < wsz)
- throw new IllegalArgumentException("Window size must be < limit");
+ throw new IllegalArgumentException(JGitText.get().windowSizeMustBeLesserThanLimit);
return (int) Math.min(5 * (limit / wsz) / 2, 2000000000);
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/WorkDirCheckout.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/WorkDirCheckout.java
index 76585add1e..ee78202868 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/WorkDirCheckout.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/WorkDirCheckout.java
@@ -49,9 +49,11 @@ package org.eclipse.jgit.lib;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
+import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.HashMap;
+import org.eclipse.jgit.JGitText;
import org.eclipse.jgit.errors.CheckoutConflictException;
import org.eclipse.jgit.lib.GitIndex.Entry;
@@ -189,7 +191,7 @@ public class WorkDirCheckout {
for (String c : conflicts) {
File conflict = new File(root, c);
if (!conflict.delete())
- throw new CheckoutConflictException("Cannot delete file: " + c);
+ throw new CheckoutConflictException(MessageFormat.format(JGitText.get().cannotDeleteFile, c));
removeEmptyParents(conflict);
}
for (String r : removed) {
@@ -263,7 +265,7 @@ public class WorkDirCheckout {
public void visitEntry(TreeEntry treeEntry, TreeEntry auxEntry,
Entry indexEntry, File file) throws IOException {
if (treeEntry instanceof Tree || auxEntry instanceof Tree) {
- throw new IllegalArgumentException("Can't pass me a tree!");
+ throw new IllegalArgumentException(JGitText.get().cantPassMeATree);
}
processEntry(treeEntry, auxEntry, indexEntry);
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/WriteTree.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/WriteTree.java
index 5bb4e535e0..bb97ccced0 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/WriteTree.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/WriteTree.java
@@ -47,7 +47,9 @@ package org.eclipse.jgit.lib;
import java.io.File;
import java.io.IOException;
+import java.text.MessageFormat;
+import org.eclipse.jgit.JGitText;
import org.eclipse.jgit.errors.GitlinksNotSupportedException;
import org.eclipse.jgit.errors.SymlinksNotSupportedException;
@@ -75,10 +77,8 @@ public class WriteTree extends TreeVisitorWithCurrentDirectory {
public void visitSymlink(final SymlinkTreeEntry s) throws IOException {
if (s.isModified()) {
- throw new SymlinksNotSupportedException("Symlink \""
- + s.getFullName()
- + "\" cannot be written as the link target"
- + " cannot be read from within Java.");
+ throw new SymlinksNotSupportedException(MessageFormat.format(
+ JGitText.get().symlinkCannotBeWrittenAsTheLinkTarget, s.getFullName()));
}
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/merge/MergeStrategy.java b/org.eclipse.jgit/src/org/eclipse/jgit/merge/MergeStrategy.java
index e7d84c68ac..d678f7c0fc 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/merge/MergeStrategy.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/merge/MergeStrategy.java
@@ -44,8 +44,10 @@
package org.eclipse.jgit.merge;
+import java.text.MessageFormat;
import java.util.HashMap;
+import org.eclipse.jgit.JGitText;
import org.eclipse.jgit.lib.Repository;
/**
@@ -97,8 +99,7 @@ public abstract class MergeStrategy {
public static synchronized void register(final String name,
final MergeStrategy imp) {
if (STRATEGIES.containsKey(name))
- throw new IllegalArgumentException("Merge strategy \"" + name
- + "\" already exists as a default strategy");
+ throw new IllegalArgumentException(MessageFormat.format(JGitText.get().mergeStrategyAlreadyExistsAsDefault, name));
STRATEGIES.put(name, imp);
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/merge/Merger.java b/org.eclipse.jgit/src/org/eclipse/jgit/merge/Merger.java
index 275a6d68ff..38af20fb8f 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/merge/Merger.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/merge/Merger.java
@@ -44,7 +44,9 @@
package org.eclipse.jgit.merge;
import java.io.IOException;
+import java.text.MessageFormat;
+import org.eclipse.jgit.JGitText;
import org.eclipse.jgit.errors.IncorrectObjectTypeException;
import org.eclipse.jgit.lib.AnyObjectId;
import org.eclipse.jgit.lib.Constants;
@@ -180,10 +182,9 @@ public abstract class Merger {
return new EmptyTreeIterator();
final RevCommit base2 = walk.next();
if (base2 != null) {
- throw new IOException("Multiple merge bases for:" + "\n "
- + sourceCommits[aIdx].name() + "\n "
- + sourceCommits[bIdx].name() + "found:" + "\n "
- + base.name() + "\n " + base2.name());
+ throw new IOException(MessageFormat.format(JGitText.get().multipleMergeBasesFor
+ , sourceCommits[aIdx].name(), sourceCommits[bIdx].name()
+ , base.name(), base2.name()));
}
return openTree(base.getTree());
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/nls/NLS.java b/org.eclipse.jgit/src/org/eclipse/jgit/nls/NLS.java
index f2e379e136..6f81af845b 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/nls/NLS.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/nls/NLS.java
@@ -68,7 +68,8 @@ import org.eclipse.jgit.errors.TranslationStringMissingException;
* </pre>
*/
public class NLS {
- static final Locale ROOT_LOCALE = new Locale("", "", "");
+ /** The root locale constant. It is defined here because the Locale.ROOT is not defined in Java 5 */
+ public static final Locale ROOT_LOCALE = new Locale("", "", "");
private static final InheritableThreadLocal<NLS> local = new InheritableThreadLocal<NLS>() {
protected NLS initialValue() {
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/nls/TranslationBundle.java b/org.eclipse.jgit/src/org/eclipse/jgit/nls/TranslationBundle.java
index c908aa0557..2c745e1f3e 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/nls/TranslationBundle.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/nls/TranslationBundle.java
@@ -99,7 +99,7 @@ import org.eclipse.jgit.errors.TranslationStringMissingException;
* {@link ResourceBundle#getBundle(String, Locale)} method to load a resource
* bundle. See the documentation of this method for a detailed explanation of
* resource bundle loading strategy. After a bundle is created the
- * {@link #getEffectiveLocale()} method can be used to determine whether the
+ * {@link #effectiveLocale()} method can be used to determine whether the
* bundle really corresponds to the requested locale or is a fallback.
*
* <p>
@@ -122,16 +122,24 @@ import org.eclipse.jgit.errors.TranslationStringMissingException;
public abstract class TranslationBundle {
private Locale effectiveLocale;
+ private ResourceBundle resourceBundle;
/**
* @return the locale locale used for loading the resource bundle from which
* the field values were taken
*/
- public Locale getEffectiveLocale() {
+ public Locale effectiveLocale() {
return effectiveLocale;
}
/**
+ * @return the resource bundle on which this translation bundle is based
+ */
+ public ResourceBundle resourceBundle() {
+ return resourceBundle;
+ }
+
+ /**
* Injects locale specific text in all instance fields of this instance.
* Only public instance fields of type <code>String</code> are considered.
* <p>
@@ -150,18 +158,17 @@ public abstract class TranslationBundle {
*/
void load(Locale locale) throws TranslationBundleLoadingException {
Class bundleClass = getClass();
- ResourceBundle bundle;
try {
- bundle = ResourceBundle.getBundle(bundleClass.getName(), locale);
+ resourceBundle = ResourceBundle.getBundle(bundleClass.getName(), locale);
} catch (MissingResourceException e) {
throw new TranslationBundleLoadingException(bundleClass, locale, e);
}
- this.effectiveLocale = bundle.getLocale();
+ this.effectiveLocale = resourceBundle.getLocale();
for (Field field : bundleClass.getFields()) {
if (field.getType().equals(String.class)) {
try {
- String translatedText = bundle.getString(field.getName());
+ String translatedText = resourceBundle.getString(field.getName());
field.set(this, translatedText);
} catch (MissingResourceException e) {
throw new TranslationStringMissingException(bundleClass, locale, field.getName(), e);
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/patch/CombinedHunkHeader.java b/org.eclipse.jgit/src/org/eclipse/jgit/patch/CombinedHunkHeader.java
index 781190539f..042c778510 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/patch/CombinedHunkHeader.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/patch/CombinedHunkHeader.java
@@ -48,7 +48,9 @@ import static org.eclipse.jgit.util.RawParseUtils.parseBase10;
import java.io.IOException;
import java.io.OutputStream;
+import java.text.MessageFormat;
+import org.eclipse.jgit.JGitText;
import org.eclipse.jgit.lib.AbbreviatedObjectId;
import org.eclipse.jgit.util.MutableInteger;
@@ -183,16 +185,14 @@ public class CombinedHunkHeader extends HunkHeader {
final int cmp = o.nContext + o.nDeleted;
if (cmp < o.lineCount) {
final int missingCnt = o.lineCount - cmp;
- script.error(buf, startOffset, "Truncated hunk, at least "
- + missingCnt + " lines is missing for ancestor "
- + (ancestor + 1));
+ script.error(buf, startOffset, MessageFormat.format(
+ JGitText.get().truncatedHunkLinesMissingForAncestor, missingCnt, (ancestor + 1)));
}
}
if (nContext + nAdded < newLineCount) {
final int missingCount = newLineCount - (nContext + nAdded);
- script.error(buf, startOffset, "Truncated hunk, at least "
- + missingCount + " new lines is missing");
+ script.error(buf, startOffset, MessageFormat.format(JGitText.get().truncatedHunkNewLinesMissing, missingCount));
}
return c;
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/patch/FileHeader.java b/org.eclipse.jgit/src/org/eclipse/jgit/patch/FileHeader.java
index c35b613a22..25dc72af20 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/patch/FileHeader.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/patch/FileHeader.java
@@ -54,10 +54,12 @@ import static org.eclipse.jgit.util.RawParseUtils.parseBase10;
import java.io.IOException;
import java.nio.charset.CharacterCodingException;
import java.nio.charset.Charset;
+import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
+import org.eclipse.jgit.JGitText;
import org.eclipse.jgit.diff.EditList;
import org.eclipse.jgit.lib.AbbreviatedObjectId;
import org.eclipse.jgit.lib.Constants;
@@ -241,8 +243,7 @@ public class FileHeader {
}
if (charsetGuess != null && charsetGuess.length != getParentCount() + 1)
- throw new IllegalArgumentException("Expected "
- + (getParentCount() + 1) + " character encoding guesses");
+ throw new IllegalArgumentException(MessageFormat.format(JGitText.get().expectedCharacterEncodingGuesses, (getParentCount() + 1)));
if (trySimpleConversion(charsetGuess)) {
Charset cs = charsetGuess != null ? charsetGuess[0] : null;
@@ -302,7 +303,7 @@ public class FileHeader {
}
return r;
} catch (IOException ioe) {
- throw new RuntimeException("Cannot convert script to text", ioe);
+ throw new RuntimeException(JGitText.get().cannotConvertScriptToText, ioe);
} finally {
for (final TemporaryBuffer b : tmp) {
if (b != null)
@@ -410,7 +411,7 @@ public class FileHeader {
void addHunk(final HunkHeader h) {
if (h.getFileHeader() != this)
- throw new IllegalArgumentException("Hunk belongs to another file");
+ throw new IllegalArgumentException(JGitText.get().hunkBelongsToAnotherFile);
if (hunks == null)
hunks = new ArrayList<HunkHeader>();
hunks.add(h);
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/patch/HunkHeader.java b/org.eclipse.jgit/src/org/eclipse/jgit/patch/HunkHeader.java
index 9d78d0b99f..bfb20b64e9 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/patch/HunkHeader.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/patch/HunkHeader.java
@@ -49,7 +49,9 @@ import static org.eclipse.jgit.util.RawParseUtils.parseBase10;
import java.io.IOException;
import java.io.OutputStream;
+import java.text.MessageFormat;
+import org.eclipse.jgit.JGitText;
import org.eclipse.jgit.diff.Edit;
import org.eclipse.jgit.diff.EditList;
import org.eclipse.jgit.lib.AbbreviatedObjectId;
@@ -278,21 +280,21 @@ public class HunkHeader {
if (nContext + old.nDeleted < old.lineCount) {
final int missingCount = old.lineCount - (nContext + old.nDeleted);
- script.error(buf, startOffset, "Truncated hunk, at least "
- + missingCount + " old lines is missing");
+ script.error(buf, startOffset, MessageFormat.format(
+ JGitText.get().truncatedHunkOldLinesMissing, missingCount));
} else if (nContext + old.nAdded < newLineCount) {
final int missingCount = newLineCount - (nContext + old.nAdded);
- script.error(buf, startOffset, "Truncated hunk, at least "
- + missingCount + " new lines is missing");
+ script.error(buf, startOffset, MessageFormat.format(
+ JGitText.get().truncatedHunkNewLinesMissing, missingCount));
} else if (nContext + old.nDeleted > old.lineCount
|| nContext + old.nAdded > newLineCount) {
final String oldcnt = old.lineCount + ":" + newLineCount;
final String newcnt = (nContext + old.nDeleted) + ":"
+ (nContext + old.nAdded);
- script.warn(buf, startOffset, "Hunk header " + oldcnt
- + " does not match body line count of " + newcnt);
+ script.warn(buf, startOffset, MessageFormat.format(
+ JGitText.get().hunkHeaderDoesNotMatchBodyLineCountOf, oldcnt, newcnt));
}
return c;
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/patch/Patch.java b/org.eclipse.jgit/src/org/eclipse/jgit/patch/Patch.java
index eff5303dc5..ce006dadbf 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/patch/Patch.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/patch/Patch.java
@@ -55,6 +55,7 @@ import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
+import org.eclipse.jgit.JGitText;
import org.eclipse.jgit.util.TemporaryBuffer;
/** A parsed collection of {@link FileHeader}s from a unified diff patch file */
@@ -175,7 +176,7 @@ public class Patch {
// have missed a file header previously. The hunk
// isn't valid without knowing where it comes from.
//
- error(buf, c, "Hunk disconnected from file");
+ error(buf, c, JGitText.get().hunkDisconnectedFromFile);
c = nextLF(buf, c);
continue;
}
@@ -300,7 +301,7 @@ public class Patch {
break;
default:
if (match(buf, c, SIG_FOOTER) < 0)
- warn(buf, c, "Unexpected hunk trailer");
+ warn(buf, c, JGitText.get().unexpectedHunkTrailer);
}
}
continue;
@@ -345,7 +346,7 @@ public class Patch {
if (nEnd < 0) {
// Not a binary hunk.
//
- error(fh.buf, c, "Missing forward-image in GIT binary patch");
+ error(fh.buf, c, JGitText.get().missingForwardImageInGITBinaryPatch);
return c;
}
c = nEnd;
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/revplot/PlotCommitList.java b/org.eclipse.jgit/src/org/eclipse/jgit/revplot/PlotCommitList.java
index 8f6d083a32..61eed3fa9a 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/revplot/PlotCommitList.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/revplot/PlotCommitList.java
@@ -43,10 +43,12 @@
package org.eclipse.jgit.revplot;
+import java.text.MessageFormat;
import java.util.Collection;
import java.util.HashSet;
import java.util.TreeSet;
+import org.eclipse.jgit.JGitText;
import org.eclipse.jgit.revwalk.RevCommitList;
import org.eclipse.jgit.revwalk.RevWalk;
@@ -83,7 +85,7 @@ public class PlotCommitList<L extends PlotLane> extends
@Override
public void source(final RevWalk w) {
if (!(w instanceof PlotWalk))
- throw new ClassCastException("Not a " + PlotWalk.class.getName());
+ throw new ClassCastException(MessageFormat.format(JGitText.get().classCastNotA, PlotWalk.class.getName()));
super.source(w);
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/revplot/PlotWalk.java b/org.eclipse.jgit/src/org/eclipse/jgit/revplot/PlotWalk.java
index 66756ae996..6b4ed80e15 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/revplot/PlotWalk.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/revplot/PlotWalk.java
@@ -51,6 +51,7 @@ import java.util.Comparator;
import java.util.Map;
import java.util.Set;
+import org.eclipse.jgit.JGitText;
import org.eclipse.jgit.lib.AnyObjectId;
import org.eclipse.jgit.lib.Commit;
import org.eclipse.jgit.lib.Ref;
@@ -86,7 +87,7 @@ public class PlotWalk extends RevWalk {
@Override
public void sort(final RevSort s, final boolean use) {
if (s == RevSort.TOPO && !use)
- throw new IllegalArgumentException("Topological sort required.");
+ throw new IllegalArgumentException(JGitText.get().topologicalSortRequired);
super.sort(s, use);
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/MergeBaseGenerator.java b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/MergeBaseGenerator.java
index 2f01f541de..edb883714b 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/MergeBaseGenerator.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/MergeBaseGenerator.java
@@ -44,7 +44,9 @@
package org.eclipse.jgit.revwalk;
import java.io.IOException;
+import java.text.MessageFormat;
+import org.eclipse.jgit.JGitText;
import org.eclipse.jgit.errors.IncorrectObjectTypeException;
import org.eclipse.jgit.errors.MissingObjectException;
@@ -118,7 +120,7 @@ class MergeBaseGenerator extends Generator {
// commit admitted to the initial queue only once. If
// we see this marks aren't correctly erased.
//
- throw new IllegalStateException("Stale RevFlags on " + c.name());
+ throw new IllegalStateException(MessageFormat.format(JGitText.get().staleRevFlagsOn, c.name()));
}
c.flags |= flag;
pending.add(c);
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/ObjectWalk.java b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/ObjectWalk.java
index ddf40ac104..11d40012c5 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/ObjectWalk.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/ObjectWalk.java
@@ -44,7 +44,9 @@
package org.eclipse.jgit.revwalk;
import java.io.IOException;
+import java.text.MessageFormat;
+import org.eclipse.jgit.JGitText;
import org.eclipse.jgit.errors.CorruptObjectException;
import org.eclipse.jgit.errors.IncorrectObjectTypeException;
import org.eclipse.jgit.errors.MissingObjectException;
@@ -273,10 +275,8 @@ public class ObjectWalk extends RevWalk {
if (FileMode.GITLINK.equals(mode))
break;
treeWalk.getEntryObjectId(idBuffer);
- throw new CorruptObjectException("Invalid mode " + mode
- + " for " + idBuffer.name() + " '"
- + treeWalk.getEntryPathString() + "' in "
- + currentTree.name() + ".");
+ throw new CorruptObjectException(MessageFormat.format(JGitText.get().corruptObjectInvalidMode3
+ , mode , idBuffer.name() , treeWalk.getEntryPathString() , currentTree.name()));
}
treeWalk = treeWalk.next();
@@ -428,9 +428,8 @@ public class ObjectWalk extends RevWalk {
if (FileMode.GITLINK.equals(mode))
break;
treeWalk.getEntryObjectId(idBuffer);
- throw new CorruptObjectException("Invalid mode " + mode
- + " for " + idBuffer.name() + " "
- + treeWalk.getEntryPathString() + " in " + tree + ".");
+ throw new CorruptObjectException(MessageFormat.format(JGitText.get().corruptObjectInvalidMode3
+ , mode , idBuffer.name() , treeWalk.getEntryPathString() , tree));
}
treeWalk = treeWalk.next();
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevFlag.java b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevFlag.java
index 83f57d266d..e09fae43a8 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevFlag.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevFlag.java
@@ -43,6 +43,10 @@
package org.eclipse.jgit.revwalk;
+import java.text.MessageFormat;
+
+import org.eclipse.jgit.JGitText;
+
/**
* Application level mark bit for {@link RevObject}s.
* <p>
@@ -94,8 +98,8 @@ public class RevFlag {
@Override
public RevWalk getRevWalk() {
- throw new UnsupportedOperationException(toString()
- + " is a static flag and has no RevWalk instance");
+ throw new UnsupportedOperationException(MessageFormat.format(
+ JGitText.get().isAStaticFlagAndHasNorevWalkInstance, toString()));
}
}
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevObjectList.java b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevObjectList.java
index 0454b6ea77..5f8f419569 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevObjectList.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevObjectList.java
@@ -45,8 +45,11 @@
package org.eclipse.jgit.revwalk;
+import java.text.MessageFormat;
import java.util.AbstractList;
+import org.eclipse.jgit.JGitText;
+
/**
* An ordered list of {@link RevObject} subclasses.
*
@@ -77,7 +80,7 @@ public class RevObjectList<E extends RevObject> extends AbstractList<E> {
public void add(final int index, final E element) {
if (index != size)
- throw new UnsupportedOperationException("Not add-at-end: " + index);
+ throw new UnsupportedOperationException(MessageFormat.format(JGitText.get().unsupportedOperationNotAddAtEnd, index));
set(index, element);
size++;
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevWalk.java b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevWalk.java
index 4c43aa14e1..94e11752c6 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevWalk.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevWalk.java
@@ -45,11 +45,13 @@
package org.eclipse.jgit.revwalk;
import java.io.IOException;
+import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.Collection;
import java.util.EnumSet;
import java.util.Iterator;
+import org.eclipse.jgit.JGitText;
import org.eclipse.jgit.errors.IncorrectObjectTypeException;
import org.eclipse.jgit.errors.MissingObjectException;
import org.eclipse.jgit.errors.RevWalkException;
@@ -630,7 +632,7 @@ public class RevWalk implements Iterable<RevCommit> {
r = new RevTag(id);
break;
default:
- throw new IllegalArgumentException("invalid git type: " + type);
+ throw new IllegalArgumentException(MessageFormat.format(JGitText.get().invalidGitType, type));
}
objects.add(r);
}
@@ -755,7 +757,7 @@ public class RevWalk implements Iterable<RevCommit> {
break;
}
default:
- throw new IllegalArgumentException("Bad object type: " + type);
+ throw new IllegalArgumentException(MessageFormat.format(JGitText.get().badObjectType, type));
}
objects.add(r);
} else
@@ -820,8 +822,8 @@ public class RevWalk implements Iterable<RevCommit> {
int allocFlag() {
if (freeFlags == 0)
- throw new IllegalArgumentException(32 - RESERVED_FLAGS
- + " flags already created.");
+ throw new IllegalArgumentException(MessageFormat.format(
+ JGitText.get().flagsAlreadyCreated, 32 - RESERVED_FLAGS));
final int m = Integer.lowestOneBit(freeFlags);
freeFlags &= ~m;
return m;
@@ -838,9 +840,9 @@ public class RevWalk implements Iterable<RevCommit> {
*/
public void carry(final RevFlag flag) {
if ((freeFlags & flag.mask) != 0)
- throw new IllegalArgumentException(flag.name + " is disposed.");
+ throw new IllegalArgumentException(MessageFormat.format(JGitText.get().flagIsDisposed, flag.name));
if (flag.walker != this)
- throw new IllegalArgumentException(flag.name + " not from this.");
+ throw new IllegalArgumentException(MessageFormat.format(JGitText.get().flagNotFromThis, flag.name));
carryFlags |= flag.mask;
}
@@ -1059,7 +1061,7 @@ public class RevWalk implements Iterable<RevCommit> {
protected void assertNotStarted() {
if (isNotStarted())
return;
- throw new IllegalStateException("Output has already been started.");
+ throw new IllegalStateException(JGitText.get().outputHasAlreadyBeenStarted);
}
private boolean isNotStarted() {
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/StartGenerator.java b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/StartGenerator.java
index c5353fe8c5..5e778a416e 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/StartGenerator.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/StartGenerator.java
@@ -46,7 +46,9 @@
package org.eclipse.jgit.revwalk;
import java.io.IOException;
+import java.text.MessageFormat;
+import org.eclipse.jgit.JGitText;
import org.eclipse.jgit.errors.IncorrectObjectTypeException;
import org.eclipse.jgit.errors.MissingObjectException;
import org.eclipse.jgit.revwalk.filter.AndRevFilter;
@@ -88,8 +90,8 @@ class StartGenerator extends Generator {
// use the bulk of the generator pipeline.
//
if (tf != TreeFilter.ALL)
- throw new IllegalStateException("Cannot combine TreeFilter "
- + tf + " with RevFilter " + rf + ".");
+ throw new IllegalStateException(MessageFormat.format(
+ JGitText.get().cannotCombineTreeFilterWithRevFilter, tf, rf));
final MergeBaseGenerator mbg = new MergeBaseGenerator(w);
walker.pending = mbg;
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/filter/AndRevFilter.java b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/filter/AndRevFilter.java
index 112f07aede..d4790f870c 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/filter/AndRevFilter.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/filter/AndRevFilter.java
@@ -47,6 +47,7 @@ package org.eclipse.jgit.revwalk.filter;
import java.io.IOException;
import java.util.Collection;
+import org.eclipse.jgit.JGitText;
import org.eclipse.jgit.errors.IncorrectObjectTypeException;
import org.eclipse.jgit.errors.MissingObjectException;
import org.eclipse.jgit.revwalk.RevCommit;
@@ -90,7 +91,7 @@ public abstract class AndRevFilter extends RevFilter {
if (list.length == 2)
return create(list[0], list[1]);
if (list.length < 2)
- throw new IllegalArgumentException("At least two filters needed.");
+ throw new IllegalArgumentException(JGitText.get().atLeastTwoFiltersNeeded);
final RevFilter[] subfilters = new RevFilter[list.length];
System.arraycopy(list, 0, subfilters, 0, list.length);
return new List(subfilters);
@@ -106,7 +107,7 @@ public abstract class AndRevFilter extends RevFilter {
*/
public static RevFilter create(final Collection<RevFilter> list) {
if (list.size() < 2)
- throw new IllegalArgumentException("At least two filters needed.");
+ throw new IllegalArgumentException(JGitText.get().atLeastTwoFiltersNeeded);
final RevFilter[] subfilters = new RevFilter[list.size()];
list.toArray(subfilters);
if (subfilters.length == 2)
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/filter/AuthorRevFilter.java b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/filter/AuthorRevFilter.java
index 2ede91b57f..3f88c7b8c3 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/filter/AuthorRevFilter.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/filter/AuthorRevFilter.java
@@ -45,6 +45,7 @@ package org.eclipse.jgit.revwalk.filter;
import java.util.regex.Pattern;
+import org.eclipse.jgit.JGitText;
import org.eclipse.jgit.revwalk.RevCommit;
import org.eclipse.jgit.util.RawCharSequence;
import org.eclipse.jgit.util.RawParseUtils;
@@ -68,7 +69,7 @@ public class AuthorRevFilter {
*/
public static RevFilter create(String pattern) {
if (pattern.length() == 0)
- throw new IllegalArgumentException("Cannot match on empty string.");
+ throw new IllegalArgumentException(JGitText.get().cannotMatchOnEmptyString);
if (SubStringRevFilter.safe(pattern))
return new SubStringSearch(pattern);
return new PatternSearch(pattern);
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/filter/CommitterRevFilter.java b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/filter/CommitterRevFilter.java
index 59c3e080d5..e607f4f920 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/filter/CommitterRevFilter.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/filter/CommitterRevFilter.java
@@ -45,6 +45,7 @@ package org.eclipse.jgit.revwalk.filter;
import java.util.regex.Pattern;
+import org.eclipse.jgit.JGitText;
import org.eclipse.jgit.revwalk.RevCommit;
import org.eclipse.jgit.util.RawCharSequence;
import org.eclipse.jgit.util.RawParseUtils;
@@ -68,7 +69,7 @@ public class CommitterRevFilter {
*/
public static RevFilter create(String pattern) {
if (pattern.length() == 0)
- throw new IllegalArgumentException("Cannot match on empty string.");
+ throw new IllegalArgumentException(JGitText.get().cannotMatchOnEmptyString);
if (SubStringRevFilter.safe(pattern))
return new SubStringSearch(pattern);
return new PatternSearch(pattern);
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/filter/MessageRevFilter.java b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/filter/MessageRevFilter.java
index 6ab3b1d3b0..e40fb01835 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/filter/MessageRevFilter.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/filter/MessageRevFilter.java
@@ -45,6 +45,7 @@ package org.eclipse.jgit.revwalk.filter;
import java.util.regex.Pattern;
+import org.eclipse.jgit.JGitText;
import org.eclipse.jgit.revwalk.RevCommit;
import org.eclipse.jgit.util.RawCharSequence;
import org.eclipse.jgit.util.RawParseUtils;
@@ -68,7 +69,7 @@ public class MessageRevFilter {
*/
public static RevFilter create(String pattern) {
if (pattern.length() == 0)
- throw new IllegalArgumentException("Cannot match on empty string.");
+ throw new IllegalArgumentException(JGitText.get().cannotMatchOnEmptyString);
if (SubStringRevFilter.safe(pattern))
return new SubStringSearch(pattern);
return new PatternSearch(pattern);
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/filter/OrRevFilter.java b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/filter/OrRevFilter.java
index bd1314a934..586c138fff 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/filter/OrRevFilter.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/filter/OrRevFilter.java
@@ -47,6 +47,7 @@ package org.eclipse.jgit.revwalk.filter;
import java.io.IOException;
import java.util.Collection;
+import org.eclipse.jgit.JGitText;
import org.eclipse.jgit.errors.IncorrectObjectTypeException;
import org.eclipse.jgit.errors.MissingObjectException;
import org.eclipse.jgit.revwalk.RevCommit;
@@ -88,7 +89,7 @@ public abstract class OrRevFilter extends RevFilter {
if (list.length == 2)
return create(list[0], list[1]);
if (list.length < 2)
- throw new IllegalArgumentException("At least two filters needed.");
+ throw new IllegalArgumentException(JGitText.get().atLeastTwoFiltersNeeded);
final RevFilter[] subfilters = new RevFilter[list.length];
System.arraycopy(list, 0, subfilters, 0, list.length);
return new List(subfilters);
@@ -104,7 +105,7 @@ public abstract class OrRevFilter extends RevFilter {
*/
public static RevFilter create(final Collection<RevFilter> list) {
if (list.size() < 2)
- throw new IllegalArgumentException("At least two filters needed.");
+ throw new IllegalArgumentException(JGitText.get().atLeastTwoFiltersNeeded);
final RevFilter[] subfilters = new RevFilter[list.size()];
list.toArray(subfilters);
if (subfilters.length == 2)
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/filter/PatternMatchRevFilter.java b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/filter/PatternMatchRevFilter.java
index 5f2bcf26ab..c2a287958a 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/filter/PatternMatchRevFilter.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/filter/PatternMatchRevFilter.java
@@ -48,6 +48,7 @@ import java.io.IOException;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
+import org.eclipse.jgit.JGitText;
import org.eclipse.jgit.errors.IncorrectObjectTypeException;
import org.eclipse.jgit.errors.MissingObjectException;
import org.eclipse.jgit.lib.Constants;
@@ -101,7 +102,7 @@ public abstract class PatternMatchRevFilter extends RevFilter {
protected PatternMatchRevFilter(String pattern, final boolean innerString,
final boolean rawEncoding, final int flags) {
if (pattern.length() == 0)
- throw new IllegalArgumentException("Cannot match on empty string.");
+ throw new IllegalArgumentException(JGitText.get().cannotMatchOnEmptyString);
patternText = pattern;
if (innerString) {
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/filter/RevFilter.java b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/filter/RevFilter.java
index 2d67d9763a..378c906992 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/filter/RevFilter.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/filter/RevFilter.java
@@ -45,6 +45,7 @@ package org.eclipse.jgit.revwalk.filter;
import java.io.IOException;
+import org.eclipse.jgit.JGitText;
import org.eclipse.jgit.errors.IncorrectObjectTypeException;
import org.eclipse.jgit.errors.MissingObjectException;
import org.eclipse.jgit.errors.StopWalkException;
@@ -157,7 +158,7 @@ public abstract class RevFilter {
public static final RevFilter MERGE_BASE = new RevFilter() {
@Override
public boolean include(final RevWalk walker, final RevCommit c) {
- throw new UnsupportedOperationException("Cannot be combined.");
+ throw new UnsupportedOperationException(JGitText.get().cannotBeCombined);
}
@Override
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/AmazonS3.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/AmazonS3.java
index c5d6db7e3e..0430b5fdca 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/AmazonS3.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/AmazonS3.java
@@ -60,6 +60,7 @@ import java.security.InvalidKeyException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.security.spec.InvalidKeySpecException;
+import java.text.MessageFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Collections;
@@ -78,6 +79,7 @@ import java.util.TreeMap;
import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
+import org.eclipse.jgit.JGitText;
import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.lib.NullProgressMonitor;
import org.eclipse.jgit.lib.ProgressMonitor;
@@ -158,7 +160,7 @@ public class AmazonS3 {
try {
return MessageDigest.getInstance("MD5");
} catch (NoSuchAlgorithmException e) {
- throw new RuntimeException("JRE lacks MD5 implementation", e);
+ throw new RuntimeException(JGitText.get().JRELacksMD5Implementation, e);
}
}
@@ -211,11 +213,11 @@ public class AmazonS3 {
public AmazonS3(final Properties props) {
publicKey = props.getProperty("accesskey");
if (publicKey == null)
- throw new IllegalArgumentException("Missing accesskey.");
+ throw new IllegalArgumentException(JGitText.get().missingAccesskey);
final String secret = props.getProperty("secretkey");
if (secret == null)
- throw new IllegalArgumentException("Missing secretkey.");
+ throw new IllegalArgumentException(JGitText.get().missingSecretkey);
privateKey = new SecretKeySpec(Constants.encodeASCII(secret), HMAC);
final String pacl = props.getProperty("acl", "PRIVATE");
@@ -241,9 +243,9 @@ public class AmazonS3 {
encryption = WalkEncryption.NONE;
}
} catch (InvalidKeySpecException e) {
- throw new IllegalArgumentException("Invalid encryption", e);
+ throw new IllegalArgumentException(JGitText.get().invalidEncryption, e);
} catch (NoSuchAlgorithmException e) {
- throw new IllegalArgumentException("Invalid encryption", e);
+ throw new IllegalArgumentException(JGitText.get().invalidEncryption, e);
}
maxAttempts = Integer.parseInt(props.getProperty(
@@ -471,7 +473,7 @@ public class AmazonS3 {
if (monitor == null)
monitor = NullProgressMonitor.INSTANCE;
if (monitorTask == null)
- monitorTask = "Uploading " + key;
+ monitorTask = MessageFormat.format(JGitText.get().progressMonUploading, key);
final String md5str = Base64.encodeBytes(csum);
final long len = buf.length();
@@ -508,9 +510,8 @@ public class AmazonS3 {
private IOException error(final String action, final String key,
final HttpURLConnection c) throws IOException {
- final IOException err = new IOException(action + " of '" + key
- + "' failed: " + HttpSupport.response(c) + " "
- + c.getResponseMessage());
+ final IOException err = new IOException(MessageFormat.format(JGitText.get().amazonS3ActionFailed
+ , action, key, HttpSupport.response(c), c.getResponseMessage()));
final ByteArrayOutputStream b = new ByteArrayOutputStream();
byte[] buf = new byte[2048];
for (;;) {
@@ -527,8 +528,8 @@ public class AmazonS3 {
}
private IOException maxAttempts(final String action, final String key) {
- return new IOException(action + " of '" + key + "' failed:"
- + " Giving up after " + maxAttempts + " attempts.");
+ return new IOException(MessageFormat.format(JGitText.get().amazonS3ActionFailedGivingUp
+ , action, key, maxAttempts));
}
private HttpURLConnection open(final String method, final String bucket,
@@ -614,9 +615,9 @@ public class AmazonS3 {
m.init(privateKey);
sec = Base64.encodeBytes(m.doFinal(s.toString().getBytes("UTF-8")));
} catch (NoSuchAlgorithmException e) {
- throw new IOException("No " + HMAC + " support:" + e.getMessage());
+ throw new IOException(MessageFormat.format(JGitText.get().noHMACsupport, HMAC, e.getMessage()));
} catch (InvalidKeyException e) {
- throw new IOException("Invalid key: " + e.getMessage());
+ throw new IOException(MessageFormat.format(JGitText.get().invalidKey, e.getMessage()));
}
c.setRequestProperty("Authorization", "AWS " + publicKey + ":" + sec);
}
@@ -668,7 +669,7 @@ public class AmazonS3 {
try {
xr = XMLReaderFactory.createXMLReader();
} catch (SAXException e) {
- throw new IOException("No XML parser available.");
+ throw new IOException(JGitText.get().noXMLParserAvailable);
}
xr.setContentHandler(this);
final InputStream in = c.getInputStream();
@@ -676,7 +677,7 @@ public class AmazonS3 {
xr.parse(new InputSource(in));
} catch (SAXException parsingError) {
final IOException p;
- p = new IOException("Error listing " + prefix);
+ p = new IOException(MessageFormat.format(JGitText.get().errorListing, prefix));
p.initCause(parsingError);
throw p;
} finally {
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/BaseConnection.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/BaseConnection.java
index 1339b86913..30d3bb13e7 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/BaseConnection.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/BaseConnection.java
@@ -52,6 +52,7 @@ import java.util.Collection;
import java.util.Collections;
import java.util.Map;
+import org.eclipse.jgit.JGitText;
import org.eclipse.jgit.errors.TransportException;
import org.eclipse.jgit.lib.Ref;
@@ -111,7 +112,7 @@ public abstract class BaseConnection implements Connection {
protected void markStartedOperation() throws TransportException {
if (startedOperation)
throw new TransportException(
- "Only one operation call per connection is supported.");
+ JGitText.get().onlyOneOperationCallPerConnectionIsSupported);
startedOperation = true;
}
@@ -136,7 +137,7 @@ public abstract class BaseConnection implements Connection {
*/
protected void setMessageWriter(Writer writer) {
if (messageWriter != null)
- throw new IllegalStateException("Writer already initialized");
+ throw new IllegalStateException(JGitText.get().writerAlreadyInitialized);
messageWriter = writer;
}
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackConnection.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackConnection.java
index 7b6d3e121a..2927cada9c 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackConnection.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackConnection.java
@@ -50,10 +50,12 @@ import java.io.EOFException;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
+import java.text.MessageFormat;
import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.Set;
+import org.eclipse.jgit.JGitText;
import org.eclipse.jgit.errors.NoRemoteRepositoryException;
import org.eclipse.jgit.errors.PackProtocolException;
import org.eclipse.jgit.errors.RemoteRepositoryException;
@@ -230,8 +232,8 @@ abstract class BasePackConnection extends BaseConnection {
name = name.substring(0, name.length() - 3);
final Ref prior = avail.get(name);
if (prior == null)
- throw new PackProtocolException(uri, "advertisement of "
- + name + "^{} came before " + name);
+ throw new PackProtocolException(uri, MessageFormat.format(
+ JGitText.get().advertisementCameBefore, name, name));
if (prior.getPeeledObjectId() != null)
throw duplicateAdvertisement(name + "^{}");
@@ -258,7 +260,7 @@ abstract class BasePackConnection extends BaseConnection {
* possibly why.
*/
protected TransportException noRepository() {
- return new NoRemoteRepositoryException(uri, "not found.");
+ return new NoRemoteRepositoryException(uri, JGitText.get().notFound);
}
protected boolean isCapableOf(final String option) {
@@ -274,8 +276,7 @@ abstract class BasePackConnection extends BaseConnection {
}
private PackProtocolException duplicateAdvertisement(final String name) {
- return new PackProtocolException(uri, "duplicate advertisements of "
- + name);
+ return new PackProtocolException(uri, MessageFormat.format(JGitText.get().duplicateAdvertisementsOf, name));
}
@Override
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackFetchConnection.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackFetchConnection.java
index 7b90ec199f..2819ae26de 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackFetchConnection.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackFetchConnection.java
@@ -47,11 +47,13 @@ package org.eclipse.jgit.transport;
import java.io.IOException;
import java.io.InputStream;
+import java.text.MessageFormat;
import java.util.Collection;
import java.util.Collections;
import java.util.Date;
import java.util.Set;
+import org.eclipse.jgit.JGitText;
import org.eclipse.jgit.errors.PackProtocolException;
import org.eclipse.jgit.errors.TransportException;
import org.eclipse.jgit.lib.AnyObjectId;
@@ -391,8 +393,7 @@ abstract class BasePackFetchConnection extends BasePackConnection implements
// ACK status to tell us common objects for reuse in future
// requests. If its not enabled, we can't talk to the peer.
//
- throw new PackProtocolException(uri, "stateless RPC requires "
- + OPTION_MULTI_ACK_DETAILED + " to be enabled");
+ throw new PackProtocolException(uri, MessageFormat.format(JGitText.get().statelessRPCRequiresOptionToBeEnabled, OPTION_MULTI_ACK_DETAILED));
}
return line.toString();
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()));
}
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/BundleFetchConnection.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/BundleFetchConnection.java
index c788244f74..3b97dfc0d6 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/BundleFetchConnection.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/BundleFetchConnection.java
@@ -50,6 +50,7 @@ package org.eclipse.jgit.transport;
import java.io.BufferedInputStream;
import java.io.IOException;
import java.io.InputStream;
+import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
@@ -59,6 +60,7 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
+import org.eclipse.jgit.JGitText;
import org.eclipse.jgit.errors.MissingBundlePrerequisiteException;
import org.eclipse.jgit.errors.MissingObjectException;
import org.eclipse.jgit.errors.PackProtocolException;
@@ -101,7 +103,7 @@ class BundleFetchConnection extends BaseFetchConnection {
readBundleV2();
break;
default:
- throw new TransportException(transport.uri, "not a bundle");
+ throw new TransportException(transport.uri, JGitText.get().notABundle);
}
} catch (TransportException err) {
close();
@@ -119,7 +121,7 @@ class BundleFetchConnection extends BaseFetchConnection {
final String rev = readLine(new byte[1024]);
if (TransportBundle.V2_BUNDLE_SIGNATURE.equals(rev))
return 2;
- throw new TransportException(transport.uri, "not a bundle");
+ throw new TransportException(transport.uri, JGitText.get().notABundle);
}
private void readBundleV2() throws IOException {
@@ -151,7 +153,7 @@ class BundleFetchConnection extends BaseFetchConnection {
private PackProtocolException duplicateAdvertisement(final String name) {
return new PackProtocolException(transport.uri,
- "duplicate advertisements of " + name);
+ MessageFormat.format(JGitText.get().duplicateAdvertisementsOf, name));
}
private String readLine(final byte[] hdrbuf) throws IOException {
@@ -227,8 +229,8 @@ class BundleFetchConnection extends BaseFetchConnection {
} catch (MissingObjectException notFound) {
missing.put(p, e.getValue());
} catch (IOException err) {
- throw new TransportException(transport.uri, "Cannot read commit "
- + p.name(), err);
+ throw new TransportException(transport.uri
+ , MessageFormat.format(JGitText.get().cannotReadCommit, p.name()), err);
}
}
if (!missing.isEmpty())
@@ -253,7 +255,7 @@ class BundleFetchConnection extends BaseFetchConnection {
}
}
} catch (IOException err) {
- throw new TransportException(transport.uri, "Cannot read object", err);
+ throw new TransportException(transport.uri, JGitText.get().cannotReadObject, err);
}
if (remaining > 0) {
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/BundleWriter.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/BundleWriter.java
index 7b0a5eec45..7e91557b09 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/BundleWriter.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/BundleWriter.java
@@ -47,11 +47,13 @@ import java.io.IOException;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.Writer;
+import java.text.MessageFormat;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import java.util.TreeMap;
+import org.eclipse.jgit.JGitText;
import org.eclipse.jgit.lib.AnyObjectId;
import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.lib.ObjectId;
@@ -112,9 +114,9 @@ public class BundleWriter {
*/
public void include(final String name, final AnyObjectId id) {
if (!Repository.isValidRefName(name))
- throw new IllegalArgumentException("Invalid ref name: " + name);
+ throw new IllegalArgumentException(MessageFormat.format(JGitText.get().invalidRefName, name));
if (include.containsKey(name))
- throw new IllegalStateException("Duplicate ref: " + name);
+ throw new IllegalStateException(JGitText.get().duplicateRef + name);
include.put(name, id.toObjectId());
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/Daemon.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/Daemon.java
index cafcd7b4bd..39c7ae8f01 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/Daemon.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/Daemon.java
@@ -57,6 +57,7 @@ import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CopyOnWriteArrayList;
+import org.eclipse.jgit.JGitText;
import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.lib.PersonIdent;
import org.eclipse.jgit.lib.Repository;
@@ -250,7 +251,7 @@ public class Daemon {
*/
public synchronized void start() throws IOException {
if (acceptThread != null)
- throw new IllegalStateException("Daemon already running");
+ throw new IllegalStateException(JGitText.get().daemonAlreadyRunning);
final ServerSocket listenSock = new ServerSocket(
myAddress != null ? myAddress.getPort() : 0, BACKLOG,
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);
}
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/IndexPack.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/IndexPack.java
index 6eeccea841..2a5b4344f5 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/IndexPack.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/IndexPack.java
@@ -52,6 +52,7 @@ import java.io.IOException;
import java.io.InputStream;
import java.io.RandomAccessFile;
import java.security.MessageDigest;
+import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@@ -60,6 +61,7 @@ import java.util.zip.DataFormatException;
import java.util.zip.Deflater;
import java.util.zip.Inflater;
+import org.eclipse.jgit.JGitText;
import org.eclipse.jgit.errors.CorruptObjectException;
import org.eclipse.jgit.errors.MissingObjectException;
import org.eclipse.jgit.lib.AnyObjectId;
@@ -82,10 +84,10 @@ import org.eclipse.jgit.util.NB;
/** Indexes Git pack files for local use. */
public class IndexPack {
/** Progress message when reading raw data from the pack. */
- public static final String PROGRESS_DOWNLOAD = "Receiving objects";
+ public static final String PROGRESS_DOWNLOAD = JGitText.get().receivingObjects;
/** Progress message when computing names of delta compressed objects. */
- public static final String PROGRESS_RESOLVE_DELTA = "Resolving deltas";
+ public static final String PROGRESS_RESOLVE_DELTA = JGitText.get().resolvingDeltas;
/**
* Size of the internal stream buffer.
@@ -392,20 +394,19 @@ public class IndexPack {
indexOneObject();
progress.update(1);
if (progress.isCancelled())
- throw new IOException("Download cancelled");
+ throw new IOException(JGitText.get().downloadCancelled);
}
readPackFooter();
endInput();
progress.endTask();
if (deltaCount > 0) {
if (packOut == null)
- throw new IOException("need packOut");
+ throw new IOException(JGitText.get().needPackOut);
resolveDeltas(progress);
if (entryCount < objectCount) {
if (!fixThin) {
- throw new IOException("pack has "
- + (objectCount - entryCount)
- + " unresolved deltas");
+ throw new IOException(MessageFormat.format(
+ JGitText.get().packHasUnresolvedDeltas, (objectCount - entryCount)));
}
fixThinPack(progress);
}
@@ -458,7 +459,7 @@ public class IndexPack {
resolveDeltas(entries[i]);
progress.update(entryCount - before);
if (progress.isCancelled())
- throw new IOException("Download cancelled during indexing");
+ throw new IOException(JGitText.get().downloadCancelledDuringIndexing);
}
progress.endTask();
}
@@ -505,12 +506,12 @@ public class IndexPack {
break;
}
default:
- throw new IOException("Unknown object type " + typeCode + ".");
+ throw new IOException(MessageFormat.format(JGitText.get().unknownObjectType, typeCode));
}
final int crc32 = (int) crc.getValue();
if (oldCRC != crc32)
- throw new IOException("Corruption detected re-reading at " + pos);
+ throw new IOException(MessageFormat.format(JGitText.get().corruptionDetectedReReadingAt, pos));
if (oe == null) {
objectDigest.update(Constants.encodedTypeString(type));
objectDigest.update((byte) ' ');
@@ -602,7 +603,7 @@ public class IndexPack {
resolveChildDeltas(oe.getOffset(), typeCode, data, oe);
if (progress.isCancelled())
- throw new IOException("Download cancelled during indexing");
+ throw new IOException(JGitText.get().downloadCancelledDuringIndexing);
}
def.end();
@@ -691,7 +692,7 @@ public class IndexPack {
if (!Arrays.equals(origDigest.digest(), origcsum)
|| !Arrays.equals(tailDigest.digest(), tailcsum))
- throw new IOException("Pack corrupted while writing to filesystem");
+ throw new IOException(JGitText.get().packCorruptedWhileWritingToFilesystem);
packcsum = packDigest.digest();
packOut.write(packcsum);
@@ -730,11 +731,11 @@ public class IndexPack {
final int p = fillFromInput(hdrln);
for (int k = 0; k < Constants.PACK_SIGNATURE.length; k++)
if (buf[p + k] != Constants.PACK_SIGNATURE[k])
- throw new IOException("Not a PACK file.");
+ throw new IOException(JGitText.get().notAPACKFile);
final long vers = NB.decodeUInt32(buf, p + 4);
if (vers != 2 && vers != 3)
- throw new IOException("Unsupported pack version " + vers + ".");
+ throw new IOException(MessageFormat.format(JGitText.get().unsupportedPackVersion, vers));
objectCount = NB.decodeUInt32(buf, p + 8);
use(hdrln);
}
@@ -750,7 +751,7 @@ public class IndexPack {
packOut.write(packcsum);
if (!Arrays.equals(cmpcsum, packcsum))
- throw new CorruptObjectException("Packfile checksum incorrect.");
+ throw new CorruptObjectException(JGitText.get().corruptObjectPackfileChecksumIncorrect);
}
// Cleanup all resources associated with our input parsing.
@@ -814,7 +815,7 @@ public class IndexPack {
break;
}
default:
- throw new IOException("Unknown object type " + typeCode + ".");
+ throw new IOException(MessageFormat.format(JGitText.get().unknownObjectType, typeCode));
}
}
@@ -839,9 +840,8 @@ public class IndexPack {
try {
objCheck.check(type, data);
} catch (CorruptObjectException e) {
- throw new IOException("Invalid "
- + Constants.typeString(type) + " " + id.name()
- + ":" + e.getMessage());
+ throw new IOException(MessageFormat.format(JGitText.get().invalidObject
+ , Constants.typeString(type) , id.name() , e.getMessage()));
}
}
@@ -849,7 +849,7 @@ public class IndexPack {
if (ldr != null) {
final byte[] existingData = ldr.getCachedBytes();
if (ldr.getType() != type || !Arrays.equals(data, existingData)) {
- throw new IOException("Collision on " + id.name());
+ throw new IOException(MessageFormat.format(JGitText.get().collisionOn, id.name()));
}
}
}
@@ -904,7 +904,7 @@ public class IndexPack {
}
next = in.read(buf, next, free);
if (next <= 0)
- throw new EOFException("Packfile is truncated.");
+ throw new EOFException(JGitText.get().packfileIsTruncated);
bAvail += next;
}
return bOffset;
@@ -924,7 +924,7 @@ public class IndexPack {
}
next = packOut.read(buf, next, free);
if (next <= 0)
- throw new EOFException("Packfile is truncated.");
+ throw new EOFException(JGitText.get().packfileIsTruncated);
bAvail += next;
}
return bOffset;
@@ -966,7 +966,7 @@ public class IndexPack {
n += inf.inflate(dst, n, free);
}
if (n != sz)
- throw new DataFormatException("wrong decompressed length");
+ throw new DataFormatException(JGitText.get().wrongDecompressedLength);
n = bAvail - inf.getRemaining();
if (n > 0) {
crc.update(buf, p, n);
@@ -998,7 +998,7 @@ public class IndexPack {
n += inf.inflate(dst, n, dst.length - n);
}
if (n != sz)
- throw new DataFormatException("wrong decompressed length");
+ throw new DataFormatException(JGitText.get().wrongDecompressedLength);
n = bAvail - inf.getRemaining();
if (n > 0) {
crc.update(buf, p, n);
@@ -1043,8 +1043,8 @@ public class IndexPack {
}
private static CorruptObjectException corrupt(final DataFormatException dfe) {
- return new CorruptObjectException("Packfile corruption detected: "
- + dfe.getMessage());
+ return new CorruptObjectException(MessageFormat.format(
+ JGitText.get().packfileCorruptionDetected, dfe.getMessage()));
}
private static class DeltaChain extends ObjectId {
@@ -1138,7 +1138,7 @@ public class IndexPack {
// to create it. There is no way to move this pack in.
//
cleanupTemporaryFiles();
- throw new IOException("Cannot create " + packDir.getAbsolutePath());
+ throw new IOException(MessageFormat.format(JGitText.get().cannotCreateDirectory, packDir.getAbsolutePath()));
}
if (finalPack.exists()) {
@@ -1154,7 +1154,7 @@ public class IndexPack {
//
try {
if (!keep.lock(lockMessage))
- throw new IOException("Cannot lock pack in " + finalPack);
+ throw new IOException(MessageFormat.format(JGitText.get().cannotLockPackIn, finalPack));
} catch (IOException e) {
cleanupTemporaryFiles();
throw e;
@@ -1164,7 +1164,7 @@ public class IndexPack {
if (!dstPack.renameTo(finalPack)) {
cleanupTemporaryFiles();
keep.unlock();
- throw new IOException("Cannot move pack to " + finalPack);
+ throw new IOException(MessageFormat.format(JGitText.get().cannotMovePackTo, finalPack));
}
if (!dstIdx.renameTo(finalIdx)) {
@@ -1172,7 +1172,7 @@ public class IndexPack {
keep.unlock();
if (!finalPack.delete())
finalPack.deleteOnExit();
- throw new IOException("Cannot move index to " + finalIdx);
+ throw new IOException(MessageFormat.format(JGitText.get().cannotMoveIndexTo, finalIdx));
}
try {
@@ -1199,4 +1199,4 @@ public class IndexPack {
if (needNewObjectIds())
newObjectIds.add(oe);
}
-} \ No newline at end of file
+}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/PacketLineIn.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/PacketLineIn.java
index 170e4ddbe0..3821d696ed 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/PacketLineIn.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/PacketLineIn.java
@@ -47,7 +47,9 @@ package org.eclipse.jgit.transport;
import java.io.IOException;
import java.io.InputStream;
+import java.text.MessageFormat;
+import org.eclipse.jgit.JGitText;
import org.eclipse.jgit.errors.PackProtocolException;
import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.lib.MutableObjectId;
@@ -82,7 +84,7 @@ class PacketLineIn {
AckNackResult readACK(final MutableObjectId returnedId) throws IOException {
final String line = readString();
if (line.length() == 0)
- throw new PackProtocolException("Expected ACK/NAK, found EOF");
+ throw new PackProtocolException(JGitText.get().expectedACKNAKFoundEOF);
if ("NAK".equals(line))
return AckNackResult.NAK;
if (line.startsWith("ACK ")) {
@@ -98,7 +100,7 @@ class PacketLineIn {
else if (arg.equals(" ready"))
return AckNackResult.ACK_READY;
}
- throw new PackProtocolException("Expected ACK/NAK, got: " + line);
+ throw new PackProtocolException(MessageFormat.format(JGitText.get().expectedACKNAKGot, line));
}
String readString() throws IOException {
@@ -142,9 +144,9 @@ class PacketLineIn {
throw new ArrayIndexOutOfBoundsException();
return len;
} catch (ArrayIndexOutOfBoundsException err) {
- throw new IOException("Invalid packet line header: "
- + (char) lineBuffer[0] + (char) lineBuffer[1]
- + (char) lineBuffer[2] + (char) lineBuffer[3]);
+ throw new IOException(MessageFormat.format(JGitText.get().invalidPacketLineHeader,
+ "" + (char) lineBuffer[0] + (char) lineBuffer[1]
+ + (char) lineBuffer[2] + (char) lineBuffer[3]));
}
}
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/PushProcess.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/PushProcess.java
index 03b783427a..02497cb06f 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/PushProcess.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/PushProcess.java
@@ -44,10 +44,12 @@
package org.eclipse.jgit.transport;
import java.io.IOException;
+import java.text.MessageFormat;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
+import org.eclipse.jgit.JGitText;
import org.eclipse.jgit.errors.MissingObjectException;
import org.eclipse.jgit.errors.NotSupportedException;
import org.eclipse.jgit.errors.TransportException;
@@ -66,7 +68,7 @@ import org.eclipse.jgit.transport.RemoteRefUpdate.Status;
*/
class PushProcess {
/** Task name for {@link ProgressMonitor} used during opening connection. */
- static final String PROGRESS_OPENING_CONNECTION = "Opening connection";
+ static final String PROGRESS_OPENING_CONNECTION = JGitText.get().openingConnection;
/** Transport used to perform this operation. */
private final Transport transport;
@@ -97,9 +99,8 @@ class PushProcess {
this.toPush = new HashMap<String, RemoteRefUpdate>();
for (final RemoteRefUpdate rru : toPush) {
if (this.toPush.put(rru.getRemoteName(), rru) != null)
- throw new TransportException(
- "Duplicate remote ref update is illegal. Affected remote name: "
- + rru.getRemoteName());
+ throw new TransportException(MessageFormat.format(
+ JGitText.get().duplicateRemoteRefUpdateIsIllegal, rru.getRemoteName()));
}
}
@@ -200,9 +201,8 @@ class PushProcess {
} catch (MissingObjectException x) {
fastForward = false;
} catch (Exception x) {
- throw new TransportException(transport.getURI(),
- "reading objects from local repository failed: "
- + x.getMessage(), x);
+ throw new TransportException(transport.getURI(), MessageFormat.format(
+ JGitText.get().readingObjectsFromLocalRepositoryFailed, x.getMessage()), x);
}
rru.setFastForward(fastForward);
if (!fastForward && !rru.isForceUpdate())
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/ReceivePack.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/ReceivePack.java
index 4e62d7427f..e42b7fe0c9 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/ReceivePack.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/ReceivePack.java
@@ -57,6 +57,7 @@ import java.io.InputStream;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.Writer;
+import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
@@ -64,6 +65,7 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
+import org.eclipse.jgit.JGitText;
import org.eclipse.jgit.errors.MissingObjectException;
import org.eclipse.jgit.errors.PackProtocolException;
import org.eclipse.jgit.lib.Config;
@@ -724,7 +726,7 @@ public class ReceivePack {
}
if (line.length() < 83) {
- final String m = "error: invalid protocol: wanted 'old new ref'";
+ final String m = JGitText.get().errorInvalidProtocolWantedOldNewRef;
sendError(m);
throw new PackProtocolException(m);
}
@@ -898,7 +900,7 @@ public class ReceivePack {
// other requested old id is invalid.
//
cmd.setResult(Result.REJECTED_OTHER_REASON,
- "invalid old id sent");
+ JGitText.get().invalidOldIdSent);
continue;
}
@@ -906,7 +908,7 @@ public class ReceivePack {
if (ref == null) {
// The ref must have been advertised in order to be updated.
//
- cmd.setResult(Result.REJECTED_OTHER_REASON, "no such ref");
+ cmd.setResult(Result.REJECTED_OTHER_REASON, JGitText.get().noSuchRef);
continue;
}
@@ -915,7 +917,7 @@ public class ReceivePack {
// object id we advertised.
//
cmd.setResult(Result.REJECTED_OTHER_REASON,
- "invalid old id sent");
+ JGitText.get().invalidOldIdSent);
continue;
}
@@ -958,7 +960,7 @@ public class ReceivePack {
if (!cmd.getRefName().startsWith(Constants.R_REFS)
|| !Repository.isValidRefName(cmd.getRefName())) {
- cmd.setResult(Result.REJECTED_OTHER_REASON, "funny refname");
+ cmd.setResult(Result.REJECTED_OTHER_REASON, JGitText.get().funnyRefname);
}
}
}
@@ -997,8 +999,8 @@ public class ReceivePack {
break;
}
} catch (IOException err) {
- cmd.setResult(Result.REJECTED_OTHER_REASON, "lock error: "
- + err.getMessage());
+ cmd.setResult(Result.REJECTED_OTHER_REASON, MessageFormat.format(
+ JGitText.get().lockError, err.getMessage()));
}
}
@@ -1047,7 +1049,7 @@ public class ReceivePack {
private void sendStatusReport(final boolean forClient, final Reporter out)
throws IOException {
if (unpackError != null) {
- out.sendString("unpack error " + unpackError.getMessage());
+ out.sendString(MessageFormat.format(JGitText.get().unpackError, unpackError.getMessage()));
if (forClient) {
for (final ReceiveCommand cmd : commands) {
out.sendString("ng " + cmd.getRefName()
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/RefSpec.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/RefSpec.java
index 154ae3fedc..ca6f01500b 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/RefSpec.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/RefSpec.java
@@ -43,6 +43,9 @@
package org.eclipse.jgit.transport;
+import java.text.MessageFormat;
+
+import org.eclipse.jgit.JGitText;
import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.lib.Ref;
@@ -125,7 +128,7 @@ public class RefSpec {
if (c == 0) {
s = s.substring(1);
if (isWildcard(s))
- throw new IllegalArgumentException("Invalid wildcards " + spec);
+ throw new IllegalArgumentException(MessageFormat.format(JGitText.get().invalidWildcards, spec));
dstName = s;
} else if (c > 0) {
srcName = s.substring(0, c);
@@ -133,10 +136,10 @@ public class RefSpec {
if (isWildcard(srcName) && isWildcard(dstName))
wildcard = true;
else if (isWildcard(srcName) || isWildcard(dstName))
- throw new IllegalArgumentException("Invalid wildcards " + spec);
+ throw new IllegalArgumentException(MessageFormat.format(JGitText.get().invalidWildcards, spec));
} else {
if (isWildcard(s))
- throw new IllegalArgumentException("Invalid wildcards " + spec);
+ throw new IllegalArgumentException(MessageFormat.format(JGitText.get().invalidWildcards, spec));
srcName = s;
}
}
@@ -211,9 +214,9 @@ public class RefSpec {
final RefSpec r = new RefSpec(this);
r.srcName = source;
if (isWildcard(r.srcName) && r.dstName == null)
- throw new IllegalStateException("Destination is not a wildcard.");
+ throw new IllegalStateException(JGitText.get().destinationIsNotAWildcard);
if (isWildcard(r.srcName) != isWildcard(r.dstName))
- throw new IllegalStateException("Source/Destination must match.");
+ throw new IllegalStateException(JGitText.get().sourceDestinationMustMatch);
return r;
}
@@ -250,9 +253,9 @@ public class RefSpec {
final RefSpec r = new RefSpec(this);
r.dstName = destination;
if (isWildcard(r.dstName) && r.srcName == null)
- throw new IllegalStateException("Source is not a wildcard.");
+ throw new IllegalStateException(JGitText.get().sourceIsNotAWildcard);
if (isWildcard(r.srcName) != isWildcard(r.dstName))
- throw new IllegalStateException("Source/Destination must match.");
+ throw new IllegalStateException(JGitText.get().sourceDestinationMustMatch);
return r;
}
@@ -271,7 +274,7 @@ public class RefSpec {
public RefSpec setSourceDestination(final String source,
final String destination) {
if (isWildcard(source) != isWildcard(destination))
- throw new IllegalArgumentException("Source/Destination must match.");
+ throw new IllegalStateException(JGitText.get().sourceDestinationMustMatch);
final RefSpec r = new RefSpec(this);
r.wildcard = isWildcard(source);
r.srcName = source;
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/RemoteRefUpdate.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/RemoteRefUpdate.java
index b2aa6335d8..1b17c9f0f4 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/RemoteRefUpdate.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/RemoteRefUpdate.java
@@ -44,7 +44,9 @@
package org.eclipse.jgit.transport;
import java.io.IOException;
+import java.text.MessageFormat;
+import org.eclipse.jgit.JGitText;
import org.eclipse.jgit.lib.ObjectId;
import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.revwalk.RevWalk;
@@ -184,13 +186,13 @@ public class RemoteRefUpdate {
final String localName, final ObjectId expectedOldObjectId)
throws IOException {
if (remoteName == null)
- throw new IllegalArgumentException("Remote name can't be null.");
+ throw new IllegalArgumentException(JGitText.get().remoteNameCantBeNull);
this.srcRef = srcRef;
this.newObjectId = (srcRef == null ? ObjectId.zeroId() : localDb
.resolve(srcRef));
if (newObjectId == null)
- throw new IOException("Source ref " + srcRef
- + " doesn't resolve to any object.");
+ throw new IOException(MessageFormat.format(
+ JGitText.get().sourceRefDoesntResolveToAnyObject, srcRef));
this.remoteName = remoteName;
this.forceUpdate = forceUpdate;
if (localName != null && localDb != null)
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/SideBandInputStream.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/SideBandInputStream.java
index 796cb745a1..1f9883e504 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/SideBandInputStream.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/SideBandInputStream.java
@@ -49,9 +49,11 @@ import static org.eclipse.jgit.transport.SideBandOutputStream.HDR_SIZE;
import java.io.IOException;
import java.io.InputStream;
import java.io.Writer;
+import java.text.MessageFormat;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
+import org.eclipse.jgit.JGitText;
import org.eclipse.jgit.errors.PackProtocolException;
import org.eclipse.jgit.errors.TransportException;
import org.eclipse.jgit.lib.Constants;
@@ -75,7 +77,7 @@ import org.eclipse.jgit.util.RawParseUtils;
* @see SideBandOutputStream
*/
class SideBandInputStream extends InputStream {
- private static final String PFX_REMOTE = "remote: ";
+ private static final String PFX_REMOTE = JGitText.get().prefixRemote;
static final int CH_DATA = 1;
@@ -170,7 +172,7 @@ class SideBandInputStream extends InputStream {
eof = true;
throw new TransportException(PFX_REMOTE + readString(available));
default:
- throw new PackProtocolException("Invalid channel " + channel);
+ throw new PackProtocolException(MessageFormat.format(JGitText.get().invalidChannel, channel));
}
}
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/SideBandOutputStream.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/SideBandOutputStream.java
index 6e0a52627e..31acdcde5b 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/SideBandOutputStream.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/SideBandOutputStream.java
@@ -45,6 +45,9 @@ package org.eclipse.jgit.transport;
import java.io.IOException;
import java.io.OutputStream;
+import java.text.MessageFormat;
+
+import org.eclipse.jgit.JGitText;
/**
* Multiplexes data and progress messages.
@@ -94,14 +97,11 @@ class SideBandOutputStream extends OutputStream {
*/
SideBandOutputStream(final int chan, final int sz, final OutputStream os) {
if (chan <= 0 || chan > 255)
- throw new IllegalArgumentException("channel " + chan
- + " must be in range [0, 255]");
+ throw new IllegalArgumentException(MessageFormat.format(JGitText.get().channelMustBeInRange0_255, chan));
if (sz <= HDR_SIZE)
- throw new IllegalArgumentException("packet size " + sz
- + " must be >= " + HDR_SIZE);
+ throw new IllegalArgumentException(MessageFormat.format(JGitText.get().packetSizeMustBeAtLeast, sz, HDR_SIZE));
else if (MAX_BUF < sz)
- throw new IllegalArgumentException("packet size " + sz
- + " must be <= " + MAX_BUF);
+ throw new IllegalArgumentException(MessageFormat.format(JGitText.get().packetSizeMustBeAtMost, sz, MAX_BUF));
out = os;
buffer = new byte[sz];
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/SshTransport.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/SshTransport.java
index 5c6b498cad..d25a7b6180 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/SshTransport.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/SshTransport.java
@@ -50,6 +50,7 @@ package org.eclipse.jgit.transport;
import java.net.ConnectException;
import java.net.UnknownHostException;
+import org.eclipse.jgit.JGitText;
import org.eclipse.jgit.errors.TransportException;
import org.eclipse.jgit.lib.Repository;
@@ -96,10 +97,10 @@ public abstract class SshTransport extends TcpTransport {
*/
public void setSshSessionFactory(SshSessionFactory factory) {
if (factory == null)
- throw new NullPointerException("The factory must not be null");
+ throw new NullPointerException(JGitText.get().theFactoryMustNotBeNull);
if (sock != null)
throw new IllegalStateException(
- "An SSH session has been already created");
+ JGitText.get().anSSHSessionHasBeenAlreadyCreated);
sch = factory;
}
@@ -133,7 +134,7 @@ public abstract class SshTransport extends TcpTransport {
} catch (JSchException je) {
final Throwable c = je.getCause();
if (c instanceof UnknownHostException)
- throw new TransportException(uri, "unknown host");
+ throw new TransportException(uri, JGitText.get().unknownHost);
if (c instanceof ConnectException)
throw new TransportException(uri, c.getMessage());
throw new TransportException(uri, je.getMessage(), je);
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/TagOpt.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/TagOpt.java
index 66f36a0d27..82a5f23b6a 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/TagOpt.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/TagOpt.java
@@ -44,6 +44,10 @@
package org.eclipse.jgit.transport;
+import java.text.MessageFormat;
+
+import org.eclipse.jgit.JGitText;
+
/** Specification of annotated tag behavior during fetch. */
public enum TagOpt {
/**
@@ -105,6 +109,6 @@ public enum TagOpt {
if (tagopt.option().equals(o))
return tagopt;
}
- throw new IllegalArgumentException("Invalid tag option: " + o);
+ throw new IllegalArgumentException(MessageFormat.format(JGitText.get().invalidTagOption, o));
}
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/Transport.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/Transport.java
index d6400963ac..c0b2eedc00 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/Transport.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/Transport.java
@@ -48,6 +48,7 @@ package org.eclipse.jgit.transport;
import java.io.IOException;
import java.net.URISyntaxException;
+import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
@@ -56,6 +57,7 @@ import java.util.LinkedList;
import java.util.List;
import java.util.Map;
+import org.eclipse.jgit.JGitText;
import org.eclipse.jgit.errors.NotSupportedException;
import org.eclipse.jgit.errors.TransportException;
import org.eclipse.jgit.lib.Constants;
@@ -240,9 +242,8 @@ public abstract class Transport {
throws NotSupportedException {
final List<URIish> uris = getURIs(cfg, op);
if (uris.isEmpty())
- throw new IllegalArgumentException(
- "Remote config \""
- + cfg.getName() + "\" has no URIs associated");
+ throw new IllegalArgumentException(MessageFormat.format(
+ JGitText.get().remoteConfigHasNoURIAssociated, cfg.getName()));
final Transport tn = open(local, uris.get(0));
tn.applyConfig(cfg);
return tn;
@@ -351,7 +352,7 @@ public abstract class Transport {
else if (TransportLocal.canHandle(remote))
return new TransportLocal(local, remote);
- throw new NotSupportedException("URI not supported: " + remote);
+ throw new NotSupportedException(MessageFormat.format(JGitText.get().URINotSupported, remote));
}
/**
@@ -787,7 +788,7 @@ public abstract class Transport {
// If the caller did not ask for anything use the defaults.
//
if (fetch.isEmpty())
- throw new TransportException("Nothing to fetch.");
+ throw new TransportException(JGitText.get().nothingToFetch);
toFetch = fetch;
} else if (!fetch.isEmpty()) {
// If the caller asked for something specific without giving
@@ -862,12 +863,11 @@ public abstract class Transport {
try {
toPush = findRemoteRefUpdatesFor(push);
} catch (final IOException e) {
- throw new TransportException(
- "Problem with resolving push ref specs locally: "
- + e.getMessage(), e);
+ throw new TransportException(MessageFormat.format(
+ JGitText.get().problemWithResolvingPushRefSpecsLocally, e.getMessage()), e);
}
if (toPush.isEmpty())
- throw new TransportException("Nothing to push.");
+ throw new TransportException(JGitText.get().nothingToPush);
}
final PushProcess pushProcess = new PushProcess(this, toPush);
return pushProcess.execute(monitor);
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportAmazonS3.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportAmazonS3.java
index a3fd1ceae5..bcf6e873fe 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportAmazonS3.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportAmazonS3.java
@@ -50,6 +50,7 @@ import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.URLConnection;
+import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;
@@ -57,6 +58,7 @@ import java.util.Map;
import java.util.Properties;
import java.util.TreeMap;
+import org.eclipse.jgit.JGitText;
import org.eclipse.jgit.errors.NotSupportedException;
import org.eclipse.jgit.errors.TransportException;
import org.eclipse.jgit.lib.Constants;
@@ -133,7 +135,7 @@ public class TransportAmazonS3 extends HttpTransport implements WalkTransport {
try {
props = AmazonS3.properties(propsFile);
} catch (IOException e) {
- throw new NotSupportedException("cannot read " + propsFile, e);
+ throw new NotSupportedException(MessageFormat.format(JGitText.get().cannotReadFile, propsFile), e);
}
} else {
props = new Properties();
@@ -277,7 +279,7 @@ public class TransportAmazonS3 extends HttpTransport implements WalkTransport {
+ "refs")))
readRef(avail, "refs/" + n);
} catch (IOException e) {
- throw new TransportException(getURI(), "cannot list refs", e);
+ throw new TransportException(getURI(), JGitText.get().cannotListRefs, e);
}
}
@@ -295,11 +297,12 @@ public class TransportAmazonS3 extends HttpTransport implements WalkTransport {
} catch (FileNotFoundException noRef) {
return null;
} catch (IOException err) {
- throw new TransportException(getURI(), "read " + ref, err);
+ throw new TransportException(getURI(), MessageFormat.format(
+ JGitText.get().transportExceptionReadRef, ref), err);
}
if (s == null)
- throw new TransportException(getURI(), "Empty ref: " + rn);
+ throw new TransportException(getURI(), MessageFormat.format(JGitText.get().transportExceptionEmptyRef, rn));
if (s.startsWith("ref: ")) {
final String target = s.substring("ref: ".length());
@@ -320,7 +323,7 @@ public class TransportAmazonS3 extends HttpTransport implements WalkTransport {
return r;
}
- throw new TransportException(getURI(), "Bad ref: " + rn + ": " + s);
+ throw new TransportException(getURI(), MessageFormat.format(JGitText.get().transportExceptionBadRef, rn, s));
}
private Storage loose(final Ref r) {
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportBundleFile.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportBundleFile.java
index 17e3bdd229..0245818fe3 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportBundleFile.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportBundleFile.java
@@ -51,6 +51,7 @@ import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.InputStream;
+import org.eclipse.jgit.JGitText;
import org.eclipse.jgit.errors.NotSupportedException;
import org.eclipse.jgit.errors.TransportException;
import org.eclipse.jgit.lib.Repository;
@@ -84,7 +85,7 @@ class TransportBundleFile extends Transport implements TransportBundle {
try {
src = new FileInputStream(bundle);
} catch (FileNotFoundException err) {
- throw new TransportException(uri, "not found");
+ throw new TransportException(uri, JGitText.get().notFound);
}
return new BundleFetchConnection(this, src);
}
@@ -92,7 +93,7 @@ class TransportBundleFile extends Transport implements TransportBundle {
@Override
public PushConnection openPush() throws NotSupportedException {
throw new NotSupportedException(
- "Push is not supported for bundle transport");
+ JGitText.get().pushIsNotSupportedForBundleTransport);
}
@Override
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportBundleStream.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportBundleStream.java
index e5188bb236..defc8c2bb6 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportBundleStream.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportBundleStream.java
@@ -49,6 +49,7 @@ package org.eclipse.jgit.transport;
import java.io.IOException;
import java.io.InputStream;
+import org.eclipse.jgit.JGitText;
import org.eclipse.jgit.errors.NotSupportedException;
import org.eclipse.jgit.errors.TransportException;
import org.eclipse.jgit.lib.Repository;
@@ -92,7 +93,7 @@ public class TransportBundleStream extends Transport implements TransportBundle
@Override
public FetchConnection openFetch() throws TransportException {
if (src == null)
- throw new TransportException(uri, "Only one fetch supported");
+ throw new TransportException(uri, JGitText.get().onlyOneFetchSupported);
try {
return new BundleFetchConnection(this, src);
} finally {
@@ -103,7 +104,7 @@ public class TransportBundleStream extends Transport implements TransportBundle
@Override
public PushConnection openPush() throws NotSupportedException {
throw new NotSupportedException(
- "Push is not supported for bundle transport");
+ JGitText.get().pushIsNotSupportedForBundleTransport);
}
@Override
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportGitAnon.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportGitAnon.java
index 8a0b4357cd..5ad57768fe 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportGitAnon.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportGitAnon.java
@@ -56,6 +56,7 @@ import java.net.InetSocketAddress;
import java.net.Socket;
import java.net.UnknownHostException;
+import org.eclipse.jgit.JGitText;
import org.eclipse.jgit.errors.TransportException;
import org.eclipse.jgit.lib.Repository;
@@ -107,7 +108,7 @@ class TransportGitAnon extends TcpTransport implements PackTransport {
// ignore a failure during close, we're already failing
}
if (c instanceof UnknownHostException)
- throw new TransportException(uri, "unknown host");
+ throw new TransportException(uri, JGitText.get().unknownHost);
if (c instanceof ConnectException)
throw new TransportException(uri, c.getMessage());
throw new TransportException(uri, c.getMessage(), c);
@@ -151,7 +152,7 @@ class TransportGitAnon extends TcpTransport implements PackTransport {
} catch (IOException err) {
close();
throw new TransportException(uri,
- "remote hung up unexpectedly", err);
+ JGitText.get().remoteHungUpUnexpectedly, err);
}
readAdvertisedRefs();
}
@@ -190,7 +191,7 @@ class TransportGitAnon extends TcpTransport implements PackTransport {
} catch (IOException err) {
close();
throw new TransportException(uri,
- "remote hung up unexpectedly", err);
+ JGitText.get().remoteHungUpUnexpectedly, err);
}
readAdvertisedRefs();
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportGitSsh.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportGitSsh.java
index 8df3ea5b2b..34b13b2d1d 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportGitSsh.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportGitSsh.java
@@ -51,7 +51,9 @@ import java.io.InputStream;
import java.io.OutputStream;
import java.io.PipedInputStream;
import java.io.PipedOutputStream;
+import java.text.MessageFormat;
+import org.eclipse.jgit.JGitText;
import org.eclipse.jgit.errors.NoRemoteRepositoryException;
import org.eclipse.jgit.errors.TransportException;
import org.eclipse.jgit.lib.Repository;
@@ -172,8 +174,8 @@ public class TransportGitSsh extends SshTransport implements PackTransport {
IOException cause = null;
if (why != null && why.length() > 0)
cause = new IOException(why);
- throw new TransportException(uri, "cannot execute: "
- + commandFor(exe), cause);
+ throw new TransportException(uri, MessageFormat.format(
+ JGitText.get().cannotExecute, commandFor(exe)), cause);
}
}
@@ -257,7 +259,7 @@ public class TransportGitSsh extends SshTransport implements PackTransport {
} catch (IOException err) {
close();
throw new TransportException(uri,
- "remote hung up unexpectedly", err);
+ JGitText.get().remoteHungUpUnexpectedly, err);
}
try {
@@ -325,7 +327,7 @@ public class TransportGitSsh extends SshTransport implements PackTransport {
} catch (IOException err) {
close();
throw new TransportException(uri,
- "remote hung up unexpectedly", err);
+ JGitText.get().remoteHungUpUnexpectedly, err);
}
try {
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportHttp.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportHttp.java
index f49828bf2d..71e7bf285e 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportHttp.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportHttp.java
@@ -65,6 +65,7 @@ import java.net.MalformedURLException;
import java.net.Proxy;
import java.net.ProxySelector;
import java.net.URL;
+import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Map;
@@ -73,6 +74,7 @@ import java.util.TreeMap;
import java.util.zip.GZIPInputStream;
import java.util.zip.GZIPOutputStream;
+import org.eclipse.jgit.JGitText;
import org.eclipse.jgit.errors.NoRemoteRepositoryException;
import org.eclipse.jgit.errors.NotSupportedException;
import org.eclipse.jgit.errors.PackProtocolException;
@@ -170,7 +172,7 @@ public class TransportHttp extends HttpTransport implements WalkTransport,
baseUrl = new URL(uriString);
objectsUrl = new URL(baseUrl, "objects/");
} catch (MalformedURLException e) {
- throw new NotSupportedException("Invalid URL " + uri, e);
+ throw new NotSupportedException(MessageFormat.format(JGitText.get().invalidURL, uri), e);
}
http = local.getConfig().get(HTTP_KEY);
proxySelector = ProxySelector.getDefault();
@@ -216,7 +218,7 @@ public class TransportHttp extends HttpTransport implements WalkTransport,
} catch (TransportException err) {
throw err;
} catch (IOException err) {
- throw new TransportException(uri, "error reading info/refs", err);
+ throw new TransportException(uri, JGitText.get().errorReadingInfoRefs, err);
}
}
@@ -265,8 +267,8 @@ public class TransportHttp extends HttpTransport implements WalkTransport,
break;
default:
- throw new TransportException(uri, "cannot read HEAD: " + status
- + " " + conn.getResponseMessage());
+ throw new TransportException(uri, MessageFormat.format(
+ JGitText.get().cannotReadHEAD, status, conn.getResponseMessage()));
}
}
@@ -292,11 +294,11 @@ public class TransportHttp extends HttpTransport implements WalkTransport,
return new SmartHttpPushConnection(in);
} else if (!useSmartHttp) {
- final String msg = "smart HTTP push disabled";
+ final String msg = JGitText.get().smartHTTPPushDisabled;
throw new NotSupportedException(msg);
} else {
- final String msg = "remote does not support smart HTTP push";
+ final String msg = JGitText.get().remoteDoesNotSupportSmartHTTPPush;
throw new NotSupportedException(msg);
}
} finally {
@@ -307,7 +309,7 @@ public class TransportHttp extends HttpTransport implements WalkTransport,
} catch (TransportException err) {
throw err;
} catch (IOException err) {
- throw new TransportException(uri, "error reading info/refs", err);
+ throw new TransportException(uri, JGitText.get().errorReadingInfoRefs, err);
}
}
@@ -335,7 +337,7 @@ public class TransportHttp extends HttpTransport implements WalkTransport,
u = new URL(b.toString());
} catch (MalformedURLException e) {
- throw new NotSupportedException("Invalid URL " + uri, e);
+ throw new NotSupportedException(MessageFormat.format(JGitText.get().invalidURL, uri), e);
}
try {
@@ -352,10 +354,10 @@ public class TransportHttp extends HttpTransport implements WalkTransport,
return conn;
case HttpURLConnection.HTTP_NOT_FOUND:
- throw new NoRemoteRepositoryException(uri, u + " not found");
+ throw new NoRemoteRepositoryException(uri, MessageFormat.format(JGitText.get().URLNotFound, u));
case HttpURLConnection.HTTP_FORBIDDEN:
- throw new TransportException(uri, service + " not permitted");
+ throw new TransportException(uri, MessageFormat.format(JGitText.get().serviceNotPermitted, service));
default:
String err = status + " " + conn.getResponseMessage();
@@ -366,7 +368,7 @@ public class TransportHttp extends HttpTransport implements WalkTransport,
} catch (TransportException e) {
throw e;
} catch (IOException e) {
- throw new TransportException(uri, "cannot open " + service, e);
+ throw new TransportException(uri, MessageFormat.format(JGitText.get().cannotOpenService, service), e);
}
}
@@ -389,8 +391,7 @@ public class TransportHttp extends HttpTransport implements WalkTransport,
}
IOException wrongContentType(String expType, String actType) {
- final String why = "expected Content-Type " + expType
- + "; received Content-Type " + actType;
+ final String why = MessageFormat.format(JGitText.get().expectedReceivedContentType, expType, actType);
return new TransportException(uri, why);
}
@@ -410,9 +411,8 @@ public class TransportHttp extends HttpTransport implements WalkTransport,
final byte[] magic = new byte[5];
IO.readFully(in, magic, 0, magic.length);
if (magic[4] != '#') {
- throw new TransportException(uri, "expected pkt-line with"
- + " '# service=', got '" + RawParseUtils.decode(magic)
- + "'");
+ throw new TransportException(uri, MessageFormat.format(
+ JGitText.get().expectedPktLineWithService, RawParseUtils.decode(magic)));
}
final PacketLineIn pckIn = new PacketLineIn(new UnionInputStream(
@@ -420,8 +420,8 @@ public class TransportHttp extends HttpTransport implements WalkTransport,
final String exp = "# service=" + service;
final String act = pckIn.readString();
if (!exp.equals(act)) {
- throw new TransportException(uri, "expected '" + exp + "', got '"
- + act + "'");
+ throw new TransportException(uri, MessageFormat.format(
+ JGitText.get().expectedGot, exp, act));
}
while (pckIn.readString() != PacketLineIn.END) {
@@ -546,16 +546,15 @@ public class TransportHttp extends HttpTransport implements WalkTransport,
}
private PackProtocolException outOfOrderAdvertisement(final String n) {
- return new PackProtocolException("advertisement of " + n
- + "^{} came before " + n);
+ return new PackProtocolException(MessageFormat.format(JGitText.get().advertisementOfCameBefore, n, n));
}
private PackProtocolException invalidAdvertisement(final String n) {
- return new PackProtocolException("invalid advertisement of " + n);
+ return new PackProtocolException(MessageFormat.format(JGitText.get().invalidAdvertisementOf, n));
}
private PackProtocolException duplicateAdvertisement(final String n) {
- return new PackProtocolException("duplicate advertisements of " + n);
+ return new PackProtocolException(MessageFormat.format(JGitText.get().duplicateAdvertisementsOf, n));
}
@Override
@@ -667,9 +666,8 @@ public class TransportHttp extends HttpTransport implements WalkTransport,
// our request buffer. Send with a Content-Length header.
//
if (out.length() == 0) {
- throw new TransportException(uri, "Starting read stage"
- + " without written request data pending"
- + " is not supported");
+ throw new TransportException(uri,
+ JGitText.get().startingReadStageWithoutWrittenRequestDataPendingIsNotSupported);
}
// Try to compress the content, but only if that is smaller.
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportLocal.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportLocal.java
index 22c436de3a..cf4dbd5392 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportLocal.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportLocal.java
@@ -56,6 +56,7 @@ import java.io.OutputStream;
import java.io.PipedInputStream;
import java.io.PipedOutputStream;
+import org.eclipse.jgit.JGitText;
import org.eclipse.jgit.errors.NotSupportedException;
import org.eclipse.jgit.errors.TransportException;
import org.eclipse.jgit.lib.Constants;
@@ -175,7 +176,7 @@ class TransportLocal extends Transport implements PackTransport {
try {
dst = new Repository(remoteGitDir);
} catch (IOException err) {
- throw new TransportException(uri, "not a git directory");
+ throw new TransportException(uri, JGitText.get().notAGitDirectory);
}
final PipedInputStream in_r;
@@ -199,7 +200,7 @@ class TransportLocal extends Transport implements PackTransport {
out_w = new PipedOutputStream(out_r);
} catch (IOException err) {
dst.close();
- throw new TransportException(uri, "cannot connect pipes", err);
+ throw new TransportException(uri, JGitText.get().cannotConnectPipes, err);
}
worker = new Thread("JGit-Upload-Pack") {
@@ -315,7 +316,7 @@ class TransportLocal extends Transport implements PackTransport {
try {
dst = new Repository(remoteGitDir);
} catch (IOException err) {
- throw new TransportException(uri, "not a git directory");
+ throw new TransportException(uri, JGitText.get().notAGitDirectory);
}
final PipedInputStream in_r;
@@ -331,7 +332,7 @@ class TransportLocal extends Transport implements PackTransport {
out_w = new PipedOutputStream(out_r);
} catch (IOException err) {
dst.close();
- throw new TransportException(uri, "cannot connect pipes", err);
+ throw new TransportException(uri, JGitText.get().cannotConnectPipes, err);
}
worker = new Thread("JGit-Receive-Pack") {
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/URIish.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/URIish.java
index 80b94b2324..5939bc2f28 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/URIish.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/URIish.java
@@ -50,6 +50,7 @@ import java.net.URL;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
+import org.eclipse.jgit.JGitText;
import org.eclipse.jgit.lib.Constants;
/**
@@ -107,7 +108,7 @@ public class URIish {
host = matcher.group(2);
path = matcher.group(3);
} else
- throw new URISyntaxException(s, "Cannot parse Git URI-ish");
+ throw new URISyntaxException(s, JGitText.get().cannotParseGitURIish);
}
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java
index 3d5abd34bd..3381c0724a 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java
@@ -47,6 +47,7 @@ import java.io.EOFException;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
+import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
@@ -54,6 +55,7 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
+import org.eclipse.jgit.JGitText;
import org.eclipse.jgit.errors.PackProtocolException;
import org.eclipse.jgit.lib.NullProgressMonitor;
import org.eclipse.jgit.lib.ObjectId;
@@ -371,7 +373,7 @@ public class UploadPack {
if (line == PacketLineIn.END)
break;
if (!line.startsWith("want ") || line.length() < 45)
- throw new PackProtocolException("expected want; got " + line);
+ throw new PackProtocolException(MessageFormat.format(JGitText.get().expectedGot, "want", line));
if (isFirst && line.length() > 45) {
String opt = line.substring(45);
@@ -387,10 +389,10 @@ public class UploadPack {
try {
o = walk.parseAny(id);
} catch (IOException e) {
- throw new PackProtocolException(id.name() + " not valid", e);
+ throw new PackProtocolException(MessageFormat.format(JGitText.get().notValid, id.name()), e);
}
if (!o.has(ADVERTISED))
- throw new PackProtocolException(id.name() + " not valid");
+ throw new PackProtocolException(MessageFormat.format(JGitText.get().notValid, id.name()));
want(o);
}
}
@@ -473,7 +475,7 @@ public class UploadPack {
return true;
} else {
- throw new PackProtocolException("expected have; got " + line);
+ throw new PackProtocolException(MessageFormat.format(JGitText.get().expectedGot, "have", line));
}
}
}
@@ -521,7 +523,7 @@ public class UploadPack {
i.remove();
}
} catch (IOException e) {
- throw new PackProtocolException("internal revision error", e);
+ throw new PackProtocolException(JGitText.get().internalRevisionError, e);
}
return wantCommits.isEmpty();
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/WalkEncryption.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/WalkEncryption.java
index d368fb2cd7..b55de9265a 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/WalkEncryption.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/WalkEncryption.java
@@ -51,6 +51,7 @@ import java.security.InvalidAlgorithmParameterException;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
import java.security.spec.InvalidKeySpecException;
+import java.text.MessageFormat;
import javax.crypto.Cipher;
import javax.crypto.CipherInputStream;
@@ -61,6 +62,8 @@ import javax.crypto.SecretKeyFactory;
import javax.crypto.spec.PBEKeySpec;
import javax.crypto.spec.PBEParameterSpec;
+import org.eclipse.jgit.JGitText;
+
abstract class WalkEncryption {
static final WalkEncryption NONE = new NoEncryption();
@@ -84,18 +87,18 @@ abstract class WalkEncryption {
if (v == null)
v = "";
if (!version.equals(v))
- throw new IOException("Unsupported encryption version: " + v);
+ throw new IOException(MessageFormat.format(JGitText.get().unsupportedEncryptionVersion, v));
v = u.getHeaderField(p + JETS3T_CRYPTO_ALG);
if (v == null)
v = "";
if (!name.equals(v))
- throw new IOException("Unsupported encryption algorithm: " + v);
+ throw new IOException(JGitText.get().unsupportedEncryptionAlgorithm + v);
}
IOException error(final Throwable why) {
final IOException e;
- e = new IOException("Encryption error: " + why.getMessage());
+ e = new IOException(MessageFormat.format(JGitText.get().encryptionError, why.getMessage()));
e.initCause(why);
return e;
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/WalkFetchConnection.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/WalkFetchConnection.java
index ba4486144d..6254745476 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/WalkFetchConnection.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/WalkFetchConnection.java
@@ -49,6 +49,7 @@ import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.security.MessageDigest;
+import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
@@ -58,6 +59,7 @@ import java.util.LinkedList;
import java.util.List;
import java.util.Set;
+import org.eclipse.jgit.JGitText;
import org.eclipse.jgit.errors.CompoundException;
import org.eclipse.jgit.errors.CorruptObjectException;
import org.eclipse.jgit.errors.MissingObjectException;
@@ -261,7 +263,7 @@ class WalkFetchConnection extends BaseFetchConnection {
if (inWorkQueue.add(id))
workQueue.add(id);
} catch (IOException e) {
- throw new TransportException("Cannot read " + id.name(), e);
+ throw new TransportException(MessageFormat.format(JGitText.get().cannotRead, id.name()), e);
}
}
}
@@ -280,7 +282,7 @@ class WalkFetchConnection extends BaseFetchConnection {
return;
}
} catch (IOException e) {
- throw new TransportException("Cannot read " + id.name(), e);
+ throw new TransportException(MessageFormat.format(JGitText.get().cannotRead, id.name()), e);
}
switch (obj.getType()) {
@@ -297,7 +299,7 @@ class WalkFetchConnection extends BaseFetchConnection {
processTag(obj);
break;
default:
- throw new TransportException("Unknown object type " + id.name());
+ throw new TransportException(MessageFormat.format(JGitText.get().unknownObjectType, id.name()));
}
// If we had any prior errors fetching this object they are
@@ -308,7 +310,7 @@ class WalkFetchConnection extends BaseFetchConnection {
private void processBlob(final RevObject obj) throws TransportException {
if (!local.hasObject(obj))
- throw new TransportException("Cannot read blob " + obj.name(),
+ throw new TransportException(MessageFormat.format(JGitText.get().cannotReadBlob, obj.name()),
new MissingObjectException(obj, Constants.TYPE_BLOB));
obj.add(COMPLETE);
}
@@ -331,14 +333,12 @@ class WalkFetchConnection extends BaseFetchConnection {
if (FileMode.GITLINK.equals(mode))
continue;
treeWalk.getObjectId(idBuffer, 0);
- throw new CorruptObjectException("Invalid mode " + mode
- + " for " + idBuffer.name() + " "
- + treeWalk.getPathString() + " in "
- + obj.getId().name() + ".");
+ throw new CorruptObjectException(MessageFormat.format(JGitText.get().invalidModeFor
+ , mode, idBuffer.name(), treeWalk.getPathString(), obj.getId().name()));
}
}
} catch (IOException ioe) {
- throw new TransportException("Cannot read tree " + obj.name(), ioe);
+ throw new TransportException(MessageFormat.format(JGitText.get().cannotReadTree, obj.name()), ioe);
}
obj.add(COMPLETE);
}
@@ -445,7 +445,7 @@ class WalkFetchConnection extends BaseFetchConnection {
List<Throwable> failures = fetchErrors.get(id.copy());
final TransportException te;
- te = new TransportException("Cannot get " + id.name() + ".");
+ te = new TransportException(MessageFormat.format(JGitText.get().cannotGet, id.name()));
if (failures != null && !failures.isEmpty()) {
if (failures.size() == 1)
te.initCause(failures.get(0));
@@ -521,8 +521,8 @@ class WalkFetchConnection extends BaseFetchConnection {
// the object, but after indexing we didn't
// actually find it in the pack.
//
- recordError(id, new FileNotFoundException("Object " + id.name()
- + " not found in " + pack.packName + "."));
+ recordError(id, new FileNotFoundException(MessageFormat.format(
+ JGitText.get().objectNotFoundIn, id.name(), pack.packName)));
continue;
}
@@ -565,7 +565,7 @@ class WalkFetchConnection extends BaseFetchConnection {
recordError(id, e);
return false;
} catch (IOException e) {
- throw new TransportException("Cannot download " + id.name(), e);
+ throw new TransportException(MessageFormat.format(JGitText.get().cannotDownload, id.name()), e);
}
}
@@ -601,18 +601,15 @@ class WalkFetchConnection extends BaseFetchConnection {
idBuffer.fromRaw(objectDigest.digest(), 0);
if (!AnyObjectId.equals(id, idBuffer)) {
- throw new TransportException("Incorrect hash for " + id.name()
- + "; computed " + idBuffer.name() + " as a "
- + Constants.typeString(uol.getType()) + " from "
- + compressed.length + " bytes.");
+ throw new TransportException(MessageFormat.format(JGitText.get().incorrectHashFor
+ , id.name(), idBuffer.name(), Constants.typeString(uol.getType()), compressed.length));
}
if (objCheck != null) {
try {
objCheck.check(uol.getType(), uol.getCachedBytes());
} catch (CorruptObjectException e) {
- throw new TransportException("Invalid "
- + Constants.typeString(uol.getType()) + " "
- + id.name() + ":" + e.getMessage());
+ throw new TransportException(MessageFormat.format(JGitText.get().transportExceptionInvalid
+ , Constants.typeString(uol.getType()), id.name(), e.getMessage()));
}
}
}
@@ -650,7 +647,7 @@ class WalkFetchConnection extends BaseFetchConnection {
tmp.delete();
if (local.hasObject(id))
return;
- throw new ObjectWritingException("Unable to store " + id.name() + ".");
+ throw new ObjectWritingException(MessageFormat.format(JGitText.get().unableToStore, id.name()));
}
private Collection<WalkRemoteObjectDatabase> expandOneAlternate(
@@ -658,7 +655,7 @@ class WalkFetchConnection extends BaseFetchConnection {
while (!noAlternatesYet.isEmpty()) {
final WalkRemoteObjectDatabase wrr = noAlternatesYet.removeFirst();
try {
- pm.beginTask("Listing alternates", ProgressMonitor.UNKNOWN);
+ pm.beginTask(JGitText.get().listingAlternates, ProgressMonitor.UNKNOWN);
Collection<WalkRemoteObjectDatabase> altList = wrr
.getAlternates();
if (altList != null && !altList.isEmpty())
@@ -679,15 +676,14 @@ class WalkFetchConnection extends BaseFetchConnection {
try {
markLocalObjComplete(revWalk.parseAny(r.getObjectId()));
} catch (IOException readError) {
- throw new TransportException("Local ref " + r.getName()
- + " is missing object(s).", readError);
+ throw new TransportException(MessageFormat.format(JGitText.get().localRefIsMissingObjects, r.getName()), readError);
}
}
for (final ObjectId id : have) {
try {
markLocalObjComplete(revWalk.parseAny(id));
} catch (IOException readError) {
- throw new TransportException("Missing assumed "+id.name(), readError);
+ throw new TransportException(MessageFormat.format(JGitText.get().transportExceptionMissingAssumed, id.name()), readError);
}
}
}
@@ -726,7 +722,7 @@ class WalkFetchConnection extends BaseFetchConnection {
pushLocalCommit(p);
}
} catch (IOException err) {
- throw new TransportException("Local objects incomplete.", err);
+ throw new TransportException(JGitText.get().localObjectsIncomplete, err);
}
}
@@ -769,9 +765,8 @@ class WalkFetchConnection extends BaseFetchConnection {
if (FileMode.GITLINK.equals(mode))
continue;
treeWalk.getObjectId(idBuffer, 0);
- throw new CorruptObjectException("Invalid mode " + mode
- + " for " + idBuffer.name() + " "
- + treeWalk.getPathString() + " in " + tree.name() + ".");
+ throw new CorruptObjectException(MessageFormat.format(JGitText.get().corruptObjectInvalidMode3
+ , mode, idBuffer.name(), treeWalk.getPathString(), tree.name()));
}
}
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/WalkPushConnection.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/WalkPushConnection.java
index f977915bb3..0edf9678e4 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/WalkPushConnection.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/WalkPushConnection.java
@@ -55,6 +55,7 @@ import java.util.List;
import java.util.Map;
import java.util.TreeMap;
+import org.eclipse.jgit.JGitText;
import org.eclipse.jgit.errors.TransportException;
import org.eclipse.jgit.lib.AnyObjectId;
import org.eclipse.jgit.lib.Constants;
@@ -145,7 +146,7 @@ class WalkPushConnection extends BaseConnection implements PushConnection {
final String n = u.getRemoteName();
if (!n.startsWith("refs/") || !Repository.isValidRefName(n)) {
u.setStatus(Status.REJECTED_OTHER_REASON);
- u.setMessage("funny refname");
+ u.setMessage(JGitText.get().funnyRefname);
continue;
}
@@ -187,14 +188,14 @@ class WalkPushConnection extends BaseConnection implements PushConnection {
u.setStatus(Status.REJECTED_OTHER_REASON);
u.setMessage(err.getMessage());
}
- throw new TransportException(uri, "failed updating refs", err);
+ throw new TransportException(uri, JGitText.get().failedUpdatingRefs, err);
}
}
try {
refWriter.writeInfoRefs();
} catch (IOException err) {
- throw new TransportException(uri, "failed updating refs", err);
+ throw new TransportException(uri, JGitText.get().failedUpdatingRefs, err);
}
}
@@ -279,7 +280,7 @@ class WalkPushConnection extends BaseConnection implements PushConnection {
safeDelete(pathIdx);
safeDelete(pathPack);
- throw new TransportException(uri, "cannot store objects", err);
+ throw new TransportException(uri, JGitText.get().cannotStoreObjects, err);
}
}
@@ -349,7 +350,7 @@ class WalkPushConnection extends BaseConnection implements PushConnection {
final byte[] bytes = Constants.encode(ref);
dest.writeFile(ROOT_DIR + Constants.HEAD, bytes);
} catch (IOException e) {
- throw new TransportException(uri, "cannot create HEAD", e);
+ throw new TransportException(uri, JGitText.get().cannotCreateHEAD, e);
}
try {
@@ -358,7 +359,7 @@ class WalkPushConnection extends BaseConnection implements PushConnection {
final byte[] bytes = Constants.encode(config);
dest.writeFile(ROOT_DIR + "config", bytes);
} catch (IOException e) {
- throw new TransportException(uri, "cannot create config", e);
+ throw new TransportException(uri, JGitText.get().cannotCreateConfig, e);
}
}
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)
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/WorkingTreeIterator.java b/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/WorkingTreeIterator.java
index 6b8a6cea4b..013e0edb35 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/WorkingTreeIterator.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/WorkingTreeIterator.java
@@ -50,9 +50,11 @@ import java.nio.CharBuffer;
import java.nio.charset.CharacterCodingException;
import java.nio.charset.CharsetEncoder;
import java.security.MessageDigest;
+import java.text.MessageFormat;
import java.util.Arrays;
import java.util.Comparator;
+import org.eclipse.jgit.JGitText;
import org.eclipse.jgit.errors.CorruptObjectException;
import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.lib.FileMode;
@@ -373,7 +375,7 @@ public abstract class WorkingTreeIterator extends AbstractTreeIterator {
b = enc.encode(CharBuffer.wrap(getName()));
} catch (CharacterCodingException e) {
// This should so never happen.
- throw new RuntimeException("Unencodeable file: " + getName());
+ throw new RuntimeException(MessageFormat.format(JGitText.get().unencodeableFile, getName()));
}
encodedNameLen = b.limit();
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/filter/AndTreeFilter.java b/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/filter/AndTreeFilter.java
index 9a6156f082..12964bbe64 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/filter/AndTreeFilter.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/filter/AndTreeFilter.java
@@ -47,6 +47,7 @@ package org.eclipse.jgit.treewalk.filter;
import java.io.IOException;
import java.util.Collection;
+import org.eclipse.jgit.JGitText;
import org.eclipse.jgit.errors.IncorrectObjectTypeException;
import org.eclipse.jgit.errors.MissingObjectException;
import org.eclipse.jgit.treewalk.TreeWalk;
@@ -89,7 +90,7 @@ public abstract class AndTreeFilter extends TreeFilter {
if (list.length == 2)
return create(list[0], list[1]);
if (list.length < 2)
- throw new IllegalArgumentException("At least two filters needed.");
+ throw new IllegalArgumentException(JGitText.get().atLeastTwoFiltersNeeded);
final TreeFilter[] subfilters = new TreeFilter[list.length];
System.arraycopy(list, 0, subfilters, 0, list.length);
return new List(subfilters);
@@ -105,7 +106,7 @@ public abstract class AndTreeFilter extends TreeFilter {
*/
public static TreeFilter create(final Collection<TreeFilter> list) {
if (list.size() < 2)
- throw new IllegalArgumentException("At least two filters needed.");
+ throw new IllegalArgumentException(JGitText.get().atLeastTwoFiltersNeeded);
final TreeFilter[] subfilters = new TreeFilter[list.size()];
list.toArray(subfilters);
if (subfilters.length == 2)
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/filter/OrTreeFilter.java b/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/filter/OrTreeFilter.java
index f14ceeab32..de5aa421a0 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/filter/OrTreeFilter.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/filter/OrTreeFilter.java
@@ -47,6 +47,7 @@ package org.eclipse.jgit.treewalk.filter;
import java.io.IOException;
import java.util.Collection;
+import org.eclipse.jgit.JGitText;
import org.eclipse.jgit.errors.IncorrectObjectTypeException;
import org.eclipse.jgit.errors.MissingObjectException;
import org.eclipse.jgit.treewalk.TreeWalk;
@@ -87,7 +88,7 @@ public abstract class OrTreeFilter extends TreeFilter {
if (list.length == 2)
return create(list[0], list[1]);
if (list.length < 2)
- throw new IllegalArgumentException("At least two filters needed.");
+ throw new IllegalArgumentException(JGitText.get().atLeastTwoFiltersNeeded);
final TreeFilter[] subfilters = new TreeFilter[list.length];
System.arraycopy(list, 0, subfilters, 0, list.length);
return new List(subfilters);
@@ -103,7 +104,7 @@ public abstract class OrTreeFilter extends TreeFilter {
*/
public static TreeFilter create(final Collection<TreeFilter> list) {
if (list.size() < 2)
- throw new IllegalArgumentException("At least two filters needed.");
+ throw new IllegalArgumentException(JGitText.get().atLeastTwoFiltersNeeded);
final TreeFilter[] subfilters = new TreeFilter[list.size()];
list.toArray(subfilters);
if (subfilters.length == 2)
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/filter/PathFilter.java b/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/filter/PathFilter.java
index 65451da8e6..e317789840 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/filter/PathFilter.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/filter/PathFilter.java
@@ -44,6 +44,7 @@
package org.eclipse.jgit.treewalk.filter;
+import org.eclipse.jgit.JGitText;
import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.treewalk.TreeWalk;
@@ -76,7 +77,7 @@ public class PathFilter extends TreeFilter {
while (path.endsWith("/"))
path = path.substring(0, path.length() - 1);
if (path.length() == 0)
- throw new IllegalArgumentException("Empty path not permitted.");
+ throw new IllegalArgumentException(JGitText.get().emptyPathNotPermitted);
return new PathFilter(path);
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/filter/PathFilterGroup.java b/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/filter/PathFilterGroup.java
index e58512da35..756b000684 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/filter/PathFilterGroup.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/filter/PathFilterGroup.java
@@ -48,6 +48,7 @@ import java.util.Arrays;
import java.util.Collection;
import java.util.Comparator;
+import org.eclipse.jgit.JGitText;
import org.eclipse.jgit.errors.StopWalkException;
import org.eclipse.jgit.treewalk.TreeWalk;
@@ -82,7 +83,7 @@ public class PathFilterGroup {
*/
public static TreeFilter createFromStrings(final Collection<String> paths) {
if (paths.isEmpty())
- throw new IllegalArgumentException("At least one path is required.");
+ throw new IllegalArgumentException(JGitText.get().atLeastOnePathIsRequired);
final PathFilter[] p = new PathFilter[paths.size()];
int i = 0;
for (final String s : paths)
@@ -103,7 +104,7 @@ public class PathFilterGroup {
*/
public static TreeFilter create(final Collection<PathFilter> paths) {
if (paths.isEmpty())
- throw new IllegalArgumentException("At least one path is required.");
+ throw new IllegalArgumentException(JGitText.get().atLeastOnePathIsRequired);
final PathFilter[] p = new PathFilter[paths.size()];
paths.toArray(p);
return create(p);
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/filter/PathSuffixFilter.java b/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/filter/PathSuffixFilter.java
index 3721ec646f..c4561c4d39 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/filter/PathSuffixFilter.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/filter/PathSuffixFilter.java
@@ -45,6 +45,7 @@ package org.eclipse.jgit.treewalk.filter;
import java.io.IOException;
+import org.eclipse.jgit.JGitText;
import org.eclipse.jgit.errors.IncorrectObjectTypeException;
import org.eclipse.jgit.errors.MissingObjectException;
import org.eclipse.jgit.lib.Constants;
@@ -68,7 +69,7 @@ public class PathSuffixFilter extends TreeFilter {
*/
public static PathSuffixFilter create(String path) {
if (path.length() == 0)
- throw new IllegalArgumentException("Empty path not permitted.");
+ throw new IllegalArgumentException(JGitText.get().emptyPathNotPermitted);
return new PathSuffixFilter(path);
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/Base64.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/Base64.java
index 53c7beced8..1c7d397e9c 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/util/Base64.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/Base64.java
@@ -9,6 +9,9 @@ package org.eclipse.jgit.util;
import java.io.Closeable;
import java.io.IOException;
+import java.text.MessageFormat;
+
+import org.eclipse.jgit.JGitText;
/**
@@ -702,7 +705,7 @@ public class Base64
} // end if: white space, equals sign or better
else
{
- System.err.println( "Bad Base64 input character at " + i + ": " + source[i] + "(decimal)" );
+ System.err.println(MessageFormat.format(JGitText.get().badBase64InputCharacterAt, i+ source[i]));
return null;
} // end else:
} // each input character
@@ -925,7 +928,7 @@ public class Base64
// Check for size of file
if( file.length() > Integer.MAX_VALUE )
{
- System.err.println( "File is too big for this convenience method (" + file.length() + " bytes)." );
+ System.err.println(MessageFormat.format(JGitText.get().fileIsTooBigForThisConvenienceMethod, file.length()));
return null;
} // end if: file too big for int index
buffer = new byte[ (int)file.length() ];
@@ -946,7 +949,7 @@ public class Base64
} // end try
catch( java.io.IOException e )
{
- System.err.println( "Error decoding from file " + filename );
+ System.err.println(MessageFormat.format(JGitText.get().errorDecodingFromFile, filename));
} // end catch: IOException
finally
{
@@ -994,7 +997,7 @@ public class Base64
} // end try
catch( java.io.IOException e )
{
- System.err.println( "Error encoding from file " + filename );
+ System.err.println(MessageFormat.format(JGitText.get().errorEncodingFromFile, filename));
} // end catch: IOException
finally
{
@@ -1154,7 +1157,7 @@ public class Base64
else
{
// Must have broken out from above.
- throw new java.io.IOException( "Improperly padded Base64 input." );
+ throw new java.io.IOException(JGitText.get().improperlyPaddedBase64Input);
} // end
} // end else: decode
@@ -1192,7 +1195,7 @@ public class Base64
else
{
// When JDK1.4 is more accepted, use an assertion here.
- throw new java.io.IOException( "Error in Base64 code reading stream." );
+ throw new java.io.IOException(JGitText.get().errorInBase64CodeReadingStream);
} // end else
} // end read
@@ -1363,7 +1366,7 @@ public class Base64
} // end if: meaningful base64 character
else if( DECODABET[ theByte & 0x7f ] != WHITE_SPACE_ENC )
{
- throw new java.io.IOException( "Invalid character in Base64 data." );
+ throw new java.io.IOException(JGitText.get().invalidCharacterInBase64Data);
} // end else: not white space either
} // end else: decoding
} // end write
@@ -1413,7 +1416,7 @@ public class Base64
} // end if: encoding
else
{
- throw new java.io.IOException( "Base64 input not properly padded." );
+ throw new java.io.IOException(JGitText.get().base64InputNotProperlyPadded);
} // end else: decoding
} // end if: buffer partially full
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/HttpSupport.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/HttpSupport.java
index 2532593ec5..d3e1f60035 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/util/HttpSupport.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/HttpSupport.java
@@ -53,6 +53,9 @@ import java.net.ProxySelector;
import java.net.URISyntaxException;
import java.net.URL;
import java.net.URLEncoder;
+import java.text.MessageFormat;
+
+import org.eclipse.jgit.JGitText;
/** Extra utilities to support usage of HTTP. */
public class HttpSupport {
@@ -133,7 +136,7 @@ public class HttpSupport {
try {
urlstr.append(URLEncoder.encode(key, "UTF-8"));
} catch (UnsupportedEncodingException e) {
- throw new RuntimeException("Could not URL encode to UTF-8", e);
+ throw new RuntimeException(JGitText.get().couldNotURLEncodeToUTF8, e);
}
}
@@ -158,7 +161,7 @@ public class HttpSupport {
// The standard J2SE error message is not very useful.
//
if ("Connection timed out: connect".equals(ce.getMessage()))
- throw new ConnectException("Connection time out: " + host);
+ throw new ConnectException(MessageFormat.format(JGitText.get().connectionTimeOut, host));
throw new ConnectException(ce.getMessage() + " " + host);
}
}
@@ -181,7 +184,7 @@ public class HttpSupport {
return proxySelector.select(u.toURI()).get(0);
} catch (URISyntaxException e) {
final ConnectException err;
- err = new ConnectException("Cannot determine proxy for " + u);
+ err = new ConnectException(MessageFormat.format(JGitText.get().cannotDetermineProxyFor, u));
err.initCause(e);
throw err;
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/IO.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/IO.java
index 566b857460..1778654203 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/util/IO.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/IO.java
@@ -53,6 +53,9 @@ import java.io.IOException;
import java.io.InputStream;
import java.nio.ByteBuffer;
import java.nio.channels.FileChannel;
+import java.text.MessageFormat;
+
+import org.eclipse.jgit.JGitText;
/**
* Input/Output utilities
@@ -95,7 +98,7 @@ public class IO {
try {
final long sz = in.getChannel().size();
if (sz > max)
- throw new IOException("File is too large: " + path);
+ throw new IOException(MessageFormat.format(JGitText.get().fileIsTooLarge, path));
final byte[] buf = new byte[(int) sz];
IO.readFully(in, buf, 0, buf.length);
return buf;
@@ -129,7 +132,7 @@ public class IO {
while (len > 0) {
final int r = fd.read(dst, off, len);
if (r <= 0)
- throw new EOFException("Short read of block.");
+ throw new EOFException(JGitText.get().shortReadOfBlock);
off += r;
len -= r;
}
@@ -158,7 +161,7 @@ public class IO {
while (len > 0) {
final int r = fd.read(ByteBuffer.wrap(dst, off, len), pos);
if (r <= 0)
- throw new EOFException("Short read of block.");
+ throw new EOFException(JGitText.get().shortReadOfBlock);
pos += r;
off += r;
len -= r;
@@ -187,7 +190,7 @@ public class IO {
while (toSkip > 0) {
final long r = fd.skip(toSkip);
if (r <= 0)
- throw new EOFException("Short skip of block");
+ throw new EOFException(JGitText.get().shortSkipOfBlock);
toSkip -= r;
}
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/RawSubStringPattern.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/RawSubStringPattern.java
index 67d67b90c4..f45bf2796b 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/util/RawSubStringPattern.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/RawSubStringPattern.java
@@ -44,6 +44,7 @@
package org.eclipse.jgit.util;
+import org.eclipse.jgit.JGitText;
import org.eclipse.jgit.lib.Constants;
/**
@@ -67,7 +68,7 @@ public class RawSubStringPattern {
*/
public RawSubStringPattern(final String patternText) {
if (patternText.length() == 0)
- throw new IllegalArgumentException("Cannot match on empty string.");
+ throw new IllegalArgumentException(JGitText.get().cannotMatchOnEmptyString);
needleString = patternText;
final byte[] b = Constants.encode(patternText);
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/StringUtils.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/StringUtils.java
index 582dce8aff..119c041570 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/util/StringUtils.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/StringUtils.java
@@ -43,6 +43,10 @@
package org.eclipse.jgit.util;
+import java.text.MessageFormat;
+
+import org.eclipse.jgit.JGitText;
+
/** Miscellaneous string comparison utility methods. */
public final class StringUtils {
private static final char[] LC;
@@ -135,7 +139,7 @@ public final class StringUtils {
*/
public static boolean toBoolean(final String stringValue) {
if (stringValue == null)
- throw new NullPointerException("Expected boolean string value");
+ throw new NullPointerException(JGitText.get().expectedBooleanStringValue);
if (equalsIgnoreCase("yes", stringValue)
|| equalsIgnoreCase("true", stringValue)
@@ -150,7 +154,7 @@ public final class StringUtils {
return false;
} else {
- throw new IllegalArgumentException("Not a boolean: " + stringValue);
+ throw new IllegalArgumentException(MessageFormat.format(JGitText.get().notABoolean, stringValue));
}
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/TemporaryBuffer.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/TemporaryBuffer.java
index 95b3fa090b..6c421c5f50 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/util/TemporaryBuffer.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/TemporaryBuffer.java
@@ -53,6 +53,7 @@ import java.io.InputStream;
import java.io.OutputStream;
import java.util.ArrayList;
+import org.eclipse.jgit.JGitText;
import org.eclipse.jgit.lib.NullProgressMonitor;
import org.eclipse.jgit.lib.ProgressMonitor;
@@ -196,7 +197,7 @@ public abstract class TemporaryBuffer extends OutputStream {
public byte[] toByteArray() throws IOException {
final long len = length();
if (Integer.MAX_VALUE < len)
- throw new OutOfMemoryError("Length exceeds maximum array size");
+ throw new OutOfMemoryError(JGitText.get().lengthExceedsMaximumArraySize);
final byte[] out = new byte[(int) len];
int outPtr = 0;
for (final Block b : blocks) {
@@ -351,7 +352,7 @@ public abstract class TemporaryBuffer extends OutputStream {
final long len = length();
if (Integer.MAX_VALUE < len)
- throw new OutOfMemoryError("Length exceeds maximum array size");
+ throw new OutOfMemoryError(JGitText.get().lengthExceedsMaximumArraySize);
final byte[] out = new byte[(int) len];
final FileInputStream in = new FileInputStream(onDiskFile);
try {
@@ -419,7 +420,7 @@ public abstract class TemporaryBuffer extends OutputStream {
@Override
protected OutputStream overflow() throws IOException {
- throw new IOException("In-memory buffer limit exceeded");
+ throw new IOException(JGitText.get().inMemoryBufferLimitExceeded);
}
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/io/DisabledOutputStream.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/io/DisabledOutputStream.java
index e38660d632..d95849a76b 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/util/io/DisabledOutputStream.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/io/DisabledOutputStream.java
@@ -46,6 +46,8 @@ package org.eclipse.jgit.util.io;
import java.io.IOException;
import java.io.OutputStream;
+import org.eclipse.jgit.JGitText;
+
/** An OutputStream which always throws IllegalStateExeption during write. */
public final class DisabledOutputStream extends OutputStream {
/** The canonical instance which always throws IllegalStateException. */
@@ -61,6 +63,6 @@ public final class DisabledOutputStream extends OutputStream {
// We shouldn't be writing output at this stage, there
// is nobody listening to us.
//
- throw new IllegalStateException("Writing not permitted");
+ throw new IllegalStateException(JGitText.get().writingNotPermitted);
}
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/io/InterruptTimer.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/io/InterruptTimer.java
index 91aa1cb6d2..575fa3ef0c 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/util/io/InterruptTimer.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/io/InterruptTimer.java
@@ -43,6 +43,10 @@
package org.eclipse.jgit.util.io;
+import java.text.MessageFormat;
+
+import org.eclipse.jgit.JGitText;
+
/**
* Triggers an interrupt on the calling thread if it doesn't complete a block.
* <p>
@@ -113,7 +117,7 @@ public final class InterruptTimer {
*/
public void begin(final int timeout) {
if (timeout <= 0)
- throw new IllegalArgumentException("Invalid timeout: " + timeout);
+ throw new IllegalArgumentException(MessageFormat.format(JGitText.get().invalidTimeout, timeout));
Thread.interrupted();
state.begin(timeout);
}
@@ -193,7 +197,7 @@ public final class InterruptTimer {
synchronized void begin(final int timeout) {
if (terminated)
- throw new IllegalStateException("Timer already terminated");
+ throw new IllegalStateException(JGitText.get().timerAlreadyTerminated);
callingThread = Thread.currentThread();
deadline = now() + timeout;
notifyAll();
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/io/TimeoutInputStream.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/io/TimeoutInputStream.java
index 19d7933e1b..3670639c1d 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/util/io/TimeoutInputStream.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/io/TimeoutInputStream.java
@@ -47,6 +47,9 @@ import java.io.FilterInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InterruptedIOException;
+import java.text.MessageFormat;
+
+import org.eclipse.jgit.JGitText;
/** InputStream with a configurable timeout. */
public class TimeoutInputStream extends FilterInputStream {
@@ -80,7 +83,7 @@ public class TimeoutInputStream extends FilterInputStream {
*/
public void setTimeout(final int millis) {
if (millis < 0)
- throw new IllegalArgumentException("Invalid timeout: " + millis);
+ throw new IllegalArgumentException(MessageFormat.format(JGitText.get().invalidTimeout, millis));
timeout = millis;
}
@@ -134,6 +137,6 @@ public class TimeoutInputStream extends FilterInputStream {
}
private static InterruptedIOException readTimedOut() {
- return new InterruptedIOException("Read timed out");
+ return new InterruptedIOException(JGitText.get().readTimedOut);
}
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/io/TimeoutOutputStream.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/io/TimeoutOutputStream.java
index a826086cd1..59ac7b21e5 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/util/io/TimeoutOutputStream.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/io/TimeoutOutputStream.java
@@ -46,6 +46,9 @@ package org.eclipse.jgit.util.io;
import java.io.IOException;
import java.io.InterruptedIOException;
import java.io.OutputStream;
+import java.text.MessageFormat;
+
+import org.eclipse.jgit.JGitText;
/** OutputStream with a configurable timeout. */
public class TimeoutOutputStream extends OutputStream {
@@ -81,7 +84,7 @@ public class TimeoutOutputStream extends OutputStream {
*/
public void setTimeout(final int millis) {
if (millis < 0)
- throw new IllegalArgumentException("Invalid timeout: " + millis);
+ throw new IllegalArgumentException(MessageFormat.format(JGitText.get().invalidTimeout, millis));
timeout = millis;
}
@@ -147,6 +150,6 @@ public class TimeoutOutputStream extends OutputStream {
}
private static InterruptedIOException writeTimedOut() {
- return new InterruptedIOException("Write timed out");
+ return new InterruptedIOException(JGitText.get().writeTimedOut);
}
}

Back to the top