cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject cvs commit: cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/coplet/adapter/impl URICopletAdapter.java
Date Mon, 09 Feb 2004 12:14:21 GMT
cziegeler    2004/02/09 04:14:21

  Modified:    src/blocks/portal/java/org/apache/cocoon/portal/coplet/adapter/impl
                        URICopletAdapter.java
  Log:
  Bug fixes for the URICoplet:
  - Use correct event type to detect coplet changes
  - Fix changed list handling
  - throw better exception, if uri is not present (instead of NPE)
  
  Revision  Changes    Path
  1.12      +8 -5      cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/coplet/adapter/impl/URICopletAdapter.java
  
  Index: URICopletAdapter.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/coplet/adapter/impl/URICopletAdapter.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- URICopletAdapter.java	20 Oct 2003 13:36:41 -0000	1.11
  +++ URICopletAdapter.java	9 Feb 2004 12:14:20 -0000	1.12
  @@ -64,11 +64,11 @@
   import org.apache.cocoon.portal.Constants;
   import org.apache.cocoon.portal.PortalService;
   import org.apache.cocoon.portal.coplet.CopletInstanceData;
  +import org.apache.cocoon.portal.event.CopletInstanceEvent;
   import org.apache.cocoon.portal.event.Event;
   import org.apache.cocoon.portal.event.EventManager;
   import org.apache.cocoon.portal.event.Filter;
   import org.apache.cocoon.portal.event.Subscriber;
  -import org.apache.cocoon.portal.event.impl.ChangeCopletInstanceAspectDataEvent;
   import org.apache.excalibur.source.Source;
   import org.apache.excalibur.source.SourceResolver;
   import org.xml.sax.ContentHandler;
  @@ -100,6 +100,9 @@
       public void streamContent(CopletInstanceData coplet, ContentHandler contentHandler)
       throws SAXException {
           final String uri = (String)coplet.getCopletData().getAttribute("uri");
  +        if ( uri == null ) {
  +            throw new SAXException("No URI for coplet data "+coplet.getCopletData().getId()+"
found.");
  +        }
           this.streamContent( coplet, uri, contentHandler);
       }
   
  @@ -118,7 +121,7 @@
                   String sourceUri = uri;
                   
                   if ( handlePars != null && handlePars.booleanValue() ) {
  -                    List list = (List) portalService.getAttribute(URICopletAdapter.class.getName());
  +                    List list = (List) portalService.getTemporaryAttribute(URICopletAdapter.class.getName());
                       if ( list != null && list.contains( coplet )) {
                           // add parameters
                           if ( uri.startsWith("cocoon:raw:") ) {
  @@ -177,7 +180,7 @@
        * @see org.apache.cocoon.portal.event.Subscriber#getEventType()
        */
       public Class getEventType() {
  -        return ChangeCopletInstanceAspectDataEvent.class;
  +        return CopletInstanceEvent.class;
       }
   
       /* (non-Javadoc)
  @@ -191,7 +194,7 @@
        * @see org.apache.cocoon.portal.event.Subscriber#inform(org.apache.cocoon.portal.event.Event)
        */
       public void inform(Event e) {
  -        ChangeCopletInstanceAspectDataEvent event = (ChangeCopletInstanceAspectDataEvent)e;
  +        CopletInstanceEvent event = (CopletInstanceEvent)e;
           PortalService service = null;
           try {
               service = (PortalService)this.manager.lookup(PortalService.ROLE);
  
  
  

Mime
View raw message