Hi Semyon,

Thanks to you, it works fine ! :)

I show my code it may helps someone..

        public String getProperty(String path, String name) throws SVNException,
IOException{


                SVNPropertyData data = 
clientManager.getWCClient().doGetProperty(new
File(path), name, SVNRevision.UNDEFINED, SVNRevision.WORKING);
                if(data != null){
                        SVNPropertyValue  value = data.getValue();
                        
                        return new String(value.getBytes());
                }
                
                
                return null;
                
        }


Anthony Simonigh


Semyon Vadishev wrote:
> 
> Hello,
> 
>> my data.value is always
>> null.
> 
>>              SVNPropertyValue  value = data.getValue();
>>              return value.getString();
> 
> If data.getValue() returns null, then you get NullPointerException in 
> return statement. So I think that data.getValue() returns valid 
> SVNPropertyValue object, but value.getString() returns null. There is an 
> explanation for such behavior.
> 
> SVNKit treats all user custom properties as binary, as result you get 
> binary SVNPropertyValue object. Check value.isBinary() before and if it 
> returns true, use value.getBytes() for actual property value.
> 
> There is also utility method to get UTF-8 encoded string from binary 
> property value — use SVNPropertyValue.getPropertyAsString(value).
> 
> Hope that helps.
> 
> Semen Vadishev,
> TMate Software,
> http://svnkit.com/ - Java [Sub]Versioning Library!
> http://hg4j.com/ - Java Mercurial Library!
> http://sqljet.com/ - Java SQLite Library!
> 
> 
> On Sep 22, 2011 13:40 , Dr G. wrote:
>> Hello all,
>>
>>   I'm new to Svnkit, and i have difficulties to get properties on a
>> specified
>> folder.
>>
>> I can set easily properties to a specified folder with the following code
>> :
>>
>> public void setProperty(String path, String name, String value) throws
>> SVNException{
>>              
>>              clientManager.getWCClient().doSetProperty(new File(path), name,
>> SVNPropertyValue.create(value),true,  SVNDepth.EMPTY, null, null);
>>              
>>      }
>>
>> And my code to get properties which don't works, my data.value is always
>> null. :confused:
>>
>> public String getProperty(String path, String name) throws SVNException{
>>      
>>              SVNPropertyData data = 
>> clientManager.getWCClient().doGetProperty(new
>> File(path), name, SVNRevision.UNDEFINED, SVNRevision.WORKING);
>>              SVNPropertyValue  value = data.getValue();
>>              return value.getString();
>>              
>>              
>>              
>>      }
> 
> 
> 

-- 
View this message in context: 
http://old.nabble.com/Problem-to-get-properties-of-a-folder-tp32503798p32549413.html
Sent from the SVNKit - Users mailing list archive at Nabble.com.


Reply via email to