Logo Search packages:      
Sourcecode: jardiff version File versions  Download package

void org::osjava::jardiff::ant::JarDiffTask::execute (  )  throws BuildException [inline]

Run the task, generating the jardiff report.

Exceptions:
BuildException When there is an error creating the diff, When there is a problem with the xml parser, When there is a problem with the xslt transformer When the attributes specified are invalid.

Definition at line 112 of file JarDiffTask.java.

References org::osjava::jardiff::JarDiff::diff(), force, fromJar, fromName, org::osjava::jardiff::JarDiff::loadNewClasses(), org::osjava::jardiff::JarDiff::loadOldClasses(), out, org::osjava::jardiff::JarDiff::setNewVersion(), org::osjava::jardiff::JarDiff::setOldVersion(), toJar, and toName.

                                                {
        try {
            if(fromJar == null) {
                throw new BuildException("no fromjar file specified",
                        getLocation());
            }
            if(toJar == null) {
                throw new BuildException("no tojar file specified",
                        getLocation());
            }
            if(out == null) {
                throw new BuildException("no out file specified", 
                        getLocation());
            }
            if(fromName == null) {
                fromName = fromJar.getName();
            }
            if(toName == null) {
                toName = toJar.getName();
            }
            if(!fromJar.exists() || !fromJar.isFile() || !fromJar.canRead()) {
                String msg = "fromjar is not a file, or cannot be read";
                throw new BuildException(msg, getLocation());
            }
            if(!toJar.exists() || !toJar.isFile() || !toJar.canRead()) {
                String msg = "tojar is not a file, or cannot be read";
                throw new BuildException(msg, getLocation());
            }
            long outModified = out.lastModified();
            long oldModified = fromJar.lastModified();
            long newModified = toJar.lastModified();
            if(force || oldModified > outModified || newModified > outModified)
            {
                log("Writing xml api diff to "+out);
                JarDiff jd = new JarDiff();
                jd.setOldVersion(fromName);
                jd.setNewVersion(toName);
                jd.loadOldClasses(fromJar);
                jd.loadNewClasses(toJar);
                jd.diff(
                        new StreamDiffHandler(new FileOutputStream(out)),
                        new SimpleDiffCriteria()
                       );
            }
        } catch (DiffException de) {
            throw new BuildException(de);
        } catch (IOException ioe) {
            throw new BuildException(ioe);
        }
    }


Generated by  Doxygen 1.6.0   Back to index