private void validate()

in partial-jnlp-ant-task/src/main/java/org/apache/easyant/tasks/JNLPTask.java [154:202]


    private void validate() throws BuildException {

        // less one resources has to be setted.
        if (null == this.filesets || this.filesets.isEmpty()) {
            throw new BuildException("the parameter filesets can not be empty");
        }

        // mainjar can't be empty or null
        if (null == mainjar || "".equals(mainjar)) {
            throw new BuildException("the parameter mainjar have to be setted");
        }

        // jnlp can't null or not exist
        if (null == jnlpFile) {
            throw new BuildException("the parameter jnlpFile have to be setted");
        }

        if (!(new File(jnlpFile).exists())) {
            throw new BuildException("the jnlpFile " + jnlpFile
                    + " doesn't exist");
        }

        if (flatPath != null) {
            pathType = PathType.FLAT;
        } else {
            pathType = PathType.AUTOMATIC;
        }
        
        // check if the main jar parameter is included in the resources and if
        // the resources exists.
        for (FileSet currentResource : filesets) {

            for (File currentFile : currentResource.getDir().listFiles()) {

                if (checkDirectories(currentResource, currentFile)) {
                    if (!currentFile.exists()) {
                        throw new BuildException("the resource: "
                                + currentFile.getAbsolutePath()
                                + " doesnot exists !");
                    }

                }
            }
        }
        if (!new File(mainjar).exists()) {
            throw new BuildException("the mainJar does not exists");
        }

    }