Hi,
I wrote an SCM plugin some time ago and from time to time it is throwing a
NullPointerException at the following location:
@Override
public boolean checkout(AbstractBuild<?, ?> build, Launcher launcher,
FilePath workspace, BuildListener listener, File changelogFile) throws
IOException, InterruptedException {
return innerScm.checkout(new FilePath(changelogFile),
getRevisionStateFileFileForBuild(build), workspace);
}
I'm using "innerScm" to have an internal API that is easier to unit-test
for me, and in the "outer" scm there is basically only this adapter code.
What is null is the "innerScm".
I also see Null pointer exceptions thrown at this location sometimes:
@Override
public ChangeLogParser createChangeLogParser() {
return new ChangeLogParser() {
@SuppressWarnings("rawtypes")
@Override
public ChangeLogSet<? extends Entry> parse(
AbstractBuild build, File changelogFile) throws IOException {
return new HanaChangeLogSet(build, innerScm.
parseChangeLog(changelogFile));
}
};
}
I don't understand how this can happen, because I only have the following
constructor:
private final transient DatabaseInnerSCM innerScm;
@DataBoundConstructor
public DatabaseSCM(String connection, String objectFilter, boolean
shouldDownloadContent, RepositoryBrowser<HanaChangeLogSet.Entry> browser) {
this.connection = connection;
this.objectFilter = objectFilter;
this.shouldDownloadContent = shouldDownloadContent;
this.browser = browser;
Repository repository = new SQLRepository(new SQLConnectionProviderImpl());
ObjectFilter[] filters = new ObjectFilterParser().parseMultiple(this.
objectFilter);
this.innerScm = new DatabaseInnerSCM(repository, filters,
shouldDownloadContent);
}
So from the code I don't see how this could become null when going through
the constructor.
Does the Jenkins framework have any other way to assign the field than
using the data-bound constructor?
Best regards
Jens
--
You received this message because you are subscribed to the Google Groups
"Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/jenkinsci-dev/1c092fb3-893d-4526-80a5-4e68d1136f76%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.