Skip to content

Commit

Permalink
Fixed TCK tests - allowing to use http://xxx:8888... as a JNDI name
Browse files Browse the repository at this point in the history
Signed-off-by: David Matějček <david.matejcek@omnifish.ee>
  • Loading branch information
dmatej committed Nov 14, 2022
1 parent a29f9af commit b0b28fa
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,11 @@ public class SimpleJndiName implements Serializable, Comparable<SimpleJndiName>
* not contain more than one colon.
*/
public SimpleJndiName(final String jndiName) {
if (!jndiName.startsWith(JNDI_CTX_CORBA)) {
if (jndiName.startsWith(JNDI_CTX_JAVA)) {
int firstColon = jndiName.indexOf(':');
if (firstColon >= 0 && firstColon != jndiName.lastIndexOf(':')) {
throw new IllegalArgumentException(
"Non-corba JNDI name is not allowed to contain more than one colon: " + jndiName);
"The " + JNDI_CTX_JAVA + " JNDI name is not allowed to contain more than one colon: " + jndiName);
}
}
this.jndiName = jndiName;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ public class SimpleJndiNameTest {
public void constructorValidations() {
assertAll(
() -> assertThrows(NullPointerException.class, () -> new SimpleJndiName(null)),
() -> assertThrows(IllegalArgumentException.class, () -> new SimpleJndiName("x:y:z")),
() -> assertThrows(IllegalArgumentException.class, () -> new SimpleJndiName("java:x:y:z")),
() -> assertDoesNotThrow(() -> new SimpleJndiName("http://validJndiName:7777/something/somewhere")),
() -> assertDoesNotThrow(() -> new SimpleJndiName(""))
);
}
Expand Down

0 comments on commit b0b28fa

Please sign in to comment.