summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.lfs.server/src/org
Commit message (Collapse)AuthorAgeFilesLines
* Merge branch 'stable-5.1' into stable-5.2Matthias Sohn2019-04-201-2/+45
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-5.1: Prepare 5.1.8-SNAPSHOT builds JGit v5.1.7.201904200442-r ObjectUploadListener: Add callback interface Prepare 4.11.9-SNAPSHOT builds JGit v4.11.8.201904181247-r Prepare 4.9.11-SNAPSHOT builds JGit v4.9.10.201904181027-r Prepare 4.7.10-SNAPSHOT builds JGit v4.7.9.201904161809-r Prepare 4.5.8-SNAPSHOT builds JGit v4.5.7.201904151645-r Remember the cause for invalidating a packfile Fix API problem filters Fix pack files scan when filesnapshot isn't modified Change-Id: I76761002eedf360e93d0559942ebc927a40428d6 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
| * ObjectUploadListener: Add callback interfaceDavid Pursehouse2019-04-201-2/+45
| | | | | | | | | | | | | | | | The callback interface is invoked after object upload was completed. Change-Id: I705d8becaf4f35188caf098aa75cff8963d64a60 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* | Remove unnecessary modifiers from interfacesJonathan Nieder2018-11-201-4/+4
| | | | | | | | | | | | | | This continues what commit d9ac7ddf1026123fee6c4477d172d614522dfc08 (Remove unnecessary modifiers from interfaces, 2018-11-15) started. Change-Id: I89720985a5a986722a0dcb9b5e9bbc25996bd5b3
* | Merge branch 'stable-5.1'David Pursehouse2018-10-201-1/+6
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-5.1: Prepare 5.1.4-SNAPSHOT builds JGit v5.1.3.201810200350-r Prepare 4.11.6-SNAPSHOT builds JGit v4.11.5.201810191925-r Prepare 4.9.8-SNAPSHOT builds JGit v4.9.7.201810191756-r Update API problem filter Prepare 4.7.7-SNAPSHOT builds JGit v4.7.6.201810191618-r Update API problem filter Fix file handle leak in ObjectDownloadListener.onWritePossible Replace Findbugs with Spotbugs in org.eclipse.jgit/pom.xml Replace FindBugs with SpotBugs Prepare 4.4.2-SNAPSHOT builds JGit v4.0.3.201509231615-r Change-Id: Ic8b2189fdd8403294327a17cc0c1f6a6e2f78cb8 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
| * Merge "Merge branch 'stable-4.11' into stable-5.0" into stable-5.1David Pursehouse2018-10-201-1/+6
| |\
| | * Merge branch 'stable-4.11' into stable-5.0Matthias Sohn2018-10-201-1/+6
| | |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-4.11: Prepare 4.11.6-SNAPSHOT builds JGit v4.11.5.201810191925-r Prepare 4.9.8-SNAPSHOT builds JGit v4.9.7.201810191756-r Update API problem filter Prepare 4.7.7-SNAPSHOT builds JGit v4.7.6.201810191618-r Update API problem filter Fix file handle leak in ObjectDownloadListener.onWritePossible Replace Findbugs with Spotbugs in org.eclipse.jgit/pom.xml Replace FindBugs with SpotBugs Prepare 4.4.2-SNAPSHOT builds JGit v4.0.3.201509231615-r Change-Id: I3ec3c9af49b11979a551a9749d5a8ba5ef2ef726 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
| | | * Merge branch 'stable-4.10' into stable-4.11Matthias Sohn2018-10-201-1/+6
| | | |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-4.10: Prepare 4.9.8-SNAPSHOT builds JGit v4.9.7.201810191756-r Update API problem filter Prepare 4.7.7-SNAPSHOT builds JGit v4.7.6.201810191618-r Update API problem filter Fix file handle leak in ObjectDownloadListener.onWritePossible Replace Findbugs with Spotbugs in org.eclipse.jgit/pom.xml Replace FindBugs with SpotBugs Prepare 4.4.2-SNAPSHOT builds JGit v4.0.3.201509231615-r Change-Id: I5698fde41417c4ce9e813c683c84978f303b76fe Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
| | | | * Merge branch 'stable-4.9' into stable-4.10Matthias Sohn2018-10-201-1/+6
| | | | |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-4.9: Prepare 4.9.8-SNAPSHOT builds JGit v4.9.7.201810191756-r Update API problem filter Prepare 4.7.7-SNAPSHOT builds JGit v4.7.6.201810191618-r Update API problem filter Fix file handle leak in ObjectDownloadListener.onWritePossible Replace Findbugs with Spotbugs in org.eclipse.jgit/pom.xml Replace FindBugs with SpotBugs Prepare 4.4.2-SNAPSHOT builds JGit v4.0.3.201509231615-r Change-Id: I6f07ea02491ba3a32f30ee2408e1153241cc8a07 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
| | | | | * Merge branch 'stable-4.8' into stable-4.9Matthias Sohn2018-10-191-1/+6
| | | | | |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-4.8: Prepare 4.7.7-SNAPSHOT builds JGit v4.7.6.201810191618-r Update API problem filter Fix file handle leak in ObjectDownloadListener.onWritePossible Replace Findbugs with Spotbugs in org.eclipse.jgit/pom.xml Replace FindBugs with SpotBugs Prepare 4.4.2-SNAPSHOT builds JGit v4.0.3.201509231615-r Change-Id: Ic18af2ddcba8f7a53eb27a33ea9f637adb941993 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
| | | | | | * Fix file handle leak in ObjectDownloadListener.onWritePossibleMatthias Sohn2018-10-131-1/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 5c134f4d removed closing the input stream when we reached end of the stream. This caused file handle leaks. Bug: 540049 Change-Id: I48082b537077c7471fc160f59aa04deb99687d9b Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* | | | | | | Format @Nullable on return value as method annotationJonathan Nieder2018-10-092-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For example, instead of using public @Nullable String getMyFavoriteString() { ... } use @Nullable public String getMyFavoriteString() { ... } This makes the style more consistent (the existing JGit code base tends to lean toward the second style) and makes the source code better reflect how the annotation is parsed, as a METHOD annotation. Longer term, we should switch to a TYPE_USE annotation and switch to the first style. Noticed using a style checker that follows https://google.github.io/styleguide/javaguide.html#s4.8.5-annotations Change-Id: I07f4e67cc149fb8007f696a4663e10d4bfc57e3a Reported-by: Ivan Frade <ifrade@google.com> Signed-off-by: Jonathan Nieder <jrn@google.com>
* | | | | | | Explicitly specify charset when calling getBytesDavid Pursehouse2018-09-261-1/+2
|/ / / / / / | | | | | | | | | | | | | | | | | | | | | | | | Change-Id: Ie492406005be56ccaf4dfb385ae376636404816d Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* | | | | | Merge branch 'stable-5.0' into stable-5.1David Pursehouse2018-09-261-0/+4
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-5.0: ObjectDownloadListener#onWritePossible: Add comment on return statement Change-Id: Ie7cb0c8a9775626cf2a2daae04b2d1f73a6c5af7 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
| * | | | | Merge branch 'stable-4.11' into stable-5.0David Pursehouse2018-09-261-0/+4
| |\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-4.11: ObjectDownloadListener#onWritePossible: Add comment on return statement Change-Id: Icacfa8dcd1ced32715fb772c336574318f28ddd1 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
| | * | | | Merge branch 'stable-4.10' into stable-4.11David Pursehouse2018-09-261-0/+4
| | |\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-4.10: ObjectDownloadListener#onWritePossible: Add comment on return statement Change-Id: I2ab21595531bcd487ce6a5cb0a3bc3c6f6f6e518 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
| | | * | | Merge branch 'stable-4.9' into stable-4.10David Pursehouse2018-09-261-0/+4
| | | |\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-4.9: ObjectDownloadListener#onWritePossible: Add comment on return statement Change-Id: I3dff04d2ea99e5b6331e45e3ea2ccc78fb2d5a02 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
| | | | * | Merge branch 'stable-4.8' into stable-4.9David Pursehouse2018-09-261-0/+4
| | | | |\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-4.8: ObjectDownloadListener#onWritePossible: Add comment on return statement Change-Id: Ie3de769209ec8477c97df5f90b8c63c03e023be0 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
| | | | | * ObjectDownloadListener#onWritePossible: Add comment on return statementDavid Ostrovsky2018-09-251-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It is not obvious why this return statement is needed. Clarify with a comment that otherwise endless loop may show up when recent versions of Jetty are used. Change-Id: I8e5d4de51869fb1179bf599bfb81bcd7d745874b Signed-off-by: David Ostrovsky <david@ostrovsky.org>
* | | | | | Merge branch 'stable-5.0' into stable-5.1David Pursehouse2018-09-183-13/+27
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-5.0: Fix ObjectUploadListener#close Fix error handling in FileLfsServlet ObjectDownloadListener#onWritePossible: Make code spec compatible ObjectDownloadListener: Return from onWritePossible when data is written Fix IOException when LockToken#close fails Change-Id: Ib7a63b5144a89c213aff3b32c30a2a6526355e64 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
| * | | | | Merge branch 'stable-4.11' into stable-5.0David Pursehouse2018-09-183-13/+27
| |\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-4.11: Fix ObjectUploadListener#close Fix error handling in FileLfsServlet ObjectDownloadListener#onWritePossible: Make code spec compatible ObjectDownloadListener: Return from onWritePossible when data is written Fix IOException when LockToken#close fails Change-Id: Iffe202a412b3bca1c8d8d7dc5dfd646c49838de9 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
| | * | | | Merge branch 'stable-4.10' into stable-4.11David Pursehouse2018-09-183-13/+27
| | |\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-4.10: Fix ObjectUploadListener#close Fix error handling in FileLfsServlet ObjectDownloadListener#onWritePossible: Make code spec compatible ObjectDownloadListener: Return from onWritePossible when data is written Fix IOException when LockToken#close fails Change-Id: I28ebf6138ccd9425fc05319de78c7716f0bdd199 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
| | | * | | Merge branch 'stable-4.9' into stable-4.10David Pursehouse2018-09-183-13/+27
| | | |\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-4.9: Fix ObjectUploadListener#close Fix error handling in FileLfsServlet ObjectDownloadListener#onWritePossible: Make code spec compatible ObjectDownloadListener: Return from onWritePossible when data is written Fix IOException when LockToken#close fails Change-Id: Ib7d01cb0ece8b259156855045a53b8baf3fa2968 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
| | | | * | Merge branch 'stable-4.8' into stable-4.9David Pursehouse2018-09-183-13/+27
| | | | |\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-4.8: Fix ObjectUploadListener#close Fix error handling in FileLfsServlet ObjectDownloadListener#onWritePossible: Make code spec compatible ObjectDownloadListener: Return from onWritePossible when data is written Fix IOException when LockToken#close fails Change-Id: Id8eb635094336567d9f3c28ec985cd5127d31632 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
| | | | | * Fix ObjectUploadListener#closeMatthias Sohn2018-09-181-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Do not try to set response status if response is already committed. Change-Id: I9a7c2871c86eb53416b905324775f3ed961c8ae6 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
| | | | | * Fix error handling in FileLfsServletMatthias Sohn2018-09-171-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Check in #sendError method if the response was committed already. If yes we cannot set response status or send an error message, last resort is to close the outputstream. If the response wasn't yet committed first reset the response before using writer to send the error message to the client since mixing STREAM and WRITE mode (mixing asynchronous and blocking I/O) is illegal in servlet 3.1. see the following bugs in the gerrit and jetty issue trackers https://bugs.chromium.org/p/gerrit/issues/detail?id=9667 https://bugs.chromium.org/p/gerrit/issues/detail?id=9721 https://github.com/eclipse/jetty.project/issues/2911 Change-Id: Ie35563c2e0ac1c5e918185a746622589a880dc7f Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
| | | | | * ObjectDownloadListener#onWritePossible: Make code spec compatibleDavid Ostrovsky2018-09-171-13/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Current code violates the ServletOutputStream contract. For every out.isReady() == true either write or close of that ServletOutputStream should be called. See also this issue upstream for more context: [1]. [1] https://github.com/eclipse/jetty.project/issues/2911 Change-Id: Ied575f3603a6be0d2dafc6c3329d685fc212c7a3 Signed-off-by: David Ostrovsky <david@ostrovsky.org> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
| | | | | * ObjectDownloadListener: Return from onWritePossible when data is writtenDavid Ostrovsky2018-09-151-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When buffer was written not only call AsyncContext#complete() but also return from the ObjectDownloadListener#onWritePossible(). This avoids endless loop after upgrading from Jetty 9.3.x to 9.4.x lines. In Jetty example implementation:[1] the return statemnt is also used: // If we are at EOF then complete   if (len < 0)   {    async.complete();     return;   } See also this issue upstream: [2]. [1] https://webtide.com/servlet-3-1-async-io-and-jetty [2] https://github.com/eclipse/jetty.project/issues/2911 Change-Id: Iac73fb25e67d40228a378a8e34103f1d28b72a76 Signed-off-by: David Ostrovsky <david@ostrovsky.org>
| | | | * | FileLfsServlet: Do not pretty print json responseDavid Pursehouse2017-12-081-5/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Pretty printing the response is useful for human readers, but most (if not all) of the time, the response will be read by programs. Remove it to avoid the additional overhead of the formatting and extra bytes in the response. Adjust the test accordingly. Note that LfsProtocolServlet already doesn't use pretty printing, so this change makes FileLfsServlet's behavior consistent. In fact, both classes now have duplicate Gson handling; this will be cleaned up in a separate change. Change-Id: I113a23403f9222f16e2c0ddf39461398b721d064 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* | | | | | Deprecate Constants.CHARSET in favor of StandardCharsets.UTF_8David Pursehouse2018-09-042-7/+7
|/ / / / / | | | | | | | | | | | | | | | | | | | | Change-Id: I3b748620f067582afef20f144feebe40d0332be2 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* | | | | Remove 'final' in parameter listsHan-Wen Nienhuys2018-05-151-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | Change-Id: Id924f79c8b2c720297ebc49bf9c5d4ddd6d52547 Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
* | | | | Consistently use Constants.CHARSET rather than StandardCharsets.UTF_8David Pursehouse2018-03-112-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | | Change-Id: I6714fc3666e1bced22abba94ceb700477349586e Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* | | | | Remove deprecated LfsProtocolServlet#getLargeFileRepositoryMatthias Sohn2018-03-101-42/+0
|/ / / / | | | | | | | | | | | | | | | | | | | | | | | | Use LfsProtocolServlet##getLargeFileRepository(LfsRequest, String, String) instead. Change-Id: If68d06f2e6edbf843dc9d3b4e3b99c33b0fab766 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* | | | FileLfsServlet: Open PrintWriter in try-with-resourceDavid Pursehouse2018-03-061-4/+4
| | | | | | | | | | | | | | | | | | | | Change-Id: I6fa225e541c6d5c3dbf3d852a502f4e9c4f7d77e Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* | | | LFS: Add remote download to SmudgeFilterMarkus Duft2018-02-161-1/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Transfer data in chunks of 8k Transferring data byte per byte is slow, running checkout with CleanFilter on a 2.9MB file takes 20 seconds. Using a buffer of 8k shrinks this time to 70ms. Also register the filter commands in a way that the native GIT LFS can be used alongside with JGit. Implements auto-discovery of LFS server URL when cloning from a Gerrit LFS server. Change-Id: I452a5aa177dcb346d92af08b27c2e35200f246fd Also-by: Christian Halstrick <christian.halstrick@sap.com> Signed-off-by: Markus Duft <markus.duft@ssi-schaefer.com>
* | | | Revert usage of TYPE_USE in Nullable and NonNull annotationsDavid Pursehouse2018-01-191-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Using TYPE_USE causes compilation errors in Eclipse Neon.3 (JDT 3.12.3) and Eclipse Oxygen.2 (JDT 3.13.2). This reverts commit 8e217517e2c515032dd0d661535d2133cd80123a. This reverts commit 55eba8d0f55464ca84d676828f67a6fe14b2454d. Reported-by: Thomas Wolf <thomas.wolf@paranor.ch> Change-Id: I96869f80dd11ee238911706581b224bca4fb12cd Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* | | | Nullable: Switch to TYPE_USEDavid Pursehouse2018-01-181-1/+1
|/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since JGit now requires Java 8, we can switch to TYPE_USE instead of explicitly specifying the target type. Some of the existing uses of Nullable need to be reworked slightly as described in [1] to prevent the compilation error: scoping construct cannot be annotated with type-use annotation [1] https://stackoverflow.com/a/21385939/381622 Change-Id: Idba48f67a09353b5237685996ce828c8ca398168 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* | | Fix remaining javadoc errors raised by doclintMatthias Sohn2017-12-211-4/+3
| | | | | | | | | | | | | | | | | | | | | For now ignore doclint "missing" warnings. Change-Id: I0e5af7a757f4d92ffeeb113f30576a35414d6781 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* | | Fix javadoc in org.eclipse.jgit.lfs.serverMatthias Sohn2017-12-1711-66/+98
| | | | | | | | | | | | Change-Id: I0c52536ebeeb8e71d95c6420f6db7055ff082dfa Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* | | Use constants from StandardCharsets instead of hard-coded stringsDavid Pursehouse2017-12-071-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Instead of hard-coding the charset strings "US-ASCII", "UTF-8", and "ISO-8859-1", use the corresponding constants from StandardCharsets. UnsupportedEncodingException is not thrown when the StandardCharset constants are used, so remove the now redundant handling. Because the encoding names are no longer hard-coded strings, also remove redundant $NON-NLS warning suppressions. Also replace existing usages of the constants with static imports. Change-Id: I0a4510d3d992db5e277f009a41434276f95bda4e Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* | | Move repeated LFS Gson handling to common classDavid Pursehouse2017-12-073-46/+123
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | LfsProtocolServlet and FileLfsServlet both implement the same setup of the Gson object. Factor it out to a common class and reuse it. Change-Id: I5696404fad140cbff1b712ebb04a7e8bba60e4b4 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* | | FileLfsServlet: Do not pretty print json responseDavid Pursehouse2017-12-071-5/+4
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Pretty printing the response is useful for human readers, but most (if not all) of the time, the response will be read by programs. Remove it to avoid the additional overhead of the formatting and extra bytes in the response. Adjust the test accordingly. Note that LfsProtocolServlet already doesn't use pretty printing, so this change makes FileLfsServlet's behavior consistent. In fact, both classes now have duplicate Gson handling; this will be cleaned up in a separate change. Change-Id: I113a23403f9222f16e2c0ddf39461398b721d064 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* / Add missing newlines at ends of Java filesDavid Pursehouse2017-07-251-1/+1
|/ | | | | Change-Id: Iead36f53d57ead0eb3edd3f9efb63b6630c9c20c Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* LfsProtocolServlet: Pass HTTP Authorization header to getLargeFileRepositoryDavid Pursehouse2017-03-081-2/+49
| | | | | | | | This allows implementations to reject operations that do not include proper authentication. Change-Id: If301476d8fb56a0899e424be3789c7576097d185 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* Enable and fix warnings about redundant specification of type argumentsDavid Pursehouse2017-02-202-8/+8
| | | | | | | | | | Since the introduction of generic type parameter inference in Java 7, it's not necessary to explicitly specify the type of generic parameters. Enable the warning in Eclipse, and fix all occurrences. Change-Id: I9158caf1beca5e4980b6240ac401f3868520aad0 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* Don't rely on default locale when using toUpperCase() and toLowerCase()Matthias Sohn2017-01-281-2/+4
| | | | | | | | | | | | | | | | Otherwise these methods may produce unexpected results if used for strings that are intended to be interpreted locale independently. Examples are programming language identifiers, protocol keys, and HTML tags. For instance, "TITLE".toLowerCase() in a Turkish locale returns "t\u0131tle", where '\u0131' is the LATIN SMALL LETTER DOTLESS I character. See https://docs.oracle.com/javase/8/docs/api/java/lang/String.html#toLowerCase-- http://blog.thetaphi.de/2012/07/default-locales-default-charsets-and.html Bug: 511238 Change-Id: Id8d8f37d84d62239c918b81f8d883ed798d87656 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Make ObjectDownloadListener publicDavid Pursehouse2017-01-191-2/+4
| | | | | | | The same was already done for ObjectUploadListener in I5b0fb1220. Change-Id: Ie8a79f715fe69bed9331962fb478f7e35acf8680 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* LfsProtocolServlet#LfsRequest: Add operation type helper methodsDavid Pursehouse2017-01-141-0/+27
| | | | | | | | Server implementations may need to check what type of operation is being performed. Add helper methods to make it a bit simpler. Change-Id: Ia33ed6699ebcb9000ef514ce79bcddbebf94e1c5 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* Expose LFS operation strings as public constantsDavid Pursehouse2017-01-131-7/+6
| | | | | | | | So that they can be used either by third party LFS server implementations or from within other parts of JGit's internal LFS implementation. Change-Id: I58da6230247204588e017c010ce5b14e4615448d Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* LfsProtocolServlet: Improve error on getLargeFileRepository failureDavid Pursehouse2017-01-141-1/+10
| | | | | | | | Externalize the error message and make it more specific. Also emit an error log. Change-Id: Ie7b1c90c54673bfb8e133fb0aa19a117d4ca6587 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Add support for refusing LFS request due to invalid authorizationDavid Pursehouse2017-01-131-0/+4
| | | | | | | | | | | | | | | | | | | Add a new exception type that server implementations can throw when a client attempts to make an unauthorized LFS operation, which will result in HTTP 401 Unauthorized being returned to the client. An example of this is a Gerrit server that rejects a request to perform an LFS operation on a ref that is not visible to the caller. As defined in the LFS spec [1] the request may include authentication, and per RFC 2616 [2], "401 response indicates that authorization has been refused for those credentials". [1] https://github.com/git-lfs/git-lfs/blob/master/docs/api/batch.md [2] https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html Change-Id: I2aa22e2144df5fb7972df0e3285b77b08ecc63f2 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>