提交 bd8091cf 编写于 作者: J Josh Soref

Drop useless local variables

上级 95c8e715
......@@ -1929,8 +1929,7 @@ public final class FilePath implements Serializable {
} catch (BuildException x) {
throw new IOException(x.getMessage());
}
String[] files = ds.getIncludedFiles();
return files;
return ds.getIncludedFiles();
}
/**
......
......@@ -80,29 +80,25 @@ public class PluginFirstClassLoader
protected Enumeration findResources( String arg0, boolean arg1 )
throws IOException
{
Enumeration enu = super.findResources( arg0, arg1 );
return enu;
return super.findResources( arg0, arg1 );
}
@Override
protected Enumeration findResources( String name )
throws IOException
{
Enumeration enu = super.findResources( name );
return enu;
return super.findResources( name );
}
@Override
public URL getResource( String arg0 )
{
URL url = super.getResource( arg0 );
return url;
return super.getResource( arg0 );
}
@Override
public InputStream getResourceAsStream( String name )
{
InputStream is = super.getResourceAsStream( name );
return is;
return super.getResourceAsStream( name );
}
}
......@@ -1045,8 +1045,7 @@ public abstract class PluginManager extends AbstractModelObject implements OnMas
URL res = cl.findResource(PluginWrapper.MANIFEST_FILENAME);
if (res!=null) {
in = getBundledJpiManifestStream(res);
Manifest manifest = new Manifest(in);
return manifest;
return new Manifest(in);
}
} finally {
Util.closeAndLogFailures(in, LOGGER, PluginWrapper.MANIFEST_FILENAME, bundledJpi.toString());
......
......@@ -64,8 +64,7 @@ public final class BuildAuthorizationToken {
}
@Deprecated public static void checkPermission(AbstractProject<?,?> project, BuildAuthorizationToken token, StaplerRequest req, StaplerResponse rsp) throws IOException {
Job<?,?> j = project;
checkPermission(j, token, req, rsp);
checkPermission((Job<?,?>) project, token, req, rsp);
}
public static void checkPermission(Job<?,?> project, BuildAuthorizationToken token, StaplerRequest req, StaplerResponse rsp) throws IOException {
......
......@@ -268,8 +268,7 @@ public class ParametersAction implements RunAction2, Iterable<ParameterValue>, Q
@Nonnull
public ParametersAction merge(@CheckForNull ParametersAction overrides) {
if (overrides == null) {
ParametersAction parametersAction = new ParametersAction(parameters, this.safeParameters);
return parametersAction;
return new ParametersAction(parameters, this.safeParameters);
}
ParametersAction parametersAction = createUpdated(overrides.parameters);
Set<String> safe = new TreeSet<>();
......
......@@ -50,8 +50,7 @@ public class BatchCommandInstaller extends AbstractCommandInstaller {
@Override
public String[] getCommandCall(FilePath script) {
String[] cmd = {"cmd", "/c", "call", script.getRemote()};
return cmd;
return new String[]{"cmd", "/c", "call", script.getRemote()};
}
private Object readResolve() throws ObjectStreamException {
......
......@@ -49,8 +49,7 @@ public class CommandInstaller extends AbstractCommandInstaller {
@Override
public String[] getCommandCall(FilePath script) {
String[] cmd = {"sh", "-e", script.getRemote()};
return cmd;
return new String[]{"sh", "-e", script.getRemote()};
}
private Object readResolve() throws ObjectStreamException {
......
......@@ -192,9 +192,8 @@ public abstract class DownloadFromUrlInstaller extends ToolInstaller {
ToolInstallerList toolInstallerList = new ToolInstallerList();
toolInstallerList.list = new ToolInstallerEntry[reducedToolEntries.size()];
reducedToolEntries.toArray(toolInstallerList.list);
JSONObject reducedToolEntriesJsonList = JSONObject.fromObject(toolInstallerList);
//return the list with no duplicates
return reducedToolEntriesJsonList;
return JSONObject.fromObject(toolInstallerList);
}
/**
......
......@@ -873,8 +873,7 @@ public abstract class ProcessTree implements Iterable<OSProcess>, IProcessTree,
JAVA_9_PROCESSHANDLE_DESTROY = null;
}
} catch (ClassNotFoundException | NoSuchFieldException | NoSuchMethodException e) {
LinkageError x = new LinkageError("Cannot initialize reflection for Unix Processes", e);
throw x;
throw new LinkageError("Cannot initialize reflection for Unix Processes", e);
}
}
......
......@@ -44,8 +44,7 @@ public class NewViewLink extends TransientViewActionFactory {
@Override
public String getUrlName() {
String urlName = Jenkins.getInstance().getRootUrl() + URL_NAME;
return urlName;
return Jenkins.getInstance().getRootUrl() + URL_NAME;
}
private boolean hasPermission(View view) {
......
......@@ -54,10 +54,9 @@ enum Boundary {
* Computes the boundary value.
*/
public int apply(int binarySearchOutput) {
int r = binarySearchOutput;
if (r>=0) return r+offsetOfExactMatch; // if we had some x_i==p
if (binarySearchOutput >=0) return binarySearchOutput +offsetOfExactMatch; // if we had some x_i==p
int ip = -(r+1);
int ip = -(binarySearchOutput +1);
return ip+offsetOfInsertionPoint;
}
}
......@@ -92,8 +92,7 @@ public class LegacyApiTokenAdministrativeMonitor extends AdministrativeMonitor {
@Restricted(NoExternalUse.class)
public @Nullable ApiTokenStore.HashedToken getLegacyTokenOf(@Nonnull User user) {
ApiTokenProperty apiTokenProperty = user.getProperty(ApiTokenProperty.class);
ApiTokenStore.HashedToken legacyToken = apiTokenProperty.getTokenStore().getLegacyToken();
return legacyToken;
return apiTokenProperty.getTokenStore().getLegacyToken();
}
// used by Jelly view
......@@ -102,8 +101,7 @@ public class LegacyApiTokenAdministrativeMonitor extends AdministrativeMonitor {
ApiTokenProperty apiTokenProperty = user.getProperty(ApiTokenProperty.class);
if (legacyToken != null) {
ApiTokenStats.SingleTokenStats legacyStats = apiTokenProperty.getTokenStats().findTokenStatsById(legacyToken.getUuid());
ApiTokenProperty.TokenInfoAndStats tokenInfoAndStats = new ApiTokenProperty.TokenInfoAndStats(legacyToken, legacyStats);
return tokenInfoAndStats;
return new ApiTokenProperty.TokenInfoAndStats(legacyToken, legacyStats);
}
// in case the legacy token was revoked during the request
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册