Skip to content
Permalink
Browse files
Merge branch 'JENKINS-25735' into JENKINS-41955-mask-passwords
  • Loading branch information
oleg-nenashev committed Mar 16, 2017
2 parents 1cbfffa + 0ddf7b3 commit c499cefb2aac4bc17965e78d6d36e49eec42a9eb
Showing 1 changed file with 13 additions and 4 deletions.
@@ -284,7 +284,7 @@ public synchronized boolean isMasked(String paramValueClassName) {
maskPasswordsParamValueClasses = new LinkedHashSet<String>();

// The only way to find parameter definition/parameter value
// couples is to reflect the 3 methods of parameter definition
// couples is to reflect the methods of parameter definition
// classes which instantiate the parameter value.
// This means that this algorithm expects that the developers do
// clearly redefine the return type when implementing parameter
@@ -305,16 +305,25 @@ public synchronized boolean isMasked(String paramValueClassName) {
} catch(RuntimeException e) {
LOGGER.log(Level.INFO, "No createValue(String) method for " + paramDefClass);
}
// ParameterDefinition.createValue(org.kohsuke.stapler.StaplerRequest, net.sf.json.JSONObjec)
// 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);
}
// 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);
}
}};

for(Method m: methods) {
maskPasswordsParamValueClasses.add(m.getReturnType().getName());
// If the class defines any method, we consider it as a ParameterDefinition.
// This parameter definition may produce any ParameterValue, and effectively we cannot guarantee the
// value is a type or a subtype of the requested parameter.
if(!methods.isEmpty()) {
maskPasswordsParamValueClasses.add(paramValueClassName);
}
}
}

0 comments on commit c499cef

Please sign in to comment.