You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hivemind.apache.org by Jean-Francois Poilpret <jf...@hcm.vnn.vn> on 2005/07/06 17:55:53 UTC

Configuration as List of String and nulls

Hello,

For some configurations, I need to have something that looks like the
following (NB: the real case is more complex, but the next example exhibits
the problem I meet):

<configuration-point id="Menus">
	<schema>
		<element name="item">
			<attribute name="id"/>
			<rules>
				<push-attribute attribute="id"/>
				<invoke-parent method="addElement"/>
			</rules>
		</element>
	</schema>
</configuration-point>

Please note that:
- the "id" attribute defines no translator (so passed directly as String)
- the "id attribute is not required

Then in my configuration I put:

<contribution configuration-id="Menus">
	<item id="item-1"/>
	<item/>
</contribution>

>From the schema that I declared the second "item" tag is valid (no id
attribute). However, when I get the configuration and I want to use it, I
have got an exception:

org.apache.hivemind.ApplicationRuntimeException: 
	Unable to construct configuration test.Menus: 
	Error invoking method addElement on
org.apache.hivemind.impl.SchemaProcessorImpl@172e449 
	(at
jar:file:/C:/dev/hivetranse-hm11/build/bugs.test.jar!/META-INF/hivemodule.xm
l, line 10): 
	java.lang.NullPointerException
[jar:file:/C:/dev/hivetranse-hm11/build/bugs.test.jar!/META-INF/hivemodule.x
ml, line 10] 
at
org.apache.hivemind.impl.ConfigurationPointImpl.processContributionElements(
ConfigurationPointImpl.java:273) 
at
org.apache.hivemind.impl.ConfigurationPointImpl.constructElements(Configurat
ionPointImpl.java:189) 
at
org.apache.hivemind.impl.ElementsInnerProxyList.inner(ElementsInnerProxyList
.java:46) 
at
org.apache.hivemind.impl.ElementsInnerProxyList.size(ElementsInnerProxyList.
java:62) 
at
org.apache.hivemind.impl.ElementsProxyList.size(ElementsProxyList.java:60) 
at
test.MenuContributionTest.testMenuContribution(MenuContributionTest.java:25)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39
) 
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
.java:25)

Caused by: org.apache.hivemind.ApplicationRuntimeException: 
	Error invoking method addElement on
org.apache.hivemind.impl.SchemaProcessorImpl@172e449 
	(at
jar:file:/C:/dev/hivetranse-hm11/build/bugs.test.jar!/META-INF/hivemodule.xm
l, line 10): 
	java.lang.NullPointerException
[jar:file:/C:/dev/hivetranse-hm11/build/bugs.test.jar!/META-INF/hivemodule.x
ml, line 10] 
at
org.apache.hivemind.schema.rules.InvokeParentRule.begin(InvokeParentRule.jav
a:63) 
at org.apache.hivemind.impl.SchemaElement.fireBegin(SchemaElement.java:228) 
at
org.apache.hivemind.impl.SchemaProcessorImpl.processElement(SchemaProcessorI
mpl.java:255) 
at
org.apache.hivemind.impl.SchemaProcessorImpl.processRootElement(SchemaProces
sorImpl.java:235) 
at
org.apache.hivemind.impl.SchemaProcessorImpl.process(SchemaProcessorImpl.jav
a:223) 
at
org.apache.hivemind.impl.ConfigurationPointImpl.processContributionElements(
ConfigurationPointImpl.java:268) 
... 20 more

Caused by: java.lang.NullPointerException 
at
org.apache.hivemind.schema.rules.InvokeParentRule.begin(InvokeParentRule.jav
a:57) 
... 25 more

Actually, I would have expected to get a List of 2 Strings, the first being
"item-1", the second being null.

Is my assumption founded (ie, can I consider this to be a HiveMind problem)
or should I consider a different way to handle this situation (Note that I
have another way already but I am not very pleased with it: I had to write a
class wrapping a String to make this work).

Thanks for any answer/comment.
Cheers

	Jean-Francois



---------------------------------------------------------------------
To unsubscribe, e-mail: hivemind-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: hivemind-user-help@jakarta.apache.org


RE: Configuration as List of String and nulls

Posted by Jean-Francois Poilpret <jf...@hcm.vnn.vn>.
Hello Knut,

Thank you for your prompt answer.
Yes, allowing null in <invoke-parent> rule is the way I would like it to be.

Cheers

	Jean-Francois

-----Original Message-----
From: Knut Wannheden [mailto:knut.wannheden@gmail.com] 
Sent: Thursday, July 07, 2005 12:27 AM
To: hivemind-user@jakarta.apache.org
Subject: Re: Configuration as List of String and nulls

Jean-Francois,

The error message you get is missleading so this is certainly
something we have to fix in HiveMind.

I think we should actually change the <invoke-parent> rule to allow
null values. I take it that's what your preferred solution would be as
well, no?

--knut

On 7/6/05, Jean-Francois Poilpret <jf...@hcm.vnn.vn> wrote:
> Hello,
> 
> For some configurations, I need to have something that looks like the
> following (NB: the real case is more complex, but the next example
exhibits
> the problem I meet):
> 
> <configuration-point id="Menus">
>         <schema>
>                 <element name="item">
>                         <attribute name="id"/>
>                         <rules>
>                                 <push-attribute attribute="id"/>
>                                 <invoke-parent method="addElement"/>
>                         </rules>
>                 </element>
>         </schema>
> </configuration-point>
> 
> Please note that:
> - the "id" attribute defines no translator (so passed directly as String)
> - the "id attribute is not required
> 
> Then in my configuration I put:
> 
> <contribution configuration-id="Menus">
>         <item id="item-1"/>
>         <item/>
> </contribution>
> 
> From the schema that I declared the second "item" tag is valid (no id
> attribute). However, when I get the configuration and I want to use it, I
> have got an exception:
> 
> org.apache.hivemind.ApplicationRuntimeException:
>         Unable to construct configuration test.Menus:
>         Error invoking method addElement on
> org.apache.hivemind.impl.SchemaProcessorImpl@172e449
>         (at
>
jar:file:/C:/dev/hivetranse-hm11/build/bugs.test.jar!/META-INF/hivemodule.xm
> l, line 10):
>         java.lang.NullPointerException
>
[jar:file:/C:/dev/hivetranse-hm11/build/bugs.test.jar!/META-INF/hivemodule.x
> ml, line 10]
> at
>
org.apache.hivemind.impl.ConfigurationPointImpl.processContributionElements(
> ConfigurationPointImpl.java:273)
> at
>
org.apache.hivemind.impl.ConfigurationPointImpl.constructElements(Configurat
> ionPointImpl.java:189)
> at
>
org.apache.hivemind.impl.ElementsInnerProxyList.inner(ElementsInnerProxyList
> .java:46)
> at
>
org.apache.hivemind.impl.ElementsInnerProxyList.size(ElementsInnerProxyList.
> java:62)
> at
> org.apache.hivemind.impl.ElementsProxyList.size(ElementsProxyList.java:60)
> at
>
test.MenuContributionTest.testMenuContribution(MenuContributionTest.java:25)
> 
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
>
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39
> )
> at
>
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
> .java:25)
> 
> Caused by: org.apache.hivemind.ApplicationRuntimeException:
>         Error invoking method addElement on
> org.apache.hivemind.impl.SchemaProcessorImpl@172e449
>         (at
>
jar:file:/C:/dev/hivetranse-hm11/build/bugs.test.jar!/META-INF/hivemodule.xm
> l, line 10):
>         java.lang.NullPointerException
>
[jar:file:/C:/dev/hivetranse-hm11/build/bugs.test.jar!/META-INF/hivemodule.x
> ml, line 10]
> at
>
org.apache.hivemind.schema.rules.InvokeParentRule.begin(InvokeParentRule.jav
> a:63)
> at
org.apache.hivemind.impl.SchemaElement.fireBegin(SchemaElement.java:228)
> at
>
org.apache.hivemind.impl.SchemaProcessorImpl.processElement(SchemaProcessorI
> mpl.java:255)
> at
>
org.apache.hivemind.impl.SchemaProcessorImpl.processRootElement(SchemaProces
> sorImpl.java:235)
> at
>
org.apache.hivemind.impl.SchemaProcessorImpl.process(SchemaProcessorImpl.jav
> a:223)
> at
>
org.apache.hivemind.impl.ConfigurationPointImpl.processContributionElements(
> ConfigurationPointImpl.java:268)
> ... 20 more
> 
> Caused by: java.lang.NullPointerException
> at
>
org.apache.hivemind.schema.rules.InvokeParentRule.begin(InvokeParentRule.jav
> a:57)
> ... 25 more
> 
> Actually, I would have expected to get a List of 2 Strings, the first
being
> "item-1", the second being null.
> 
> Is my assumption founded (ie, can I consider this to be a HiveMind
problem)
> or should I consider a different way to handle this situation (Note that I
> have another way already but I am not very pleased with it: I had to write
a
> class wrapping a String to make this work).
> 
> Thanks for any answer/comment.
> Cheers
> 
>         Jean-Francois
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: hivemind-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: hivemind-user-help@jakarta.apache.org
> 
>

---------------------------------------------------------------------
To unsubscribe, e-mail: hivemind-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: hivemind-user-help@jakarta.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: hivemind-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: hivemind-user-help@jakarta.apache.org


Re: Configuration as List of String and nulls

Posted by Knut Wannheden <kn...@gmail.com>.
Jean-Francois,

The error message you get is missleading so this is certainly
something we have to fix in HiveMind.

I think we should actually change the <invoke-parent> rule to allow
null values. I take it that's what your preferred solution would be as
well, no?

--knut

On 7/6/05, Jean-Francois Poilpret <jf...@hcm.vnn.vn> wrote:
> Hello,
> 
> For some configurations, I need to have something that looks like the
> following (NB: the real case is more complex, but the next example exhibits
> the problem I meet):
> 
> <configuration-point id="Menus">
>         <schema>
>                 <element name="item">
>                         <attribute name="id"/>
>                         <rules>
>                                 <push-attribute attribute="id"/>
>                                 <invoke-parent method="addElement"/>
>                         </rules>
>                 </element>
>         </schema>
> </configuration-point>
> 
> Please note that:
> - the "id" attribute defines no translator (so passed directly as String)
> - the "id attribute is not required
> 
> Then in my configuration I put:
> 
> <contribution configuration-id="Menus">
>         <item id="item-1"/>
>         <item/>
> </contribution>
> 
> From the schema that I declared the second "item" tag is valid (no id
> attribute). However, when I get the configuration and I want to use it, I
> have got an exception:
> 
> org.apache.hivemind.ApplicationRuntimeException:
>         Unable to construct configuration test.Menus:
>         Error invoking method addElement on
> org.apache.hivemind.impl.SchemaProcessorImpl@172e449
>         (at
> jar:file:/C:/dev/hivetranse-hm11/build/bugs.test.jar!/META-INF/hivemodule.xm
> l, line 10):
>         java.lang.NullPointerException
> [jar:file:/C:/dev/hivetranse-hm11/build/bugs.test.jar!/META-INF/hivemodule.x
> ml, line 10]
> at
> org.apache.hivemind.impl.ConfigurationPointImpl.processContributionElements(
> ConfigurationPointImpl.java:273)
> at
> org.apache.hivemind.impl.ConfigurationPointImpl.constructElements(Configurat
> ionPointImpl.java:189)
> at
> org.apache.hivemind.impl.ElementsInnerProxyList.inner(ElementsInnerProxyList
> .java:46)
> at
> org.apache.hivemind.impl.ElementsInnerProxyList.size(ElementsInnerProxyList.
> java:62)
> at
> org.apache.hivemind.impl.ElementsProxyList.size(ElementsProxyList.java:60)
> at
> test.MenuContributionTest.testMenuContribution(MenuContributionTest.java:25)
> 
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39
> )
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
> .java:25)
> 
> Caused by: org.apache.hivemind.ApplicationRuntimeException:
>         Error invoking method addElement on
> org.apache.hivemind.impl.SchemaProcessorImpl@172e449
>         (at
> jar:file:/C:/dev/hivetranse-hm11/build/bugs.test.jar!/META-INF/hivemodule.xm
> l, line 10):
>         java.lang.NullPointerException
> [jar:file:/C:/dev/hivetranse-hm11/build/bugs.test.jar!/META-INF/hivemodule.x
> ml, line 10]
> at
> org.apache.hivemind.schema.rules.InvokeParentRule.begin(InvokeParentRule.jav
> a:63)
> at org.apache.hivemind.impl.SchemaElement.fireBegin(SchemaElement.java:228)
> at
> org.apache.hivemind.impl.SchemaProcessorImpl.processElement(SchemaProcessorI
> mpl.java:255)
> at
> org.apache.hivemind.impl.SchemaProcessorImpl.processRootElement(SchemaProces
> sorImpl.java:235)
> at
> org.apache.hivemind.impl.SchemaProcessorImpl.process(SchemaProcessorImpl.jav
> a:223)
> at
> org.apache.hivemind.impl.ConfigurationPointImpl.processContributionElements(
> ConfigurationPointImpl.java:268)
> ... 20 more
> 
> Caused by: java.lang.NullPointerException
> at
> org.apache.hivemind.schema.rules.InvokeParentRule.begin(InvokeParentRule.jav
> a:57)
> ... 25 more
> 
> Actually, I would have expected to get a List of 2 Strings, the first being
> "item-1", the second being null.
> 
> Is my assumption founded (ie, can I consider this to be a HiveMind problem)
> or should I consider a different way to handle this situation (Note that I
> have another way already but I am not very pleased with it: I had to write a
> class wrapping a String to make this work).
> 
> Thanks for any answer/comment.
> Cheers
> 
>         Jean-Francois
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: hivemind-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: hivemind-user-help@jakarta.apache.org
> 
>

---------------------------------------------------------------------
To unsubscribe, e-mail: hivemind-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: hivemind-user-help@jakarta.apache.org