Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions core/src/main/java/hudson/PluginWrapper.java
Original file line number Diff line number Diff line change
Expand Up @@ -522,6 +522,7 @@ public PluginWrapper(PluginManager parent, File archive, Manifest manifest, URL
this.archive = archive;
}

@Exported(visibility = 2)
@Override
public String getDisplayName() {
String displayName = getLongName();
Expand Down Expand Up @@ -595,7 +596,7 @@ public List<Dependency> getOptionalDependencies() {
/**
* Returns the short name suitable for URL.
*/
@Exported
@Exported(visibility = 2)
public String getShortName() {
return shortName;
}
Expand Down Expand Up @@ -627,7 +628,7 @@ public String getShortName() {
* null if this information is unavailable.
* @since 1.283
*/
@Exported
@Exported(visibility = 2)
public String getUrl() {
// first look in update center metadata
List<UpdateSite.Plugin> siteMetadataList = getInfoFromAllSites();
Expand Down Expand Up @@ -683,7 +684,7 @@ public YesNoMaybe supportsDynamicLoad() {
/**
* Returns the version number of this plugin
*/
@Exported
@Exported(visibility = 2)
public String getVersion() {
return getVersionOf(manifest);
}
Expand Down Expand Up @@ -894,7 +895,7 @@ private Set<String> dependentsToCheck(PluginDisableStrategy strategy) {
/**
* Returns true if this plugin is enabled for this session.
*/
@Exported
@Exported(visibility = 2)
public boolean isActive() {
return active && !hasCycleDependency();
}
Expand All @@ -921,7 +922,7 @@ public boolean isBundled() {
* If true, the plugin is going to be activated next time
* Jenkins runs.
*/
@Exported
@Exported(visibility = 2)
public boolean isEnabled() {
return !disableFile.exists();
}
Expand Down Expand Up @@ -1080,7 +1081,7 @@ private List<UpdateSite.Plugin> getInfoFromAllSites() {
* This method is conservative in the sense that if the version number is incomprehensible,
* it always returns false.
*/
@Exported
@Exported(visibility = 2)
public boolean hasUpdate() {
return getUpdateInfo() != null;
}
Expand Down
30 changes: 30 additions & 0 deletions test/src/test/java/hudson/PluginManagerTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -542,6 +542,36 @@ void pluginListJSONApi() throws Throwable {
});
}

@Issue("https://github.com/jenkinsci/jenkins/issues/21047")
@WithPlugin("htmlpublisher.jpi")
@Test
void pluginManagerApiJsonReturnsPluginDetails() throws Throwable {
session.then(r -> {
JSONObject response = r.getJSON("pluginManager/api/json").getJSONObject();
JSONArray plugins = response.getJSONArray("plugins");
assertThat(plugins, not(empty()));

// Find the htmlpublisher plugin in the response
JSONObject htmlPublisher = null;
for (int i = 0; i < plugins.size(); i++) {
JSONObject plugin = plugins.getJSONObject(i);
if ("htmlpublisher".equals(plugin.optString("shortName"))) {
htmlPublisher = plugin;
break;
}
}
assertNotNull(htmlPublisher, "htmlpublisher plugin should be present in API response");

// Verify key properties are present at default depth (visibility = 2)
assertNotNull(htmlPublisher.optString("shortName", null), "shortName should be exported at default depth");
assertNotNull(htmlPublisher.optString("version", null), "version should be exported at default depth");
assertNotNull(htmlPublisher.optString("displayName", null), "displayName should be exported at default depth");
assertTrue(htmlPublisher.has("active"), "active should be exported at default depth");
assertTrue(htmlPublisher.has("enabled"), "enabled should be exported at default depth");
assertTrue(htmlPublisher.has("hasUpdate"), "hasUpdate should be exported at default depth");
Comment on lines +565 to +571
Copy link

Copilot AI Feb 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR description says the new test verifies that the response includes url, but this test currently never asserts that url is present. Either add an assertion for url (and, if needed for stability, set up update site data like prevalidateConfig() does with /plugins/htmlpublisher-update-center.json) or update the PR description to match what’s actually being tested.

Copilot uses AI. Check for mistakes.
});
}

@Issue("JENKINS-41684")
@Test
void requireSystemDuringLoad() throws Throwable {
Expand Down
Loading