directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From seelm...@apache.org
Subject svn commit: r781179 - /directory/apacheds/trunk/server-integ/src/main/java/org/apache/directory/server/integ/state/AbstractState.java
Date Tue, 02 Jun 2009 21:39:31 GMT
Author: seelmann
Date: Tue Jun  2 21:39:30 2009
New Revision: 781179

URL: http://svn.apache.org/viewvc?rev=781179&view=rev
Log:
Use getResourceAsStream, this makes it possible to load an LDIF from within an jar (Eclipse
Plug-in)


Modified:
    directory/apacheds/trunk/server-integ/src/main/java/org/apache/directory/server/integ/state/AbstractState.java

Modified: directory/apacheds/trunk/server-integ/src/main/java/org/apache/directory/server/integ/state/AbstractState.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-integ/src/main/java/org/apache/directory/server/integ/state/AbstractState.java?rev=781179&r1=781178&r2=781179&view=diff
==============================================================================
--- directory/apacheds/trunk/server-integ/src/main/java/org/apache/directory/server/integ/state/AbstractState.java
(original)
+++ directory/apacheds/trunk/server-integ/src/main/java/org/apache/directory/server/integ/state/AbstractState.java
Tue Jun  2 21:39:30 2009
@@ -19,12 +19,10 @@
 package org.apache.directory.server.integ.state;
 
 
-import java.io.File;
 import java.io.FileNotFoundException;
 import java.io.IOException;
+import java.io.InputStream;
 import java.io.StringReader;
-import java.net.URI;
-import java.net.URL;
 import java.util.ArrayList;
 import java.util.List;
 
@@ -212,20 +210,17 @@
                     throw new FileNotFoundException( message );
                 }
                 
-                URL url = clazz.getResource( ldifFile );
-
-                if ( url == null )
+                InputStream in = clazz.getResourceAsStream( ldifFile );
+                
+                if ( in == null )
                 {
                     String message = "Cannot inject a LDIF for the file " + ldifFile;
                     LOG.error( message );
                     throw new FileNotFoundException( message );
                 }
                 
-                URI uri = url.toURI();
-                File file = new File( uri );
+                LdifReader ldifReader = new LdifReader( in );
                 
-                LdifReader ldifReader = new LdifReader( file ); 
-
                 for ( LdifEntry entry : ldifReader )
                 {
                     service.getAdminSession().add( 



Mime
View raw message