[JBoss JIRA] Commented: (SHRINKWRAP-237) ShrinkWrap ClassLoader Caches the read Assets Inputstream
by Aslak Knutsen (JIRA)
[ https://jira.jboss.org/browse/SHRINKWRAP-237?page=com.atlassian.jira.plug... ]
Aslak Knutsen commented on SHRINKWRAP-237:
------------------------------------------
No I'm just stating where in the code the issues is and what needs to be done to fix it..
I'm not sure what your getting at in your example tho, a InputStream is a one time operation, you can't reset it. So reading it twice will normally fail.
I can counter your argument for Descriptors with; why are we closing resources we don't create/control. Give us a File or a String, we create the InputSream and we clean up. Give us a InputStream, your in charge of cleaning up. We don't know what type of inputstream etc we're getting, closing it might not be the desired behavior.
> ShrinkWrap ClassLoader Caches the read Assets Inputstream
> ---------------------------------------------------------
>
> Key: SHRINKWRAP-237
> URL: https://jira.jboss.org/browse/SHRINKWRAP-237
> Project: ShrinkWrap
> Issue Type: Bug
> Affects Versions: 1.0.0-alpha-11
> Environment: Weld 1.1.0.Beta1, Arqullian Alpha4, Seam XML Alpha3
> Reporter: Lincoln Baxter III
>
> http://pastebin.com/3neHZ6BL
> This can be reproduced using Weld 1.1.0.Beta1, Seam XML Alpha3 and Arqullian Alpha4- create a test that attempts to add a Manifest Resources from disk to Beans.xml.
> Seam XML will attempt to load the beans file and complain that the InputStream was closed.
> @RunWith(Arquillian.class)
> public class DefaultTimeZoneTest
> {
> @Deployment
> public static JavaArchive createTestArchive()
> {
> return ShrinkWrap.create(JavaArchive.class, "test.jar")
> .addClass(DefaultTimeZoneProducer.class)
> .addClass(DefaultTimeZoneConfig.class)
> .addManifestResource("org/jboss/seam/international/test/timezone/user-timezone.xml", ArchivePaths.create("beans.xml"));
> }
> @Inject
> DateTimeZone timeZone;
> @Test
> public void testDefaultTimeZoneProducerDirect()
> {
> Assert.assertNotNull(timeZone);
> }
> }
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
13 years, 6 months
[JBoss JIRA] Issue Comment Edited: (SHRINKWRAP-237) ShrinkWrap ClassLoader Caches the read Assets Inputstream
by Dan Allen (JIRA)
[ https://jira.jboss.org/browse/SHRINKWRAP-237?page=com.atlassian.jira.plug... ]
Dan Allen edited comment on SHRINKWRAP-237 at 10/26/10 3:45 PM:
----------------------------------------------------------------
Aslak, I'm not sure what you are getting at. Are you saying this is not an issue? I ran into the same problem testing the descriptors project. If I try to read in a descriptor two times in a row, even if I close the stream, the second time I get an EOF. We can't assume that developers will only ever read a resource once.
I'll clarify my use case with an example. If I do this operation twice, the second time will fail.
InputStream is = getResourceAsStream(name);
if (is != null)
{
try
{
return Descriptors.importAs(descriptorType).from(is);
}
finally
{
try
{
is.close();
}
catch (IOException e)
{
// Nothing we can do about this
}
}
}
was (Author: dan.j.allen):
Aslak, I'm not sure what you are getting at. Are you saying this is not an issue? I ran into the same problem testing the descriptors project. If I try to read in a descriptor two times in a row, even if I close the stream, the second time I get an EOF. We can't assume that developers will only ever read a resource once.
I'll clarify my use case with an example. If I do this operation twice, the second time will fail.
InputStream is = getResourceAsStream(name);
if (is != null)
{
try
{
return Descriptors.importAs(descriptorType).from(is);
}
finally
{
// NOTE the import process should really be closing the stream
try
{
is.close();
}
catch (IOException e)
{
// Nothing we can do about this
}
}
}
> ShrinkWrap ClassLoader Caches the read Assets Inputstream
> ---------------------------------------------------------
>
> Key: SHRINKWRAP-237
> URL: https://jira.jboss.org/browse/SHRINKWRAP-237
> Project: ShrinkWrap
> Issue Type: Bug
> Affects Versions: 1.0.0-alpha-11
> Environment: Weld 1.1.0.Beta1, Arqullian Alpha4, Seam XML Alpha3
> Reporter: Lincoln Baxter III
>
> http://pastebin.com/3neHZ6BL
> This can be reproduced using Weld 1.1.0.Beta1, Seam XML Alpha3 and Arqullian Alpha4- create a test that attempts to add a Manifest Resources from disk to Beans.xml.
> Seam XML will attempt to load the beans file and complain that the InputStream was closed.
> @RunWith(Arquillian.class)
> public class DefaultTimeZoneTest
> {
> @Deployment
> public static JavaArchive createTestArchive()
> {
> return ShrinkWrap.create(JavaArchive.class, "test.jar")
> .addClass(DefaultTimeZoneProducer.class)
> .addClass(DefaultTimeZoneConfig.class)
> .addManifestResource("org/jboss/seam/international/test/timezone/user-timezone.xml", ArchivePaths.create("beans.xml"));
> }
> @Inject
> DateTimeZone timeZone;
> @Test
> public void testDefaultTimeZoneProducerDirect()
> {
> Assert.assertNotNull(timeZone);
> }
> }
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
13 years, 6 months
[JBoss JIRA] Commented: (SHRINKWRAP-237) ShrinkWrap ClassLoader Caches the read Assets Inputstream
by Dan Allen (JIRA)
[ https://jira.jboss.org/browse/SHRINKWRAP-237?page=com.atlassian.jira.plug... ]
Dan Allen commented on SHRINKWRAP-237:
--------------------------------------
Aslak, I'm not sure what you are getting at. Are you saying this is not an issue? I ran into the same problem testing the descriptors project. If I try to read in a descriptor two times in a row, even if I close the stream, the second time I get an EOF. We can't assume that developers will only ever read a resource once.
I'll clarify my use case with an example. If I do this operation twice, the second time will fail.
InputStream is = getResourceAsStream(name);
if (is != null)
{
try
{
return Descriptors.importAs(descriptorType).from(is);
}
finally
{
// NOTE the import process should really be closing the stream
try
{
is.close();
}
catch (IOException e)
{
// Nothing we can do about this
}
}
}
> ShrinkWrap ClassLoader Caches the read Assets Inputstream
> ---------------------------------------------------------
>
> Key: SHRINKWRAP-237
> URL: https://jira.jboss.org/browse/SHRINKWRAP-237
> Project: ShrinkWrap
> Issue Type: Bug
> Affects Versions: 1.0.0-alpha-11
> Environment: Weld 1.1.0.Beta1, Arqullian Alpha4, Seam XML Alpha3
> Reporter: Lincoln Baxter III
>
> http://pastebin.com/3neHZ6BL
> This can be reproduced using Weld 1.1.0.Beta1, Seam XML Alpha3 and Arqullian Alpha4- create a test that attempts to add a Manifest Resources from disk to Beans.xml.
> Seam XML will attempt to load the beans file and complain that the InputStream was closed.
> @RunWith(Arquillian.class)
> public class DefaultTimeZoneTest
> {
> @Deployment
> public static JavaArchive createTestArchive()
> {
> return ShrinkWrap.create(JavaArchive.class, "test.jar")
> .addClass(DefaultTimeZoneProducer.class)
> .addClass(DefaultTimeZoneConfig.class)
> .addManifestResource("org/jboss/seam/international/test/timezone/user-timezone.xml", ArchivePaths.create("beans.xml"));
> }
> @Inject
> DateTimeZone timeZone;
> @Test
> public void testDefaultTimeZoneProducerDirect()
> {
> Assert.assertNotNull(timeZone);
> }
> }
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
13 years, 6 months
[JBoss JIRA] Updated: (SHRINKWRAP-237) ShrinkWrap ClassLoader Caches the read Assets Inputstream
by Aslak Knutsen (JIRA)
[ https://jira.jboss.org/browse/SHRINKWRAP-237?page=com.atlassian.jira.plug... ]
Aslak Knutsen updated SHRINKWRAP-237:
-------------------------------------
Summary: ShrinkWrap ClassLoader Caches the read Assets Inputstream (was: ShrinkWrap ClassLoader closes the InputStream for added resources, resulting in unreadable/closed stream errors when combined with Seam XML in test cases.)
> ShrinkWrap ClassLoader Caches the read Assets Inputstream
> ---------------------------------------------------------
>
> Key: SHRINKWRAP-237
> URL: https://jira.jboss.org/browse/SHRINKWRAP-237
> Project: ShrinkWrap
> Issue Type: Bug
> Affects Versions: 1.0.0-alpha-11
> Environment: Weld 1.1.0.Beta1, Arqullian Alpha4, Seam XML Alpha3
> Reporter: Lincoln Baxter III
>
> http://pastebin.com/3neHZ6BL
> This can be reproduced using Weld 1.1.0.Beta1, Seam XML Alpha3 and Arqullian Alpha4- create a test that attempts to add a Manifest Resources from disk to Beans.xml.
> Seam XML will attempt to load the beans file and complain that the InputStream was closed.
> @RunWith(Arquillian.class)
> public class DefaultTimeZoneTest
> {
> @Deployment
> public static JavaArchive createTestArchive()
> {
> return ShrinkWrap.create(JavaArchive.class, "test.jar")
> .addClass(DefaultTimeZoneProducer.class)
> .addClass(DefaultTimeZoneConfig.class)
> .addManifestResource("org/jboss/seam/international/test/timezone/user-timezone.xml", ArchivePaths.create("beans.xml"));
> }
> @Inject
> DateTimeZone timeZone;
> @Test
> public void testDefaultTimeZoneProducerDirect()
> {
> Assert.assertNotNull(timeZone);
> }
> }
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
13 years, 6 months
[JBoss JIRA] Moved: (SHRINKWRAP-237) ShrinkWrap ClassLoader closes the InputStream for added resources, resulting in unreadable/closed stream errors when combined with Seam XML in test cases.
by Aslak Knutsen (JIRA)
[ https://jira.jboss.org/browse/SHRINKWRAP-237?page=com.atlassian.jira.plug... ]
Aslak Knutsen moved ARQ-324 to SHRINKWRAP-237:
----------------------------------------------
Project: ShrinkWrap (was: Arquillian)
Key: SHRINKWRAP-237 (was: ARQ-324)
Affects Version/s: 1.0.0-alpha-11
(was: 1.0.0.Alpha4)
> ShrinkWrap ClassLoader closes the InputStream for added resources, resulting in unreadable/closed stream errors when combined with Seam XML in test cases.
> ----------------------------------------------------------------------------------------------------------------------------------------------------------
>
> Key: SHRINKWRAP-237
> URL: https://jira.jboss.org/browse/SHRINKWRAP-237
> Project: ShrinkWrap
> Issue Type: Bug
> Affects Versions: 1.0.0-alpha-11
> Environment: Weld 1.1.0.Beta1, Arqullian Alpha4, Seam XML Alpha3
> Reporter: Lincoln Baxter III
>
> http://pastebin.com/3neHZ6BL
> This can be reproduced using Weld 1.1.0.Beta1, Seam XML Alpha3 and Arqullian Alpha4- create a test that attempts to add a Manifest Resources from disk to Beans.xml.
> Seam XML will attempt to load the beans file and complain that the InputStream was closed.
> @RunWith(Arquillian.class)
> public class DefaultTimeZoneTest
> {
> @Deployment
> public static JavaArchive createTestArchive()
> {
> return ShrinkWrap.create(JavaArchive.class, "test.jar")
> .addClass(DefaultTimeZoneProducer.class)
> .addClass(DefaultTimeZoneConfig.class)
> .addManifestResource("org/jboss/seam/international/test/timezone/user-timezone.xml", ArchivePaths.create("beans.xml"));
> }
> @Inject
> DateTimeZone timeZone;
> @Test
> public void testDefaultTimeZoneProducerDirect()
> {
> Assert.assertNotNull(timeZone);
> }
> }
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
13 years, 6 months