slachiewicz opened a new pull request, #898: URL: https://github.com/apache/maven-wagon/pull/898
`wagon-webdav-jackrabbit` speaks a very small subset of WebDAV. Its entire use of `jackrabbit-webdav` is three requests: 1. **MKCOL** — create a collection when deploying. 2. **PROPFIND `Depth: 0`** on `resourcetype` — is this a collection? (`isDirectory`) 3. **PROPFIND `Depth: 1`** — list a collection. (`getFileList`) The third is thinner than it looks: it nominally asks for `displayname` but never reads it, deriving every entry from the response `href`. `jackrabbit-webdav` models all of WebDAV — locking, observation, ordering, versioning, search, transactions. Three requests were pulling in a dependency whose scope far exceeds what is needed. This moves the requests and the multistatus parsing into the module, in Wagon's own package rather than squatting Jackrabbit's. ### Commits 1. **Remove the vendored copies of two Jackrabbit classes.** This module shipped `org/apache/jackrabbit/webdav/MultiStatus.class`, which also exists in `jackrabbit-webdav` — so which of the two won depended on classpath order. It was forked only to keep responses in document order, and Jackrabbit's own `MultiStatus` has since become a `LinkedHashMap`, so the fork no longer differs from the class it shadows. `XmlRequestEntity` is left over from Jackrabbit 2.14, which no longer ships or references it, and nothing in this module used it. This commit stands alone — the full suite passes with the dependency still in place. 2. **Replace the dependency** with `DavMethods` (99 lines) and `MultiStatus` (207 lines). ### Fidelity The parser preserves what the callers rely on: - Responses stay in **document order**, because `getFileList` expects the requested collection first, per [RFC 4918 §9.1](http://www.webdav.org/specs/rfc4918.html#rfc.section.9.1). - Hrefs are **deduplicated**, matching Jackrabbit's href-keyed map. - Only `propstat` elements reporting **200** are consulted for `resourcetype`. - Elements are matched on local name in the `DAV:` namespace, tolerating servers that use a default namespace or a different prefix. Two behaviour changes, both in the safe direction: a PROPFIND answering something other than `207 Multi-Status` is no longer parsed for a body, and an empty multistatus no longer raises `ArrayIndexOutOfBoundsException` from `isDirectory`. Since a multistatus body is remote input, the parser also refuses DOCTYPE declarations. ### Verification - **292 tests pass** — the 283 already here, including the integration tests that run against a real WebDAV server, plus 9 new `MultiStatusTest` cases. - The existing suite genuinely covers this code: changing the collection element name to a bogus string fails **10 tests** across both the integration and unit tests, so it is not passing vacuously. - The built jar now contains 7 classes, all under `org.apache.maven.wagon.providers.webdav`, and no longer places anything in the `org.apache.jackrabbit` namespace. ### Notes The `artifactId` keeps the `jackrabbit` name so consumers do not break, even though the dependency is gone. This also unblocks a future move to HttpClient 5. `jackrabbit-webdav` is on `httpclient 4.5.14` in every release including the latest 2.22.4 and 2.23.x-beta, so it pinned this module to HttpClient 4 regardless of version. What remains here is two base classes (`HttpRequestBase` / `HttpEntityEnclosingRequestBase`), which become `HttpUriRequestBase` in HttpClient 5. --- - [x] Your pull request should address just one issue, without pulling in other changes. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Each commit in the pull request should have a meaningful subject line and body. - [x] Write unit tests that match behavioral changes, where the tests fail if the changes to the runtime are not applied. - [x] Run `mvn verify` to make sure basic checks pass. - [x] I hereby declare this contribution to be licenced under the [Apache License Version 2.0, January 2004](http://www.apache.org/licenses/LICENSE-2.0) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
