Skip to content

Commit

Permalink
PAYARA-1765 Distributable web.xml handling broken for WEB-INF/lib arc…
Browse files Browse the repository at this point in the history
…hive (#1692)

* application is still considered distributable when archives don't have web-fragment.xml are present.
fixes #1689

* copyright fix

* fixed failing test
  • Loading branch information
lprimak authored Jun 20, 2017
1 parent 7cd7c7c commit 39503f8
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
* only if the new code is made subject to such option by the copyright
* holder.
*/
// Portions Copyright [2014-2016] [Payara Foundation and/or its affiliates]
// Portions Copyright [2014-2017] [Payara Foundation and/or its affiliates]

package org.glassfish.web.deployment.archivist;

Expand Down Expand Up @@ -343,17 +343,18 @@ protected void postAnnotationProcess(WebBundleDescriptorImpl descriptor,
}
}

WebFragmentDescriptor mergedWebFragment = null;
WebFragmentDescriptor mergedWebFragment = new WebFragmentDescriptor();
mergedWebFragment.setExists(false);
for (WebFragmentDescriptor wf : wfList) {
if (mergedWebFragment == null) {
mergedWebFragment = wf;
} else {
mergedWebFragment.addWebBundleDescriptor(wf);
// we have the first fragment that's contains the web-fragment.xml file
if(!mergedWebFragment.isExists() && wf.isExists()) {
mergedWebFragment.setExists(true);
mergedWebFragment.setDistributable(wf.isDistributable());
}
mergedWebFragment.addWebBundleDescriptor(wf);
}

if (mergedWebFragment != null) {
mergedWebFragment.setExists(true);
if (!wfList.isEmpty()) {
descriptor.addWebBundleDescriptor(mergedWebFragment);

// if there any mapping stubs left, there is something invalid referenced from web.xml
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
* only if the new code is made subject to such option by the copyright
* holder.
*/
// Portions Copyright [2014-2016] [Payara Foundation and/or its affiliates]
// Portions Copyright [2014-2017] [Payara Foundation and/or its affiliates]

package org.glassfish.web.deployment.descriptor;

Expand Down Expand Up @@ -262,14 +262,13 @@ private void addCommonWebBundleDescriptor(WebBundleDescriptor wbd,
// combine login config with conflict resolution check
combineLoginConfiguration(webBundleDescriptor);

if (!defaultDescriptor) {
if (webBundleDescriptor.isExists()) {
boolean otherDistributable = webBundleDescriptor.isDistributable();
// the only way distributable is true is when
// all of it's web fragments are true
// The Servlet spec (section 8.2.3):
setDistributable(distributable && otherDistributable);
}
if (!defaultDescriptor && webBundleDescriptor.isExists()) {
// ignore non-fragment (plain archive) files
boolean otherDistributable = webBundleDescriptor.isDistributable();
// the only way distributable is true is when
// all of it's web fragments are true
// The Servlet spec (section 8.2.3):
setDistributable(distributable && otherDistributable);
}

combinePostConstructDescriptors(webBundleDescriptor);
Expand Down

0 comments on commit 39503f8

Please sign in to comment.