tomee-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jonathan Gallimore (Jira)" <>
Subject [jira] [Commented] (TOMEE-2756) Typo in the DeploymentsResolver causes excluding all URLs
Date Wed, 18 Dec 2019 13:08:00 GMT


Jonathan Gallimore commented on TOMEE-2756:

I added this test to DeploymentsResolverTest:


 public void testSearch() throws Exception {
  System.setProperty(DeploymentFilterable.CLASSPATH_EXCLUDE, ".*fakeJar.*");
  final File base = File.createTempFile("fakeJar", "test");
  File jarMetaInf = new File(base, "META-INF");
  File ejbJar = new File(jarMetaInf, "ejb-jar.xml");

  final PrintWriter pw = new PrintWriter(new OutputStreamWriter(new FileOutputStream(ejbJar)));

  final URLClassLoader cl = new URLClassLoader(new URL[]{
  new File("target/test-classes").toURI().toURL()});

  final ConfigurationFactory factory = new ConfigurationFactory();
  final ArrayList<File> classpathModules = factory.getModulesFromClassPath(new ArrayList<File>(),
  Assert.assertTrue(classpathModules.size() > 0);


This passes with your change, but fails without it. The thing here is, this is checking that
my fakeJar is deployed (which it is), but I have set an exclusion at the top to prevent that.
So the change means that we potentially deploy something that we explicitly shouldn't. Your
module should be being picked up on DeploymentResolver, line 257: [],
and we need to understand why it isn't. 

Whilst I'm inclined to agree that what you've pointed out looks like a typo, I don't want
to make the change yet until we understand what's going on. I'm definitely expecting some
stuff to break as a result.


> Typo in the DeploymentsResolver causes excluding all URLs
> ---------------------------------------------------------
>                 Key: TOMEE-2756
>                 URL:
>             Project: TomEE
>          Issue Type: Bug
>          Components: TomEE Core Server
>    Affects Versions: 7.0.5
>         Environment: Ubuntu 18.04, Embedded TomEE 7.0.5
>            Reporter: RomanKa
>            Priority: Major
>   Original Estimate: 0.25h
>  Remaining Estimate: 0.25h
> In the project: openejb-core
>  Is in the package: org.apache.openejb.config
>  Class: DeploymentsResolver
>  Method: loadFromClasspath
>  Line: 264
> There is typo there from refactoring done 5 years ago, which prevent us from upgrading.
> Current code:
> {code:java}
> UrlSet unchecked = new UrlSet();            if (!searchResult.filterDescriptors) {
>                 unchecked = NewLoaderLogic.applyBuiltinExcludes(searchResult.prefiltered.exclude(searchResult.prefiltered));
>                 if (searchResult.filterSystemApps) {
>                     unchecked = unchecked.exclude(".*/openejb-[^/]+(.(jar|ear|war)(./)?|/target/classes/?)");
>                 }
>                 processUrls("DeploymentsResolver2", unchecked.getUrls(), classLoader,
EnumSet.allOf(RequireDescriptors.class), jarList);
>             } {code}
> In the exclude should be urlSet instead of prefiltered, otherwice all URL are excluded:
> {code:java}
> unchecked = NewLoaderLogic.applyBuiltinExcludes(searchResult.prefiltered.exclude(searchResult.urlSet));
> {code}

This message was sent by Atlassian Jira

View raw message