[kepler-dev] Very strange issue with Kepler-1.0/Kepler-2.0 compatibility across actors

Michal Owsiak michalo at man.poznan.pl
Sat Feb 12 12:44:07 PST 2011


I have to maintain two version of the Kepler at the same time.

Compiling part of my project only once is quite convenient, because I 
can use it as a library, and have it the same in both versions of Kepler.

However, recently, I have encountered this strange issue with missing 
OBJECT field.

I will take a look at this issue once again and consider separate 
compilation of codes.

Cheers

Michal

> Well, I can see compiling it with 1.0 and then using the resulting
> class file in 2.0 might be problematic. Is there a reason you're not
> compiling this with 2.0? I tried it out under 2.0 (the development
> branch, so it was compiled under 2.0 as well) and it worked.
>
> (Forgot to cc kepler-dev at first)
>
> 2011/2/11 Michal Owsiak<michal.owsiak at man.poznan.pl>:
>> Hello Sean,
>>
>> I have even simplified the use-case.
>>
>> Please find reduced version of the actor. It doesn't require anything apart
>> from ptolemy classes.
>>
>> I am not sure whether this is a factor here, but. If you compile this class
>> using Kepler-1.0.0 sources, and you will try to import it into Kepler-2.0
>> you should get the error related to missing OBJECT field.
>>
>> import java.awt.Image;
>> import java.net.MalformedURLException;
>> import java.net.URL;
>>
>> import javax.swing.ImageIcon;
>>
>> import ptolemy.actor.TypedIOPort;
>> import ptolemy.actor.lib.Source;
>> import ptolemy.data.AWTImageToken;
>> import ptolemy.data.StringToken;
>> import ptolemy.kernel.CompositeEntity;
>> import ptolemy.kernel.util.IllegalActionException;
>> import ptolemy.kernel.util.NameDuplicationException;
>>
>> public class ReadImage extends Source {
>>    public ReadImage(CompositeEntity container, String name)
>>            throws IllegalActionException, NameDuplicationException {
>>        super(container, name);
>>
>>        imagePort = new TypedIOPort(this, "imageFile", true, false);
>>        imagePort.setTypeEquals(ptolemy.data.type.BaseType.STRING);
>>
>>        output.setTypeEquals(ptolemy.data.type.BaseType.OBJECT);
>>
>>    }
>>    public static final String REVISION = "$Revision: 2289 $";
>>
>>    public TypedIOPort imagePort;
>>
>>    public void fire() throws IllegalActionException {
>>      super.fire();
>>
>>      String imageString = null;
>>      if(imagePort.getWidth() != 0&&  imagePort.hasToken(0)) {
>>        StringToken imagePortToken = (StringToken) imagePort.get(0);
>>        imageString = imagePortToken.stringValue();
>>      }
>>
>>      if (imageString == null) {
>>          throw new IllegalActionException("sourceURL was null");
>>      } else {
>>        try {
>>          _url = new URL(imageString);
>>
>>          _fileRoot = _url.getFile();
>>          _image = new ImageIcon(_fileRoot).getImage();
>>
>>          if ((_image.getWidth(null) == -1)&&  (_image.getHeight(null) == -1))
>> {
>>                  throw new IllegalActionException("incorrect image");
>>          } else {
>>            output.broadcast(new AWTImageToken(_image));
>>          }
>>
>>        } catch (MalformedURLException e) {
>>            throw new IllegalActionException("sourceURL is incorrect");
>>        }
>>      }
>>    }
>>
>>    private String _fileRoot;
>>    private Image _image;
>>    private URL _url;
>> }
>>
>>
>>> I'd be glad to help. That's quite a strange error. Could I get a copy
>>> of your Constants class so I can try to reproduce it? If you have a
>>> sample workflow that uses the ImageReaderPort that would be helpful as
>>> well.
>>>
>>> - Sean
>>>
>>> 2011/2/11 Michal Owsiak<michal.owsiak at man.poznan.pl>:
>>>>
>>>> java.lang.NoSuchFieldError: OBJECT
>>>>     at
>>>>
>>>> pl.psnc.kepler.common.actor.ImageReaderPort.<init>(ImageReaderPort.java:91)
>>>>     at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
>>>> Method)
>>>>     at
>>>>
>>>> sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
>>>>     at
>>>>
>>>> sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
>>>>     at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
>>>>     at ptolemy.moml.MoMLParser._createInstance(MoMLParser.java:4243)
>>>>     at ptolemy.moml.MoMLParser._createEntity(MoMLParser.java:4043)
>>>>     at ptolemy.moml.MoMLParser.startElement(MoMLParser.java:2493)
>>>>     at com.microstar.xml.XmlParser.parseElement(XmlParser.java:921)
>>>>     at com.microstar.xml.XmlParser.parseContent(XmlParser.java:1104)
>>>>     at com.microstar.xml.XmlParser.parseElement(XmlParser.java:924)
>>>>     at com.microstar.xml.XmlParser.parseContent(XmlParser.java:1104)
>>>>     at com.microstar.xml.XmlParser.parseElement(XmlParser.java:924)
>>>>     at com.microstar.xml.XmlParser.parseContent(XmlParser.java:1104)
>>>>     at com.microstar.xml.XmlParser.parseElement(XmlParser.java:924)
>>>>     at com.microstar.xml.XmlParser.parseDocument(XmlParser.java:481)
>>>>     at com.microstar.xml.XmlParser.doParse(XmlParser.java:159)
>>>>     at com.microstar.xml.XmlParser.parse(XmlParser.java:132)
>>>>     at ptolemy.moml.MoMLParser.parse(MoMLParser.java:1418)
>>>>     at ptolemy.moml.MoMLParser.parse(MoMLParser.java:1354)
>>>>     at ptolemy.moml.MoMLParser.parse(MoMLParser.java:1298)
>>>>     at
>>>>
>>>> ptolemy.actor.gui.PtolemyEffigy$Factory.createEffigy(PtolemyEffigy.java:420)
>>>>     at
>>>> ptolemy.actor.gui.EffigyFactory.createEffigy(EffigyFactory.java:233)
>>>>     at ptolemy.actor.gui.Configuration.openModel(Configuration.java:823)
>>>>     at ptolemy.actor.gui.Configuration.openModel(Configuration.java:783)
>>>>     at
>>>> org.kepler.gui.kar.OpenArchiveAction._read(OpenArchiveAction.java:328)
>>>>     at
>>>> org.kepler.gui.kar.OpenArchiveAction._open(OpenArchiveAction.java:257)
>>>>     at
>>>>
>>>> org.kepler.gui.kar.OpenArchiveAction.actionPerformed(OpenArchiveAction.java:190)
>>>>     at
>>>> javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2028)
>>>>     at
>>>>
>>>> javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2351)
>>>>     at
>>>>
>>>> javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
>>>>     at
>>>> javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
>>>>     at javax.swing.AbstractButton.doClick(AbstractButton.java:389)
>>>>     at
>>>> com.apple.laf.ScreenMenuItem.actionPerformed(ScreenMenuItem.java:95)
>>>>     at java.awt.MenuItem.processActionEvent(MenuItem.java:627)
>>>>     at java.awt.MenuItem.processEvent(MenuItem.java:586)
>>>>     at java.awt.MenuComponent.dispatchEventImpl(MenuComponent.java:317)
>>>>     at java.awt.MenuComponent.dispatchEvent(MenuComponent.java:305)
>>>>     at java.awt.EventQueue.dispatchEvent(EventQueue.java:638)
>>>>     at
>>>>
>>>> java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:296)
>>>>     at
>>>>
>>>> java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:211)
>>>>     at
>>>>
>>>> java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:201)
>>>>     at
>>>> java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:196)
>>>>     at
>>>> java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:188)
>>>>     at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
>>>>
>>>
>>
>>
>> --
>> Michal Owsiak<michal.owsiak at man.poznan.pl>
>>
>> Institute of Bioorganic Chemistry PAS
>> Poznan Supercomputing and Networking Center
>> Noskowskiego 12/14, 61-704 Poznan, POLAND
>>
>> http://www.man.poznan.pl
>>
> _______________________________________________
> Kepler-dev mailing list
> Kepler-dev at kepler-project.org
> http://lists.nceas.ucsb.edu/kepler/mailman/listinfo/kepler-dev
>



More information about the Kepler-dev mailing list