So only my code will know about these properties, and other svn things (like Eclipse plugins) won't show them. That really limits their usefulness. I guess I'll just put these properties into the msg that is used for the editor session.
Thanks. Don Payette FSS19 Production Management Contractor for the GSA FAME Program 2345 Crystal Dr. Suite 250, Rm 208A. (w) 703-236-3523 (c) 571-305-0105 (h) 479-437-3084 - telework Monday and Wednesday Internal only extension 7706 On Mon, Sep 10, 2012 at 9:51 AM, Alexander Kitaev <kit...@gmail.com> wrote: > This is expected behavior. The reason for it that Subversion does not > store information on the property type and SVNKit only assumes svn: > and svn:entry: prefixed properties to be UTF-8 encoded strings. For > all other properties server sends it is unknown whether these > properties are strings or not, and if they are strings what encoding > is used to encoded them. > > In case you introduce your own property about which you know that it > could be decoded as UTF-8 string, then call: > > SVNPropertyValue.getPropertyAsString(propertyValue) to get a String object. > > Alexander Kitaev, > TMate Software, > http://subgit.com/ - Svn to Git Migration! > http://svnkit.com/ - Java [Sub]Versioning Library! > http://hg4j.com/ - Java Mercurial Library! > http://sqljet.com/ - Java SQLite Library! > > > On 10 September 2012 14:11, Don Payette <donald.paye...@gsa.gov> wrote: > > Hello! > > > > I just started using svnkit and things are working smoothly. > > > > I did have one issue that came up, and that is that I am attempting to > add > > some String properties > > and they come back as binary.. > > > > I'm using the low level interface since that works best for my particular > > needs. Here's the code I'm using: > > > > In one method I do this: > > HashMap<String, String> newProperties = new HashMap<String, > String> > > (); > > newProperties.put("Accesscode", "DONP"); > > newProperties.put("Note", "1234, 2345"); > > newProperties.put("SCR", "2345"); > > > > I then pass newProperties to another method that does this: > > > > ISVNEditor editor = repository.getCommitEditor(msg, null); > > editor.openRoot(-1); > > editor.openDir(dirPath, -1); > > editor.openFile(filePath, -1); > > editor.applyTextDelta(filePath, null); > > SVNDeltaGenerator deltaGenerator = new SVNDeltaGenerator(); > > String checksum = deltaGenerator.sendDelta(filePath > > ,new ByteArrayInputStream(oldData) > > ,0 > > ,new ByteArrayInputStream(newData) > > ,editor > > ,true > > ); > > > > /* > > * Now do any new properties. > > */ > > if (newProperties != null) { > > Iterator<String> iterator = newProperties.keySet ().iterator > (); > > while (iterator.hasNext ()) { > > String propertyName = iterator.next (); > > String propertyValueStr = newProperties.get (propertyName); > > SVNPropertyValue propertyValue = SVNPropertyValue.create > > (propertyValueStr); > > System.out.println ("File property: " + propertyName + "=" + > > propertyValue > > + ", isString " + propertyValue.isString() > > ); > > editor.changeFileProperty (filePath, propertyName, > > propertyValue); > > } > > } > > > > editor.closeFile(filePath, checksum); > > // Close the directory. > > editor.closeDir(); > > // Close the root directory. > > editor.closeDir(); > > return editor.closeEdit(); > > > > I then call my printProperties method to check my results: > > > > private static void printProperties () throws SVNException { > > System.out.println("-> printProperties"); > > ByteArrayOutputStream existingStream = new ByteArrayOutputStream > (); > > Map<String, SVNPropertyValue> newProperties = new HashMap<String, > > SVNPropertyValue>(); > > SVNProperties props = new SVNProperties (); > > repository.getFile(filePath > > ,-1 > > ,props > > ,existingStream > > ); > > newProperties = props.asMap(); > > if (newProperties != null) { > > Iterator<String> iterator = newProperties.keySet ().iterator (); > > while (iterator.hasNext ()) { > > String propertyName = iterator.next (); > > SVNPropertyValue propertyValue = (SVNPropertyValue) > > newProperties.get(propertyName); > > System.out.println( "File property: " + propertyName + "=" + > > propertyValue > > + ", isString " + propertyValue.isString() > > ); > > } > > } > > System.out.println("<- printProperties"); > > } // printProperties > > > > Here is my trace out: > > > > File property: Accesscode=DONP, isString true > > File property: SCR=2345, isString true > > File property: Note=1234, 2345, isString true > > -> printProperties > > File property: Accesscode=property is binary, isString false > > File property: svn:entry:uuid=5d85c6ed-626b-2d4c-8abd-8f48f83f7eeb, > isString > > true > > File property: Note=property is binary, isString false > > File property: SCR=property is binary, isString false > > File property: svn:entry:revision=10, isString true > > File property: svn:entry:committed-date=2012-09-10T11:59:50.088155Z, > > isString true > > File property: svn:entry:checksum=09848a8f1a278ee0b4f8b62096b2da6a, > isString > > true > > File property: svn:entry:last-author=donp, isString true > > File property: svn:entry:committed-rev=10, isString true > > <- printProperties > > > > Notice that the Accesscode, Note and SCR (my properties) are "isString > true" > > on the way in, and false after. > > > > Any ideas? > > > > Thanks. > > > > Don Payette > > FSS19 Production Management > > Contractor for the GSA FAME Program > > 2345 Crystal Dr. Suite 250, Rm 208A. > > (w) 703-236-3523 > > (c) 571-305-0105 > > (h) 479-437-3084 - telework Monday and Wednesday > > Internal only extension 7706 > > > > > >