From faae5cdb5be65547f7d681108f9a194e8da748f5 Mon Sep 17 00:00:00 2001 From: Matthias Sohn Date: Sun, 12 Apr 2015 00:51:37 +0200 Subject: [PATCH] Fix hidden field warnings in bundle org.eclipse.jgit Change-Id: I4e79cefe15037df0e1c520956bf2482240e31a7d Signed-off-by: Matthias Sohn --- .../storage/file/ObjectDirectoryPackParser.java | 11 +++++------ .../src/org/eclipse/jgit/transport/UploadPack.java | 8 ++++---- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/ObjectDirectoryPackParser.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/ObjectDirectoryPackParser.java index a186b8147..1c076ee09 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/ObjectDirectoryPackParser.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/ObjectDirectoryPackParser.java @@ -366,11 +366,10 @@ public class ObjectDirectoryPackParser extends PackParser { @Override protected void onEndThinPack() throws IOException { - final byte[] tailHash = this.tailDigest.digest(); final byte[] buf = buffer(); final MessageDigest origDigest = Constants.newMessageDigest(); - final MessageDigest tailDigest = Constants.newMessageDigest(); + final MessageDigest tailDigest2 = Constants.newMessageDigest(); final MessageDigest packDigest = Constants.newMessageDigest(); long origRemaining = origEnd; @@ -393,15 +392,15 @@ public class ObjectDirectoryPackParser extends PackParser { origDigest.update(buf, 0, origCnt); origRemaining -= origCnt; if (origRemaining == 0) - tailDigest.update(buf, origCnt, n - origCnt); + tailDigest2.update(buf, origCnt, n - origCnt); } else - tailDigest.update(buf, 0, n); + tailDigest2.update(buf, 0, n); packDigest.update(buf, 0, n); } - if (!Arrays.equals(origDigest.digest(), origHash) - || !Arrays.equals(tailDigest.digest(), tailHash)) + if (!Arrays.equals(origDigest.digest(), origHash) || !Arrays + .equals(tailDigest2.digest(), this.tailDigest.digest())) throw new IOException( JGitText.get().packCorruptedWhileWritingToFilesystem); 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 c60590dda..753277dd3 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java @@ -810,9 +810,9 @@ public class UploadPack { adv.advertiseCapability(OPTION_ALLOW_TIP_SHA1_IN_WANT); adv.advertiseCapability(OPTION_AGENT, UserAgent.get()); adv.setDerefTags(true); - Map refs = getAdvertisedOrDefaultRefs(); - findSymrefs(adv, refs); - advertised = adv.send(refs); + Map advertisedOrDefaultRefs = getAdvertisedOrDefaultRefs(); + findSymrefs(adv, advertisedOrDefaultRefs); + advertised = adv.send(advertisedOrDefaultRefs); if (adv.isEmpty()) adv.advertiseId(ObjectId.zeroId(), "capabilities^{}"); //$NON-NLS-1$ adv.end(); @@ -1467,7 +1467,7 @@ public class UploadPack { pckOut.end(); } - private void findSymrefs( + private static void findSymrefs( final RefAdvertiser adv, final Map refs) { Ref head = refs.get(Constants.HEAD); if (head != null && head.isSymbolic()) {