Skip to content

Commit

Permalink
[JENKINS-41955] - Introduce checks of all available API methods
Browse files Browse the repository at this point in the history
  • Loading branch information
oleg-nenashev committed Mar 16, 2017
1 parent c499cef commit 391f3a9
Showing 1 changed file with 13 additions and 5 deletions.
Expand Up @@ -28,6 +28,7 @@
import com.michelin.cio.hudson.plugins.maskpasswords.MaskPasswordsBuildWrapper.VarMaskRegex;
import hudson.ExtensionList;
import hudson.XmlFile;
import hudson.cli.CLICommand;
import hudson.model.Hudson;
import hudson.model.ParameterDefinition;
import hudson.model.ParameterDefinition.ParameterDescriptor;
Expand Down Expand Up @@ -297,25 +298,32 @@ public synchronized boolean isMasked(String paramValueClassName) {
try {
add(paramDefClass.getMethod("getDefaultParameterValue"));
} catch(RuntimeException e) {
LOGGER.log(Level.INFO, "No getDefaultParameterValue(String) method for " + paramDefClass);
LOGGER.log(Level.INFO, "No getDefaultParameterValue(String) method for {0}", paramDefClass);
}
// ParameterDefinition.createValue(String)
// This method does not exist anymore, but many classes still use it
try {
add(paramDefClass.getMethod("createValue", String.class));
} catch(RuntimeException e) {
LOGGER.log(Level.INFO, "No createValue(String) method for " + paramDefClass);
LOGGER.log(Level.INFO, "No createValue(String) method for {0}", paramDefClass);
}
// ParameterDefinition.createValue(org.kohsuke.stapler.StaplerRequest, net.sf.json.JSONObject)
try {
add(paramDefClass.getMethod("createValue", StaplerRequest.class, JSONObject.class));
} catch (RuntimeException e) {
LOGGER.log(Level.INFO, "No createValue(StaplerRequest, JSONObject) method for " + paramDefClass);
LOGGER.log(Level.INFO, "No createValue(StaplerRequest, JSONObject) method for {0}", paramDefClass);
}
// ParameterDefinition.createValue(org.kohsuke.stapler.StaplerRequest)
try {
add(paramDefClass.getMethod("createValue", StaplerRequest.class));
} catch (Exception e) {
LOGGER.log(Level.INFO, "No createValue(StaplerRequest) method for " + paramDefClass);
} catch (RuntimeException e) {
LOGGER.log(Level.INFO, "No createValue(StaplerRequest) method for {0}", paramDefClass);
}
// ParameterDefinition.createValue(CLICommand command, String value)
try {
add(paramDefClass.getMethod("createValue", CLICommand.class, String.class));
} catch(RuntimeException e) {
LOGGER.log(Level.INFO, "No createValue(CLICommand, String) method for {0}", paramDefClass);
}
}};

Expand Down

0 comments on commit 391f3a9

Please sign in to comment.