exceptionfactory commented on code in PR #5820:
URL: https://github.com/apache/nifi/pull/5820#discussion_r866108161
##########
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/html/HtmlDocumentationWriter.java:
##########
@@ -608,23 +608,45 @@ protected void writeProperties(final
ConfigurableComponent configurableComponent
for (final PropertyDependency dependency : dependencies) {
final Set<String> dependentValues =
dependency.getDependentValues();
final String prefix = (capitalizeThe ? "The" : "the")
+ " <" + dependency.getPropertyDisplayName() + "> Property ";
- final String suffix;
+ String suffix = "";
if (dependentValues == null) {
suffix = "has a value specified.";
- } else if (dependentValues.size() == 1) {
- final String requiredValue =
dependentValues.iterator().next();
- suffix = "has a value of \"" + requiredValue +
"\".";
} else {
- final StringBuilder sb = new StringBuilder("is set
to one of the following values: ");
-
- for (final String dependentValue :
dependentValues) {
-
sb.append("\"").append(dependentValue).append("\", ");
+ PropertyDescriptor dependencyProperty = null;
+ for (PropertyDescriptor prop : properties) {
+ if
(prop.getName().equals(dependency.getPropertyName())) {
+ dependencyProperty = prop;
+ break;
+ }
+ }
+ if (null == dependencyProperty) {
+ throw new XMLStreamException("No property was
found matching the name '" + dependency.getPropertyName() + "'");
}
+ if (dependentValues.size() == 1) {
+ final String requiredValue =
dependentValues.iterator().next();
+ for (AllowableValue av :
dependencyProperty.getAllowableValues()) {
Review Comment:
When building and running with these changes,
`HtmlDocumentationWriter.writeProperties()` threw a `NullPointerException` on
`JoltTransformRecord` and `JoltTransformJSON` at the line number. It looks like
a null check is necessary for the return of `getAllowableValues()`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]