Merge branch 'jetty-9.2.x' into jetty-9.3.x
This commit is contained in:
commit
6abb272619
|
@ -18,8 +18,6 @@
|
|||
|
||||
package org.eclipse.jetty.start;
|
||||
|
||||
import static org.eclipse.jetty.start.UsageException.ERR_BAD_ARG;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.util.ArrayList;
|
||||
|
@ -34,6 +32,8 @@ import java.util.regex.Pattern;
|
|||
|
||||
import org.eclipse.jetty.start.Props.Prop;
|
||||
|
||||
import static org.eclipse.jetty.start.UsageException.ERR_BAD_ARG;
|
||||
|
||||
/**
|
||||
* Management of Properties.
|
||||
* <p>
|
||||
|
@ -227,8 +227,6 @@ public final class Props implements Iterable<Prop>
|
|||
throw new PropsException(err.toString());
|
||||
}
|
||||
|
||||
seenStack.push(property);
|
||||
|
||||
// find property name
|
||||
expanded.append(str.subSequence(offset,mat.start()));
|
||||
// get property value
|
||||
|
@ -241,7 +239,9 @@ public final class Props implements Iterable<Prop>
|
|||
else
|
||||
{
|
||||
// recursively expand
|
||||
seenStack.push(property);
|
||||
value = expand(value,seenStack);
|
||||
seenStack.pop();
|
||||
expanded.append(value);
|
||||
}
|
||||
// update offset
|
||||
|
|
|
@ -18,15 +18,18 @@
|
|||
|
||||
package org.eclipse.jetty.start;
|
||||
|
||||
import static org.hamcrest.Matchers.nullValue;
|
||||
import static org.junit.Assert.assertThat;
|
||||
import static org.junit.Assert.fail;
|
||||
import org.eclipse.jetty.start.Props.Prop;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.hamcrest.Matchers.is;
|
||||
import static org.hamcrest.Matchers.notNullValue;
|
||||
import static org.hamcrest.Matchers.nullValue;
|
||||
import static org.junit.Assert.assertThat;
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
import org.eclipse.jetty.start.Props.Prop;
|
||||
import org.junit.Test;
|
||||
|
||||
public class PropsTest
|
||||
{
|
||||
private static final String FROM_TEST = "(test)";
|
||||
|
@ -121,6 +124,17 @@ public class PropsTest
|
|||
assertThat(props.expand("server-id=corporate-${id}"),is("server-id=corporate-jetty-9.1"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testExpandDouble()
|
||||
{
|
||||
Props props = new Props();
|
||||
props.setProperty("bar","apple",FROM_TEST);
|
||||
props.setProperty("foo","foo/${bar}/${bar}-xx",FROM_TEST);
|
||||
|
||||
// Should expand
|
||||
assertThat(props.expand("foo/${bar}/${bar}-xx"),is("foo/apple/apple-xx"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testExpandLoop()
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue