예제 #1
0
  private ChangeLogSet<? extends Entry> calcChangeSet() {
    File changelogFile = new File(getRootDir(), "changelog.xml");
    if (!changelogFile.exists()) return ChangeLogSet.createEmpty(this);

    try {
      return scm.parse(this, changelogFile);
    } catch (IOException e) {
      e.printStackTrace();
    } catch (SAXException e) {
      e.printStackTrace();
    }
    return ChangeLogSet.createEmpty(this);
  }
예제 #2
0
  /**
   * Gets the changes incorporated into this build.
   *
   * @return never null.
   */
  @Exported
  public ChangeLogSet<? extends Entry> getChangeSet() {
    if (scm == null) {
      // for historical reason, null means CVS.
      try {
        Class<?> c =
            Hudson.getInstance()
                .getPluginManager()
                .uberClassLoader
                .loadClass("hudson.scm.CVSChangeLogParser");
        scm = (ChangeLogParser) c.newInstance();
      } catch (ClassNotFoundException e) {
        // if CVS isn't available, fall back to something non-null.
        scm = new NullChangeLogParser();
      } catch (InstantiationException e) {
        scm = new NullChangeLogParser();
        throw (Error) new InstantiationError().initCause(e);
      } catch (IllegalAccessException e) {
        scm = new NullChangeLogParser();
        throw (Error) new IllegalAccessError().initCause(e);
      }
    }

    if (changeSet == null) // cached value
    try {
        changeSet = calcChangeSet();
      } finally {
        // defensive check. if the calculation fails (such as through an exception),
        // set a dummy value so that it'll work the next time. the exception will
        // be still reported, giving the plugin developer an opportunity to fix it.
        if (changeSet == null) changeSet = ChangeLogSet.createEmpty(this);
      }
    return changeSet;
  }
 /*
  * (non-Javadoc)
  *
  * @see hudson.scm.ChangeLogParser#parse(hudson.model.AbstractBuild,
  *      java.io.File)
  */
 @Override
 public ChangeLogSet<? extends Entry> parse(AbstractBuild build, File changelogFile)
     throws IOException, SAXException {
   return ChangeLogSet.createEmpty(build);
 }