[ 
https://issues.apache.org/jira/browse/IVY-1289?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Maarten Coene resolved IVY-1289.
--------------------------------

       Resolution: Duplicate
    Fix Version/s: trunk
         Assignee: Maarten Coene

Duplicate of IVY-1253 which has been fixed in SVN trunk.

> IVY throws IOException when ivy.xml file is larger than 10000 bytes
> -------------------------------------------------------------------
>
>                 Key: IVY-1289
>                 URL: https://issues.apache.org/jira/browse/IVY-1289
>             Project: Ivy
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 2.2.0
>         Environment: All environments
>            Reporter: Martin Wursthorn
>            Assignee: Maarten Coene
>             Fix For: trunk
>
>
> We habe an ivy.xml file which is 10060 bytes large. It starts with an 
> '<ivy-module>' 
> tag, there is no xml header before this tag. When processing this file we get 
> the following error:
> {noformat}
>       java.io.IOException: Resetting to invalid mark
>       at java.io.BufferedInputStream.reset(BufferedInputStream.java:416)
>       at 
> org.apache.ivy.plugins.parser.xml.XmlModuleDescriptorUpdater.update(XmlModuleDescriptorUpdater.java:1215)
>       at 
> org.apache.ivy.plugins.parser.xml.XmlModuleDescriptorUpdater.update(XmlModuleDescriptorUpdater.java:147)
>       at 
> org.apache.ivy.plugins.parser.xml.XmlModuleDescriptorParser.toIvyFile(XmlModuleDescriptorParser.java:153)
>       at 
> org.apache.ivy.core.module.descriptor.DefaultModuleDescriptor.toIvyFile(DefaultModuleDescriptor.java:547)
>       at 
> org.apache.ivy.core.resolve.ResolveEngine.resolve(ResolveEngine.java:248)
>       at 
> org.apache.ivy.core.resolve.ResolveEngine.resolve(ResolveEngine.java:195)
>       at org.apache.ivy.Ivy.resolve(Ivy.java:502)
>       at org.apache.ivy.ant.IvyResolve.doExecute(IvyResolve.java:244)
>       at org.apache.ivy.ant.IvyTask.execute(IvyTask.java:277)
>       at 
> org.apache.ivy.ant.IvyPostResolveTask.ensureResolved(IvyPostResolveTask.java:217)
>       at 
> org.apache.ivy.ant.IvyPostResolveTask.prepareAndCheck(IvyPostResolveTask.java:164)
>       at org.apache.ivy.ant.IvyRetrieve.doExecute(IvyRetrieve.java:57)
>       at org.apache.ivy.ant.IvyTask.execute(IvyTask.java:277)
>       at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
>       at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
>       at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>       at java.lang.reflect.Method.invoke(Method.java:597)
>       at 
> org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
>       at org.apache.tools.ant.Task.perform(Task.java:348)
>       at org.apache.tools.ant.Target.execute(Target.java:390)
>       at org.apache.tools.ant.Target.performTasks(Target.java:411)
>       at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1360)
>       at org.apache.tools.ant.Project.executeTarget(Project.java:1329)
>       at 
> org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
>       at org.apache.tools.ant.Project.executeTargets(Project.java:1212)
>       at org.apache.tools.ant.Main.runBuild(Main.java:801)
>       at org.apache.tools.ant.Main.startAnt(Main.java:218)
>       at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
>       at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)
> {noformat}
> Theproblem seem to be the following block of code in 
> XmlModuleDescriptorUpdater:
> {code}
> in.mark(MAX_HEADER_LENGTH); // assume the header is never larger than 10000 
> bytes.
> copyHeader(in, out);
> in.reset(); // reposition the stream at the beginning
> {code}
> The first line sets markpos to 0, and readLimit to 10000. But after the call 
> to copyHeader the position pointer 
> is set to the end of the file not just the end of the header. Since this 
> position is beyond 10000 markpos is set 
> to -1 and the above exception is thrown. Note that in our case the header is 
> empty.
>    

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to