From 2390531888af6dc9e4fda6cb026271dc068c40ab Mon Sep 17 00:00:00 2001 From: Matthias Sohn Date: Wed, 18 Mar 2015 00:32:04 +0100 Subject: [PATCH] Externalize translatable texts in org.eclipse.jgit Change-Id: Ibf4c299f9d203c78cae79e61f88d4bea60ea2795 Signed-off-by: Matthias Sohn --- .../eclipse/jgit/internal/JGitText.properties | 68 +++++++++- .../src/org/eclipse/jgit/api/PullCommand.java | 8 +- .../org/eclipse/jgit/api/RebaseCommand.java | 15 ++- .../org/eclipse/jgit/api/ResetCommand.java | 4 +- .../org/eclipse/jgit/internal/JGitText.java | 64 +++++++++ .../jgit/internal/storage/dfs/DfsReader.java | 13 +- .../storage/dfs/DfsRepositoryBuilder.java | 4 +- .../internal/storage/file/WindowCursor.java | 7 +- .../src/org/eclipse/jgit/lib/IndexDiff.java | 8 +- .../org/eclipse/jgit/lib/ObjectChecker.java | 123 ++++++++++++------ .../src/org/eclipse/jgit/lib/ObjectId.java | 5 +- .../org/eclipse/jgit/lib/ObjectInserter.java | 3 +- .../src/org/eclipse/jgit/lib/PersonIdent.java | 5 +- .../org/eclipse/jgit/lib/RepositoryState.java | 4 +- .../org/eclipse/jgit/transport/AmazonS3.java | 16 +-- .../eclipse/jgit/transport/JschSession.java | 6 +- .../eclipse/jgit/transport/TransportSftp.java | 58 +++++---- .../jgit/transport/WalkFetchConnection.java | 3 +- .../src/org/eclipse/jgit/util/FS.java | 2 +- .../jgit/util/io/LimitedInputStream.java | 6 +- 20 files changed, 314 insertions(+), 108 deletions(-) diff --git a/org.eclipse.jgit/resources/org/eclipse/jgit/internal/JGitText.properties b/org.eclipse.jgit/resources/org/eclipse/jgit/internal/JGitText.properties index 6028618598..f591eddfa3 100644 --- a/org.eclipse.jgit/resources/org/eclipse/jgit/internal/JGitText.properties +++ b/org.eclipse.jgit/resources/org/eclipse/jgit/internal/JGitText.properties @@ -27,6 +27,7 @@ badEntryName=Bad entry name: {0} badEscape=Bad escape: {0} badGroupHeader=Bad group header badObjectType=Bad object type: {0} +badRef=Bad ref: {0}: {1} badSectionEntry=Bad section entry: {0} bareRepositoryNoWorkdirAndIndex=Bare Repository has neither a working tree, nor an index base64InputNotProperlyPadded=Base64 input not properly padded. @@ -58,16 +59,23 @@ cannotCreateIndexfile=Cannot create an index file with name {0} cannotCreateTempDir=Cannot create a temp dir cannotDeleteCheckedOutBranch=Branch {0} is checked out and can not be deleted cannotDeleteFile=Cannot delete file: {0} +cannotDeleteObjectsPath="Can't delete {0}/{1}: {2} cannotDeleteStaleTrackingRef=Cannot delete stale tracking ref {0} cannotDeleteStaleTrackingRef2=Cannot delete stale tracking ref {0}: {1} cannotDetermineProxyFor=Cannot determine proxy for {0} cannotDownload=Cannot download {0} +cannotEnterObjectsPath=Can't enter {0}/objects: {1} +cannotEnterPathFromParent=Can't enter {0} from {1}: {2} cannotExecute=cannot execute: {0} cannotGet=Cannot get {0} +cannotGetObjectsPath=Can't get {0}/{1}: {2} +cannotListObjectsPath=Can't ls {0}/{1}: {2} +cannotListPackPath=Can't ls {0}/pack: {1} cannotListRefs=cannot list refs cannotLock=Cannot lock {0} cannotLockPackIn=Cannot lock pack in {0} cannotMatchOnEmptyString=Cannot match on empty string. +cannotMkdirObjectPath=Can't mkdir {0}/{1}: {2} cannotMoveIndexTo=Cannot move index to {0} cannotMovePackTo=Cannot move pack to {0} cannotOpenService=cannot open {0} @@ -80,13 +88,16 @@ cannotReadCommit=Cannot read commit {0} cannotReadFile=Cannot read file {0} cannotReadHEAD=cannot read HEAD: {0} {1} cannotReadObject=Cannot read object +cannotReadObjectsPath=Cannot read {0}/{1}: {2} cannotReadTree=Cannot read tree {0} cannotRebaseWithoutCurrentHead=Can not rebase without a current HEAD cannotResolveLocalTrackingRefForUpdating=Cannot resolve local tracking ref {0} for updating. cannotSquashFixupWithoutPreviousCommit=Cannot {0} without previous commit. cannotStoreObjects=cannot store objects +cannotResolveUniquelyAbbrevObjectId=Could not resolve uniquely the abbreviated object ID cannotUnloadAModifiedTree=Cannot unload a modified tree. cannotWorkWithOtherStagesThanZeroRightNow=Cannot work with other stages than zero right now. Won't write corrupt index. +cannotWriteObjectsPath="Can't write {0}/{1}: {2} canOnlyCherryPickCommitsWithOneParent=Cannot cherry-pick commit ''{0}'' because it has {1} parents, only commits with exactly one parent are supported. canOnlyRevertCommitsWithOneParent=Cannot revert commit ''{0}'' because it has {1} parents, only commits with exactly one parent are supported commitDoesNotHaveGivenParent=The commit ''{0}'' does not have a parent number {1}. @@ -113,26 +124,60 @@ contextMustBeNonNegative=context must be >= 0 corruptionDetectedReReadingAt=Corruption detected re-reading at {0} corruptObjectBadStream=bad stream corruptObjectBadStreamCorruptHeader=bad stream, corrupt header +corruptObjectDuplicateEntryNames=duplicate entry names corruptObjectGarbageAfterSize=garbage after size corruptObjectIncorrectLength=incorrect length +corruptObjectIncorrectSorting=incorrectly sorted +corruptObjectInvalidAuthor=invalid author +corruptObjectInvalidCommitter=invalid committer corruptObjectInvalidEntryMode=invalid entry mode corruptObjectInvalidMode=invalid mode -corruptObjectInvalidMode2=invalid mode {0} +corruptObjectInvalidModeChar=invalid mode character +corruptObjectInvalidModeStartsZero=mode starts with '0' +corruptObjectInvalidMode2=invalid mode {0,number,#} corruptObjectInvalidMode3=invalid mode {0} for {1} ''{2}'' in {3}. +corruptObjectInvalidName=invalid name '%s' +corruptObjectInvalidNameAux=invalid name 'AUX' +corruptObjectInvalidNameCon=invalid name 'CON' +corruptObjectInvalidNameCom=invalid name 'COM%c' +corruptObjectInvalidNameEnd=invalid name ends with '%c' +corruptObjectInvalidNameIgnorableUnicode=invalid name '%s' contains ignorable Unicode characters +corruptObjectInvalidNameInvalidUtf8=invalid name contains byte sequence ''{0}'' which is not a valid UTF-8 character +corruptObjectInvalidNameLpt=invalid name 'LPT%c' +corruptObjectInvalidNameNul=invalid name 'NUL' +corruptObjectInvalidNamePrn=invalid name 'PRN' +corruptObjectInvalidObject=invalid object +corruptObjectInvalidParent=invalid parent +corruptObjectInvalidTagger=invalid tagger +corruptObjectInvalidTree=invalid tree corruptObjectInvalidType=invalid type corruptObjectInvalidType2=invalid type {0} corruptObjectMalformedHeader=malformed header: {0} +corruptObjectNameContainsByte=name contains byte 0x%x +corruptObjectNameContainsChar=name contains '%c' +corruptObjectNameContainsNullByte=name contains byte 0x00 +corruptObjectNameContainsSlash=name contains '/' +corruptObjectNameDot=invalid name '.' +corruptObjectNameDotDot=invalid name '..' +corruptObjectNameZeroLength=zero length name corruptObjectNegativeSize=negative size corruptObjectNoAuthor=no author corruptObjectNoCommitter=no committer corruptObjectNoHeader=no header corruptObjectNoObject=no object +corruptObjectNoObjectHeader=no object header corruptObjectNoTaggerBadHeader=no tagger/bad header corruptObjectNoTaggerHeader=no tagger header +corruptObjectNoTagHeader=no tag header corruptObjectNoTagName=no tag name corruptObjectNotree=no tree +corruptObjectNotreeHeader=no tree header corruptObjectNoType=no type +corruptObjectNoTypeHeader=no type header corruptObjectPackfileChecksumIncorrect=Packfile checksum incorrect. +corruptObjectTruncatedInMode=truncated in mode +corruptObjectTruncatedInName=truncated in name +corruptObjectTruncatedInObjectId=truncated in object id couldNotCheckOutBecauseOfConflicts=Could not check out because of conflicts couldNotDeleteLockFileShouldNotHappen=Could not delete lock file. Should not happen couldNotDeleteTemporaryIndexFileShouldNotHappen=Could not delete temporary index file. Should not happen @@ -144,6 +189,7 @@ couldNotReadObjectWhileParsingCommit=Could not read an object while parsing comm couldNotRenameDeleteOldIndex=Could not rename delete old index couldNotRenameTemporaryFile=Could not rename temporary file {0} to new location {1} couldNotRenameTemporaryIndexFileToIndex=Could not rename temporary index file to index +couldNotRewindToUpstreamCommit=Could not rewind to upstream commit couldNotURLEncodeToUTF8=Could not URL encode to UTF-8 couldNotWriteFile=Could not write file {0} countingObjects=Counting objects @@ -180,6 +226,7 @@ duplicateStagesNotAllowed=Duplicate stages not allowed eitherGitDirOrWorkTreeRequired=One of setGitDir or setWorkTree must be called. emptyCommit=No changes emptyPathNotPermitted=Empty path not permitted. +emptyRef=Empty ref: {0} encryptionError=Encryption error: {0} endOfFileInEscape=End of file in escape entryNotFoundByPath=Entry not found by path: {0} @@ -240,6 +287,7 @@ funnyRefname=funny refname gcFailed=Garbage collection failed. gitmodulesNotFound=.gitmodules not found in tree. headRequiredToStash=HEAD required to stash local changes +hiddenFilesStartWithDot=Hiding only allowed for names that start with a period hoursAgo={0} hours ago hugeIndexesAreNotSupportedByJgitYet=Huge indexes are not supported by jgit, yet hunkBelongsToAnotherFile=Hunk belongs to another file @@ -276,8 +324,9 @@ invalidCommitParentNumber=Invalid commit parent number invalidEncryption=Invalid encryption invalidGitdirRef = Invalid .git reference in file ''{0}'' invalidGitType=invalid git type: {0} -invalidId=Invalid id {0} +invalidId=Invalid id: {0} invalidIdLength=Invalid id length {0}; should be {1} +invalidIgnoreParamSubmodule=Found invalid ignore param for submodule {0}. invalidIntegerValue=Invalid integer value: {0}.{1}={2} invalidKey=Invalid key: {0} invalidLineInConfigFile=Invalid line in config file @@ -310,8 +359,10 @@ largeObjectException={0} exceeds size limit largeObjectOutOfMemory=Out of memory loading {0} lengthExceedsMaximumArraySize=Length exceeds maximum array size listingAlternates=Listing alternates +listingPacks=Listing packs localObjectsIncomplete=Local objects incomplete. localRefIsMissingObjects=Local ref {0} is missing object(s). +localRepository=local repository lockCountMustBeGreaterOrEqual1=lockCount must be >= 1 lockError=lock error: {0} lockOnNotClosed=Lock on {0} not closed. @@ -410,6 +461,8 @@ pathIsNotInWorkingDir=Path is not in working dir pathNotConfigured=Submodule path is not configured peeledLineBeforeRef=Peeled line before ref. peerDidNotSupplyACompleteObjectGraph=peer did not supply a complete object graph +personIdentEmailNonNull=E-mail address of PersonIdent must not be null. +personIdentNameNonNull=Name of PersonIdent must not be null. prefixRemote=remote: problemWithResolvingPushRefSpecsLocally=Problem with resolving push ref specs locally: {0} progressMonUploading=Uploading {0} @@ -453,6 +506,7 @@ repositoryConfigFileInvalid=Repository config file {0} invalid {1} repositoryIsRequired=Repository is required. repositoryNotFound=repository not found: {0} repositoryState_applyMailbox=Apply mailbox +repositoryState_bare=Bare repositoryState_bisecting=Bisecting repositoryState_conflicts=Conflicts repositoryState_merged=Merged @@ -466,6 +520,9 @@ resettingHead=Resetting head to {0} resolvingDeltas=Resolving deltas resultLengthIncorrect=result length incorrect rewinding=Rewinding to commit {0} +s3ActionDeletion=Deletion +s3ActionReading=Reading +s3ActionWriting=Writing searchForReuse=Finding sources searchForSizes=Getting sizes secondsAgo={0} seconds ago @@ -547,6 +604,7 @@ unableToWrite=Unable to write {0} unencodeableFile=Unencodable file: {0} unexpectedCompareResult=Unexpected metadata comparison result: {0} unexpectedEndOfConfigFile=Unexpected end of config file +unexpectedEndOfInput=Unexpected end of input unexpectedHunkTrailer=Unexpected hunk trailer unexpectedOddResult=odd: {0} + {1} - {2} unexpectedRefReport={0}: unexpected ref report: {1} @@ -558,6 +616,7 @@ unknownHost=unknown host unknownIndexVersionOrCorruptIndex=Unknown index version (or corrupt index): {0} unknownObject=unknown object unknownObjectType=Unknown object type {0}. +unknownObjectType2=unknown unknownRepositoryFormat=Unknown repository format unknownRepositoryFormat2=Unknown repository format "{0}"; expected "0". unknownZlibError=Unknown zlib error. @@ -566,16 +625,21 @@ unmergedPaths=Repository contains unmerged paths unpackException=Exception while parsing pack stream unreadablePackIndex=Unreadable pack index: {0} unrecognizedRef=Unrecognized ref: {0} +unsetMark=Mark not set +unsupportedAlternates=Alternates not supported unsupportedArchiveFormat=Unknown archive format ''{0}'' unsupportedCommand0=unsupported command 0 unsupportedEncryptionAlgorithm=Unsupported encryption algorithm: {0} unsupportedEncryptionVersion=Unsupported encryption version: {0} unsupportedGC=Unsupported garbage collector for repository type: {0} +unsupportedMark=Mark not supported unsupportedOperationNotAddAtEnd=Not add-at-end: {0} unsupportedPackIndexVersion=Unsupported pack index version {0} unsupportedPackVersion=Unsupported pack version {0}. +updatingHeadFailed=Updating HEAD failed updatingReferences=Updating references updatingRefFailed=Updating the ref {0} to {1} failed. ReturnCode from RefUpdate.update() was {2} +upstreamBranchName=branch ''{0}'' of {1} uriNotConfigured=Submodule URI not configured uriNotFound={0} not found URINotSupported=URI not supported: {0} diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/PullCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/PullCommand.java index cdaf3ec97e..ac050dd331 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/api/PullCommand.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/PullCommand.java @@ -261,7 +261,7 @@ public class PullCommand extends TransportCommand { fetchRes = fetch.call(); } else { // we can skip the fetch altogether - remoteUri = "local repository"; + remoteUri = JGitText.get().localRepository; fetchRes = null; } @@ -302,9 +302,9 @@ public class PullCommand extends TransportCommand { } } - String upstreamName = "branch \'" - + Repository.shortenRefName(remoteBranchName) + "\' of " - + remoteUri; + String upstreamName = MessageFormat.format( + JGitText.get().upstreamBranchName, + Repository.shortenRefName(remoteBranchName), remoteUri); PullResult result; if (pullRebaseMode.rebase) { diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/RebaseCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/RebaseCommand.java index a11822975a..7196a2f386 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/api/RebaseCommand.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/RebaseCommand.java @@ -445,7 +445,7 @@ public class RebaseCommand extends GitCommand { Collection ids = or.resolve(step.getCommit()); if (ids.size() != 1) throw new JGitInternalException( - "Could not resolve uniquely the abbreviated object ID"); + JGitText.get().cannotResolveUniquelyAbbrevObjectId); RevCommit commitToPick = walk.parseCommit(ids.iterator().next()); if (shouldPick) { if (monitor.isCancelled()) @@ -887,7 +887,8 @@ public class RebaseCommand extends GitCommand { case NO_CHANGE: break; default: - throw new JGitInternalException("Updating HEAD failed"); + throw new JGitInternalException( + JGitText.get().updatingHeadFailed); } rup = repo.updateRef(Constants.HEAD); rup.setRefLogMessage("rebase finished: returning to " + headName, //$NON-NLS-1$ @@ -899,7 +900,8 @@ public class RebaseCommand extends GitCommand { case NO_CHANGE: break; default: - throw new JGitInternalException("Updating HEAD failed"); + throw new JGitInternalException( + JGitText.get().updatingHeadFailed); } } } @@ -1291,7 +1293,7 @@ public class RebaseCommand extends GitCommand { if (this.upstreamCommit == null) throw new JGitInternalException(MessageFormat .format(JGitText.get().missingRequiredParameter, - "upstream")); + "upstream")); //$NON-NLS-1$ return; default: throw new WrongRepositoryStateException(MessageFormat.format( @@ -1398,7 +1400,8 @@ public class RebaseCommand extends GitCommand { case FORCED: break; default: - throw new IOException("Could not rewind to upstream commit"); + throw new IOException( + JGitText.get().couldNotRewindToUpstreamCommit); } } finally { walk.close(); @@ -1468,7 +1471,7 @@ public class RebaseCommand extends GitCommand { public RebaseCommand setUpstreamName(String upstreamName) { if (upstreamCommit == null) { throw new IllegalStateException( - "setUpstreamName must be called after setUpstream."); + "setUpstreamName must be called after setUpstream."); //$NON-NLS-1$ } this.upstreamCommitName = upstreamName; return this; diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/ResetCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/ResetCommand.java index 6183da033b..c2e42e2a1e 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/api/ResetCommand.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/ResetCommand.java @@ -157,8 +157,8 @@ public class ResetCommand extends GitCommand { if (ref != null && commitId == null) { // @TODO throw an InvalidRefNameException. We can't do that // now because this would break the API - throw new JGitInternalException("Invalid ref " + ref - + " specified"); + throw new JGitInternalException(MessageFormat + .format(JGitText.get().invalidRefName, ref)); } final ObjectId commitTree; diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/JGitText.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/JGitText.java index 3077e18c15..b53c7c95f0 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/JGitText.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/JGitText.java @@ -86,6 +86,7 @@ public class JGitText extends TranslationBundle { /***/ public String badEscape; /***/ public String badGroupHeader; /***/ public String badObjectType; + /***/ public String badRef; /***/ public String badSectionEntry; /***/ public String bareRepositoryNoWorkdirAndIndex; /***/ public String base64InputNotProperlyPadded; @@ -117,16 +118,23 @@ public class JGitText extends TranslationBundle { /***/ public String cannotCreateTempDir; /***/ public String cannotDeleteCheckedOutBranch; /***/ public String cannotDeleteFile; + /***/ public String cannotDeleteObjectsPath; /***/ public String cannotDeleteStaleTrackingRef; /***/ public String cannotDeleteStaleTrackingRef2; /***/ public String cannotDetermineProxyFor; /***/ public String cannotDownload; + /***/ public String cannotEnterObjectsPath; + /***/ public String cannotEnterPathFromParent; /***/ public String cannotExecute; /***/ public String cannotGet; + /***/ public String cannotGetObjectsPath; + /***/ public String cannotListObjectsPath; + /***/ public String cannotListPackPath; /***/ public String cannotListRefs; /***/ public String cannotLock; /***/ public String cannotLockPackIn; /***/ public String cannotMatchOnEmptyString; + /***/ public String cannotMkdirObjectPath; /***/ public String cannotMoveIndexTo; /***/ public String cannotMovePackTo; /***/ public String cannotOpenService; @@ -139,13 +147,16 @@ public class JGitText extends TranslationBundle { /***/ public String cannotReadFile; /***/ public String cannotReadHEAD; /***/ public String cannotReadObject; + /***/ public String cannotReadObjectsPath; /***/ public String cannotReadTree; /***/ public String cannotRebaseWithoutCurrentHead; /***/ public String cannotResolveLocalTrackingRefForUpdating; /***/ public String cannotSquashFixupWithoutPreviousCommit; /***/ public String cannotStoreObjects; + /***/ public String cannotResolveUniquelyAbbrevObjectId; /***/ public String cannotUnloadAModifiedTree; /***/ public String cannotWorkWithOtherStagesThanZeroRightNow; + /***/ public String cannotWriteObjectsPath; /***/ public String canOnlyCherryPickCommitsWithOneParent; /***/ public String canOnlyRevertCommitsWithOneParent; /***/ public String commitDoesNotHaveGivenParent; @@ -172,26 +183,60 @@ public class JGitText extends TranslationBundle { /***/ public String corruptionDetectedReReadingAt; /***/ public String corruptObjectBadStream; /***/ public String corruptObjectBadStreamCorruptHeader; + /***/ public String corruptObjectDuplicateEntryNames; /***/ public String corruptObjectGarbageAfterSize; /***/ public String corruptObjectIncorrectLength; + /***/ public String corruptObjectIncorrectSorting; + /***/ public String corruptObjectInvalidAuthor; + /***/ public String corruptObjectInvalidCommitter; /***/ public String corruptObjectInvalidEntryMode; /***/ public String corruptObjectInvalidMode; + /***/ public String corruptObjectInvalidModeChar; + /***/ public String corruptObjectInvalidModeStartsZero; /***/ public String corruptObjectInvalidMode2; /***/ public String corruptObjectInvalidMode3; + /***/ public String corruptObjectInvalidName; + /***/ public String corruptObjectInvalidNameAux; + /***/ public String corruptObjectInvalidNameCon; + /***/ public String corruptObjectInvalidNameCom; + /***/ public String corruptObjectInvalidNameEnd; + /***/ public String corruptObjectInvalidNameIgnorableUnicode; + /***/ public String corruptObjectInvalidNameInvalidUtf8; + /***/ public String corruptObjectInvalidNameLpt; + /***/ public String corruptObjectInvalidNameNul; + /***/ public String corruptObjectInvalidNamePrn; + /***/ public String corruptObjectInvalidObject; + /***/ public String corruptObjectInvalidParent; + /***/ public String corruptObjectInvalidTagger; + /***/ public String corruptObjectInvalidTree; /***/ public String corruptObjectInvalidType; /***/ public String corruptObjectInvalidType2; /***/ public String corruptObjectMalformedHeader; + /***/ public String corruptObjectNameContainsByte; + /***/ public String corruptObjectNameContainsChar; + /***/ public String corruptObjectNameContainsNullByte; + /***/ public String corruptObjectNameContainsSlash; + /***/ public String corruptObjectNameDot; + /***/ public String corruptObjectNameDotDot; + /***/ public String corruptObjectNameZeroLength; /***/ public String corruptObjectNegativeSize; /***/ public String corruptObjectNoAuthor; /***/ public String corruptObjectNoCommitter; /***/ public String corruptObjectNoHeader; /***/ public String corruptObjectNoObject; + /***/ public String corruptObjectNoObjectHeader; /***/ public String corruptObjectNoTaggerBadHeader; /***/ public String corruptObjectNoTaggerHeader; + /***/ public String corruptObjectNoTagHeader; /***/ public String corruptObjectNoTagName; /***/ public String corruptObjectNotree; + /***/ public String corruptObjectNotreeHeader; /***/ public String corruptObjectNoType; + /***/ public String corruptObjectNoTypeHeader; /***/ public String corruptObjectPackfileChecksumIncorrect; + /***/ public String corruptObjectTruncatedInMode; + /***/ public String corruptObjectTruncatedInName; + /***/ public String corruptObjectTruncatedInObjectId; /***/ public String corruptPack; /***/ public String couldNotCheckOutBecauseOfConflicts; /***/ public String couldNotDeleteLockFileShouldNotHappen; @@ -204,6 +249,7 @@ public class JGitText extends TranslationBundle { /***/ public String couldNotRenameDeleteOldIndex; /***/ public String couldNotRenameTemporaryFile; /***/ public String couldNotRenameTemporaryIndexFileToIndex; + /***/ public String couldNotRewindToUpstreamCommit; /***/ public String couldNotURLEncodeToUTF8; /***/ public String couldNotWriteFile; /***/ public String countingObjects; @@ -239,6 +285,7 @@ public class JGitText extends TranslationBundle { /***/ public String eitherGitDirOrWorkTreeRequired; /***/ public String emptyCommit; /***/ public String emptyPathNotPermitted; + /***/ public String emptyRef; /***/ public String encryptionError; /***/ public String endOfFileInEscape; /***/ public String entryNotFoundByPath; @@ -299,6 +346,7 @@ public class JGitText extends TranslationBundle { /***/ public String gcFailed; /***/ public String gitmodulesNotFound; /***/ public String headRequiredToStash; + /***/ public String hiddenFilesStartWithDot; /***/ public String hoursAgo; /***/ public String hugeIndexesAreNotSupportedByJgitYet; /***/ public String hunkBelongsToAnotherFile; @@ -337,6 +385,7 @@ public class JGitText extends TranslationBundle { /***/ public String invalidGitType; /***/ public String invalidId; /***/ public String invalidIdLength; + /***/ public String invalidIgnoreParamSubmodule; /***/ public String invalidIntegerValue; /***/ public String invalidKey; /***/ public String invalidLineInConfigFile; @@ -369,8 +418,10 @@ public class JGitText extends TranslationBundle { /***/ public String largeObjectOutOfMemory; /***/ public String lengthExceedsMaximumArraySize; /***/ public String listingAlternates; + /***/ public String listingPacks; /***/ public String localObjectsIncomplete; /***/ public String localRefIsMissingObjects; + /***/ public String localRepository; /***/ public String lockCountMustBeGreaterOrEqual1; /***/ public String lockError; /***/ public String lockOnNotClosed; @@ -469,6 +520,8 @@ public class JGitText extends TranslationBundle { /***/ public String pathNotConfigured; /***/ public String peeledLineBeforeRef; /***/ public String peerDidNotSupplyACompleteObjectGraph; + /***/ public String personIdentEmailNonNull; + /***/ public String personIdentNameNonNull; /***/ public String prefixRemote; /***/ public String problemWithResolvingPushRefSpecsLocally; /***/ public String progressMonUploading; @@ -512,6 +565,7 @@ public class JGitText extends TranslationBundle { /***/ public String repositoryIsRequired; /***/ public String repositoryNotFound; /***/ public String repositoryState_applyMailbox; + /***/ public String repositoryState_bare; /***/ public String repositoryState_bisecting; /***/ public String repositoryState_conflicts; /***/ public String repositoryState_merged; @@ -525,6 +579,9 @@ public class JGitText extends TranslationBundle { /***/ public String resolvingDeltas; /***/ public String resultLengthIncorrect; /***/ public String rewinding; + /***/ public String s3ActionDeletion; + /***/ public String s3ActionReading; + /***/ public String s3ActionWriting; /***/ public String searchForReuse; /***/ public String searchForSizes; /***/ public String secondsAgo; @@ -606,6 +663,7 @@ public class JGitText extends TranslationBundle { /***/ public String unencodeableFile; /***/ public String unexpectedCompareResult; /***/ public String unexpectedEndOfConfigFile; + /***/ public String unexpectedEndOfInput; /***/ public String unexpectedHunkTrailer; /***/ public String unexpectedOddResult; /***/ public String unexpectedRefReport; @@ -617,6 +675,7 @@ public class JGitText extends TranslationBundle { /***/ public String unknownIndexVersionOrCorruptIndex; /***/ public String unknownObject; /***/ public String unknownObjectType; + /***/ public String unknownObjectType2; /***/ public String unknownRepositoryFormat; /***/ public String unknownRepositoryFormat2; /***/ public String unknownZlibError; @@ -625,16 +684,21 @@ public class JGitText extends TranslationBundle { /***/ public String unpackException; /***/ public String unreadablePackIndex; /***/ public String unrecognizedRef; + /***/ public String unsetMark; + /***/ public String unsupportedAlternates; /***/ public String unsupportedArchiveFormat; /***/ public String unsupportedCommand0; /***/ public String unsupportedEncryptionAlgorithm; /***/ public String unsupportedEncryptionVersion; /***/ public String unsupportedGC; + /***/ public String unsupportedMark; /***/ public String unsupportedOperationNotAddAtEnd; /***/ public String unsupportedPackIndexVersion; /***/ public String unsupportedPackVersion; + /***/ public String updatingHeadFailed; /***/ public String updatingReferences; /***/ public String updatingRefFailed; + /***/ public String upstreamBranchName; /***/ public String uriNotConfigured; /***/ public String uriNotFound; /***/ public String URINotSupported; diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsReader.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsReader.java index a7ab0bb4a3..1665c2c772 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsReader.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsReader.java @@ -61,6 +61,7 @@ import java.util.zip.Inflater; import org.eclipse.jgit.errors.IncorrectObjectTypeException; import org.eclipse.jgit.errors.MissingObjectException; import org.eclipse.jgit.errors.StoredObjectRepresentationNotAvailableException; +import org.eclipse.jgit.internal.JGitText; import org.eclipse.jgit.internal.storage.file.BitmapIndexImpl; import org.eclipse.jgit.internal.storage.file.PackBitmapIndex; import org.eclipse.jgit.internal.storage.file.PackIndex; @@ -210,7 +211,8 @@ public final class DfsReader extends ObjectReader implements ObjectReuseAsIs { } if (typeHint == OBJ_ANY) - throw new MissingObjectException(objectId.copy(), "unknown"); + throw new MissingObjectException(objectId.copy(), + JGitText.get().unknownObjectType2); throw new MissingObjectException(objectId.copy(), typeHint); } @@ -339,7 +341,8 @@ public final class DfsReader extends ObjectReader implements ObjectReuseAsIs { public ObjectLoader open() throws IOException { if (cur.pack == null) - throw new MissingObjectException(cur.id, "unknown"); + throw new MissingObjectException(cur.id, + JGitText.get().unknownObjectType2); return cur.pack.load(DfsReader.this, cur.offset); } @@ -376,7 +379,8 @@ public final class DfsReader extends ObjectReader implements ObjectReuseAsIs { if (idItr.hasNext()) { cur = idItr.next(); if (cur.pack == null) - throw new MissingObjectException(cur.id, "unknown"); + throw new MissingObjectException(cur.id, + JGitText.get().unknownObjectType2); sz = cur.pack.getObjectSize(DfsReader.this, cur.offset); return true; } else if (findAllError != null) { @@ -429,7 +433,8 @@ public final class DfsReader extends ObjectReader implements ObjectReuseAsIs { } if (typeHint == OBJ_ANY) - throw new MissingObjectException(objectId.copy(), "unknown"); + throw new MissingObjectException(objectId.copy(), + JGitText.get().unknownObjectType2); throw new MissingObjectException(objectId.copy(), typeHint); } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsRepositoryBuilder.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsRepositoryBuilder.java index e0c0d0a5bf..77e060a564 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsRepositoryBuilder.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsRepositoryBuilder.java @@ -46,6 +46,7 @@ package org.eclipse.jgit.internal.storage.dfs; import java.io.File; import java.io.IOException; +import org.eclipse.jgit.internal.JGitText; import org.eclipse.jgit.lib.BaseRepositoryBuilder; /** @@ -141,7 +142,8 @@ public abstract class DfsRepositoryBuilder= 0) { ptr += parent.length; if ((ptr = id(raw, ptr)) < 0 || raw[ptr++] != '\n') - throw new CorruptObjectException("invalid parent"); + throw new CorruptObjectException( + JGitText.get().corruptObjectInvalidParent); } if ((ptr = match(raw, ptr, author)) < 0) - throw new CorruptObjectException("no author"); + throw new CorruptObjectException( + JGitText.get().corruptObjectNoAuthor); if ((ptr = personIdent(raw, ptr)) < 0 || raw[ptr++] != '\n') - throw new CorruptObjectException("invalid author"); + throw new CorruptObjectException( + JGitText.get().corruptObjectInvalidAuthor); if ((ptr = match(raw, ptr, committer)) < 0) - throw new CorruptObjectException("no committer"); + throw new CorruptObjectException( + JGitText.get().corruptObjectNoCommitter); if ((ptr = personIdent(raw, ptr)) < 0 || raw[ptr++] != '\n') - throw new CorruptObjectException("invalid committer"); + throw new CorruptObjectException( + JGitText.get().corruptObjectInvalidCommitter); } /** @@ -287,21 +294,26 @@ public class ObjectChecker { int ptr = 0; if ((ptr = match(raw, ptr, object)) < 0) - throw new CorruptObjectException("no object header"); + throw new CorruptObjectException( + JGitText.get().corruptObjectNoObjectHeader); if ((ptr = id(raw, ptr)) < 0 || raw[ptr++] != '\n') - throw new CorruptObjectException("invalid object"); + throw new CorruptObjectException( + JGitText.get().corruptObjectInvalidObject); if ((ptr = match(raw, ptr, type)) < 0) - throw new CorruptObjectException("no type header"); + throw new CorruptObjectException( + JGitText.get().corruptObjectNoTypeHeader); ptr = nextLF(raw, ptr); if ((ptr = match(raw, ptr, tag)) < 0) - throw new CorruptObjectException("no tag header"); + throw new CorruptObjectException( + JGitText.get().corruptObjectNoTagHeader); ptr = nextLF(raw, ptr); if ((ptr = match(raw, ptr, tagger)) > 0) { if ((ptr = personIdent(raw, ptr)) < 0 || raw[ptr++] != '\n') - throw new CorruptObjectException("invalid tagger"); + throw new CorruptObjectException( + JGitText.get().corruptObjectInvalidTagger); } } @@ -382,37 +394,46 @@ public class ObjectChecker { int thisMode = 0; for (;;) { if (ptr == sz) - throw new CorruptObjectException("truncated in mode"); + throw new CorruptObjectException( + JGitText.get().corruptObjectTruncatedInMode); final byte c = raw[ptr++]; if (' ' == c) break; if (c < '0' || c > '7') - throw new CorruptObjectException("invalid mode character"); + throw new CorruptObjectException( + JGitText.get().corruptObjectInvalidModeChar); if (thisMode == 0 && c == '0' && !allowZeroMode) - throw new CorruptObjectException("mode starts with '0'"); + throw new CorruptObjectException( + JGitText.get().corruptObjectInvalidModeStartsZero); thisMode <<= 3; thisMode += c - '0'; } if (FileMode.fromBits(thisMode).getObjectType() == Constants.OBJ_BAD) - throw new CorruptObjectException("invalid mode " + thisMode); + throw new CorruptObjectException(MessageFormat.format( + JGitText.get().corruptObjectInvalidMode2, + Integer.valueOf(thisMode))); final int thisNameB = ptr; ptr = scanPathSegment(raw, ptr, sz); if (ptr == sz || raw[ptr] != 0) - throw new CorruptObjectException("truncated in name"); + throw new CorruptObjectException( + JGitText.get().corruptObjectTruncatedInName); checkPathSegment2(raw, thisNameB, ptr); if (normalized != null) { if (!normalized.add(normalize(raw, thisNameB, ptr))) - throw new CorruptObjectException("duplicate entry names"); + throw new CorruptObjectException( + JGitText.get().corruptObjectDuplicateEntryNames); } else if (duplicateName(raw, thisNameB, ptr)) - throw new CorruptObjectException("duplicate entry names"); + throw new CorruptObjectException( + JGitText.get().corruptObjectDuplicateEntryNames); if (lastNameB != 0) { final int cmp = pathCompare(raw, lastNameB, lastNameE, lastMode, thisNameB, ptr, thisMode); if (cmp > 0) - throw new CorruptObjectException("incorrectly sorted"); + throw new CorruptObjectException( + JGitText.get().corruptObjectIncorrectSorting); } lastNameB = thisNameB; @@ -421,7 +442,8 @@ public class ObjectChecker { ptr += 1 + Constants.OBJECT_ID_LENGTH; if (ptr > sz) - throw new CorruptObjectException("truncated in object id"); + throw new CorruptObjectException( + JGitText.get().corruptObjectTruncatedInObjectId); } } @@ -432,13 +454,16 @@ public class ObjectChecker { if (c == 0) return ptr; if (c == '/') - throw new CorruptObjectException("name contains '/'"); + throw new CorruptObjectException( + JGitText.get().corruptObjectNameContainsSlash); if (windows && isInvalidOnWindows(c)) { if (c > 31) throw new CorruptObjectException(String.format( - "name contains '%c'", c)); + JGitText.get().corruptObjectNameContainsChar, + Byte.valueOf(c))); throw new CorruptObjectException(String.format( - "name contains byte 0x%x", c & 0xff)); + JGitText.get().corruptObjectNameContainsByte, + Integer.valueOf(c & 0xff))); } } return ptr; @@ -496,49 +521,55 @@ public class ObjectChecker { throws CorruptObjectException { int e = scanPathSegment(raw, ptr, end); if (e < end && raw[e] == 0) - throw new CorruptObjectException("name contains byte 0x00"); + throw new CorruptObjectException( + JGitText.get().corruptObjectNameContainsNullByte); checkPathSegment2(raw, ptr, end); } private void checkPathSegment2(byte[] raw, int ptr, int end) throws CorruptObjectException { if (ptr == end) - throw new CorruptObjectException("zero length name"); + throw new CorruptObjectException( + JGitText.get().corruptObjectNameZeroLength); if (raw[ptr] == '.') { switch (end - ptr) { case 1: - throw new CorruptObjectException("invalid name '.'"); + throw new CorruptObjectException( + JGitText.get().corruptObjectNameDot); case 2: if (raw[ptr + 1] == '.') - throw new CorruptObjectException("invalid name '..'"); + throw new CorruptObjectException( + JGitText.get().corruptObjectNameDotDot); break; case 4: if (isGit(raw, ptr + 1)) throw new CorruptObjectException(String.format( - "invalid name '%s'", + JGitText.get().corruptObjectInvalidName, RawParseUtils.decode(raw, ptr, end))); break; default: if (end - ptr > 4 && isNormalizedGit(raw, ptr + 1, end)) throw new CorruptObjectException(String.format( - "invalid name '%s'", + JGitText.get().corruptObjectInvalidName, RawParseUtils.decode(raw, ptr, end))); } } else if (isGitTilde1(raw, ptr, end)) { - throw new CorruptObjectException(String.format("invalid name '%s'", + throw new CorruptObjectException(String.format( + JGitText.get().corruptObjectInvalidName, RawParseUtils.decode(raw, ptr, end))); } if (macosx && isMacHFSGit(raw, ptr, end)) throw new CorruptObjectException(String.format( - "invalid name '%s' contains ignorable Unicode characters", + JGitText.get().corruptObjectInvalidNameIgnorableUnicode, RawParseUtils.decode(raw, ptr, end))); if (windows) { // Windows ignores space and dot at end of file name. if (raw[end - 1] == ' ' || raw[end - 1] == '.') - throw new CorruptObjectException("invalid name ends with '" - + ((char) raw[end - 1]) + "'"); + throw new CorruptObjectException(String.format( + JGitText.get().corruptObjectInvalidNameEnd, + Character.valueOf(((char) raw[end - 1])))); if (end - ptr >= 3) checkNotWindowsDevice(raw, ptr, end); } @@ -615,7 +646,7 @@ public class ObjectChecker { throws CorruptObjectException { if ((ptr + 2) >= end) throw new CorruptObjectException(MessageFormat.format( - "invalid name contains byte sequence ''{0}'' which is not a valid UTF-8 character", + JGitText.get().corruptObjectInvalidNameInvalidUtf8, toHexString(raw, ptr, end))); } @@ -634,7 +665,8 @@ public class ObjectChecker { && toLower(raw[ptr + 1]) == 'u' && toLower(raw[ptr + 2]) == 'x' && (end - ptr == 3 || raw[ptr + 3] == '.')) - throw new CorruptObjectException("invalid name 'AUX'"); + throw new CorruptObjectException( + JGitText.get().corruptObjectInvalidNameAux); break; case 'c': // CON, COM[1-9] @@ -642,14 +674,16 @@ public class ObjectChecker { && toLower(raw[ptr + 2]) == 'n' && toLower(raw[ptr + 1]) == 'o' && (end - ptr == 3 || raw[ptr + 3] == '.')) - throw new CorruptObjectException("invalid name 'CON'"); + throw new CorruptObjectException( + JGitText.get().corruptObjectInvalidNameCon); if (end - ptr >= 4 && toLower(raw[ptr + 2]) == 'm' && toLower(raw[ptr + 1]) == 'o' && isPositiveDigit(raw[ptr + 3]) && (end - ptr == 4 || raw[ptr + 4] == '.')) - throw new CorruptObjectException("invalid name 'COM" - + ((char) raw[ptr + 3]) + "'"); + throw new CorruptObjectException(String.format( + JGitText.get().corruptObjectInvalidNameCom, + Character.valueOf(((char) raw[ptr + 3])))); break; case 'l': // LPT[1-9] @@ -658,8 +692,9 @@ public class ObjectChecker { && toLower(raw[ptr + 2]) == 't' && isPositiveDigit(raw[ptr + 3]) && (end - ptr == 4 || raw[ptr + 4] == '.')) - throw new CorruptObjectException("invalid name 'LPT" - + ((char) raw[ptr + 3]) + "'"); + throw new CorruptObjectException(String.format( + JGitText.get().corruptObjectInvalidNameLpt, + Character.valueOf(((char) raw[ptr + 3])))); break; case 'n': // NUL @@ -667,7 +702,8 @@ public class ObjectChecker { && toLower(raw[ptr + 1]) == 'u' && toLower(raw[ptr + 2]) == 'l' && (end - ptr == 3 || raw[ptr + 3] == '.')) - throw new CorruptObjectException("invalid name 'NUL'"); + throw new CorruptObjectException( + JGitText.get().corruptObjectInvalidNameNul); break; case 'p': // PRN @@ -675,7 +711,8 @@ public class ObjectChecker { && toLower(raw[ptr + 1]) == 'r' && toLower(raw[ptr + 2]) == 'n' && (end - ptr == 3 || raw[ptr + 3] == '.')) - throw new CorruptObjectException("invalid name 'PRN'"); + throw new CorruptObjectException( + JGitText.get().corruptObjectInvalidNamePrn); break; } } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectId.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectId.java index 2f04751a1d..bdbffee490 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectId.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectId.java @@ -45,6 +45,7 @@ package org.eclipse.jgit.lib; import org.eclipse.jgit.errors.InvalidObjectIdException; +import org.eclipse.jgit.internal.JGitText; import org.eclipse.jgit.util.NB; import org.eclipse.jgit.util.RawParseUtils; @@ -52,6 +53,7 @@ import java.io.IOException; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.io.Serializable; +import java.text.MessageFormat; /** * A SHA-1 abstraction. @@ -229,7 +231,8 @@ public class ObjectId extends AnyObjectId implements Serializable { */ public static ObjectId 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)); return fromHexString(Constants.encodeASCII(str), 0); } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectInserter.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectInserter.java index 5d892019ab..d9da65f03f 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectInserter.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectInserter.java @@ -52,6 +52,7 @@ import java.io.IOException; import java.io.InputStream; import java.security.MessageDigest; +import org.eclipse.jgit.internal.JGitText; import org.eclipse.jgit.transport.PackParser; /** @@ -263,7 +264,7 @@ public abstract class ObjectInserter implements AutoCloseable { while (length > 0) { int n = in.read(buf, 0, (int) Math.min(length, buf.length)); if (n < 0) - throw new EOFException("Unexpected end of input"); + throw new EOFException(JGitText.get().unexpectedEndOfInput); md.update(buf, 0, n); length -= n; } 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 8f7e3eff7c..e8591195cf 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/PersonIdent.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/PersonIdent.java @@ -51,6 +51,7 @@ import java.util.Date; import java.util.Locale; import java.util.TimeZone; +import org.eclipse.jgit.internal.JGitText; import org.eclipse.jgit.util.SystemReader; /** @@ -181,10 +182,10 @@ public class PersonIdent implements Serializable { final long aWhen, final int aTZ) { if (aName == null) throw new IllegalArgumentException( - "Name of PersonIdent must not be null."); + JGitText.get().personIdentNameNonNull); if (aEmailAddress == null) throw new IllegalArgumentException( - "E-mail address of PersonIdent must not be null."); + JGitText.get().personIdentEmailNonNull); name = aName; emailAddress = aEmailAddress; when = aWhen; diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/RepositoryState.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/RepositoryState.java index 4fac2ebed5..9b7234b3af 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/RepositoryState.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/RepositoryState.java @@ -73,7 +73,9 @@ public enum RepositoryState { public boolean isRebasing() { return false; } @Override - public String getDescription() { return "Bare"; } + public String getDescription() { + return JGitText.get().repositoryState_bare; + } }, /** 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 f43ea637aa..d3cdba5bf3 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/AmazonS3.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/AmazonS3.java @@ -292,10 +292,10 @@ public class AmazonS3 { case HttpURLConnection.HTTP_INTERNAL_ERROR: continue; default: - throw error("Reading", key, c); + throw error(JGitText.get().s3ActionReading, key, c); } } - throw maxAttempts("Reading", key); + throw maxAttempts(JGitText.get().s3ActionReading, key); } /** @@ -365,10 +365,10 @@ public class AmazonS3 { case HttpURLConnection.HTTP_INTERNAL_ERROR: continue; default: - throw error("Deletion", key, c); + throw error(JGitText.get().s3ActionDeletion, key, c); } } - throw maxAttempts("Deletion", key); + throw maxAttempts(JGitText.get().s3ActionDeletion, key); } /** @@ -426,10 +426,10 @@ public class AmazonS3 { case HttpURLConnection.HTTP_INTERNAL_ERROR: continue; default: - throw error("Writing", key, c); + throw error(JGitText.get().s3ActionWriting, key, c); } } - throw maxAttempts("Writing", key); + throw maxAttempts(JGitText.get().s3ActionWriting, key); } /** @@ -512,10 +512,10 @@ public class AmazonS3 { case HttpURLConnection.HTTP_INTERNAL_ERROR: continue; default: - throw error("Writing", key, c); + throw error(JGitText.get().s3ActionWriting, key, c); } } - throw maxAttempts("Writing", key); + throw maxAttempts(JGitText.get().s3ActionWriting, key); } private IOException error(final String action, final String key, diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/JschSession.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/JschSession.java index e5d59b579b..b4a09020b5 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/JschSession.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/JschSession.java @@ -55,6 +55,7 @@ import java.io.PipedInputStream; import java.io.PipedOutputStream; import org.eclipse.jgit.errors.TransportException; +import org.eclipse.jgit.internal.JGitText; import org.eclipse.jgit.util.io.StreamCopyThread; import com.jcraft.jsch.Channel; @@ -76,7 +77,7 @@ public class JschSession implements RemoteSession { /** * Create a new session object by passing the real Jsch session and the URI * information. - * + * * @param session * the real Jsch session created elsewhere. * @param uri @@ -149,7 +150,8 @@ public class JschSession implements RemoteSession { setupStreams(); channel.connect(timeout > 0 ? timeout * 1000 : 0); if (!channel.isConnected()) - throw new TransportException(uri, "connection failed"); + throw new TransportException(uri, + JGitText.get().connectionFailed); } catch (JSchException e) { throw new TransportException(uri, e.getMessage(), e); } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportSftp.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportSftp.java index 756a161985..c47645cd73 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportSftp.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportSftp.java @@ -47,6 +47,7 @@ import java.io.BufferedReader; import java.io.FileNotFoundException; import java.io.IOException; import java.io.OutputStream; +import java.text.MessageFormat; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; @@ -179,8 +180,9 @@ public class TransportSftp extends SshTransport implements WalkTransport { close(); throw err; } catch (SftpException je) { - throw new TransportException("Can't enter " + path + "/objects" - + ": " + je.getMessage(), je); //$NON-NLS-1$ + throw new TransportException(MessageFormat.format( + JGitText.get().cannotEnterObjectsPath, path, + je.getMessage()), je); } } @@ -195,8 +197,9 @@ public class TransportSftp extends SshTransport implements WalkTransport { close(); throw err; } catch (SftpException je) { - throw new TransportException("Can't enter " + p + " from " - + parent.objectsPath + ": " + je.getMessage(), je); //$NON-NLS-1$ + throw new TransportException(MessageFormat.format( + JGitText.get().cannotEnterPathFromParent, p, + parent.objectsPath, je.getMessage()), je); } } @@ -253,8 +256,10 @@ public class TransportSftp extends SshTransport implements WalkTransport { } }); } catch (SftpException je) { - throw new TransportException("Can't ls " + objectsPath - + "/pack: " + je.getMessage(), je); + throw new TransportException( + MessageFormat.format(JGitText.get().cannotListPackPath, + objectsPath, je.getMessage()), + je); } return packs; } @@ -267,8 +272,9 @@ public class TransportSftp extends SshTransport implements WalkTransport { } catch (SftpException je) { if (je.id == ChannelSftp.SSH_FX_NO_SUCH_FILE) throw new FileNotFoundException(path); - throw new TransportException("Can't get " + objectsPath + "/" //$NON-NLS-2$ - + path + ": " + je.getMessage(), je); //$NON-NLS-1$ + throw new TransportException(MessageFormat.format( + JGitText.get().cannotGetObjectsPath, objectsPath, path, + je.getMessage()), je); } } @@ -279,8 +285,9 @@ public class TransportSftp extends SshTransport implements WalkTransport { } catch (SftpException je) { if (je.id == ChannelSftp.SSH_FX_NO_SUCH_FILE) return; - throw new TransportException("Can't delete " + objectsPath - + "/" + path + ": " + je.getMessage(), je); //$NON-NLS-1$//$NON-NLS-2$ + throw new TransportException(MessageFormat.format( + JGitText.get().cannotDeleteObjectsPath, objectsPath, + path, je.getMessage()), je); } // Prune any now empty directories. @@ -318,8 +325,9 @@ public class TransportSftp extends SshTransport implements WalkTransport { } } - throw new TransportException("Can't write " + objectsPath + "/" //$NON-NLS-2$ - + path + ": " + je.getMessage(), je); //$NON-NLS-1$ + throw new TransportException(MessageFormat.format( + JGitText.get().cannotWriteObjectsPath, objectsPath, + path, je.getMessage()), je); } } @@ -331,8 +339,9 @@ public class TransportSftp extends SshTransport implements WalkTransport { try { ftp.rename(lock, path); } catch (SftpException je) { - throw new TransportException("Can't write " + objectsPath - + "/" + path + ": " + je.getMessage(), je); //$NON-NLS-1$//$NON-NLS-2$ + throw new TransportException(MessageFormat.format( + JGitText.get().cannotWriteObjectsPath, objectsPath, + path, je.getMessage()), je); } } catch (IOException err) { try { @@ -364,8 +373,9 @@ public class TransportSftp extends SshTransport implements WalkTransport { } } - throw new TransportException("Can't mkdir " + objectsPath + "/" - + path + ": " + je.getMessage(), je); + throw new TransportException(MessageFormat.format( + JGitText.get().cannotMkdirObjectPath, objectsPath, path, + je.getMessage()), je); } } @@ -385,8 +395,9 @@ public class TransportSftp extends SshTransport implements WalkTransport { try { list = ftp.ls(dir); } catch (SftpException je) { - throw new TransportException("Can't ls " + objectsPath + "/" //$NON-NLS-2$ - + dir + ": " + je.getMessage(), je); //$NON-NLS-1$ + throw new TransportException(MessageFormat.format( + JGitText.get().cannotListObjectsPath, objectsPath, dir, + je.getMessage()), je); } for (final ChannelSftp.LsEntry ent : list) { @@ -415,12 +426,14 @@ public class TransportSftp extends SshTransport implements WalkTransport { } catch (FileNotFoundException noRef) { return null; } catch (IOException err) { - throw new TransportException("Cannot read " + objectsPath + "/" //$NON-NLS-2$ - + path + ": " + err.getMessage(), err); //$NON-NLS-1$ + throw new TransportException(MessageFormat.format( + JGitText.get().cannotReadObjectsPath, objectsPath, path, + err.getMessage()), err); } if (line == null) - throw new TransportException("Empty ref: " + name); + throw new TransportException( + MessageFormat.format(JGitText.get().emptyRef, name)); if (line.startsWith("ref: ")) { //$NON-NLS-1$ final String target = line.substring("ref: ".length()); //$NON-NLS-1$ @@ -441,7 +454,8 @@ public class TransportSftp extends SshTransport implements WalkTransport { return r; } - throw new TransportException("Bad ref: " + name + ": " + line); //$NON-NLS-2$ + throw new TransportException( + MessageFormat.format(JGitText.get().badRef, name, line)); } private Storage loose(final Ref r) { 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 a71aac59c0..dc9dee55a4 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/WalkFetchConnection.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/WalkFetchConnection.java @@ -430,7 +430,8 @@ class WalkFetchConnection extends BaseFetchConnection { final WalkRemoteObjectDatabase wrr = noPacksYet.removeFirst(); final Collection packNameList; try { - pm.beginTask("Listing packs", ProgressMonitor.UNKNOWN); + pm.beginTask(JGitText.get().listingPacks, + ProgressMonitor.UNKNOWN); packNameList = wrr.getPackNames(); } catch (IOException e) { // Try another repository. diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/FS.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/FS.java index a46dc33cdb..fa0292e793 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/util/FS.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/FS.java @@ -671,7 +671,7 @@ public abstract class FS { public void setHidden(File path, boolean hidden) throws IOException { if (!path.getName().startsWith(".")) //$NON-NLS-1$ throw new IllegalArgumentException( - "Hiding only allowed for names that start with a period"); + JGitText.get().hiddenFilesStartWithDot); } /** diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/io/LimitedInputStream.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/io/LimitedInputStream.java index 85c8172042..d74532fd4a 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/util/io/LimitedInputStream.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/io/LimitedInputStream.java @@ -48,6 +48,8 @@ import java.io.FilterInputStream; import java.io.IOException; import java.io.InputStream; +import org.eclipse.jgit.internal.JGitText; + /** * Wraps a {@link InputStream}, limiting the number of bytes which can be * read. @@ -124,10 +126,10 @@ public abstract class LimitedInputStream extends FilterInputStream { @Override public synchronized void reset() throws IOException { if (!in.markSupported()) - throw new IOException("Mark not supported"); + throw new IOException(JGitText.get().unsupportedMark); if (mark == -1) - throw new IOException("Mark not set"); + throw new IOException(JGitText.get().unsetMark); in.reset(); left = mark; -- 2.39.5