summaryrefslogtreecommitdiffstats
path: root/src/main/java/com/gitblit/wicket/pages/EditFilePage.java
diff options
context:
space:
mode:
authorTom <tw201207@gmail.com>2016-10-26 22:49:56 +0200
committerFlorian Zschocke <2362065+flaix@users.noreply.github.com>2021-11-03 20:37:06 +0100
commit560f2e3ab0f78429fe22dc23ae25de6a7500cf02 (patch)
tree9890982332b540c86009c04a13c9729ba1f56cdb /src/main/java/com/gitblit/wicket/pages/EditFilePage.java
parentedd1e6759ce72e36776ebb2dcd5c6529a5bf079a (diff)
downloadgitblit-560f2e3ab0f78429fe22dc23ae25de6a7500cf02.tar.gz
gitblit-560f2e3ab0f78429fe22dc23ae25de6a7500cf02.zip
Issue #1011: do not serialize JGit commit objects
JGit commit objects are a recursive data structure; they have links to their parent commits. Serializing a JGit commit will try to recursively serialize all reachable ancestors as faras they have been loaded. If that ancestor chain is too long, a StackOverflowError is thrown during Wicket's page serialization if a page has a reference to sucha JGit commit. Fixed by making sure that pages o not contain references to JGit commits. Use the (existing) wrapper object RepositoryCommit instead. * RepositoryCommit has a transient reference to the JGit commit and reads the commit from the repository upon de-serialization. * RefModel is a similar case (JGit tags/branches may also have links to the commits they point to). Solved a bit differently by making it a pure data object by transferring the interesting data from the JGit object in the constructor. * Change DataViews instantiated with RevCommit to use RepositoryCommit instead. * Change inner anonymous DataViews to ensure they do not have a synthesized field referencing the "allRefs" map. Such a synthesized field would also get serialized, and then serialize JGit commits again. Finally, remove non-transient logger instances in Wicket classes. Those might lead to NotSerializableException. These StackOverflowErrors have been reported in several places since 2014: * https://groups.google.com/forum/#!topic/gitblit/GH1d8WSlR6Q * https://bugs.chromium.org/p/gerrit/issues/detail?id=3316 * https://groups.google.com/d/msg/repo-discuss/Kcl0JIGNiGk/0DjH4mO8hA8J * https://groups.google.com/d/msg/repo-discuss/0_P6A3fjTec/2kcpVPIUAQAJ * https://github.com/gitblit/gitblit/issues/1011 * https://github.com/tomaswolf/gerrit-gitblit-plugin/issues/21
Diffstat (limited to 'src/main/java/com/gitblit/wicket/pages/EditFilePage.java')
-rw-r--r--src/main/java/com/gitblit/wicket/pages/EditFilePage.java2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/main/java/com/gitblit/wicket/pages/EditFilePage.java b/src/main/java/com/gitblit/wicket/pages/EditFilePage.java
index dbf8a79e..5ec9b6ee 100644
--- a/src/main/java/com/gitblit/wicket/pages/EditFilePage.java
+++ b/src/main/java/com/gitblit/wicket/pages/EditFilePage.java
@@ -123,7 +123,7 @@ public class EditFilePage extends RepositoryPage {
try {
ObjectId docAtLoad = getRepository().resolve(commitIdAtLoad.getObject());
- logger.trace("Commiting Edit File page: " + commitIdAtLoad.getObject());
+ logger().trace("Commiting Edit File page: " + commitIdAtLoad.getObject());
DirCache index = DirCache.newInCore();
DirCacheBuilder builder = index.builder();