Enable whitespace-related Checkstyle checks (#6149)

This commit is contained in:
Basil Crow authored and GitHub committed 2022-01-03 08:55:03 -08:00
1 parent 1068567cb4
commit e27b310065
1322 files changed
+13269 -11069

No files matched your search

+30 -29
View File
@@ -22,6 +22,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package hudson;
import static hudson.PluginWrapper.PluginDisableStatus.ALREADY_DISABLED;
@@ -118,7 +119,7 @@ public class PluginWrapper implements Comparable<PluginWrapper>, ModelObject {
* A plugin won't be loaded unless his declared dependencies are present and match the required minimal version.
* This can be set to false to disable the version check (legacy behaviour)
*/
private static final boolean ENABLE_PLUGIN_DEPENDENCIES_VERSION_CHECK = Boolean.parseBoolean(System.getProperty(PluginWrapper.class.getName()+"." + "dependenciesVersionCheck.enabled", "true"));
private static final boolean ENABLE_PLUGIN_DEPENDENCIES_VERSION_CHECK = Boolean.parseBoolean(System.getProperty(PluginWrapper.class.getName() + "." + "dependenciesVersionCheck.enabled", "true"));
/**
* {@link PluginManager} to which this belongs to.
@@ -442,10 +443,10 @@ public class PluginWrapper implements Comparable<PluginWrapper>, ModelObject {
public Dependency(String s) {
int idx = s.indexOf(':');
if(idx==-1)
throw new IllegalArgumentException("Illegal dependency specifier "+s);
this.shortName = Util.intern(s.substring(0,idx));
String version = Util.intern(s.substring(idx+1));
if (idx == -1)
throw new IllegalArgumentException("Illegal dependency specifier " + s);
this.shortName = Util.intern(s.substring(0, idx));
String version = Util.intern(s.substring(idx + 1));
boolean isOptional = false;
String[] osgiProperties = version.split("[;]");
@@ -474,13 +475,13 @@ public class PluginWrapper implements Comparable<PluginWrapper>, ModelObject {
* @param archive
* A .jpi archive file jar file, or a .jpl linked plugin.
* @param manifest
* The manifest for the plugin
* The manifest for the plugin
* @param baseResourceURL
* A URL pointing to the resources for this plugin
* A URL pointing to the resources for this plugin
* @param classLoader
* a classloader that loads classes from this plugin and its dependencies
* a classloader that loads classes from this plugin and its dependencies
* @param disableFile
* if this file exists on startup, the plugin will not be activated
* if this file exists on startup, the plugin will not be activated
* @param dependencies a list of mandatory dependencies
* @param optionalDependencies a list of optional dependencies
*/
@@ -533,11 +534,11 @@ public class PluginWrapper implements Comparable<PluginWrapper>, ModelObject {
// use the name captured in the manifest, as often plugins
// depend on the specific short name in its URLs.
String n = manifest.getMainAttributes().getValue("Short-Name");
if(n!=null) return n;
if (n != null) return n;
// maven seems to put this automatically, so good fallback to check.
n = manifest.getMainAttributes().getValue("Extension-Name");
if(n!=null) return n;
if (n != null) return n;
// otherwise infer from the file name, since older plugins don't have
// this entry.
@@ -641,7 +642,7 @@ public class PluginWrapper implements Comparable<PluginWrapper>, ModelObject {
@Deprecated
public String getLongName() {
String name = manifest.getMainAttributes().getValue("Long-Name");
if(name!=null) return name;
if (name != null) return name;
return shortName;
}
@@ -651,7 +652,7 @@ public class PluginWrapper implements Comparable<PluginWrapper>, ModelObject {
@Exported
public YesNoMaybe supportsDynamicLoad() {
String v = manifest.getMainAttributes().getValue("Support-Dynamic-Loading");
if (v==null) return YesNoMaybe.MAYBE;
if (v == null) return YesNoMaybe.MAYBE;
return Boolean.parseBoolean(v) ? YesNoMaybe.YES : YesNoMaybe.NO;
}
@@ -665,11 +666,11 @@ public class PluginWrapper implements Comparable<PluginWrapper>, ModelObject {
private String getVersionOf(Manifest manifest) {
String v = manifest.getMainAttributes().getValue("Plugin-Version");
if(v!=null) return v;
if (v != null) return v;
// plugins generated before maven-hpi-plugin 1.3 should still have this attribute
v = manifest.getMainAttributes().getValue("Implementation-Version");
if(v!=null) return v;
if (v != null) return v;
return "???";
}
@@ -682,10 +683,10 @@ public class PluginWrapper implements Comparable<PluginWrapper>, ModelObject {
@Exported
public @CheckForNull String getRequiredCoreVersion() {
String v = manifest.getMainAttributes().getValue("Jenkins-Version");
if (v!= null) return v;
if (v != null) return v;
v = manifest.getMainAttributes().getValue("Hudson-Version");
if (v!= null) return v;
if (v != null) return v;
return null;
}
@@ -748,7 +749,7 @@ public class PluginWrapper implements Comparable<PluginWrapper>, ModelObject {
try {
((Closeable) classLoader).close();
} catch (IOException e) {
LOGGER.log(WARNING, "Failed to shut down classloader",e);
LOGGER.log(WARNING, "Failed to shut down classloader", e);
}
}
@@ -760,8 +761,8 @@ public class PluginWrapper implements Comparable<PluginWrapper>, ModelObject {
LOGGER.log(Level.FINEST, "Plugin {0} has been already enabled. Skipping the enable() operation", getShortName());
return;
}
if(!disableFile.delete())
throw new IOException("Failed to delete "+disableFile);
if (!disableFile.delete())
throw new IOException("Failed to delete " + disableFile);
}
/**
@@ -890,11 +891,11 @@ public class PluginWrapper implements Comparable<PluginWrapper>, ModelObject {
return active && !hasCycleDependency();
}
public boolean hasCycleDependency(){
public boolean hasCycleDependency() {
return hasCycleDependency;
}
public void setHasCycleDependency(boolean hasCycle){
public void setHasCycleDependency(boolean hasCycle) {
hasCycleDependency = hasCycle;
}
@@ -922,7 +923,7 @@ public class PluginWrapper implements Comparable<PluginWrapper>, ModelObject {
}
public void setPlugin(Plugin plugin) {
Jenkins.lookup(PluginInstanceStore.class).store.put(this,plugin);
Jenkins.lookup(PluginInstanceStore.class).store.put(this, plugin);
plugin.wrapper = this;
}
@@ -932,7 +933,7 @@ public class PluginWrapper implements Comparable<PluginWrapper>, ModelObject {
public boolean hasLicensesXml() {
try {
new URL(baseResourceURL,"WEB-INF/licenses.xml").openStream().close();
new URL(baseResourceURL, "WEB-INF/licenses.xml").openStream().close();
return true;
} catch (IOException e) {
return false;
@@ -1053,7 +1054,7 @@ public class PluginWrapper implements Comparable<PluginWrapper>, ModelObject {
public UpdateSite.Plugin getUpdateInfo() {
UpdateCenter uc = Jenkins.get().getUpdateCenter();
UpdateSite.Plugin p = uc.getPlugin(getShortName(), getVersionNumber());
if(p!=null && p.isNewerThan(getVersion())) return p;
if (p != null && p.isNewerThan(getVersion())) return p;
return null;
}
@@ -1081,7 +1082,7 @@ public class PluginWrapper implements Comparable<PluginWrapper>, ModelObject {
*/
@Exported
public boolean hasUpdate() {
return getUpdateInfo()!=null;
return getUpdateInfo() != null;
}
@Exported
@@ -1165,7 +1166,7 @@ public class PluginWrapper implements Comparable<PluginWrapper>, ModelObject {
* Where is the backup file?
*/
public File getBackupFile() {
return new File(Jenkins.get().getRootDir(),"plugins/"+getShortName() + ".bak");
return new File(Jenkins.get().getRootDir(), "plugins/" + getShortName() + ".bak");
}
/**
@@ -1238,8 +1239,8 @@ public class PluginWrapper implements Comparable<PluginWrapper>, ModelObject {
* Depending on whether the user said "dismiss" or "correct", send him to the right place.
*/
public void doAct(StaplerRequest req, StaplerResponse rsp) throws IOException {
if(req.hasParameter("correct")) {
rsp.sendRedirect(req.getContextPath()+"/pluginManager");
if (req.hasParameter("correct")) {
rsp.sendRedirect(req.getContextPath() + "/pluginManager");
}
}