*/
package org.opendaylight.restconf.nb.rfc8040.utils.parser;
-import com.google.common.base.Preconditions;
import java.util.Iterator;
+import java.util.Locale;
import java.util.Map.Entry;
+import org.opendaylight.restconf.common.errors.RestconfDocumentedException;
+import org.opendaylight.restconf.common.errors.RestconfError.ErrorTag;
+import org.opendaylight.restconf.common.errors.RestconfError.ErrorType;
import org.opendaylight.restconf.nb.rfc8040.utils.RestconfConstants;
import org.opendaylight.restconf.nb.rfc8040.utils.parser.builder.ParserBuilderConstants;
import org.opendaylight.restconf.nb.rfc8040.utils.parser.builder.ParserBuilderConstants.Serializer;
final PathArgument arg = data.getPathArguments().get(i);
variables.setCurrent(variables.getCurrent().getChild(arg));
-
- Preconditions.checkArgument(variables.getCurrent() != null,
- "Invalid input %s: schema for argument %s (after %s) not found", data, arg, path);
-
+ RestconfDocumentedException.throwIf(variables.getCurrent() == null, ErrorType.APPLICATION,
+ ErrorTag.UNKNOWN_ELEMENT, "Invalid input '%s': schema for argument '%s' (after '%s') not found",
+ data, arg, path);
if (variables.getCurrent().isMixin()) {
continue;
}
private static void prepareNodeWithPredicates(final StringBuilder path, final PathArgument arg) {
path.append(arg.getNodeType().getLocalName());
- final Iterator<Entry<QName, Object>> iterator = ((NodeIdentifierWithPredicates) arg).getKeyValues()
- .entrySet().iterator();
-
+ final Iterator<Entry<QName, Object>> iterator = ((NodeIdentifierWithPredicates) arg).entrySet().iterator();
if (iterator.hasNext()) {
path.append(ParserBuilderConstants.Deserializer.EQUAL);
}
while (start < valueOf.length()) {
if (Serializer.PERCENT_ENCODE_CHARS.matches(valueOf.charAt(start))) {
final String format = String.format("%x", (int) valueOf.charAt(start));
- final String upperCase = format.toUpperCase();
+ final String upperCase = format.toUpperCase(Locale.ROOT);
sb.append(ParserBuilderConstants.Deserializer.PERCENT_ENCODING + upperCase);
} else {
sb.append(valueOf.charAt(start));