jboss root vfile bug?
hwangarias Oct 15, 2012 10:33 AMI want to load some static resources in the root of my EAR file in a windows env with this code
final VirtualFile vfile = VFS.getChild("content/"+Resources.getEarName()+".ear"); | |||
log.info("--------------------- {} {}", vfile, vfile.getChildren().size()); | |||
for (final VirtualFile vf : vfile.getChildren()) { | |||
log.info(">>>> {} {}", vf, vf.getChildren().size()); | |||
} |
Contents of my EAR file as it's deployed are:
- lib (jars)
- META-INF
- res (my resource files)
- my_ejb.jar (a module ejb)
- test.war (arquillian webapp)
But the result of my code is:
09:34:15,456 INFO [oip.foundation.core.ejb.report.ReportTest] (http--127.0.0.1-8080-1) --- oip.core.app -- "/C:/workspace/com.foundation.core.ejb/content/oip.core.app/res"
09:34:15,465 INFO [oip.foundation.core.ejb.report.ReportTest] (http--127.0.0.1-8080-1) --------------------- "/C:/workspace/com.foundation.core.ejb/content/my-ear" 29
09:34:15,466 INFO [oip.foundation.core.ejb.report.ReportTest] (http--127.0.0.1-8080-1) >>>> "/C:/workspace/com.foundation.core.ejb/content/my-ear/res\reports\002\footer.rpi" 0
09:34:15,469 INFO [oip.foundation.core.ejb.report.ReportTest] (http--127.0.0.1-8080-1) >>>> "/C:/workspace/com.foundation.core.ejb/content/my-ear/oip.foundation.core.ejb.jar" 2
09:34:15,470 INFO [oip.foundation.core.ejb.report.ReportTest] (http--127.0.0.1-8080-1) >>>> "/C:/workspace/com.foundation.core.ejb/content/my-ear/res\report-category.xml" 0
09:34:15,476 INFO [oip.foundation.core.ejb.report.ReportTest] (http--127.0.0.1-8080-1) >>>> "/C:/workspace/com.foundation.core.ejb/content/my-ear/res\reports\002\header.rpi" 0
09:34:15,476 INFO [oip.foundation.core.ejb.report.ReportTest] (http--127.0.0.1-8080-1) >>>> "/C:/workspace/com.foundation.core.ejb/content/my-ear/res\reports\002\header.tmx" 0
09:34:15,477 INFO [oip.foundation.core.ejb.report.ReportTest] (http--127.0.0.1-8080-1) >>>> "/C:/workspace/com.foundation.core.ejb/content/my-ear/res\reports\report-category.xml" 0
09:34:15,485 INFO [oip.foundation.core.ejb.report.ReportTest] (http--127.0.0.1-8080-1) >>>> "/C:/workspace/com.foundation.core.ejb/content/my-ear/res\reports\report-category.tmx" 0
09:34:15,487 INFO [oip.foundation.core.ejb.report.ReportTest] (http--127.0.0.1-8080-1) >>>> "/C:/workspace/com.foundation.core.ejb/content/my-ear/META-INF" 2
09:34:15,488 INFO [oip.foundation.core.ejb.report.ReportTest] (http--127.0.0.1-8080-1) >>>> "/C:/workspace/com.foundation.core.ejb/content/my-ear/res\reports\002\env-vars.rpi" 0
09:34:15,489 INFO [oip.foundation.core.ejb.report.ReportTest] (http--127.0.0.1-8080-1) >>>> "/C:/workspace/com.foundation.core.ejb/content/my-ear/res\reports\002\000test02.rpt" 0
09:34:15,492 INFO [oip.foundation.core.ejb.report.ReportTest] (http--127.0.0.1-8080-1) >>>> "/C:/workspace/com.foundation.core.ejb/content/my-ear/lib" 148
09:34:15,492 INFO [oip.foundation.core.ejb.report.ReportTest] (http--127.0.0.1-8080-1) >>>> "/C:/workspace/com.foundation.core.ejb/content/my-ear/res\reports\002\000test02.tmx" 0
09:34:15,494 INFO [oip.foundation.core.ejb.report.ReportTest] (http--127.0.0.1-8080-1) >>>> "/C:/workspace/com.foundation.core.ejb/content/my-ear/res\reports\002\presets.rpi" 0
09:34:15,495 INFO [oip.foundation.core.ejb.report.ReportTest] (http--127.0.0.1-8080-1) >>>> "/C:/workspace/com.foundation.core.ejb/content/my-ear/test.war" 1
09:34:15,496 INFO [oip.foundation.core.ejb.report.ReportTest] (http--127.0.0.1-8080-1) >>>> "/C:/workspace/com.foundation.core.ejb/content/my-ear/res\reports\002\.svn\entries" 0
09:34:15,497 INFO [oip.foundation.core.ejb.report.ReportTest] (http--127.0.0.1-8080-1) --------------------- "/C:/workspace/com.foundation.core.ejb/content/my-ear/res/reports/002" 0
09:34:15,498 INFO [oip.foundation.core.ejb.report.ReportTest] (http--127.0.0.1-8080-1) --------------------- "/C:/workspace/com.foundation.core.ejb/content/my-ear/res/reports/002/header.tmx" 0
As you can see it seems to load resources with Windows slash and later when I try to detect size trying to load for example "content/"+Resources.getEarName()+".ear/res\reports\002\header.tmx", you can see in VFS.getChild() there is code to escape Windows slash and convert into '/'...
is this a bug?
is there any way to load some resource inside an EAR file?
Thank you in advance
Juan Arias