Skip to content
Browse files
Throw NPE from NamingContext when NameComponent has null fields
  • Loading branch information
joe-chacko committed Feb 13, 2015
1 parent 900fa43 commit cad2f331f25fb0290c6ae79a8bd63c5360017743
Showing 1 changed file with 9 additions and 2 deletions.
@@ -24,6 +24,7 @@

import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.logging.Level;
import java.util.logging.Logger;

@@ -613,8 +614,14 @@ protected void validateName(NameComponent[] n) throws InvalidName {
// we have at least one name, so validate the toplevel item
NameComponent name = n[0];

// more name validation
if ( == 0 && name.kind.length() == 0) {
// for remote invocation, client would have received an NPE on marshalling a NameComponent with a null field
// for local invocation, ok to propagate the NPE and not a CORBA BAD_PARAM
Objects.requireNonNull(, "A NameComponent must not have a null id field");
Objects.requireNonNull(name.kind, "A NameComponent must not have a null kind field");

// This ensures the name is not completely empty, but is this correct? CosNaming1.4 2.4.1 says:
// > The single '.' character is the only representation of a name with empty id and kind fields.
if ( && name.kind.isEmpty()) {
throw new InvalidName();

0 comments on commit cad2f33

Please sign in to comment.