protected static File unpackLocation(File tmpRoot,String location) throws DeploymentException{ File tmpDir=null; try{ File file=new File(location); if(file.isDirectory()){ log.info("Deploying an exploded jar/zip,  we will create a temporary jar for it.");
protected static File unpackLocation(File tmpRoot, String location) throws DeploymentException { File tmpDir = null; try { File file = new File(location); if (file.isDirectory()) { if (log.isDebugEnabled()) { log.debug("Deploying an exploded jar/zip, we will create a temporary jar for it."); }
    protected static File unpackLocation(File tmpRoot,String location) throws DeploymentException{        File tmpDir=null;        try{            File file=new File(location);            if(file.isDirectory()){                log.info("Deploying an exploded jar/zip,  we will create a temporary jar for it.");                // If we have a directory then we should move it over                File newFile=new File(tmpRoot.getAbsolutePath()+"/exploded.jar");                newFile.delete();                FileUtil.zipDir(file.getAbsolutePath(),newFile.getAbsolutePath());                file=newFile;                log.info("Deployment will now work from "+file.getAbsolutePath());            }            if(!file.exists()){                // assume it's a URL                try{                    URL url=new URL(location);                    String fileName=url.getFile();                    if(fileName==null||(!fileName.endsWith(".zip")&&!fileName.endsWith(".jar"))){                        throw new DeploymentException("Location: "+location+" is not an archive");                    }                    file=FileUtil.unpackArchive(url,tmpRoot);                }catch(MalformedURLException e){                    throw new DeploymentException(e);                }            }            if(FileUtil.archiveContainsEntry(file,AutoDeploymentService.DESCRIPTOR_FILE)){                tmpDir=FileUtil.createUniqueDirectory(tmpRoot,file.getName());                FileUtil.unpackArchive(file,tmpDir);                log.info("Unpacked archive "+location+" to "+tmpDir);            }        }catch(IOException e){            log.error("I/O error installing archive",e);            throw new DeploymentException(e);        }        return tmpDir;    }