You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by an...@apache.org on 2005/03/09 04:28:29 UTC

svn commit: r156601 - cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/samples/DateTestJavaSelectionList.java

Author: antonio
Date: Tue Mar  8 19:28:28 2005
New Revision: 156601

URL: http://svn.apache.org/viewcvs?view=rev&rev=156601
Log:
Fix the build

Modified:
    cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/samples/DateTestJavaSelectionList.java

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/samples/DateTestJavaSelectionList.java
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/samples/DateTestJavaSelectionList.java?view=diff&r1=156600&r2=156601
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/samples/DateTestJavaSelectionList.java (original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/samples/DateTestJavaSelectionList.java Tue Mar  8 19:28:28 2005
@@ -28,11 +28,10 @@
     protected boolean build() throws Exception {
         Calendar c = Calendar.getInstance();
         c.set(2003, 0, 1);
-        this.addItem(c.getTime(), null);
+        this.addItem(c.getTime(), (String)null);
         c.set(2004, 0, 1);
-        this.addItem(c.getTime(), null);
-        this.addItem(new Date(), null);
+        this.addItem(c.getTime(), (String)null);
+        this.addItem(new Date(), (String)null);
         return false;
     }
-
 }



Re: Java 5 - '(String) null'

Posted by Vadim Gritsenko <va...@reverycodes.com>.
Antonio Gallardo wrote:
> See:
> src/blocks/forms/java/org/apache/cocoon/forms/samples/DateTestJavaSelectionList.java
> 
> In the buld method() there where originally 3 nulls instead of the "fast
> fixed" (String)null.
> 
> Without the casting of the null the compiler in 1.4.2_07 said it was not
> able to decide wich of this 2 methods use:
> 
> protected void addItem(Object value, String label)
> protected void addItem(Object value, XMLizable label)

Yep.


> This is why I casted them to (String). I don't carefully checked the code,
> I just wanted the code to compile and test other things. Since we are near
> to a release I am doing full builds now (Sorry, my fault).
> 
> All in all, Since the class is under the o.a.c.forms.samples package, then
> I don't think it is an important one. Hence I thought will be OK a quick
> fix here.
> 
> If someone know better where is used this code and why, please review the
> fix and change it as the best it can be.

(String) null is the proper fix, so all is ok now.

Vadim

Re: Java 5 - '(String) null'

Posted by Antonio Gallardo <ag...@agssa.net>.
On Mie, 9 de Marzo de 2005, 7:43, Vadim Gritsenko dijo:
> Antonio Gallardo wrote:
>> On Mie, 9 de Marzo de 2005, 2:14, Reinhard Poetz dijo:
>>
>>>antonio@apache.org wrote:
>>>
>>>
>>>>+        this.addItem(c.getTime(), (String)null);
>>>
>>>I guess Java 5 needs this strange casts "(String) null". What's the
>>> reason
>>>for this?
>>
>>
>> Not only java 5. The build was broken even using 1.4.2. I just did a
>> quick
>> fix hoping somebody else will note it.
>>
>> Seems like there are to methods for addItem(c.getTime(), null):
>>
>> protected void addItem(Object value, String label)
>> protected void addItem(Object value, XMLizable label)
>>
>> See:
>>
>> src/blocks/forms/java/org/apache/cocoon/forms/datatype/AbstractJavaSelectionList.java
>>
>> Please fix it. ;-)
>
> I'm not following you. What should be fixed now?

See:
src/blocks/forms/java/org/apache/cocoon/forms/samples/DateTestJavaSelectionList.java

In the buld method() there where originally 3 nulls instead of the "fast
fixed" (String)null.

Without the casting of the null the compiler in 1.4.2_07 said it was not
able to decide wich of this 2 methods use:

protected void addItem(Object value, String label)
protected void addItem(Object value, XMLizable label)

This is why I casted them to (String). I don't carefully checked the code,
I just wanted the code to compile and test other things. Since we are near
to a release I am doing full builds now (Sorry, my fault).

All in all, Since the class is under the o.a.c.forms.samples package, then
I don't think it is an important one. Hence I thought will be OK a quick
fix here.

If someone know better where is used this code and why, please review the
fix and change it as the best it can be.

Best Regards,

Antonio Gallardo.



Re: Java 5 - '(String) null'

Posted by Vadim Gritsenko <va...@reverycodes.com>.
Antonio Gallardo wrote:
> On Mie, 9 de Marzo de 2005, 2:14, Reinhard Poetz dijo:
> 
>>antonio@apache.org wrote:
>>
>>
>>>+        this.addItem(c.getTime(), (String)null);
>>
>>I guess Java 5 needs this strange casts "(String) null". What's the reason
>>for this?
> 
> 
> Not only java 5. The build was broken even using 1.4.2. I just did a quick
> fix hoping somebody else will note it.
> 
> Seems like there are to methods for addItem(c.getTime(), null):
> 
> protected void addItem(Object value, String label)
> protected void addItem(Object value, XMLizable label)
> 
> See:
> 
> src/blocks/forms/java/org/apache/cocoon/forms/datatype/AbstractJavaSelectionList.java
> 
> Please fix it. ;-)

I'm not following you. What should be fixed now?

Vadim

Re: Java 5 - '(String) null'

Posted by Antonio Gallardo <ag...@agssa.net>.
On Mie, 9 de Marzo de 2005, 2:14, Reinhard Poetz dijo:
> antonio@apache.org wrote:
>
>> +        this.addItem(c.getTime(), (String)null);
>
> I guess Java 5 needs this strange casts "(String) null". What's the reason
> for this?

Not only java 5. The build was broken even using 1.4.2. I just did a quick
fix hoping somebody else will note it.

Seems like there are to methods for addItem(c.getTime(), null):

protected void addItem(Object value, String label)
protected void addItem(Object value, XMLizable label)

See:

src/blocks/forms/java/org/apache/cocoon/forms/datatype/AbstractJavaSelectionList.java

Please fix it. ;-)

Best regards,

Antonio Gallardo.


Re: Java 5 - '(String) null'

Posted by Antonio Gallardo <ag...@agssa.net>.
On Mie, 9 de Marzo de 2005, 8:41, Peter Hunsberger dijo:
> On Wed, 09 Mar 2005 09:14:00 +0100, Reinhard Poetz <re...@apache.org>
wrote:
>> antonio@apache.org wrote:
>> > +        this.addItem(c.getTime(), (String)null);
>> I guess Java 5 needs this strange casts "(String) null". What's the
reason for this?
>
> Got me, but I've allso had problems with 1.4.2_06 giving a CCE on an
naked null. Surprised the heck out of me...

Yep. I got the problem doing a full rebuild using 1.4.2_07. I am still not
using Java 5 for my daily work. I am planning to move to java 5 as my
default SDK soon.

Here is the current output without the "weird" cast:

/home/agallardo/svn/cocoon-2.1/src/blocks/forms/java/org/apache/cocoon/forms/samples/DateTestJavaSelectionList.java:31:
reference to addItemis ambiguous, both method
addItem(java.lang.Object,java.lang.String) in
org.apache.cocoon.forms.datatype.AbstractJavaSelectionList and method
addItem(java.lang.Object,org.apache.excalibur.xml.sax.XMLizable) in
org.apache.cocoon.forms.datatype.AbstractJavaSelectionList match
        this.addItem(c.getTime(), null);
        ^
/home/agallardo/svn/cocoon-2.1/src/blocks/forms/java/org/apache/cocoon/forms/samples/DateTestJavaSelectionList.java:33:
reference to addItemis ambiguous, both method
addItem(java.lang.Object,java.lang.String) in
org.apache.cocoon.forms.datatype.AbstractJavaSelectionList and method
addItem(java.lang.Object,org.apache.excalibur.xml.sax.XMLizable) in
org.apache.cocoon.forms.datatype.AbstractJavaSelectionList match
        this.addItem(c.getTime(), null);
        ^
/home/agallardo/svn/cocoon-2.1/src/blocks/forms/java/org/apache/cocoon/forms/samples/DateTestJavaSelectionList.java:34:
reference to addItemis ambiguous, both method
addItem(java.lang.Object,java.lang.String) in
org.apache.cocoon.forms.datatype.AbstractJavaSelectionList and method
addItem(java.lang.Object,org.apache.excalibur.xml.sax.XMLizable) in
org.apache.cocoon.forms.datatype.AbstractJavaSelectionList match
        this.addItem(new Date(), null);
        ^
3 errors

Best Regards,

Antonio Gallardo




Re: Java 5 - "(String) null"

Posted by Peter Hunsberger <pe...@gmail.com>.
On Wed, 09 Mar 2005 09:14:00 +0100, Reinhard Poetz <re...@apache.org> wrote:
> antonio@apache.org wrote:
> 
> > +        this.addItem(c.getTime(), (String)null);
> 
> I guess Java 5 needs this strange casts "(String) null". What's the reason for this?
> 

Got me, but I've allso had problems with 1.4.2_06 giving a CCE on an
naked null. Surprised the heck out of me...

-- 
Peter Hunsberger

Java 5 - "(String) null"

Posted by Reinhard Poetz <re...@apache.org>.
antonio@apache.org wrote:

> +        this.addItem(c.getTime(), (String)null);

I guess Java 5 needs this strange casts "(String) null". What's the reason for this?

-- 
Reinhard Pötz           Independant Consultant, Trainer & (IT)-Coach 

{Software Engineering, Open Source, Web Applications, Apache Cocoon}

                                        web(log): http://www.poetz.cc
--------------------------------------------------------------------