408945 XML Args ignored without DTD
This commit is contained in:
parent
7bb3a7be28
commit
1bbab6d6f2
|
@ -741,7 +741,6 @@ public class XmlConfiguration
|
||||||
private Object newObj(Object obj, XmlParser.Node node) throws Exception
|
private Object newObj(Object obj, XmlParser.Node node) throws Exception
|
||||||
{
|
{
|
||||||
Class<?> oClass = nodeClass(node);
|
Class<?> oClass = nodeClass(node);
|
||||||
int size = 0;
|
|
||||||
int argIndex = node.size();
|
int argIndex = node.size();
|
||||||
for (int i = 0; i < node.size(); i++)
|
for (int i = 0; i < node.size(); i++)
|
||||||
{
|
{
|
||||||
|
@ -753,13 +752,12 @@ public class XmlConfiguration
|
||||||
argIndex = i;
|
argIndex = i;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
size++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Map<String, Object> namedArgMap = new HashMap<>();
|
Map<String, Object> namedArgMap = new HashMap<>();
|
||||||
List<Object> arguments = new LinkedList<>();
|
List<Object> arguments = new LinkedList<>();
|
||||||
|
|
||||||
for (int i = 0; i < size; i++)
|
for (int i = 0; i < node.size(); i++)
|
||||||
{
|
{
|
||||||
Object o = node.get(i);
|
Object o = node.get(i);
|
||||||
|
|
||||||
|
|
|
@ -25,6 +25,7 @@ import static org.junit.Assert.assertEquals;
|
||||||
import static org.junit.Assert.assertThat;
|
import static org.junit.Assert.assertThat;
|
||||||
import static org.junit.Assert.assertTrue;
|
import static org.junit.Assert.assertTrue;
|
||||||
|
|
||||||
|
import java.io.ByteArrayInputStream;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
@ -541,6 +542,34 @@ public class XmlConfigurationTest
|
||||||
Assert.assertEquals("nested second parameter not wired correctly","arg2", atc.getNested().getSecond());
|
Assert.assertEquals("nested second parameter not wired correctly","arg2", atc.getNested().getSecond());
|
||||||
Assert.assertEquals("nested third parameter not wired correctly","arg3", atc.getNested().getThird());
|
Assert.assertEquals("nested third parameter not wired correctly","arg3", atc.getNested().getThird());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testArgumentsGetIgnoredMissingDTD() throws Exception
|
||||||
|
{
|
||||||
|
XmlConfiguration xmlConfiguration = new XmlConfiguration(new ByteArrayInputStream(("" +
|
||||||
|
"<Configure class=\"org.eclipse.jetty.xml.AnnotatedTestConfiguration\">" +
|
||||||
|
" <Arg>arg1</Arg> " +
|
||||||
|
" <Arg>arg2</Arg> " +
|
||||||
|
" <Arg>arg3</Arg> " +
|
||||||
|
" <Set name=\"nested\"> " +
|
||||||
|
" <New class=\"org.eclipse.jetty.xml.AnnotatedTestConfiguration\">\n" +
|
||||||
|
" <Arg>arg1</Arg>\n" +
|
||||||
|
" <Arg>arg2</Arg>\n" +
|
||||||
|
" <Arg>arg3</Arg>\n" +
|
||||||
|
" </New>" +
|
||||||
|
" </Set>" +
|
||||||
|
"</Configure>").getBytes("ISO-8859-1")));
|
||||||
|
// XmlConfiguration xmlConfiguration = new XmlConfiguration(url);
|
||||||
|
|
||||||
|
AnnotatedTestConfiguration atc = (AnnotatedTestConfiguration)xmlConfiguration.configure();
|
||||||
|
|
||||||
|
Assert.assertEquals("first parameter not wired correctly","arg1", atc.getFirst());
|
||||||
|
Assert.assertEquals("second parameter not wired correctly","arg2", atc.getSecond());
|
||||||
|
Assert.assertEquals("third parameter not wired correctly","arg3", atc.getThird());
|
||||||
|
Assert.assertEquals("nested first parameter not wired correctly","arg1", atc.getNested().getFirst());
|
||||||
|
Assert.assertEquals("nested second parameter not wired correctly","arg2", atc.getNested().getSecond());
|
||||||
|
Assert.assertEquals("nested third parameter not wired correctly","arg3", atc.getNested().getThird());
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testNestedConstructorNamedInjectionUnorderedMixed() throws Exception
|
public void testNestedConstructorNamedInjectionUnorderedMixed() throws Exception
|
||||||
|
|
Loading…
Reference in New Issue