[jira] (MILYN-647) Java-Binding: Inner class enum results ClassNotFoundException

View: New views
2 Messages — Rating Filter:   Alert me  

[jira] (MILYN-647) Java-Binding: Inner class enum results ClassNotFoundException

by JIRA jira@codehaus.org :: Rate this Message:

| View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.
Issue Type: Bug Bug
Affects Versions: Smooks v1.5
Assignee: Unassigned
Attachments: SmooksEnumTest.zip
Components: Smooks Javabean
Created: 19/Jun/12 2:40 AM
Description:

Hello,

I've created attached example. I'm using following xml

<order>
<header>
<info>test</info>
</header>
<items>
<item-a>
<a>test-a</a>
</item-a>
<item-b>
<b>test-b</b>
</item-b>
<item-v>
<c>test-v</c>
</item-v>
</items>
</order>

This should be mapped/bind into following classes:
public class Order {
public OrderHeader getHeader() { return header; }
public void setHeader(OrderHeader header) { this.header = header; }
public List<Item> getItems() { return items; }
public void setItems(List<Item> items) { this.items = items; }
private OrderHeader header;
private List<Item> items;
}

public class OrderHeader {
String info;
public String getInfo() { return info; }
public void setInfo(String info) { this.info = info; }
}

public class Item {
public enum ItemType { A, B, V };
private ItemType itemType;
private String a;
private String b;
private String c;
public void setA(String a) { this.a = a; }
public void setB(String b) { this.b = b; }
public void setC(String c) { this.c = c; }
public void setItemType(ItemType itemType) { this.itemType = itemType; }
public String getA() { return a; }
public String getB() { return b; }
public String getC() { return c; }
public ItemType getItemType() { return itemType; }
}

Therefore I'm using following configuration:

<smooks-resource-list xmlns="http://www.milyn.org/xsd/smooks-1.1.xsd"
xmlns:core="http://www.milyn.org/xsd/smooks/smooks-core-1.4.xsd"
xmlns:jb="http://www.milyn.org/xsd/smooks/javabean-1.4.xsd">
<jb:bean beanId="Order" class="smooksenumtest.Order" createOnElement="order">
<jb:wiring property="items" beanIdRef="items" />
</jb:bean>
<jb:bean beanId="items" class="java.util.ArrayList" createOnElement="items">
<jb:wiring beanType="smooksenumtest.Item" />
</jb:bean>
<jb:bean beanId="a" class="smooksenumtest.Item" createOnElement="item-a">
<jb:value property="a" data="item-a/a" />
<!-- Using a non existing element to obtain default-value -->
<jb:value property="itemType" data="item-a/dummy" decoder="Enum" default="A" >
<jb:decodeParam name="enumType">smooksenumtest.Item#ItemType</jb:decodeParam>
<jb:decodeParam name="A">A</jb:decodeParam>
</jb:value>
</jb:bean>
</smooks-resource-list>

This configuration generates following exception:

Exception in thread "main" org.milyn.cdr.SmooksConfigurationException: Invalid Enum decoder configuration. Failed to resolve 'org.packacge.Item.ItemType' as a Java Enum Class.

And depends on a ClassNotFound-Exception from the EnumDecoder. The class exists. If I create a "standalone" java enum everything works fine.
Smooks is just unable to find the enum inside the Item class.

Environment: Windows 7, Java 1.7.0_04
Project: Milyn
Priority: Major Major
Reporter: Wolf Mische
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators.
For more information on JIRA, see: http://www.atlassian.com/software/jira
--------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email

[jira] (MILYN-647) Java-Binding: Inner class enum results ClassNotFoundException

by JIRA jira@codehaus.org :: Rate this Message:

| View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.
Wolf Mische resolved Bug MILYN-647 as Not A Bug

The Reflection API uses $ instead of . or # for inner classes/enums.
Solution:
using smooksenumtest.Item$ItemType inside the smooks-configuration.

Change By: Wolf Mische (20/Jun/12 3:33 AM)
Resolution: Not A Bug
Status: Open Resolved
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators.
For more information on JIRA, see: http://www.atlassian.com/software/jira
--------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email