On 07/08/2013, at 8:57 AM, Luke Daley <l...@ldaley.com> wrote:

> 
> 
> On 07/08/2013, at 8:04, Luke Daley <l...@ldaley.com> wrote:
> 
>> Are you able to share the exact code? 
>> 
>> I think I know what this is but need to see the code.
> 
> Nevermind, I have enough.

Actually… I do need to see the param types and values :)

I've tracked the issue down, and it's very dependent on the types used. I want 
to make sure it's the same thing, and need this info to confirm.

> 
>> On 07/08/2013, at 1:51, Xavier Ducrohet <x...@google.com> wrote:
>> 
>>> I just encountered something very very strange in 1.7.
>>> 
>>> I rarely run this code, but I ran it on 1.6 with no issue. I'm trying to 
>>> run it with 1.7 (to update some of our local prebuilts to update to 1.7) 
>>> and it's failing with something that makes no sense.
>>> 
>>> I have a Groovy class that extends DefaultTask and looks something like 
>>> this:
>>> 
>>> class DownloadArtifactsTask extends DefaultTask {
>>>   @TaskAction
>>>   void something() {
>>>     pullArtifact(...);
>>>   }
>>> 
>>>   private void pullArtifact(...) {
>>>     try {
>>>       downloadFile(...)
>>>     } catch (IOException e2) {
>>>       // ignore
>>>     }
>>>   }
>>> 
>>>   private File downloadFile(...) throws IOException {
>>>     if (...) {
>>>       throw new IOException(...);
>>>     }
>>>   }
>>> }
>>> 
>>> 
>>> What happens is that when downloadFile throws an IOException, it's not 
>>> caught in pullArtifact. I was really confused at first. So I put a catch on 
>>> Throwable, and noticed that my original exception was encapsulated in a 
>>> GradleException.
>>> 
>>> Nothing in my code does this obviously. The stack trace looks like this:
>>> 
>>> org.gradle.api.GradleException: Could not call 
>>> DownloadArtifactsTask.downloadFile() on task ':downloadArtifacts'
>>>     at org.gradle.util.JavaMethod.invoke(JavaMethod.java:69)
>>>     at 
>>> org.gradle.api.internal.BeanDynamicObject$MetaClassAdapter.invokeMethod(BeanDynamicObject.java:295)
>>>     at 
>>> org.gradle.api.internal.BeanDynamicObject.invokeMethod(BeanDynamicObject.java:136)
>>>     at 
>>> org.gradle.api.internal.CompositeDynamicObject.invokeMethod(CompositeDynamicObject.java:147)
>>>     at 
>>> com.android.build.gradle.buildsrc.DownloadArtifactsTask_Decorated.invokeMethod(Unknown
>>>  Source)
>>>     at 
>>> org.codehaus.groovy.runtime.callsite.PogoInterceptableSite.call(PogoInterceptableSite.java:45)
>>>     at 
>>> org.codehaus.groovy.runtime.callsite.PogoInterceptableSite.callCurrent(PogoInterceptableSite.java:55)
>>>     at 
>>> com.android.build.gradle.buildsrc.DownloadArtifactsTask.pullArtifact(DownloadArtifactsTask.groovy:204)
>>>         ....
>>> Caused by: java.io.FileNotFoundException: http://xxx
>>>     at 
>>> sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1434)
>>>     at java.net.URL.openStream(URL.java:1010)
>>>     at org.apache.commons.io.FileUtils.copyURLToFile(FileUtils.java:844)
>>>     at org.apache.commons.io.FileUtils$copyURLToFile.call(Unknown Source)
>>>     at 
>>> com.android.build.gradle.buildsrc.DownloadArtifactsTask.downloadFile(DownloadArtifactsTask.groovy:256)
>>> 
>>> 
>>> DownloadArtifactsTask.groovy:204 is where downloadFile() is called.
>>> 
>>> Anyone has a clue?

-- 
Luke Daley
Principal Engineer, Gradleware 
http://gradleware.com


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to