doortts doortts 2016-12-16
dependency: Update jgit and play
Play: 2.3.6 -> 2.3.10
jgit: 3.5 -> 4.5
@f3240682db9e627638ee3542ff786dbdb6abcb94
app/Global.java
--- app/Global.java
+++ app/Global.java
@@ -27,7 +27,6 @@
 import mailbox.MailboxService;
 import models.*;
 import org.apache.commons.lang3.StringUtils;
-import org.apache.http.impl.cookie.DateUtils;
 import play.Application;
 import play.Configuration;
 import play.GlobalSettings;
@@ -58,7 +57,9 @@
 import java.nio.file.Path;
 import java.nio.file.Paths;
 import java.security.SecureRandom;
-import java.util.Date;
+import java.time.ZoneId;
+import java.time.ZonedDateTime;
+import java.time.format.DateTimeFormatter;
 
 import static play.data.Form.form;
 import static play.mvc.Results.badRequest;
@@ -185,7 +186,7 @@
                 } catch (Exception e) {
                     play.Logger.warn("Failed to update the preferred language", e);
                 }
-                ctx.response().setHeader("Date", DateUtils.formatDate(new Date()));
+                ctx.response().setHeader("Date", DateTimeFormatter.RFC_1123_DATE_TIME.format(ZonedDateTime.now(ZoneId.of("GMT"))));
                 ctx.response().setHeader("Cache-Control", "no-cache");
                 Promise<Result> promise = delegate.call(ctx);
                 AccessLogger.log(request, promise, start);
app/models/PullRequest.java
--- app/models/PullRequest.java
+++ app/models/PullRequest.java
@@ -434,7 +434,7 @@
                 String refName = getNameOfRefToMerged();
                 RevCommit commit = null;
                 try {
-                    ObjectId objectId = getRepository().getRef(refName).getObjectId();
+                    ObjectId objectId = getRepository().findRef(refName).getObjectId();
                     commit = new RevWalk(getRepository()).parseCommit(objectId);
                 } catch (Exception e) {
                     play.Logger.info("Failed to get the merged branch", e);
@@ -471,7 +471,7 @@
                 ObjectInserter inserter = getRepository().newObjectInserter();
                 mergeCommitId = inserter.insert(mergeCommit);
                 inserter.flush();
-                inserter.release();
+                inserter.close();
 
                 return new MergeRefUpdate(mergeCommitId, whoMerges);
             }
app/playRepository/BareCommit.java
--- app/playRepository/BareCommit.java
+++ app/playRepository/BareCommit.java
@@ -89,7 +89,7 @@
         } catch (OverlappingFileLockException e) {
             play.Logger.error("Overlapping File Lock Error: " + e.getMessage());
         } finally {
-            objectInserter.release();
+            objectInserter.close();
             repository.close();
             refHeadFileLock.release();
         }
@@ -193,7 +193,7 @@
     }
 
     private boolean hasOldCommit(String refName) throws IOException {
-        return this.repository.getRef(refName).getObjectId() != null;
+        return this.repository.findRef(refName).getObjectId() != null;
     }
 
     private PersonIdent getPersonIdent() {
@@ -215,18 +215,18 @@
     }
 
     public void setHeadObjectId(String refName) throws IOException {
-        if(this.repository.getRef(refName).getObjectId() == null){
+        if(this.repository.findRef(refName).getObjectId() == null){
             this.headObjectId = ObjectId.zeroId();
         } else {
-            this.headObjectId = this.repository.getRef(refName).getObjectId();
+            this.headObjectId = this.repository.findRef(refName).getObjectId();
         }
     }
 
     public ObjectId getCurrentMomentHeadObjectId() throws IOException {
-        if( this.repository.getRef(refName).getObjectId() == null ){
+        if( this.repository.findRef(refName).getObjectId() == null ){
             return ObjectId.zeroId();
         } else {
-            return this.repository.getRef(refName).getObjectId();
+            return this.repository.findRef(refName).getObjectId();
         }
     }
 
@@ -245,7 +245,7 @@
             }
 
             refHeadFile = new File(repository.getDirectory().getPath(),
-                    repository.getRef(refName).getLeaf().getName());
+                    repository.findRef(refName).getLeaf().getName());
             if(refHeadFile.exists()){
                 channel = new RandomAccessFile(refHeadFile, "rw").getChannel();
                 lock = channel.lock();
app/playRepository/BareRepository.java
--- app/playRepository/BareRepository.java
+++ app/playRepository/BareRepository.java
@@ -76,7 +76,7 @@
 
     public static ObjectId getFileObjectId(Repository repository, String fileNameWithPath) throws IOException {
         TreeWalk treeWalk = new TreeWalk(repository);
-        RevTree revTree = getRevTreeFromRef(repository, repository.getRef(HEAD));
+        RevTree revTree = getRevTreeFromRef(repository, repository.findRef(HEAD));
         if( revTree == null ){
             return ObjectId.zeroId();
         }
@@ -88,7 +88,7 @@
 
     private static ObjectId getFirstFoundREADMEfileObjectId(Repository repository) throws IOException {
         TreeWalk treeWalk = new TreeWalk(repository);
-        RevTree revTree = getRevTreeFromRef(repository, repository.getRef(HEAD));
+        RevTree revTree = getRevTreeFromRef(repository, repository.findRef(HEAD));
         if( revTree == null ){
             return ObjectId.zeroId();
         }
app/playRepository/GitRepository.java
--- app/playRepository/GitRepository.java
+++ app/playRepository/GitRepository.java
@@ -38,10 +38,14 @@
 import org.eclipse.jgit.api.Git;
 import org.eclipse.jgit.api.LogCommand;
 import org.eclipse.jgit.api.errors.GitAPIException;
+import org.eclipse.jgit.attributes.AttributesNode;
+import org.eclipse.jgit.attributes.AttributesNodeProvider;
+import org.eclipse.jgit.attributes.AttributesRule;
 import org.eclipse.jgit.blame.BlameResult;
 import org.eclipse.jgit.diff.*;
 import org.eclipse.jgit.diff.Edit.Type;
 import org.eclipse.jgit.errors.MissingObjectException;
+import org.eclipse.jgit.internal.storage.dfs.DfsRepository;
 import org.eclipse.jgit.lib.*;
 import org.eclipse.jgit.lib.RefUpdate.Result;
 import org.eclipse.jgit.revwalk.RevCommit;
@@ -59,15 +63,13 @@
 import org.eclipse.jgit.util.io.NullOutputStream;
 import org.tmatesoft.svn.core.SVNException;
 import play.Logger;
+import play.api.Play;
 import play.libs.Json;
 import utils.FileUtil;
 import utils.GravatarUtil;
 
 import javax.naming.LimitExceededException;
-import java.io.ByteArrayOutputStream;
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.IOException;
+import java.io.*;
 import java.nio.file.*;
 import java.nio.file.attribute.BasicFileAttributes;
 import java.util.*;
@@ -1110,7 +1112,7 @@
             diffFormatter.setDetectRenames(true);
             return diffFormatter.scan(commitA, commitB);
         } finally {
-            diffFormatter.release();
+            diffFormatter.close();
         }
     }
 
@@ -1148,7 +1150,7 @@
                     .setStartCommit(start).call();
             return getAuthorsFromBlameResult(edits, blameResult);
         } finally {
-            diffFormatter.release();
+            diffFormatter.close();
         }
     }
 
@@ -1269,7 +1271,7 @@
                     RevWalk revWalk = new RevWalk(fromRepo);
                     RevCommit commit = revWalk.parseCommit(fromRepo.resolve(branchName));
                     String commitName = commit.name(); // fromBranch's head commit name
-                    revWalk.release();
+                    revWalk.close();
 
                     // check whether the target repository has the commit witch is the fromBranch's head commit.
                     Repository toRepo = buildGitRepository(pullRequest.toProject);
@@ -1310,7 +1312,7 @@
             throw new RuntimeException(e);
         } finally {
             if(revWalk != null) {
-                revWalk.release();
+                revWalk.close();
             }
             if(repo != null) {
                 repo.close();
@@ -1506,6 +1508,11 @@
                 }
                 return union;
             }
+
+            @Override
+            public void close() {
+                play.Logger.warn("MultipleRepositoryObjectReader#close - Not implemented method but called!");
+            }
         }
 
         final MultipleRepositoryObjectReader reader = new MultipleRepositoryObjectReader();
@@ -1536,6 +1543,11 @@
             }
 
             @Override
+            public AttributesNodeProvider createAttributesNodeProvider() {
+                return new EmptyAttributesNodeProvider();
+            }
+
+            @Override
             public void scanForRepoChanges() throws IOException {
                 throw new UnsupportedOperationException();
             }
@@ -1552,6 +1564,32 @@
 
             public ObjectReader newObjectReader() {
                 return reader;
+            }
+
+            // Borrowed from org.eclipse.jgit.internal.storage.dfs.DfsRepository
+            class EmptyAttributesNodeProvider implements AttributesNodeProvider {
+                private EmptyAttributesNodeProvider.EmptyAttributesNode emptyAttributesNode
+                        = new EmptyAttributesNodeProvider.EmptyAttributesNode();
+
+                public AttributesNode getInfoAttributesNode() throws IOException {
+                    return emptyAttributesNode;
+                }
+
+                public AttributesNode getGlobalAttributesNode() throws IOException {
+                    return emptyAttributesNode;
+                }
+
+                class EmptyAttributesNode extends AttributesNode {
+
+                    public EmptyAttributesNode() {
+                        super(Collections.<AttributesRule> emptyList());
+                    }
+
+                    @Override
+                    public void parse(InputStream in) throws IOException {
+                        // Do nothing
+                    }
+                }
             }
         };
 
@@ -1791,7 +1829,7 @@
 
     @Override
     public String getDefaultBranch() throws IOException {
-        return repository.getRef(Constants.HEAD).getTarget().getName();
+        return repository.findRef(Constants.HEAD).getTarget().getName();
     }
 
     @Override
app/utils/diff_match_patch.java
--- app/utils/diff_match_patch.java
+++ app/utils/diff_match_patch.java
@@ -1761,6 +1761,7 @@
      * @return LinkedList of Patch objects.
      * @deprecated Prefer patch_make(String text1, LinkedList<Diff> diffs).
      */
+    @Deprecated
     public LinkedList<Patch> patch_make(String text1, String text2,
                                         LinkedList<Diff> diffs) {
         return patch_make(text1, diffs);
@@ -2311,6 +2312,11 @@
                 return false;
             }
         }
+
+        @Override
+        public int hashCode() {
+            return super.hashCode();
+        }
     }
 
 
build.sbt
--- build.sbt
+++ build.sbt
@@ -16,13 +16,12 @@
   "com.h2database" % "h2" % "1.3.176",
   // JDBC driver for mariadb
   "org.mariadb.jdbc" % "mariadb-java-client" % "1.3.6",
-  "net.contentobjects.jnotify" % "jnotify" % "0.94",
   // Core Library
-  "org.eclipse.jgit" % "org.eclipse.jgit" % "3.5.3.201412180710-r",
+  "org.eclipse.jgit" % "org.eclipse.jgit" % "4.5.0.201609210915-r",
   // Smart HTTP Servlet
-  "org.eclipse.jgit" % "org.eclipse.jgit.http.server" % "3.5.3.201412180710-r",
-  // Symlink support for Java7
-  "org.eclipse.jgit" % "org.eclipse.jgit.java7" % "3.5.3.201412180710-r",
+  "org.eclipse.jgit" % "org.eclipse.jgit.http.server" % "4.5.0.201609210915-r",
+  // JGit Large File Storage
+  "org.eclipse.jgit" % "org.eclipse.jgit.lfs" % "4.5.0.201609210915-r",
   // svnkit
   "org.tmatesoft.svnkit" % "svnkit" % "1.8.12",
   // svnkit-dav
@@ -54,7 +53,8 @@
 
 val projectSettings = Seq(
   // Add your own project settings here
-  resolvers += "jgit-repository" at "http://download.eclipse.org/jgit/maven",
+  resolvers += "jgit-repository" at "https://repo.eclipse.org/content/groups/releases/",
+  resolvers += "java-semVer" at "http://oss.sonatype.org/content/repositories/snapshots/",
   resolvers += "scm-manager release repository" at "http://maven.scm-manager.org/nexus/content/groups/public",
   resolvers += "tmatesoft release repository" at "http://maven.tmatesoft.com/content/repositories/releases",
   resolvers += "julienrf.github.com" at "http://julienrf.github.com/repo/",
@@ -124,3 +124,6 @@
           </FindBugsFilter>
         )
       )
+
+
+fork in run := true
(No newline at end of file)
project/plugins.sbt
--- project/plugins.sbt
+++ project/plugins.sbt
@@ -5,7 +5,7 @@
 resolvers += "Typesafe repository" at "http://repo.typesafe.com/typesafe/releases/"
 
 // Use the Play sbt plugin for Play projects
-addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.3.6")
+addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.3.10")
 
 // Dependency graph plugin
 addSbtPlugin("net.virtual-void" % "sbt-dependency-graph" % "0.7.4")
Add a comment
List