Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Get the Size of files inside a WAR file of a EAR File

 
Shaik Riyaz
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

Iam developing a utility to compare Jar/EAR/WAR Files.

I am facing an issue while comapring EAR files i.e. I am able to get the sizes of files inside EAR file including WAR File , But I want to be able to iterate the WAR file (which is present inside EAR) and get sizes of files inside it.

The above funtionality would enable users to identify the file inside WAR file of a EAR file which has changed.

Please find below the code Iam using to get the contents and as can be seen I am able to get file name and file date timestamp of files inside WAR file but not the sizes.

Please let me know your thoughts regarding the approach which can be adopted.

Thanks in advance !!


Current Output:
In EAR comparision
OUTSIDE WAR FILE NAME:META-INF/MANIFEST.MF FILE SIZE:[ 25 ] FILE Time: [ 09/27/2012 09:56:48 PM ]
OUTSIDE WAR FILE NAME:META-INF/ibmconfig/cells/defaultCell/applications/defaultApp/deployments/defaultApp/deployment.xml FILE SIZE:[ 1348 ] FILE Time: [ 08/30/2012 01:56:24 PM ]
OUTSIDE WAR FILE NAME:META-INF/application.xml.20120405-163700.bak FILE SIZE:[ 833 ] FILE Time: [ 08/30/2012 01:56:24 PM ]
OUTSIDE WAR FILE NAME:META-INF/application.xml FILE SIZE:[ 833 ] FILE Time: [ 08/30/2012 01:56:54 PM ]
OUTSIDE WAR FILE NAME:project.pj FILE SIZE:[ 527 ] FILE Time: [ 08/30/2012 01:56:24 PM ]
OUTSIDE WAR FILE NAME:META-INF/ibm-application-bnd.xmi FILE SIZE:[ 835 ] FILE Time: [ 08/30/2012 01:56:24 PM ]
OUTSIDE WAR FILE NAME:deployment.xml.20120409-125442.bak FILE SIZE:[ 2458 ] FILE Time: [ 08/30/2012 01:56:24 PM ]
In WAR comparision
WAR FILE NAME:samplewebapp.war
WAR FILE SizE:292765
WAR FILE Time:09/27/2012 09:56:48 PM
INSIDE WAR FILE NAME:samplewebapp.war/META-INF/MANIFEST.MF FILE SIZE: [ -1-1-1 ] FILE Time: [ 09/27/2012 09:56:48 PM ]
INSIDE WAR FILE NAME:samplewebapp.war/sample.jsp FILE SIZE: [ -1-1-1 ] FILE Time: [ 08/30/2012 01:56:44 PM ]
INSIDE WAR FILE NAME:samplewebapp.war/WEB-INF/ibm-web-bnd.xmi FILE SIZE: [ -1-1-1 ] FILE Time: [ 08/30/2012 01:56:52 PM ]
INSIDE WAR FILE NAME:samplewebapp.war/xsl/sample.xsl FILE SIZE: [ -1-1-1 ] FILE Time: [ 08/30/2012 01:56:38 PM ]
INSIDE WAR FILE NAME:samplewebapp.war/xsl/sample.xsl FILE SIZE: [ -1-1-1 ] FILE Time: [ 08/30/2012 01:56:46 PM ]

Needed Output:
In EAR comparision
OUTSIDE WAR FILE NAME:META-INF/MANIFEST.MF FILE SIZE:[ 25 ] FILE Time: [ 09/27/2012 09:56:48 PM ]
OUTSIDE WAR FILE NAME:META-INF/ibmconfig/cells/defaultCell/applications/defaultApp/deployments/defaultApp/deployment.xml FILE SIZE:[ 1348 ] FILE Time: [ 08/30/2012 01:56:24 PM ]
OUTSIDE WAR FILE NAME:META-INF/application.xml.20120405-163700.bak FILE SIZE:[ 833 ] FILE Time: [ 08/30/2012 01:56:24 PM ]
OUTSIDE WAR FILE NAME:META-INF/application.xml FILE SIZE:[ 833 ] FILE Time: [ 08/30/2012 01:56:54 PM ]
OUTSIDE WAR FILE NAME:project.pj FILE SIZE:[ 527 ] FILE Time: [ 08/30/2012 01:56:24 PM ]
OUTSIDE WAR FILE NAME:META-INF/ibm-application-bnd.xmi FILE SIZE:[ 835 ] FILE Time: [ 08/30/2012 01:56:24 PM ]
OUTSIDE WAR FILE NAME:deployment.xml.20120409-125442.bak FILE SIZE:[ 2458 ] FILE Time: [ 08/30/2012 01:56:24 PM ]
In WAR comparision
WAR FILE NAME:samplewebapp.war
WAR FILE SizE:292765
WAR FILE Time:09/27/2012 09:56:48 PM
INSIDE WAR FILE NAME:samplewebapp.war/META-INF/MANIFEST.MF FILE SIZE: [ 25 ] FILE Time: [ 09/27/2012 09:56:48 PM ]
INSIDE WAR FILE NAME:samplewebapp.war/sample.jsp FILE SIZE: [ 35733 ] FILE Time: [ 08/30/2012 01:56:44 PM ]
INSIDE WAR FILE NAME:samplewebapp.war/WEB-INF/ibm-web-bnd.xmi FILE SIZE: [ 1411 ] FILE Time: [ 08/30/2012 01:56:52 PM ]
INSIDE WAR FILE NAME:samplewebapp.war/xsl/sample.xsl FILE SIZE: [ 22912 ] FILE Time: [ 08/30/2012 01:56:38 PM ]


 
Venkata Sirish
Ranch Hand
Posts: 112
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try closing the ZipEntry using zis.closeEntry(); before line 47.

Hope this helps!

 
Shaik Riyaz
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The above issue has been resolved. I had to close the zip entry while iterating for file sizes of files inside WAR file of a EAR file.

 
Shaik Riyaz
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yeah Thanks for the reply the sollution worked
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic