Hello, 

TL;DR: 
looks like there is an ignored exception that occurs when the test factory 
CustomClassLoaderObjectFactory tries to load a not existing resource. 

Test files 'test1' and 'test2' that are not processed by Maven (branch 1.x has 
a not-maven-default directory structure). This way, no new objects are 
created/added to the pool and the test fails.

---

FWIU, in TestGenericObjectPoolClassLoaders.java the testContextClassLoader() 
test method creates custom class loaders (CustomClassLoader) and custom class 
loader object factories (CustomClassLoaderObjectFactory).

These factories are created with a number and the makeObject() method returns 
an URL to a resource "test" + n.

In the test package, there are two files, test1 and test2 that were supposed to 
be used in the test. However, it looks like during test execution these files 
are not included by Maven (probably because the 1.x branch has a custom 
directory structure).

Thus, the CustomClassLoaderObjectFactory#makeObject() method returns null. When 
the GenericObjectPool tries to create a new object (using that factory) an 
exception is raised, but ignored (see GenericObjectPool, line 1801). And in the 
end no new objects are added to the pool and the test fails.

I think we could fix it by changing the pom.xml to include these two files or 
by dropping these files and creating some other dummy URL for tests. Here's a 
patch that worked for me [1] (sorry, going to a meeting and couldn't attach a 
decent patch right now). 

Just my 0.02 cents, hope that helps.

Apache Maven 3.0.5 (r01de14724cdef164cd33c7c8c2fe155faf9602da; 2013-02-19 
10:51:28-0300)
Maven home: /opt/java/apache-maven-3.0.5
Java version: 1.6.0_43, vendor: Sun Microsystems Inc.
Java home: /opt/java/jdk1.6.0_43/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "3.8.0-21-generic", arch: "amd64", family: "unix"

Cheers, Bruno

[1] https://gist.github.com/kinow/5600147

Bruno P. Kinoshita
http://kinoshita.eti.br
http://tupilabs.com


--- Em sex, 17/5/13, Mark Thomas <ma...@apache.org> escreveu:

> De: Mark Thomas <ma...@apache.org>
> Assunto: Re: [pool] 1.x and TestGenericObjectPoolClassLoaders
> Para: "Commons Developers List" <dev@commons.apache.org>
> Data: Sexta-feira, 17 de Maio de 2013, 10:03
> On 17/05/2013 13:51, Gary Gregory
> wrote:
> > On Thu, May 16, 2013 at 6:30 PM, Mark Thomas <ma...@apache.org>
> wrote:
> > 
> >> On 16/05/2013 20:58, Gary Gregory wrote:
> >>> TestGenericObjectPoolClassLoaders (1)
> >>>
> org.apache.commons.pool.impl.TestGenericObjectPoolClassLoaders
> >>>
> >>
> testContextClassLoader(org.apache.commons.pool.impl.TestGenericObjectPoolClassLoaders)
> >>> junit.framework.AssertionFailedError: Wrong
> number of idle objects in
> >> pool1
> >>> expected:<1> but was:<0>
> >>
> >> <snip/>
> >>
> >>>     at
> >>
> org.apache.commons.pool.impl.TestGenericObjectPoolClassLoaders.testContextClassLoader(TestGenericObjectPoolClassLoaders.java:46)
> >>
> >> <snip/>
> >>
> >> Looking at line 46 of the test, it is possible that
> it could fail
> >> depending on the execution timing. Maybe try
> increasing the Thread.sleep()
> >> ?
> >>
> > 
> > I am glad it works on your end.
> > 
> > It fails no matter what I change the numbers to, for
> example:
> 
> OK. That makes a timing issue unlikely.
> 
> > 
> >         
>    pool1.setTimeBetweenEvictionRunsMillis(20);
> >         
>    Thread.sleep(5000);
> > 
> > or:
> > 
> >         
>    pool1.setTimeBetweenEvictionRunsMillis(1000);
> >         
>    Thread.sleep(5000);
> > 
> > arg :(
> > 
> > I makes it hard to cut an RC!
> 
> Indeed.
> 
> I'd suggest it is time to step through that test case with
> the debugger
> in Eclipse and figure out why the object isn't being
> created.
> 
> Mark
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
> For additional commands, e-mail: dev-h...@commons.apache.org
> 
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org

Reply via email to