Skip to content
Permalink
Browse files
[JENKINS-41955] - Introduce checks of all available API methods
  • Loading branch information
oleg-nenashev committed Mar 16, 2017
1 parent c499cef commit 391f3a944333dae4dcdb933d05e659d4bd484757
Showing with 13 additions and 5 deletions.
  1. +13 −5 src/main/java/com/michelin/cio/hudson/plugins/maskpasswords/MaskPasswordsConfig.java
@@ -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;
@@ -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);
}
}};

0 comments on commit 391f3a9

Please sign in to comment.