Skip to content

Commit

Permalink
[MSC-76] Problem in DFA parser causes quoted last segment to be doubl…
Browse files Browse the repository at this point in the history
…ed in final service name
  • Loading branch information
dmlloyd committed Apr 29, 2011
1 parent 156289a commit 2eeb9c9
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/main/java/org/jboss/msc/service/ServiceName.java
Expand Up @@ -456,9 +456,11 @@ public static ServiceName parse(String original) throws IllegalArgumentException
// End of string unexpected.
throw unexpectedEnd();
}
case 1:
case 9: {
case 1: {
segments.add(builder.toString());
// fall thru
}
case 9: {
break;
}
default: throw new IllegalStateException();
Expand Down
8 changes: 8 additions & 0 deletions src/test/java/org/jboss/msc/service/ServiceNameTestCase.java
Expand Up @@ -293,4 +293,12 @@ public void testSerialize() throws Exception {
ObjectInputStream objectInputStream = new ObjectInputStream(new ByteArrayInputStream(bytes));
assertEquals(serviceName, objectInputStream.readObject());
}

@Test
public void testMsc76Parsing() {
assertEquals(ServiceName.parse("jboss.server.path.\"java.home\""), ServiceName.of("jboss", "server", "path", "java.home"));
assertEquals(ServiceName.parse("jboss.server.path.\"jboss.home.dir\""), ServiceName.of("jboss", "server", "path", "jboss.home.dir"));
assertEquals(ServiceName.parse("\"first.section\".\"second.section\".third.fourth"), ServiceName.of("first.section", "second.section", "third", "fourth"));
assertEquals(ServiceName.parse("\"all.in.one\""), ServiceName.of("all.in.one"));
}
}

0 comments on commit 2eeb9c9

Please sign in to comment.