Java Mailing List Archive

http://www.junlu.com/

Google
Google
Mailing List
Home
Forum Home
JBoss - Java Application Server
Tomcat - JSP/Servlet container
Struts - A MVC web framework
iText - An open source PDF Java Library
JDOM - JDOM XML Parser
JSP - A mailing list about Java Server Pages specification and reference
J2EE - A mailing list for Java(tm) 2 Platform, Enterprise Edition
J2EE Pattern - An interest list for Sun Java Center J2EE Pattern Catalog
Servlet - A mailing list for discussion about Sun Microsystem's Java Servlet API Technology
Struts & Hibernate
Subjects
JSP editor plugin for eclipse ?
org apache jasper JasperException: Unable to compile class for JSP
Tomcat: Connection reset by peer: socket write error
Cannot retrieve definition for form bean null
Struts Tiles Tutorial (free Struts training)
Where do I download Tomcat 4 0 6?
Data Access Object (DAO) pattern, example DAO 's
Where to download Tomcat v 4 1 24 from?
Tomcat 5 0 16 Requested resource not available
Subject: Servlet : Session invalidate
Oracle Connection Pooling in 3 2 2
Servlet action is currently unavailable
Tomcat/Struts Unicode Encoding/Decoding problems
Subject: Running a Simple JMS Example
Tomcat and webapplication specific java library path
Mapping in workers2 properties
org apache jasper JasperException
problem with html:text bean throwing exception
Cannot find message resources under key org apache struts action
   MESSAGE
Cannot find message resources under key org apache struts action MESSAGE
invalid direct reference problem with solution
Tool for jsp debug Try Sysdeo Eclipse Plugin
Tomcat 5 Cannot load JDBC driver class 'null ' SQL state: null
weblogic ejbc
java properties file
Jboss 3 2 3 Coyote Can 't re
Tomcat 5, Apache2 and mod jk2 integration problem
JBoss example problem new to J2EE
Value attribute of <html:checkbox
url string for connecting jboss to oracle
javax servlet ServletException: BeanUtils populate
5 0 18: Windows XP Pro vs Windows 2000
HTTP Status 404 The requested resource is not available
 
Subject: Re: Document getter/setter not the same (collection vs List)

Subject: Re: Document getter/setter not the same (collection vs List)

2007-09-19       - By Jason Hunter

 Back
Well, here's the source of the complaint:

In Document.java:

  public List getContent() { }
  public Document setContent(Collection newContent) { }

The JDOM programming contract is you can pass in any old Collection type
as content but JDOM promises on access to return a specific type of
Collection, a List.  NetBeans seems to have a problem with this.  It
must be making some wrong assumptions that Content is a property,
probably in the hidden magic it performs on the method since it's marked
@(protected)

-jh-

IL Bretone wrote:
> Hello,
>
> I'm trying to compile a class which will become a web service, I'm using
> Netbeans 5.5 and when i try to compile the following code:
>
> "
>     @(protected)
>     public Document getUserTrainingPlan(@(protected)(name="userId") String
> userId) {
>        
>        UserPlan[] availableUserPlans =
> AngelSelectQuery.doGetAvailbleUserPlans(userId);
>            
>        Document doc = new Document();
>        Element plans = new Element("plans");
>                        
>        for  ( int i = 0; i < availableUserPlans.length; i++) {
>           Element plan = new Element("plan").setAttribute("id",
> availableUserPlans[i].getPlan().getPlanId());
>           plan.addContent(new
> Element("creationDate").setText(angel.webapp.utils.Date4Jsp.getDate
(availableUserPlans[i].getPlan().getCreationDate())));
>           plan.addContent(new
> Element("name").setText(availableUserPlans[i].getPlan().getPlanName()));
>           plan.addContent(new
> Element("creator").setText(availableUserPlans[i].getPlan().getCreator()
.getGeneralInfo()));
>           plan.addContent(new
> Element("duration").setText(availableUserPlans[i].getPlan().getDuration()));
>                 plan.addContent(new
> Element("avgSpeed").setText(availableUserPlans[i].getPlan().getAverageSpeed()
));
>                
>           plans.addContent(plan);
>             }
>  
>           doc.addContent(plans);
>            
>             // Debug
>             try {
>                 XMLOutputter outp = new XMLOutputter();
>                 outp.output(doc, System.out);
>             } catch (Exception e){
>                 System.out.println("Erreur xml: " + e.toString());
>             }
>        
>         return doc;
>        
>     }
> "
>
> it gives me the following error:
>
> "error: The type of the getter is java.util.List but that of the setter is
> java.util.Collection. They have to be the same.
>         this problem is related to the following location:
>                 at org.jdom.Document.getContent (Unknown Source)
>                 at org.jdom.Document (Unknown Source)
>                 at
> angel.ws.jaxws.GetUserTrainingPlanResponse._return
(GetUserTrainingPlanResponse.java:17)
>                 at
> angel.ws.jaxws.GetUserTrainingPlanResponse(GetUserTrainingPlanResponse.java
:14)
>         this problem is related to the following location:
>                 at org.jdom.Document.setContent (Unknown Source)
>                 at org.jdom.Document (Unknown Source)
>                 at
> angel.ws.jaxws.GetUserTrainingPlanResponse._return
(GetUserTrainingPlanResponse.java:17)
>                 at
> angel.ws.jaxws.GetUserTrainingPlanResponse(GetUserTrainingPlanResponse.java
:14)
> error: The type of the getter is java.util.List but that of the setter is
> java.util.Collection. They have to be the same.
>         this problem is related to the following location:
>                 at org.jdom.Element.getContent (Unknown Source)
>                 at org.jdom.Element (Unknown Source)
>                 at org.jdom.Document.getRootElement (Unknown Source)
>                 at org.jdom.Document (Unknown Source)
>                 at
> angel.ws.jaxws.GetUserTrainingPlanResponse._return
(GetUserTrainingPlanResponse.java:17)
>                 at
> angel.ws.jaxws.GetUserTrainingPlanResponse(GetUserTrainingPlanResponse.java
:14)
>         this problem is related to the following location:
>                 at org.jdom.Element.setContent (Unknown Source)
>                 at org.jdom.Element (Unknown Source)
>                 at org.jdom.Document.getRootElement (Unknown Source)
>                 at org.jdom.Document (Unknown Source)
>                 at
> angel.ws.jaxws.GetUserTrainingPlanResponse._return
(GetUserTrainingPlanResponse.java:17)
>                 at
> angel.ws.jaxws.GetUserTrainingPlanResponse(GetUserTrainingPlanResponse.java
:14)
> error: org.jdom.Namespace does not have a no-arg default constructor.
>         this problem is related to the following location:
>                 at org.jdom.Namespace (Unknown Source)
>                 at org.jdom.Element.getNamespace (Unknown Source)
>                 at org.jdom.Element (Unknown Source)
>                 at org.jdom.Document.getRootElement (Unknown Source)
>                 at org.jdom.Document (Unknown Source)
>                 at
> angel.ws.jaxws.GetUserTrainingPlanResponse._return
(GetUserTrainingPlanResponse.java:17)
>                 at
> angel.ws.jaxws.GetUserTrainingPlanResponse(GetUserTrainingPlanResponse.java
:14)
> 3 errors
> error: compilation failed, errors should have been reported
> "
>
> What should I do ? I wouldn't like to rewrite jdom ;)
>
> Cheers,
> Joel
__ ____ ____ ____ ____ ____ ____ ____ ____ ____
To control your jdom-interest membership:
http://www.jdom.org/mailman/options/jdom-interest/youraddr@(protected)

©2008 junlu.com - Jax Systems, LLC, U.S.A.