Title: Modular Input: Error during ValidationDefinition/InputDefinition when no value for parameter is passed · Issue #198 · splunk/splunk-sdk-java · GitHub
Open Graph Title: Modular Input: Error during ValidationDefinition/InputDefinition when no value for parameter is passed · Issue #198 · splunk/splunk-sdk-java
X Title: Modular Input: Error during ValidationDefinition/InputDefinition when no value for parameter is passed · Issue #198 · splunk/splunk-sdk-java
Description: I am able to reproduce this using v1.9.1. This issue happens when the user provides no value for a modular input parameter. https://github.com/splunk/splunk-sdk-java/blob/master/splunk/src/main/java/com/splunk/modularinput/XmlUtil.java t...
Open Graph Description: I am able to reproduce this using v1.9.1. This issue happens when the user provides no value for a modular input parameter. https://github.com/splunk/splunk-sdk-java/blob/master/splunk/src/main/jav...
X Description: I am able to reproduce this using v1.9.1. This issue happens when the user provides no value for a modular input parameter. https://github.com/splunk/splunk-sdk-java/blob/master/splunk/src/main/jav...
Opengraph URL: https://github.com/splunk/splunk-sdk-java/issues/198
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Modular Input: Error during ValidationDefinition/InputDefinition when no value for parameter is passed","articleBody":"I am able to reproduce this using v1.9.1. This issue happens when the user provides no value for a modular input parameter.\r\nhttps://github.com/splunk/splunk-sdk-java/blob/master/splunk/src/main/java/com/splunk/modularinput/XmlUtil.java textInNode() line number 38:\r\n```\r\nstatic String textInNode(Node node, String errorMessage) throws MalformedDataException {\r\n Node child = node.getFirstChild();\r\n if (child.getNodeType() != Node.TEXT_NODE) {\r\n throw new MalformedDataException(errorMessage);\r\n } else {\r\n return ((Text)child).getData();\r\n }\r\n }\r\n```\r\nHere, no null check is performed for the `child` variable. In case when the modular input parameter has no value, `child` will be null and child.getNodeType() leads to null pointer.\r\n\r\nSample input to --validate-arguments that triggers the error:\r\n```\r\n\u003c?xml version=\"1.0\" encoding=\"utf-16\"?\u003e\r\n\u003citems xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"\u003e\r\n \u003cserver_host\u003etiny\u003c/server_host\u003e\r\n \u003cserver_uri\u003ehttps://127.0.0.1:8089\u003c/server_uri\u003e\r\n \u003ccheckpoint_dir\u003e/opt/splunk/var/lib/splunk/modinputs\u003c/checkpoint_dir\u003e\r\n \u003csession_key\u003e123102983109283019283\u003c/session_key\u003e\r\n \u003c!-- The items element only ever contains one item element --\u003e\r\n \u003citem name=\"aaa\"\u003e\r\n \u003cparam name=\"param1\"\u003evalue1\u003c/param\u003e\r\n \u003cparam name=\"param_bug\"\u003e\u003c/param\u003e\r\n \u003cparam name=\"disabled\"\u003e0\u003c/param\u003e\r\n \u003cparam name=\"index\"\u003edefault\u003c/param\u003e\r\n \u003cparam_list name=\"multiValue\"\u003e\r\n \u003cvalue\u003evalue1\u003c/value\u003e\r\n \u003cvalue\u003evalue2\u003c/value\u003e\r\n \u003c/param_list\u003e\r\n \u003cparam_list name=\"multiValue2\"\u003e\r\n \u003cvalue\u003evalue3\u003c/value\u003e\r\n \u003cvalue\u003evalue4\u003c/value\u003e\r\n \u003c/param_list\u003e\r\n \u003c/item\u003e\r\n\u003c/items\u003e\r\n```\r\nIn the above example `param_bug` has no value (user did not input any value to the modular input parameter), this causes `child` to be null in the `textInNode()` method.\r\n\r\nPlease let me know if you need any other information regarding this issue.\r\n\r\nSimilar issue was created previously: https://github.com/splunk/splunk-sdk-java/issues/122 back in March 2018, but it was closed stating that it could not reproduced.","author":{"url":"https://github.com/jrobins04","@type":"Person","name":"jrobins04"},"datePublished":"2022-10-25T06:07:24.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":11},"url":"https://github.com/198/splunk-sdk-java/issues/198"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:afc37a68-6e41-4cbe-3c08-309824899416 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D40C:246CE:6602096:8666991:6A5DD8AC |
| html-safe-nonce | 6dbf202f30a4760db39da2f970062982c12c5196c46863c2875c81d3e75a7f74 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJENDBDOjI0NkNFOjY2MDIwOTY6ODY2Njk5MTo2QTVERDhBQyIsInZpc2l0b3JfaWQiOiI5MDE0Nzg2MTE4Njg1NDE1NTk2IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 357e01fefbb618a70c98976e556cc5999c858d4212aaa35c23f3153279f37e39 |
| hovercard-subject-tag | issue:1421911723 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/splunk/splunk-sdk-java/198/issue_layout |
| twitter:image | https://opengraph.githubassets.com/ceb026e9ef7bf842f501aa79d66084d89ae2d1c0fa9119765077e22071b83181/splunk/splunk-sdk-java/issues/198 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/ceb026e9ef7bf842f501aa79d66084d89ae2d1c0fa9119765077e22071b83181/splunk/splunk-sdk-java/issues/198 |
| og:image:alt | I am able to reproduce this using v1.9.1. This issue happens when the user provides no value for a modular input parameter. https://github.com/splunk/splunk-sdk-java/blob/master/splunk/src/main/jav... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | jrobins04 |
| hostname | github.com |
| expected-hostname | github.com |
| None | 5290d7e14309ad1e76106a9c4237bd1041517e83ea182c8ab756752cb0c6940b |
| turbo-cache-control | no-preview |
| go-import | github.com/splunk/splunk-sdk-java git https://github.com/splunk/splunk-sdk-java.git |
| octolytics-dimension-user_id | 651467 |
| octolytics-dimension-user_login | splunk |
| octolytics-dimension-repository_id | 1777352 |
| octolytics-dimension-repository_nwo | splunk/splunk-sdk-java |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 1777352 |
| octolytics-dimension-repository_network_root_nwo | splunk/splunk-sdk-java |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 9c975978430e9ad293956f2bbdaf153b1bd84a99 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width