- final String contentStr = content.get(0);
- builder.setContent(RestconfDocumentedException.throwIfNull(
- ContentParameter.forUriValue(contentStr), ErrorType.PROTOCOL, ErrorTag.INVALID_VALUE,
- "Invalid content parameter: %s, allowed values are %s", contentStr, POSSIBLE_CONTENT));
-
- final String depthStr = depth.get(0);
- try {
- builder.setDepth(DepthParameter.forUriValue(depthStr));
- } catch (IllegalArgumentException e) {
- throw new RestconfDocumentedException(e, new RestconfError(ErrorType.PROTOCOL, ErrorTag.INVALID_VALUE,
- "Invalid depth parameter: " + depthStr, null,
- "The depth parameter must be an integer between 1 and 65535 or \"unbounded\""));
+ final String contentStr = getSingleParameter(queryParams, ContentParameter.uriName());
+ if (contentStr != null) {
+ builder.setContent(RestconfDocumentedException.throwIfNull(
+ ContentParameter.forUriValue(contentStr), ErrorType.PROTOCOL, ErrorTag.INVALID_VALUE,
+ "Invalid content parameter: %s, allowed values are %s", contentStr, POSSIBLE_CONTENT));
+ }
+
+ // check and set depth
+ final String depthStr = getSingleParameter(queryParams, DepthParameter.uriName());
+ if (depthStr != null) {
+ try {
+ builder.setDepth(DepthParameter.forUriValue(depthStr));
+ } catch (IllegalArgumentException e) {
+ throw new RestconfDocumentedException(e, new RestconfError(ErrorType.PROTOCOL, ErrorTag.INVALID_VALUE,
+ "Invalid depth parameter: " + depthStr, null,
+ "The depth parameter must be an integer between 1 and 65535 or \"unbounded\""));
+ }