Hi,

I am writing a java code in the javascript transformation to unzip a file. When I click test script I am getting StackOverFlow error.

The following is my java code:
try
{
var zf = new java.util.zip.ZipFile("c:\\Sample\\Sample.zip");
var dir = new java.lang.String(".");
var directoryname=new java.lang.String("c:\\");
dir = directoryname.replace('\\','/');
if(dir.charAt(dir.length()-1) != '/')
{
dir += "/";
}
while( zipEnum.hasMoreElements())
{
//var item = new java.io.zip.ZipEntry(zipEnum.nextElement());
var item = zipEnum.nextElement();
//ZipEntry item = (ZipEntry) zipEnum.nextElement();

if( item.isDirectory() ) //Directory
{
var newdir = File(dir + item.getName());
newdir.mkdir();
}
else //File
{
var newfile = dir + item.getName();
var is = zf.getInputStream(item);
var fos = new java.io.FileOutputStream(newfile);

var ch;
while( (ch = is.read()) != -1 )
{
fos.write(ch);
}

is.close();
fos.close();

}
}

zf.close();
}
catch(e)
{
throw("Error " + e);
}

Can anyone tell me how to solve this issue. I cannot use shell script. I am using kettle 2.3.

Thanks in advance.