[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: JavaHL setConfigDirectory() and auth cache problems

From: Daniel Rall <dlr_at_collab.net>
Date: 2006-12-20 19:09:43 CET

On Wed, 20 Dec 2006, Daniel Rall wrote:
...
> Yup, "Java(TM) 2 Runtime Environment, Standard Edition (build
> 1.5.0_07-b03)" now works as expected. Thanks for the update, Patrick.
> If I can't weasel some native library version checks into JavaHL's
> Java code, we'll go with this as a best-effort attempt to maintain
> some compatibility with older native library versions.

Index: subversion/bindings/java/javahl/src/org/tigris/subversion/javahl/SVNClient.java
===================================================================
--- subversion/bindings/java/javahl/src/org/tigris/subversion/javahl/SVNClient.java (revision 22772)
+++ subversion/bindings/java/javahl/src/org/tigris/subversion/javahl/SVNClient.java (working copy)
@@ -45,18 +45,39 @@
         // Ensure that Subversion's config file area and templates exist.
         try
         {
- // Passing an empty string instead of null (which would be
- // more appropriate) prevents earlier versions of the
- // native library (mismatched from the Java bytecode
- // version) from crashing.
- setConfigDirectory("");
+ setConfigDirectory(determineInitialConfigDir());
         }
         catch (ClientException suppressed)
         {
             // Not an exception-worthy problem, continue on.
         }
     }
+
     /**
+ * Attempt to return the user's home directory (not possible with
+ * older JREs).
+ *
+ * @return The initial configuration directory, or
+ * <code>null</code> to use the library default. Note that native
+ * library versions older than 1.4 may segfault if we return
+ * <code>null</code>.
+ */
+ protected String determineInitialConfigDir()
+ {
+ try
+ {
+ return System.getenv("HOME");
+ }
+ catch (Throwable jreComplaint)
+ {
+ // As an example, Sun JRE 1.4.2_12-b03 throws
+ // java.lang.Error, with the message "getenv no longer
+ // supported, use properties and -D instead: HOME".
+ return null;
+ }
+ }
+
+ /**
      * Build the native peer
      * @return the adress of the peer
      */

  • application/pgp-signature attachment: stored
Received on Wed Dec 20 19:11:15 2006

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.