commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gregg, John E." <>
Subject commons-id Using ClassLoader.getSystemResourceAsStream()
Date Thu, 21 Oct 2004 16:58:51 GMT
Hi all,
I'm having a little trouble with the fact that commons-id's
ReadOnlyResourceStateImpl uses ClassLoader.getSystemResourceAsStream to load
the config file containing MAC addresses.  Is that intentional?  When I'm
testing my app with Maven, the only thing in the system class loader's path
is Maven's forehead jar.  Perhaps I can/should change that, but it causes my
test to fail because my config file isn't found.  If I use
this.getClass().getResourceAsStream(), things are fine.  I can understand
why the system class loader is used, however, for that particular file--
because it's based on where the app is deployed and therefore is not
portable, like the rest of the app is.  If you think it should change to use
the app's class loader, I'll submit a patch.  If you think it should stay
the way it is, I might consider refactoring the load() method to use
inversion of control so I can better test with mock objects and not worry
about environmental concerns.  If I do that I'll submit a patch.

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message