-
Notifications
You must be signed in to change notification settings - Fork 123
Description
Version of this project you're using 1.6.4
Platform version osx 10.13.3 (high sierra)
Framework version java 1.8.0_131
Splunk version 7.0.2 - 03bbabbd5c0f
Other relevant information (ex: local/remote environment, Splunk network configuration)
I tracked down this bug because at surface level, it appeared that input validation was not being executed. Indeed it wasn't being executed because XmlUtil.textInNode would throw an exception when encountering an argument with a null/empty value.
I have a proposed fix below that seems to work on 7.0.2, but i can't speak to backwards compatibility with older versions of splunk
com.splunk.modularinput.XmlUtil.textInNode(XmlUtil.java:38)\com.splunk.modularinput.Parameter.nodeToParameterList(Parameter.java:72)\com.splunk.modularinput.ValidationDefinition.parseDefinition(ValidationDefinition.java:245)\com.splunk.modularinput.Script.run(Script.java:85)\com.splunk.modularinput.Script.run(Script.java:44)...
fix in my env
static String textInNode(Node node, String errorMessage) throws MalformedDataException {
Node child = node.getFirstChild();
-
if (child.getNodeType() != Node.TEXT_NODE) { -
throw new MalformedDataException(errorMessage); -
} else { -
return ((Text)child).getData();
-
if(child != null) { -
if (child.getNodeType() != Node.TEXT_NODE) { -
throw new MalformedDataException(errorMessage); -
} else { -
return ((Text)child).getData(); -
} } -
}
return("");