JavaHL info2 problem

2012-08-27 Thread Marcin Porwit
Hi,

I'm running into a problem with the info2 call in the 1.6 JavaHL library. I am 
attempting to use this to fake password validation for a user, so if this is a 
bass-ackwards way of doing things, please let me know. I issue two calls to 
svnclient.info2. The first one does an info2 on the local, checked out 
directory, and the callback stores the serverUrl (gotten using the getUrl() 
call). I get the correct value:
http://10.0.62.148/svn/myproject
The second call then does an svnclient.info2 on the serverUrl. This second call 
throws a ClientException:
2012-08-27 15:21:57,446 [main] ERROR P42svnMain - 
com.salesforce.cheetah.p42svn.SubversionRepositoryException: Could not validate 
the user [p42svn:p42svn] on repository [http://10.0.62.148/svn/myproject] at 
com.salesforce.cheetah.p42svn.SubversionRepository.validatePassword(SubversionRepository.java:113)
 at 
com.salesforce.cheetah.p42svn.P42svnMain.setupSubversionRepo(P42svnMain.java:46)
 at com.salesforce.cheetah.p42svn.P42svnMain.main(P42svnMain.java:68) Caused 
by: org.tigris.subversion.javahl.ClientException: Path is not a working copy 
directory svn: 'http://10.0.62.148/svn' is not a working copy No such file or 
directory svn: 'http://10.0.62.148/svn' does not exist at 
org.tigris.subversion.javahl.SVNClient.info2(Native Method) at 
org.tigris.subversion.javahl.SVNClientSynchronized.info2(SVNClientSynchronized.java:1779)
 at 
com.salesforce.cheetah.p42svn.SubversionRepository.validatePassword(SubversionRepository.java:111)
 ... 2 more

If I do an svn info from the command line, it works fine:
mporwit-wsl[script]$ svn --username p42svn info 
http://10.0.62.148/svn/myprojectAuthentication realm:  
myproject subversion repository
Password for 'p42svn': 

---
ATTENTION!  Your password for authentication realm:

    myproject subversion repository

can only be stored to disk unencrypted!  You are advised to configure
your system so that Subversion can store passwords encrypted, if
possible.  See the documentation for details.

You can avoid future appearances of this warning by setting the value
of the 'store-plaintext-passwords' option to either 'yes' or 'no' in
'/home/mporwit/.subversion/servers'.
---
Store password unencrypted (yes/no)? no
Path: myproject
URL: http://10.0.62.148/svn/myproject
Repository Root: http://10.0.62.148/svn/myproject
Repository UUID: 945e25ec-ac10-400e-ab83-16708dcd2c39
Revision: 77
Node Kind: directory
Last Changed Author: p42svn
Last Changed Rev: 77
Last Changed Date: 2012-08-26 19:34:58 -0700 (Sun, 26 Aug 2012)

So I'm confused as to why info2 is failing. It seems to be dropping the last 
element of the path, which is another thing I'm confused about. Pointers to 
what I am doing wrong are appreciated, as would be pointers on how to better 
validate a user password prior to doing a commit on the repo.

I'm not subscribed to the mailing list, so an explicit CC would be greatly 
appreciated.

Thanks,

Marcin



Re: JavaHL info2 problem

2012-08-28 Thread Marcin Porwit
Hi Mark,

I'm calling the non-deprecated version of info2:
http://subversion.apache.org/docs/javahl/1.7/org/tigris/subversion/javahl/SVNClientInterface.html#info2(java.lang.String,
 org.tigris.subversion.javahl.Revision, org.tigris.subversion.javahl.Revision, 
int, java.lang.String[], org.tigris.subversion.javahl.InfoCallback)

You're right in that it looks like it is treating the URL as a local file 
system path… and yes, I'm passing in null for both the Revsion and pegRevision 
arguments.  What should I be passing in instead? The svn info from the command 
line does not take a revision -- does it pass one in implicitly?

My first call to info2 uses the local file system path:
svnclient.info2(destdir, null, null, 0, null, infoCallback);

The second call to info2 uses the server URL I got from the first info2 call:
svnclient.info2(serverURI, null, null, 0, null, infoCallback);

The actual infoCallback is as follows:
class InformationCallback implements InfoCallback {
private SubversionRepository repo;

InformationCallback(SubversionRepository repo) {
this.repo = repo;
}

public void singleInfo(Info2 info) {
repo.setServerURI(info.getReposRootUrl());
}

}

Thanks,

MKP
On Aug 28, 2012, at 6:06 AM, Mark Phippard wrote:

> On Mon, Aug 27, 2012 at 6:40 PM, Marcin Porwit  wrote:
> 
> 
>> I'm running into a problem with the info2 call in the 1.6 JavaHL library. I 
>> am attempting to use this to fake password
>> validation for a user, so if this is a bass-ackwards way of doing things, 
>> please let me know. I issue two calls to
>> svnclient.info2. The first one does an info2 on the local, checked out 
>> directory, and the callback stores the serverUrl
>> (gotten using the getUrl() call). I get the correct value:
> 
> Which method are you calling?  What are you passing for the Revision
> and pegRevision arguments?
> 
> It seems like it is interpreting the String you are passing as a local
> path.  I am guessing you are passing null or something else in the
> revision arguments that would cause it do this.
> 
> -- 
> Thanks
> 
> Mark Phippard
> http://markphip.blogspot.com/