Thursday, December 19, 2013

Re: GeneratorContext.tryCreateResource

The following commit changed the behavior:

https://gwt.googlesource.com/gwt/+/a6f06d327d72fcabe46dbb69de40013ec14a1627%5E%21/#F0


Java's mkdir() / mkdirs() do not work as expected with directories containing "/../", so I think the correct way would have been to do dir = dir.getCanonicalFile() before calling dir.mkdir(). The implementation before that commit simply ignores the return value of dir.mkdir() which in turn means it has ignored the failed creation of directory "/path/to/folder/..". So the programming bug has kind of cured itself because of the recursive behavior of OutputFileSetOnDirectory.mkdirs().

Looks pretty similar to what I have done in

https://gwt-review.googlesource.com/#/c/3821/7/dev/core/src/com/google/gwt/dev/javac/PersistentUnitCache.java


Please file a bug so it gets fixed for 2.6 or 2.6.1.


-- J.



Am Donnerstag, 19. Dezember 2013 22:09:16 UTC+1 schrieb Douglas Hoskins:
Right. 

Done a bit more research -- the path I am trying to create is in the form /path/to/folder1/../folder2/filename.ext

It seems that the failure is happening on processing the ".." part:

[ERROR] Fatal error emitting artifact: ../folder2/filename.ext

java.io.IOException: unable to create directory: /path/to/folder1/..

at com.google.gwt.dev.util.OutputFileSetOnDirectory.mkdirs(OutputFileSetOnDirectory.java:82)



On Thursday, 19 December 2013 18:03:38 UTC, Douglas Hoskins wrote:
I have just upgraded my project from 2.5.1 to 2.6.0-rc3.  I have some Generators in my project that create new files in the file system using GeneratorContext.tryCreateResource.

This used to work fine even if the target directory for the file did not exist, but now in 2.6.0-rc3 it is throwing an IOException: unable to create directory.

I will step through the GWT code at some point to find out what the reason is, but has something changed to prevent GeneratorContext being able to create new folders since 2.5.1?

Thanks

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/groups/opt_out.

No comments:

Post a Comment