You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by ta...@apache.org on 2019/05/14 12:05:34 UTC
[myfaces] branch master updated: fixed aboslute ordering
This is an automated email from the ASF dual-hosted git repository.
tandraschko pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/myfaces.git
The following commit(s) were added to refs/heads/master by this push:
new 88dc575 fixed aboslute ordering
88dc575 is described below
commit 88dc575dea9e7897a9697220fbf0a95ace876df0
Author: Thomas Andraschko <ta...@apache.org>
AuthorDate: Tue May 14 14:05:26 2019 +0200
fixed aboslute ordering
---
.../config/impl/FacesConfigUnmarshallerImpl.java | 27 +++++++++++++++++-----
.../digister/FacesConfigUnmarshallerImplTest.java | 5 ++--
2 files changed, 24 insertions(+), 8 deletions(-)
diff --git a/impl/src/main/java/org/apache/myfaces/config/impl/FacesConfigUnmarshallerImpl.java b/impl/src/main/java/org/apache/myfaces/config/impl/FacesConfigUnmarshallerImpl.java
index 5db6ec9..a07f63b 100755
--- a/impl/src/main/java/org/apache/myfaces/config/impl/FacesConfigUnmarshallerImpl.java
+++ b/impl/src/main/java/org/apache/myfaces/config/impl/FacesConfigUnmarshallerImpl.java
@@ -241,13 +241,28 @@ public class FacesConfigUnmarshallerImpl implements FacesConfigUnmarshaller<Face
{
AbsoluteOrderingImpl obj = new AbsoluteOrderingImpl();
- onChild("name", node, (n) -> {
- obj.addOrderSlot(new FacesConfigNameSlotImpl(n.getTextContent()));
- });
+ if (node.getChildNodes() != null)
+ {
+ for (int i = 0; i < node.getChildNodes().getLength(); i++)
+ {
+ Node childNode = node.getChildNodes().item(i);
+ if (childNode == null)
+ {
+ continue;
+ }
- onChild("others", node, (n) -> {
- obj.addOrderSlot(new ConfigOthersSlotImpl());
- });
+ if ("name".equals(childNode.getLocalName()))
+ {
+ FacesConfigNameSlotImpl slot = new FacesConfigNameSlotImpl();
+ slot.setName(childNode.getTextContent());
+ obj.addOrderSlot(slot);
+ }
+ else if ("others".equals(childNode.getLocalName()))
+ {
+ obj.addOrderSlot(new ConfigOthersSlotImpl());
+ }
+ }
+ }
return obj;
}
diff --git a/impl/src/test/java/org/apache/myfaces/config/impl/digister/FacesConfigUnmarshallerImplTest.java b/impl/src/test/java/org/apache/myfaces/config/impl/digister/FacesConfigUnmarshallerImplTest.java
index 26e6f65..f3fb00e 100644
--- a/impl/src/test/java/org/apache/myfaces/config/impl/digister/FacesConfigUnmarshallerImplTest.java
+++ b/impl/src/test/java/org/apache/myfaces/config/impl/digister/FacesConfigUnmarshallerImplTest.java
@@ -26,6 +26,7 @@ import org.apache.myfaces.config.element.FacesConfig;
import org.apache.myfaces.config.element.FacesConfigNameSlot;
import org.apache.myfaces.config.element.LocaleConfig;
import org.apache.myfaces.config.element.OrderSlot;
+import org.apache.myfaces.config.impl.elements.ConfigOthersSlotImpl;
/**
* @author Mathias Broekelmann (latest modification by $Author$)
@@ -118,8 +119,8 @@ public class FacesConfigUnmarshallerImplTest extends TestCase
assertEquals("b", ((FacesConfigNameSlot) orderList.get(0)).getName());
assertEquals("c", ((FacesConfigNameSlot) orderList.get(1)).getName());
- assertEquals("d", ((FacesConfigNameSlot) orderList.get(2)).getName());
- assertEquals(org.apache.myfaces.config.impl.elements.ConfigOthersSlotImpl.class, orderList.get(3).getClass());
+ assertEquals(ConfigOthersSlotImpl.class, orderList.get(2).getClass());
+ assertEquals("d", ((FacesConfigNameSlot) orderList.get(3)).getName());
assertTrue(cfg.getApplications().isEmpty());
assertTrue(cfg.getComponents().isEmpty());