Uploaded image for project: 'Commons VFS'
  1. Commons VFS
  2. VFS-26

[vfs] Multiple taskdefs causes ClassCastException

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • None
    • None
    • Operating System: All
      Platform: All

    • 35958

    Description

      If you have defined your tasks as such:
      <taskdef name="v-mkdir" classname="org.apache.commons.vfs.tasks.MkdirTask"
      classpathref="vfs-classpath" />
      <taskdef name="v-copy" classname="org.apache.commons.vfs.tasks.CopyTask"
      classpathref="vfs-classpath"/>

      Then in a task use them:
      <v-mkdir dir="..."/>
      <v-copy destdir="...">
      <src file="..."/>
      </v-copy>

      You get the following exception:
      v-copy
      ..\build.xml:xx: null
      at org.apache.commons.vfs.tasks.AbstractSyncTask.execute(AbstractSyncTask.java:196)
      at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
      at org.apache.tools.ant.Task.perform(Task.java:364)
      at org.apache.tools.ant.Target.execute(Target.java:341)
      at org.apache.tools.ant.Target.performTasks(Target.java:369)
      at org.apache.tools.ant.Project.executeTarget(Project.java:1214)
      at org.apache.tools.ant.Project.executeTargets(Project.java:1062)
      at org.apache.tools.ant.Main.runBuild(Main.java:673)
      at org.apache.tools.ant.Main.startAnt(Main.java:188)
      at org.apache.tools.ant.Main.start(Main.java:151)
      at org.apache.tools.ant.Main.main(Main.java:241)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at
      sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at com.intellij.rt.ant.execution.AntMain2.main(AntMain2.java:13)
      Caused by: java.lang.ClassCastException
      at org.apache.commons.vfs.tasks.VfsTask.resolveFile(VfsTask.java:64)
      at
      org.apache.commons.vfs.tasks.AbstractSyncTask.handleFiles(AbstractSyncTask.java:206)
      at org.apache.commons.vfs.tasks.AbstractSyncTask.execute(AbstractSyncTask.java:187)
      ... 15 more

      The alternative, if you call it that, is to use (as given on the web site):
      <taskdef resource="org/apache/commons/vfs/tasks/tasks.properties"
      classpathref="vfs-classpath"/>

      I would expect that the Ant tasks would work either way.

      Attachments

        Activity

          People

            Unassigned Unassigned
            andrew.newman@suncorp.com.au andrew newman
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: