NodeId { public static NodeId parse(@Nonnull String s) throws UaRuntimeException { if (s.startsWith("ns=")) { int index = s.indexOf(";"); if (index == -1) { throw new UaRuntimeException(StatusCodes.Bad_NodeIdInvalid); } try { int namespaceIndex = Integer.parseInt(s.substring(3, index)); return parse(s.substring(index + 1), namespaceIndex); } catch (NumberFormatException e) { throw new UaRuntimeException(StatusCodes.Bad_NodeIdInvalid, e); } } else { return parse(s, 0); } } NodeId(int namespaceIndex, int identifier);  NodeId(int namespaceIndex, UInteger identifier);  NodeId(int namespaceIndex, String identifier);  NodeId(int namespaceIndex, UUID identifier);  NodeId(int namespaceIndex, ByteString identifier);  NodeId(UShort namespaceIndex, UInteger identifier);  NodeId(UShort namespaceIndex, int identifier);  NodeId(UShort namespaceIndex, String identifier);  NodeId(UShort namespaceIndex, UUID identifier);  NodeId(UShort namespaceIndex, ByteString identifier);   NodeId(@Nonnull UShort namespaceIndex, @Nonnull Object identifier); UShort getNamespaceIndex(); Object getIdentifier(); IdType getType(); ExpandedNodeId expanded(); ExpandedNodeId expanded(NamespaceTable namespaceTable); boolean isNull(); boolean isNotNull(); NodeId reindex(NamespaceTable namespaceTable, String namespaceUri); NodeId withId(UInteger id); NodeId withId(String id); NodeId withId(UUID id); NodeId withId(ByteString id); NodeId withNamespaceIndex(UShort namespaceIndex); @Override boolean equals(Object o); boolean equals(ExpandedNodeId xni); boolean equals(ExpandedNodeId xni, NamespaceTable namespaceTable); @Override int hashCode(); @Override String toString(); String toParseableString(); static NodeId parse(@Nonnull String s); @Nullable static NodeId parseOrNull(@Nonnull String s); static Optional<NodeId> parseSafe(@Nonnull String s); static final NodeId NULL_NUMERIC; static final NodeId NULL_STRING; static final NodeId NULL_GUID; static final NodeId NULL_OPAQUE; static final NodeId NULL_VALUE; }
@Test public void testParseInvalidInt() { assertThrows(UaRuntimeException.class, () -> NodeId.parse("ns=0;i=" + UInteger.MAX_VALUE + 1)); assertThrows(UaRuntimeException.class, () -> NodeId.parse("ns=0;i=" + -1)); }