I am trying to modify web.xml using ZipInputStream. File to read is web.xml which is inside ear/war file
C:/XX.ear/YY.war/WEB-INF/web.xml
ZipFile zipFile = new ZipFile("C:/XX.ear");
Enumeration<? extends ZipEntry> entries = zipFile.entries();
while(entries.hasMoreElements()){
ZipEntry entry = entries.nextElement();
if(entry.getName().equalsIgnoreCase("YY.war")){
ZipInputStream inputStream = new ZipInputStream(zipFile.getInputStream(entry));
ZipEntry zipEntry;
while(( zipEntry = inputStream.getNextEntry())!=null)
{
System.out.println(zipEntry.getName());// Prints WEB-INF/web.xml
if (zipEntry.getName().endsWith(".xml")) {
ZipInputStream iStream = new ZipInputStream(zipFile.getInputStream(zipEntry));
// throws NullPointerException here
}
}
}
}
new ZipInputStream(zipFile.getInputStream(zipEntry)) I couldn't point to inner zip file to get input stream of inner war file
Is it possible to read the inner zipentry as inputstream ??