Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FIXED JENKINS-9062] Fixed a bug in persisting user configuration tha…
…t causes NPE in some plugins
- Loading branch information
Showing
5 changed files
with
59 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
package hudson.model; | ||
|
||
import org.jvnet.hudson.test.Bug; | ||
import org.jvnet.hudson.test.HudsonTestCase; | ||
import org.jvnet.hudson.test.TestExtension; | ||
|
||
/** | ||
* @author Kohsuke Kawaguchi | ||
*/ | ||
public class UserPropertyTest extends HudsonTestCase { | ||
@Bug(9062) | ||
public void test9062() throws Exception { | ||
User u = User.get("foo"); | ||
u.addProperty(new UserProperty1()); | ||
configRoundtrip(u); | ||
for (UserProperty p : u.getAllProperties()) | ||
assertNotNull(p); | ||
} | ||
|
||
public static class UserProperty1 extends UserProperty { | ||
@TestExtension | ||
public static class DescriptorImpl extends UserPropertyDescriptor { | ||
public String getDisplayName() { | ||
return "UserProperty1"; | ||
} | ||
|
||
@Override | ||
public UserProperty newInstance(User user) { | ||
return new UserProperty1(); | ||
} | ||
} | ||
} | ||
|
||
public static class UserProperty2 extends UserProperty { | ||
@TestExtension | ||
public static class DescriptorImpl extends UserPropertyDescriptor { | ||
public String getDisplayName() { | ||
return "UserProperty2"; | ||
} | ||
|
||
@Override | ||
public boolean isEnabled() { | ||
return false; | ||
} | ||
|
||
@Override | ||
public UserProperty newInstance(User user) { | ||
return new UserProperty1(); | ||
} | ||
} | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
test/src/test/resources/hudson/model/UserPropertyTest/UserProperty1/config.jelly
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<j:jelly xmlns:j="jelly:core"/> |
1 change: 1 addition & 0 deletions
1
test/src/test/resources/hudson/model/UserPropertyTest/UserProperty2/config.jelly
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<j:jelly xmlns:j="jelly:core"/> |