directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1792718 - in /directory/apacheds/branches/apacheds-value: http-integration/src/main/java/org/apache/directory/server/integration/http/ installers-maven-plugin/src/main/java/org/apache/directory/server/installers/ interceptors/changelog/src...
Date Wed, 26 Apr 2017 09:19:53 GMT
Author: elecharny
Date: Wed Apr 26 09:19:53 2017
New Revision: 1792718

URL: http://svn.apache.org/viewvc?rev=1792718&view=rev
Log:
Applied Colm's changes (FikeIn/OutputStream)

Added:
    directory/apacheds/branches/apacheds-value/lmdb-partation/
    directory/apacheds/branches/apacheds-value/lmdb-partation/pom.xml
Modified:
    directory/apacheds/branches/apacheds-value/http-integration/src/main/java/org/apache/directory/server/integration/http/HttpServer.java
    directory/apacheds/branches/apacheds-value/installers-maven-plugin/src/main/java/org/apache/directory/server/installers/MojoHelperUtils.java
    directory/apacheds/branches/apacheds-value/interceptors/changelog/src/main/java/org/apache/directory/server/core/changelog/MemoryChangeLogStore.java
    directory/apacheds/branches/apacheds-value/interceptors/journal/src/main/java/org/apache/directory/server/core/journal/DefaultJournalStore.java
    directory/apacheds/branches/apacheds-value/interceptors/schema/src/main/java/org/apache/directory/server/core/schema/SchemaLdifToPartitionExtractor.java
    directory/apacheds/branches/apacheds-value/kerberos-client/src/main/java/org/apache/directory/kerberos/credentials/cache/CredentialsCache.java
    directory/apacheds/branches/apacheds-value/kerberos-codec/src/main/java/org/apache/directory/server/kerberos/shared/keytab/Keytab.java
    directory/apacheds/branches/apacheds-value/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapServer.java
    directory/apacheds/branches/apacheds-value/protocol-shared/src/main/java/org/apache/directory/server/protocol/shared/store/LdifFileLoader.java
    directory/apacheds/branches/apacheds-value/server-config/src/main/java/org/apache/directory/server/config/LdifConfigExtractor.java

Modified: directory/apacheds/branches/apacheds-value/http-integration/src/main/java/org/apache/directory/server/integration/http/HttpServer.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-value/http-integration/src/main/java/org/apache/directory/server/integration/http/HttpServer.java?rev=1792718&r1=1792717&r2=1792718&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-value/http-integration/src/main/java/org/apache/directory/server/integration/http/HttpServer.java
(original)
+++ directory/apacheds/branches/apacheds-value/http-integration/src/main/java/org/apache/directory/server/integration/http/HttpServer.java
Wed Apr 26 09:19:53 2017
@@ -23,10 +23,11 @@ package org.apache.directory.server.inte
 
 import java.io.ByteArrayInputStream;
 import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
 import java.io.FilenameFilter;
+import java.io.InputStream;
 import java.io.OutputStream;
+import java.nio.file.Files;
+import java.nio.file.Paths;
 import java.security.KeyPair;
 import java.security.KeyStore;
 import java.security.cert.Certificate;
@@ -115,7 +116,8 @@ public class HttpServer
 
         if ( confFile != null )
         {
-            jettyConf = new XmlConfiguration( new FileInputStream( confFile ) );
+            InputStream input = Files.newInputStream( Paths.get( confFile ) );
+            jettyConf = new XmlConfiguration( input );
 
             LOG.info( "configuring jetty http server from the configuration file {}", confFile
);
 
@@ -206,7 +208,7 @@ public class HttpServer
                 ks.setKeyEntry( "privatekey", keyPair.getPrivate(), password.toCharArray(),
new Certificate[]
                     { cert } );
 
-                try ( OutputStream stream = new FileOutputStream( ksFile ) )
+                try ( OutputStream stream = Files.newOutputStream( ksFile.toPath() ) )
                 {
                     ks.store( stream, password.toCharArray() );
                 }

Modified: directory/apacheds/branches/apacheds-value/installers-maven-plugin/src/main/java/org/apache/directory/server/installers/MojoHelperUtils.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-value/installers-maven-plugin/src/main/java/org/apache/directory/server/installers/MojoHelperUtils.java?rev=1792718&r1=1792717&r2=1792718&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-value/installers-maven-plugin/src/main/java/org/apache/directory/server/installers/MojoHelperUtils.java
(original)
+++ directory/apacheds/branches/apacheds-value/installers-maven-plugin/src/main/java/org/apache/directory/server/installers/MojoHelperUtils.java
Wed Apr 26 09:19:53 2017
@@ -22,14 +22,14 @@ package org.apache.directory.server.inst
 
 import java.io.BufferedReader;
 import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.InputStreamReader;
+import java.io.OutputStream;
 import java.io.OutputStreamWriter;
 import java.io.Reader;
 import java.io.Writer;
+import java.nio.file.Files;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Properties;
@@ -63,7 +63,7 @@ public final class MojoHelperUtils
     {
         mojo.getLog().info( "Copying " + fileName + " to " + to );
 
-        try ( FileOutputStream out = new FileOutputStream( to ) )
+        try ( OutputStream out = Files.newOutputStream( to.toPath() ) )
         {
             IOUtil.copy( from, out );
         }
@@ -79,7 +79,8 @@ public final class MojoHelperUtils
     {
         // buffer so it isn't reading a byte at a time!
         try ( Reader fileReader = new BufferedReader( new InputStreamReader( from ) );
-            Writer fileWriter = new OutputStreamWriter( new FileOutputStream( to ) ) )
+            OutputStream out = Files.newOutputStream( to.toPath() );
+            Writer fileWriter = new OutputStreamWriter( out ) )
         {
             Reader reader = null;
             if ( filtering )
@@ -111,7 +112,8 @@ public final class MojoHelperUtils
     public static void copyAsciiFile( GenerateMojo mymojo, Properties filterProperties, File
from, File to,
         boolean filtering ) throws IOException
     {
-        copyAsciiFile( mymojo, filterProperties, from.getAbsolutePath(), new FileInputStream(
from ), to, filtering );
+        InputStream input = Files.newInputStream( from.toPath() );
+        copyAsciiFile( mymojo, filterProperties, from.getAbsolutePath(), input, to, filtering
);
     }
 
 

Modified: directory/apacheds/branches/apacheds-value/interceptors/changelog/src/main/java/org/apache/directory/server/core/changelog/MemoryChangeLogStore.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-value/interceptors/changelog/src/main/java/org/apache/directory/server/core/changelog/MemoryChangeLogStore.java?rev=1792718&r1=1792717&r2=1792718&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-value/interceptors/changelog/src/main/java/org/apache/directory/server/core/changelog/MemoryChangeLogStore.java
(original)
+++ directory/apacheds/branches/apacheds-value/interceptors/changelog/src/main/java/org/apache/directory/server/core/changelog/MemoryChangeLogStore.java
Wed Apr 26 09:19:53 2017
@@ -21,14 +21,15 @@ package org.apache.directory.server.core
 
 import java.io.BufferedReader;
 import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
 import java.io.FileReader;
 import java.io.FileWriter;
 import java.io.IOException;
+import java.io.InputStream;
 import java.io.ObjectInputStream;
 import java.io.ObjectOutputStream;
+import java.io.OutputStream;
 import java.io.PrintWriter;
+import java.nio.file.Files;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.HashMap;
@@ -207,11 +208,11 @@ public class MemoryChangeLogStore implem
             throw new IOException( I18n.err( I18n.ERR_726_FILE_UNDELETABLE, tagFile.getAbsolutePath()
) );
         }
 
-        FileOutputStream out = null;
+        OutputStream out = null;
 
         try
         {
-            out = new FileOutputStream( tagFile );
+            out = Files.newOutputStream( tagFile.toPath() );
 
             Properties props = new Properties();
 
@@ -262,11 +263,11 @@ public class MemoryChangeLogStore implem
         if ( revFile.exists() )
         {
             Properties props = new Properties();
-            FileInputStream in = null;
+            InputStream in = null;
 
             try
             {
-                in = new FileInputStream( revFile );
+                in = Files.newInputStream( revFile.toPath() );
                 props.load( in );
                 ArrayList<Long> revList = new ArrayList<>();
 
@@ -334,7 +335,7 @@ public class MemoryChangeLogStore implem
 
             try
             {
-                in = new ObjectInputStream( new FileInputStream( file ) );
+                in = new ObjectInputStream( Files.newInputStream( file.toPath() ) );
                 int size = in.readInt();
 
                 ArrayList<ChangeLogEvent> changeLogEvents = new ArrayList<>(
size );
@@ -397,7 +398,7 @@ public class MemoryChangeLogStore implem
 
         try
         {
-            out = new ObjectOutputStream( new FileOutputStream( file ) );
+            out = new ObjectOutputStream( Files.newOutputStream( file.toPath() ) );
 
             out.writeInt( events.size() );
 

Modified: directory/apacheds/branches/apacheds-value/interceptors/journal/src/main/java/org/apache/directory/server/core/journal/DefaultJournalStore.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-value/interceptors/journal/src/main/java/org/apache/directory/server/core/journal/DefaultJournalStore.java?rev=1792718&r1=1792717&r2=1792718&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-value/interceptors/journal/src/main/java/org/apache/directory/server/core/journal/DefaultJournalStore.java
(original)
+++ directory/apacheds/branches/apacheds-value/interceptors/journal/src/main/java/org/apache/directory/server/core/journal/DefaultJournalStore.java
Wed Apr 26 09:19:53 2017
@@ -21,11 +21,12 @@ package org.apache.directory.server.core
 
 
 import java.io.File;
-import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.OutputStreamWriter;
 import java.io.PrintWriter;
 import java.io.Writer;
+import java.nio.file.Files;
+import java.nio.file.StandardOpenOption;
 
 import org.apache.directory.api.ldap.model.exception.LdapException;
 import org.apache.directory.api.ldap.model.ldif.LdifEntry;
@@ -89,7 +90,7 @@ public class DefaultJournalStore impleme
         // The new requests are added at the end of the existing journal
         writer = new PrintWriter(
             new OutputStreamWriter(
-                new FileOutputStream( journal, true ) ) );
+                Files.newOutputStream( journal.toPath(), StandardOpenOption.APPEND ) ) );
     }
 
 

Modified: directory/apacheds/branches/apacheds-value/interceptors/schema/src/main/java/org/apache/directory/server/core/schema/SchemaLdifToPartitionExtractor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-value/interceptors/schema/src/main/java/org/apache/directory/server/core/schema/SchemaLdifToPartitionExtractor.java?rev=1792718&r1=1792717&r2=1792718&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-value/interceptors/schema/src/main/java/org/apache/directory/server/core/schema/SchemaLdifToPartitionExtractor.java
(original)
+++ directory/apacheds/branches/apacheds-value/interceptors/schema/src/main/java/org/apache/directory/server/core/schema/SchemaLdifToPartitionExtractor.java
Wed Apr 26 09:19:53 2017
@@ -21,11 +21,11 @@ package org.apache.directory.server.core
 
 
 import java.io.File;
-import java.io.FileInputStream;
 import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.InvalidObjectException;
+import java.nio.file.Files;
 import java.util.Map;
 import java.util.TreeMap;
 import java.util.UUID;
@@ -172,7 +172,7 @@ public class SchemaLdifToPartitionExtrac
             throw new FileNotFoundException( I18n.err( I18n.ERR_08002, source.getAbsolutePath()
) );
         }
 
-        FileInputStream in = new FileInputStream( source );
+        InputStream in = Files.newInputStream( source.toPath() );
         addFromStream( in, source.getAbsolutePath() );
     }
 

Modified: directory/apacheds/branches/apacheds-value/kerberos-client/src/main/java/org/apache/directory/kerberos/credentials/cache/CredentialsCache.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-value/kerberos-client/src/main/java/org/apache/directory/kerberos/credentials/cache/CredentialsCache.java?rev=1792718&r1=1792717&r2=1792718&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-value/kerberos-client/src/main/java/org/apache/directory/kerberos/credentials/cache/CredentialsCache.java
(original)
+++ directory/apacheds/branches/apacheds-value/kerberos-client/src/main/java/org/apache/directory/kerberos/credentials/cache/CredentialsCache.java
Wed Apr 26 09:19:53 2017
@@ -21,11 +21,10 @@ package org.apache.directory.kerberos.cr
 
 import java.io.ByteArrayInputStream;
 import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
+import java.nio.file.Files;
 import java.util.ArrayList;
 import java.util.List;
 
@@ -45,7 +44,7 @@ public class CredentialsCache
 	
     public static CredentialsCache load( File cacheFile ) throws IOException 
     {
-        return load(new FileInputStream( cacheFile ));
+        return load( Files.newInputStream( cacheFile.toPath() ) );
     }
     
     public static CredentialsCache load( InputStream is ) throws IOException 
@@ -60,7 +59,7 @@ public class CredentialsCache
     
     public static void store( File fileName, CredentialsCache credCache ) throws IOException

     {
-        store( new FileOutputStream(fileName), credCache );
+        store( Files.newOutputStream( fileName.toPath() ), credCache );
     }
     
     public static void store( OutputStream os, CredentialsCache credCache ) throws IOException


Modified: directory/apacheds/branches/apacheds-value/kerberos-codec/src/main/java/org/apache/directory/server/kerberos/shared/keytab/Keytab.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-value/kerberos-codec/src/main/java/org/apache/directory/server/kerberos/shared/keytab/Keytab.java?rev=1792718&r1=1792717&r2=1792718&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-value/kerberos-codec/src/main/java/org/apache/directory/server/kerberos/shared/keytab/Keytab.java
(original)
+++ directory/apacheds/branches/apacheds-value/kerberos-codec/src/main/java/org/apache/directory/server/kerberos/shared/keytab/Keytab.java
Wed Apr 26 09:19:53 2017
@@ -21,12 +21,13 @@ package org.apache.directory.server.kerb
 
 
 import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
+import java.io.OutputStream;
 import java.nio.ByteBuffer;
-import java.nio.channels.FileChannel;
+import java.nio.channels.Channels;
+import java.nio.channels.WritableByteChannel;
+import java.nio.file.Files;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
@@ -224,7 +225,7 @@ public class Keytab
      */
     protected static byte[] getBytesFromFile( File file ) throws IOException
     {
-        try (InputStream is = new FileInputStream( file ))
+        try ( InputStream is = Files.newInputStream( file.toPath() ) )
         {
 
             long length = file.length();
@@ -267,16 +268,16 @@ public class Keytab
     protected void writeFile( ByteBuffer buffer, File file ) throws IOException
     {
         // Set append false to replace existing.
-        FileOutputStream fout = new FileOutputStream( file, false );
+        OutputStream out = Files.newOutputStream( file.toPath() );
 
-        try (FileChannel wChannel = fout.getChannel())
+        try ( WritableByteChannel channel = Channels.newChannel( out ) )
         {
             // Write the bytes between the position and limit.
-            wChannel.write( buffer );
+            channel.write( buffer );
         }
         finally
         {
-            fout.close();
+            out.close();
         }
     }
 }

Added: directory/apacheds/branches/apacheds-value/lmdb-partation/pom.xml
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-value/lmdb-partation/pom.xml?rev=1792718&view=auto
==============================================================================
--- directory/apacheds/branches/apacheds-value/lmdb-partation/pom.xml (added)
+++ directory/apacheds/branches/apacheds-value/lmdb-partation/pom.xml Wed Apr 26 09:19:53
2017
@@ -0,0 +1,146 @@
+<?xml version="1.0"?>
+<!--
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  <parent>
+    <groupId>org.apache.directory.server</groupId>
+    <artifactId>apacheds-parent</artifactId>
+    <version>2.0.0-M24-SNAPSHOT</version>
+  </parent>
+  <artifactId>apacheds-ldbm-partition</artifactId>
+  <name>ApacheDS LDBM Partition</name>
+  <packaging>bundle</packaging>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.lmdbjava</groupId>
+      <artifactId>lmdbjava</artifactId>
+      <version>0.0.2</version>
+    </dependency>
+
+    <dependency>
+      <groupId>org.apache.directory.junit</groupId>
+      <artifactId>junit-addons</artifactId>
+      <scope>test</scope>
+    </dependency>
+    
+    <dependency>
+      <groupId>${project.groupId}</groupId>
+      <artifactId>apacheds-core-api</artifactId>
+    </dependency>
+    
+    <dependency>
+      <groupId>${project.groupId}</groupId>
+      <artifactId>apacheds-core-api</artifactId>
+      <type>test-jar</type>
+      <scope>test</scope>
+    </dependency>
+    
+    <dependency>
+      <groupId>${project.groupId}</groupId>
+      <artifactId>apacheds-core-shared</artifactId>
+    </dependency>
+
+    <dependency>
+      <groupId>${project.groupId}</groupId>
+      <artifactId>apacheds-core-avl</artifactId>
+    </dependency>
+    
+    <dependency>
+      <groupId>${project.groupId}</groupId>
+      <artifactId>apacheds-i18n</artifactId>
+    </dependency>
+    
+    <dependency>
+      <groupId>${project.groupId}</groupId>
+      <artifactId>apacheds-xdbm-partition</artifactId>
+    </dependency>
+    
+    <dependency>
+      <groupId>${project.groupId}</groupId>
+      <artifactId>apacheds-xdbm-partition</artifactId>
+      <type>test-jar</type>
+      <scope>test</scope>
+    </dependency>
+    
+    <dependency>
+      <groupId>commons-lang</groupId>
+      <artifactId>commons-lang</artifactId>
+    </dependency>
+    
+    <dependency>
+      <groupId>org.apache.directory.api</groupId>
+      <artifactId>api-ldap-model</artifactId>
+    </dependency>
+    
+    <dependency>
+      <groupId>org.apache.directory.api</groupId>
+      <artifactId>api-ldap-schema-data</artifactId>
+    </dependency>
+    
+    <dependency>
+      <groupId>org.apache.directory.api</groupId>
+      <artifactId>api-util</artifactId>
+    </dependency>
+  </dependencies>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-source-plugin</artifactId>
+        <executions>
+          <execution>
+            <id>attach-sources</id>
+            <phase>verify</phase>
+            <goals>
+              <goal>jar</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+      
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-jar-plugin</artifactId>
+        <configuration>
+          <archive>
+            <manifestFile>META-INF/MANIFEST.MF</manifestFile>
+            <addMavenDescriptor>false</addMavenDescriptor>
+          </archive>
+        </configuration>
+      </plugin>
+      
+      <plugin>
+        <groupId>org.apache.felix</groupId>
+        <artifactId>maven-bundle-plugin</artifactId>
+        <inherited>true</inherited>
+        <extensions>true</extensions>
+        <configuration>
+          <manifestLocation>META-INF</manifestLocation>
+          <instructions>
+            <Bundle-SymbolicName>${project.groupId}.ldbm.partition</Bundle-SymbolicName>
+            <Export-Package>
+                org.apache.directory.server.core.partition.impl.btree.mavibot;version=${project.version};-noimport:=true
+            </Export-Package>
+          </instructions>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+</project>

Modified: directory/apacheds/branches/apacheds-value/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapServer.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-value/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapServer.java?rev=1792718&r1=1792717&r2=1792718&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-value/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapServer.java
(original)
+++ directory/apacheds/branches/apacheds-value/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapServer.java
Wed Apr 26 09:19:53 2017
@@ -20,8 +20,10 @@
 package org.apache.directory.server.ldap;
 
 
-import java.io.FileInputStream;
 import java.io.IOException;
+import java.io.InputStream;
+import java.nio.file.Files;
+import java.nio.file.Paths;
 import java.security.KeyStore;
 import java.security.Provider;
 import java.security.Security;
@@ -380,9 +382,10 @@ public class LdapServer extends Director
         else
         {
             keyStore = KeyStore.getInstance( KeyStore.getDefaultType() );
-            try ( FileInputStream fis = new FileInputStream( keystoreFile ) )
+            
+            try ( InputStream is = Files.newInputStream( Paths.get( keystoreFile ) ) )
             {
-                keyStore.load( fis, null );
+                keyStore.load( is, null );
             }
         }
 

Modified: directory/apacheds/branches/apacheds-value/protocol-shared/src/main/java/org/apache/directory/server/protocol/shared/store/LdifFileLoader.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-value/protocol-shared/src/main/java/org/apache/directory/server/protocol/shared/store/LdifFileLoader.java?rev=1792718&r1=1792717&r2=1792718&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-value/protocol-shared/src/main/java/org/apache/directory/server/protocol/shared/store/LdifFileLoader.java
(original)
+++ directory/apacheds/branches/apacheds-value/protocol-shared/src/main/java/org/apache/directory/server/protocol/shared/store/LdifFileLoader.java
Wed Apr 26 09:19:53 2017
@@ -21,9 +21,10 @@ package org.apache.directory.server.prot
 
 
 import java.io.File;
-import java.io.FileInputStream;
 import java.io.FileNotFoundException;
+import java.io.IOException;
 import java.io.InputStream;
+import java.nio.file.Files;
 import java.util.Collections;
 import java.util.List;
 
@@ -264,11 +265,11 @@ public class LdifFileLoader
      * @return the input stream to the ldif file.
      * @throws FileNotFoundException if the file cannot be found.
      */
-    private InputStream getLdifStream() throws FileNotFoundException
+    private InputStream getLdifStream() throws FileNotFoundException, IOException
     {
         if ( ldif.exists() )
         {
-            return new FileInputStream( ldif );
+            return Files.newInputStream( ldif.toPath() );
         }
         else
         {

Modified: directory/apacheds/branches/apacheds-value/server-config/src/main/java/org/apache/directory/server/config/LdifConfigExtractor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-value/server-config/src/main/java/org/apache/directory/server/config/LdifConfigExtractor.java?rev=1792718&r1=1792717&r2=1792718&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-value/server-config/src/main/java/org/apache/directory/server/config/LdifConfigExtractor.java
(original)
+++ directory/apacheds/branches/apacheds-value/server-config/src/main/java/org/apache/directory/server/config/LdifConfigExtractor.java
Wed Apr 26 09:19:53 2017
@@ -24,12 +24,13 @@ package org.apache.directory.server.conf
 import java.io.BufferedReader;
 import java.io.File;
 import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
 import java.io.FileReader;
 import java.io.FileWriter;
 import java.io.IOException;
 import java.io.InputStream;
+import java.io.OutputStream;
 import java.net.URL;
+import java.nio.file.Files;
 import java.util.Map;
 import java.util.Map.Entry;
 import java.util.Stack;
@@ -192,7 +193,7 @@ public final class LdifConfigExtractor
                 }
             }
 
-            try ( FileOutputStream out = new FileOutputStream( destination ) )
+            try ( OutputStream out = Files.newOutputStream( destination.toPath() ) )
             {
                 while ( in.available() > 0 )
                 {



Mime
View raw message