Fix saving of LDIF user directory.
authorMathieu Baudier <mbaudier@argeo.org>
Sat, 31 Jul 2021 15:08:04 +0000 (17:08 +0200)
committerMathieu Baudier <mbaudier@argeo.org>
Sat, 31 Jul 2021 15:08:04 +0000 (17:08 +0200)
org.argeo.enterprise/src/org/argeo/osgi/useradmin/LdifUserAdmin.java

index b19e9bf4f311da72fc962bb5b411913d05ae57b0..832e8e57819a87eaf72f261057615a1c312a544d 100644 (file)
@@ -9,6 +9,7 @@ import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
 import java.net.URI;
+import java.net.URISyntaxException;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.Dictionary;
@@ -106,9 +107,9 @@ public class LdifUserAdmin extends AbstractUserDirectory {
                        throw new UserDirectoryException("Cannot save LDIF user admin: no URI is set");
                if (isReadOnly())
                        throw new UserDirectoryException("Cannot save LDIF user admin: " + getUri() + " is read-only");
-               try (FileOutputStream out = new FileOutputStream(new File(getUri()))) {
+               try (FileOutputStream out = new FileOutputStream(new File(new URI(getUri())))) {
                        save(out);
-               } catch (IOException e) {
+               } catch (IOException | URISyntaxException e) {
                        throw new UserDirectoryException("Cannot save user admin to " + getUri(), e);
                }
        }