directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: r608981 - in /directory/apacheds/branches/bigbang: core-integ/src/main/java/org/apache/directory/server/core/integ/ core-integ/src/test/java/org/apache/directory/server/core/authz/ core-integ/src/test/java/org/apache/directory/server/core/j...
Date Fri, 04 Jan 2008 20:21:47 GMT
Author: akarasulu
Date: Fri Jan  4 12:21:46 2008
New Revision: 608981

URL: http://svn.apache.org/viewvc?rev=608981&view=rev
Log:
Making DefaultDirectoryService throw unchecked IllegalStateException instead of
a checked NamingException because of the following two reasons which have just 
been discussed on the mailing list:

  o The checked NamingException is a PITA to deal with in terms of the try/catch
    blocks the user has to deal with all over.
  o The NamingException never really happens unless something is severely broken
    with the build or the packaging is corrupted making the bootstrap schema not
    load.  So there is no reason why we should not wrap this exception in an 
    IllegalStateException.


Modified:
    directory/apacheds/branches/bigbang/core-integ/src/main/java/org/apache/directory/server/core/integ/DirectoryServiceFactory.java
    directory/apacheds/branches/bigbang/core-integ/src/test/java/org/apache/directory/server/core/authz/AutzIntegUtils.java
    directory/apacheds/branches/bigbang/core-integ/src/test/java/org/apache/directory/server/core/jndi/MixedCaseITest.java
    directory/apacheds/branches/bigbang/core-integ/src/test/java/org/apache/directory/server/core/jndi/SearchWithIndicesITest.java
    directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java
    directory/apacheds/branches/bigbang/server-jndi/src/main/java/org/apache/directory/server/configuration/ApacheDS.java

Modified: directory/apacheds/branches/bigbang/core-integ/src/main/java/org/apache/directory/server/core/integ/DirectoryServiceFactory.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core-integ/src/main/java/org/apache/directory/server/core/integ/DirectoryServiceFactory.java?rev=608981&r1=608980&r2=608981&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core-integ/src/main/java/org/apache/directory/server/core/integ/DirectoryServiceFactory.java
(original)
+++ directory/apacheds/branches/bigbang/core-integ/src/main/java/org/apache/directory/server/core/integ/DirectoryServiceFactory.java
Fri Jan  4 12:21:46 2008
@@ -42,7 +42,7 @@
      */
     DirectoryServiceFactory DEFAULT = new DirectoryServiceFactory()
     {
-        public DirectoryService newInstance() throws NamingException
+        public DirectoryService newInstance()
         {
             DirectoryService service = new DefaultDirectoryService();
             service.getChangeLog().setEnabled( true );

Modified: directory/apacheds/branches/bigbang/core-integ/src/test/java/org/apache/directory/server/core/authz/AutzIntegUtils.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core-integ/src/test/java/org/apache/directory/server/core/authz/AutzIntegUtils.java?rev=608981&r1=608980&r2=608981&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core-integ/src/test/java/org/apache/directory/server/core/authz/AutzIntegUtils.java
(original)
+++ directory/apacheds/branches/bigbang/core-integ/src/test/java/org/apache/directory/server/core/authz/AutzIntegUtils.java
Fri Jan  4 12:21:46 2008
@@ -55,7 +55,7 @@
 
     public static class ServiceFactory implements DirectoryServiceFactory
     {
-        public DirectoryService newInstance() throws NamingException
+        public DirectoryService newInstance() 
         {
             DefaultDirectoryService service = new DefaultDirectoryService();
             service.setAccessControlEnabled( true );
@@ -68,7 +68,7 @@
 
     public static class DefaultServiceFactory implements DirectoryServiceFactory
     {
-        public DirectoryService newInstance() throws NamingException
+        public DirectoryService newInstance() 
         {
             DefaultDirectoryService service = new DefaultDirectoryService();
             service.setAccessControlEnabled( false );

Modified: directory/apacheds/branches/bigbang/core-integ/src/test/java/org/apache/directory/server/core/jndi/MixedCaseITest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core-integ/src/test/java/org/apache/directory/server/core/jndi/MixedCaseITest.java?rev=608981&r1=608980&r2=608981&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core-integ/src/test/java/org/apache/directory/server/core/jndi/MixedCaseITest.java
(original)
+++ directory/apacheds/branches/bigbang/core-integ/src/test/java/org/apache/directory/server/core/jndi/MixedCaseITest.java
Fri Jan  4 12:21:46 2008
@@ -74,7 +74,7 @@
 
     public static class MyFactory implements DirectoryServiceFactory
     {
-        public DirectoryService newInstance() throws NamingException
+        public DirectoryService newInstance() 
         {
             DirectoryService service = new DefaultDirectoryService();
             service.getChangeLog().setEnabled( true );

Modified: directory/apacheds/branches/bigbang/core-integ/src/test/java/org/apache/directory/server/core/jndi/SearchWithIndicesITest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core-integ/src/test/java/org/apache/directory/server/core/jndi/SearchWithIndicesITest.java?rev=608981&r1=608980&r2=608981&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core-integ/src/test/java/org/apache/directory/server/core/jndi/SearchWithIndicesITest.java
(original)
+++ directory/apacheds/branches/bigbang/core-integ/src/test/java/org/apache/directory/server/core/jndi/SearchWithIndicesITest.java
Fri Jan  4 12:21:46 2008
@@ -115,7 +115,7 @@
     
     public static class MyFactory implements DirectoryServiceFactory
     {
-        public DirectoryService newInstance() throws NamingException
+        public DirectoryService newInstance() 
         {
             DirectoryService service = new DefaultDirectoryService();
             service.getChangeLog().setEnabled( true );

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java?rev=608981&r1=608980&r2=608981&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java
(original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java
Fri Jan  4 12:21:46 2008
@@ -120,6 +120,10 @@
 {
     private static final Logger LOG = LoggerFactory.getLogger( DefaultDirectoryService.class
);
 
+    private static final String ILLEGAL_STATE_MSG = "Something has got to be severely " +
+    "wrong with the core packaging\nor the build to have " +
+    "resulted in this exception.";
+    
     private SchemaService schemaService;
 
     /** the registries for system schema objects */
@@ -157,7 +161,7 @@
     /**
      * Creates a new instance.
      */
-    public DefaultDirectoryService() throws NamingException
+    public DefaultDirectoryService() 
     {
         setDefaultInterceptorConfigurations();
         changeLog = new DefaultChangeLog();
@@ -177,7 +181,16 @@
         bootstrapSchemas.add( new ApacheSchema() );
         bootstrapSchemas.add( new CoreSchema() );
         bootstrapSchemas.add( new SystemSchema() );
-        loader.loadWithDependencies( bootstrapSchemas, registries );
+        
+        
+        try
+        {
+            loader.loadWithDependencies( bootstrapSchemas, registries );
+        }
+        catch ( NamingException e )
+        {
+            throw new IllegalStateException( ILLEGAL_STATE_MSG, e );
+        }
 
         // run referential integrity tests
         List<Throwable> errors = registries.checkRefInteg();
@@ -185,7 +198,7 @@
         {
             NamingException e = new NamingException();
             e.setRootCause( errors.get( 0 ) );
-            throw e;
+            throw new IllegalStateException( ILLEGAL_STATE_MSG, e );
         }
         
         SerializableComparator.setRegistry( registries.getComparatorRegistry() );

Modified: directory/apacheds/branches/bigbang/server-jndi/src/main/java/org/apache/directory/server/configuration/ApacheDS.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/server-jndi/src/main/java/org/apache/directory/server/configuration/ApacheDS.java?rev=608981&r1=608980&r2=608981&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/server-jndi/src/main/java/org/apache/directory/server/configuration/ApacheDS.java
(original)
+++ directory/apacheds/branches/bigbang/server-jndi/src/main/java/org/apache/directory/server/configuration/ApacheDS.java
Fri Jan  4 12:21:46 2008
@@ -75,7 +75,6 @@
 
 
     public ApacheDS( DirectoryService directoryService, LdapServer ldapServer, LdapServer
ldapsServer )
-        throws NamingException
     {
         this.directoryService = directoryService;
         



Mime
View raw message