Search in sources :

Example 1 with TextFile

use of hudson.util.TextFile in project hudson-2.x by hudson.

the class Job method onLoad.

@Override
@SuppressWarnings("unchecked")
public void onLoad(ItemGroup<? extends Item> parent, String name) throws IOException {
    super.onLoad(parent, name);
    cascadingProject = (JobT) Functions.getItemByName(Hudson.getInstance().getAllItems(this.getClass()), cascadingProjectName);
    initAllowSave();
    TextFile f = getNextBuildNumberFile();
    if (f.exists()) {
        // assume that nextBuildNumber was read from config.xml
        try {
            synchronized (this) {
                this.nextBuildNumber = Integer.parseInt(f.readTrim());
            }
        } catch (NumberFormatException e) {
            throw new IOException2(f + " doesn't contain a number", e);
        }
    } else {
        // From the old Hudson, or doCreateItem. Create this file now.
        saveNextBuildNumber();
        // and delete it from the config.xml
        save();
    }
    if (// didn't exist < 1.72
    properties == null)
        properties = new CopyOnWriteList<JobProperty<? super JobT>>();
    if (cascadingChildrenNames == null) {
        cascadingChildrenNames = new CopyOnWriteArraySet<String>();
    }
    buildProjectProperties();
    for (JobProperty p : getAllProperties()) {
        p.setOwner(this);
    }
}
Also used : CopyOnWriteList(hudson.util.CopyOnWriteList) TextFile(hudson.util.TextFile) IOException2(hudson.util.IOException2)

Aggregations

CopyOnWriteList (hudson.util.CopyOnWriteList)1 IOException2 (hudson.util.IOException2)1 TextFile (hudson.util.TextFile)1