Skip to main content
Participant
November 3, 2008
Question

Ant Html-Wrapper Exception

  • November 3, 2008
  • 2 replies
  • 966 views
Hi,

can anybody explain to me why i get a java.lang.NullPointerException when running the ant task html-wrapper. I used the example of the documentation and changend only the FLEX_HOME Path as well as the APP Path. The compiling works very well.




Thanks

Cube
This topic has been closed for replies.

2 replies

Participant
November 9, 2009

I can tell you why this is happening.

I got the same error when I first tried using the html-wrapper task.  I did a little debug of the Java source code for the HtmlWrapperTask when I got the NullPointerException, and I saw that it assumes the templates directory is in the current directory that you are executing the task from. In other words, it assumes you are running the ant build script from ${FLEX_HOME}, or have moved the templates from ${FLEX_HOME} directory to the directory where you are running the ant tasks from. With this unchecked assumption, the code blindly tries to construct an InputStream object from the templates directory location that it assumes.  This  InputStream constructor throws a NullPointerException when this location cannot be found in the working directory, and the whole task dies. This is the code snippet where this happens, at line 19 of HtmlWrapperTask.java:

InputStream inputStream = getClass().getResourceAsStream("/templates/html-templates/" + resources);

This crux of this problem is that HtmlWrapperTask does not extends from FlexTask like the other Flex Tasks, and therefore does not use the ${FLEX_HOME}  variable that you specify in your build.xml.  This is very annoying!  Particularly in light of that fact the other Flex Ant Tasks (such as compile) make the ${FLEX_HOME} variable mandatory (as its essential to separating the Flex JDK from your actual working directory as you would do with any serious project beyond "hello world").

I have dug around the community, but there does not seem to be very high visibility around this defect in the html-wrapper task. I am new to Flex, so I assume may be most folks use FlexBuilder to generate Wrappers, as opposed to running the raw ant scripts from the command line, which may shield this issue.

I have fixed the error in my local copy of the HtmlWrapperTask, and I can provide you a copy of this file if you'd like,  However, it'd be preferable that Adobe fixed this issue themselves.

matt_chotin
Inspiring
November 9, 2009

Can you please make sure that a bug is filed and post the bug number

here? If you have a patch for it you can attach it to the bug too.

Matt

Known Participant
November 3, 2008
Unfortunately I don't have anything useful to add, but I've come across this in the past too, and couldn't get an answer, so I'm very interested in the resolution if you can figure it out.

Cheers,

-Josh

On Tue, Nov 4, 2008 at 8:09 AM, Cube < member@adobeforums.com> wrote:

A new discussion was started by Cube in



Developers --

  Ant Html-Wrapper Exception



Hi,

can anybody explain to me why i get a java.lang.NullPointerException when running the ant task html-wrapper. I used the example of the documentation and changend only the FLEX_HOME Path as well as the APP Path. The compiling works very well.


    <target name="html">

        <html-wrapper swf="SWP"/>

    </target>

Thanks

Cube





View/reply at Ant Html-Wrapper Exception

Replies by email are OK.

Use the unsubscribe form to cancel your email subscription.





--
"Therefore, send not to know For whom the bell tolls. It tolls for thee."

Like the cut of my jib? Check out my Flex blog!

:: Josh 'G-Funk' McDonald

:: 0437 221 380 :: josh@gfunk007.com
:: http://flex.joshmcdonald.info/
:: http://twitter.com/sophistifunk