dajester2013 / ivysvn

Automatically exported from code.google.com/p/ivysvn
Apache License 2.0
0 stars 0 forks source link

Pre-Existing path in a repository can cause transitive install failure in SvnRespository.commitPublishTransaction() (Bug Fix included) #36

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

NOTE: i am not certain that this will repro in all environments

1. create a build xml with the following target
    <target name="ivy-install"
        description="--> install module from maven 2 repository">
        <ivy:install 
            organisation="org.seleniumhq.selenium" module="selenium-java" revision="2.20.0"
            from="local" to="shared" transitive="true" haltonfailure="false" overwrite="false" />
    </target>

2. run the target in ant at least twice

Expected Result:

New Dependencies will be updated with no errors

Actual Results:

[ivy:install] Scheduling publish to http://subversion.eschoolsolutions.com/test/
ivy-repository/log4j/log4j/1.2.16/ivys/ivy.xml.md5
[ivy:install]   published ivy to log4j/log4j/1.2.16/ivys/ivy.xml
[ivy:install] Commit finished r400 by 'SUBVERSION\codechecker' at Thu Apr 26 16:
46:24 EDT 2012
[ivy:install] Copying from log4j/log4j/LATEST/sources to log4j/log4j/1.2.16/sour
ces
[ivy:install] Aborting transaction

BUILD FAILED
C:\Users\tlittle\workspace\ESSAutomationFramework\build.xml:112: impossible to i
nstall com.ess.qa#eSSAutomationFramework;0.1.698M: java.io.IOException
        at fm.last.ivy.plugins.svnresolver.SvnRepository.commitPublishTransactio
n(SvnRepository.java:217)
        at fm.last.ivy.plugins.svnresolver.SvnResolver.commitPublishTransaction(
SvnResolver.java:58)
        at org.apache.ivy.core.install.InstallEngine.install(InstallEngine.java:
154)
        at org.apache.ivy.Ivy.install(Ivy.java:526)
        at org.apache.ivy.ant.IvyInstall.doExecute(IvyInstall.java:101)
        at org.apache.ivy.ant.IvyTask.execute(IvyTask.java:277)
        at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:601)
        at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.jav
a: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:1399)
        at org.apache.tools.ant.Project.executeTarget(Project.java:1368)
        at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExe
cutor.java:41)
        at org.apache.tools.ant.Project.executeTargets(Project.java:1251)
        at org.apache.tools.ant.Main.runBuild(Main.java:809)
        at org.apache.tools.ant.Main.startAnt(Main.java:217)
        at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
        at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)
Caused by: org.tmatesoft.svn.core.SVNException: svn: E175005: Path '/test/ivy-re
pository/log4j/log4j/1.2.16' already exists
        at org.tmatesoft.svn.core.internal.wc.SVNErrorManager.error(SVNErrorMana
ger.java:64)
        at org.tmatesoft.svn.core.internal.wc.SVNErrorManager.error(SVNErrorMana
ger.java:51)
        at org.tmatesoft.svn.core.internal.io.dav.DAVCommitEditor.addDir(DAVComm
itEditor.java:171)
        at fm.last.ivy.plugins.svnresolver.SvnDao.createFolders(SvnDao.java:139)

        at fm.last.ivy.plugins.svnresolver.SvnPublishTransaction.copyDiff(SvnPub
lishTransaction.java:345)
        at fm.last.ivy.plugins.svnresolver.SvnPublishTransaction.commit(SvnPubli
shTransaction.java:179)
        at fm.last.ivy.plugins.svnresolver.SvnRepository.commitPublishTransactio
n(SvnRepository.java:214)
        ... 22 more

Please provide any additional information below.

I have included a fix for the bug, it is very localized

The new code is to replace the catch block in  
SvnRespository.commitPublishTransaction() (line 218) with the following:

    } catch (SVNException e) {
      if(e.getErrorMessage().getErrorCode().equals(SVNErrorCode.RA_DAV_ALREADY_EXISTS)) {
        try {
          publishTransaction.abort();
          publishTransaction = null;
        } catch (SVNException ae) {
          throw (IOException) new IOException().initCause(ae);
        }
      } else {
        throw (IOException) new IOException().initCause(e);
      }
    } finally {
      publishTransaction = null;
    }

I tried to run the unnit tests, but they all failed on me.  

Original issue reported on code.google.com by thorson....@gmail.com on 26 Apr 2012 at 9:00

Attachments: