directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r993432 - in /directory/shared/trunk: i18n/src/main/java/org/apache/directory/shared/i18n/ i18n/src/main/resources/org/apache/directory/shared/i18n/ ldap-ldif/src/main/java/org/apache/directory/shared/ldap/ldif/
Date Tue, 07 Sep 2010 17:09:40 GMT
Author: elecharny
Date: Tue Sep  7 17:09:40 2010
New Revision: 993432

URL: http://svn.apache.org/viewvc?rev=993432&view=rev
Log:
Fixed some checkstyle warnings
updated some i18n messages

Modified:
    directory/shared/trunk/i18n/src/main/java/org/apache/directory/shared/i18n/I18n.java
    directory/shared/trunk/i18n/src/main/resources/org/apache/directory/shared/i18n/errors.properties
    directory/shared/trunk/ldap-ldif/src/main/java/org/apache/directory/shared/ldap/ldif/LdifAttributesReader.java
    directory/shared/trunk/ldap-ldif/src/main/java/org/apache/directory/shared/ldap/ldif/LdifEntry.java
    directory/shared/trunk/ldap-ldif/src/main/java/org/apache/directory/shared/ldap/ldif/LdifReader.java
    directory/shared/trunk/ldap-ldif/src/main/java/org/apache/directory/shared/ldap/ldif/LdifUtils.java

Modified: directory/shared/trunk/i18n/src/main/java/org/apache/directory/shared/i18n/I18n.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/i18n/src/main/java/org/apache/directory/shared/i18n/I18n.java?rev=993432&r1=993431&r2=993432&view=diff
==============================================================================
--- directory/shared/trunk/i18n/src/main/java/org/apache/directory/shared/i18n/I18n.java (original)
+++ directory/shared/trunk/i18n/src/main/java/org/apache/directory/shared/i18n/I18n.java Tue
Sep  7 17:09:40 2010
@@ -710,32 +710,22 @@ public enum I18n
     ERR_12015_INVALID_BASE64_DN( "ERR_12015_INVALID_BASE64_DN" ),
     ERR_12016_DN_EXPECTED( "ERR_12016_DN_EXPECTED" ),
     ERR_12017_INVALID_DN( "ERR_12017_INVALID_DN" ),
-    ERR_12018( "ERR_12018" ),
-    ERR_12019( "ERR_12019" ),
-    ERR_12020( "ERR_12020" ),
-    ERR_12021( "ERR_12021" ),
-    ERR_12022( "ERR_12022" ),
-    ERR_12023( "ERR_12023" ),
-    ERR_12024( "ERR_12024" ),
-    ERR_12025( "ERR_12025" ),
-    ERR_12026( "ERR_12026" ),
-    ERR_12027( "ERR_12027" ),
-    ERR_12028( "ERR_12028" ),
-    ERR_12029( "ERR_12029" ),
-    ERR_12030( "ERR_12030" ),
-    ERR_12031( "ERR_12031" ),
-    ERR_12032( "ERR_12032" ),
-    ERR_12033( "ERR_12033" ),
-    ERR_12034( "ERR_12034" ),
-    ERR_12035( "ERR_12035" ),
-    ERR_12036( "ERR_12036" ),
-    ERR_12037( "ERR_12037" ),
-    ERR_12038( "ERR_12038" ),
-    ERR_12039( "ERR_12039" ),
-    ERR_12040( "ERR_12040" ),
-    ERR_12041( "ERR_12041" ),
-    ERR_12042( "ERR_12042" ),
-    ERR_12043( "ERR_12043" ),
+    ERR_12018_FILE_NOT_FOUND( "ERR_12018_FILE_NOT_FOUND" ),
+    ERR_12019_BAD_URL_FILE_NOT_FOUND( "ERR_12019_BAD_URL_FILE_NOT_FOUND" ),
+    ERR_12020_FILE_TOO_BIG( "ERR_12020_FILE_TOO_BIG" ),
+    ERR_12022_ERROR_READING_FILE( "ERR_12022_ERROR_READING_FILE" ),
+    ERR_12023_ERROR_READING_BAD_URL( "ERR_12023_ERROR_READING_BAD_URL" ),
+    ERR_12024_CANNOT_CLOSE_FILE( "ERR_12024_CANNOT_CLOSE_FILE" ),
+    ERR_12025_BAD_PROTOCOL( "ERR_12025_BAD_PROTOCOL" ),
+    ERR_12026_UNSUPPORTED_PROTOCOL( "ERR_12026_UNSUPPORTED_PROTOCOL" ),
+    ERR_12027_BAD_URL( "ERR_12027_BAD_URL" ),
+    ERR_12029_CONTROL_WITHOUT_OID( "ERR_12029_CONTROL_WITHOUT_OID" ),
+    ERR_12031_INVALID_OID( "ERR_12031_INVALID_OID" ),
+    ERR_12033_INVALID_CRITICALITY( "ERR_12033_INVALID_CRITICALITY" ),
+    ERR_12035_BAD_MODRDN_OPERATION( "ERR_12035_BAD_MODRDN_OPERATION" ),
+    ERR_12038_NO_DELETEOLDRDN( "ERR_12038_NO_DELETEOLDRDN" ),
+    ERR_12040_BAD_MODIFY_SEPARATOR( "ERR_12040_BAD_MODIFY_SEPARATOR" ),
+    ERR_12042_BAD_MODIFY_SEPARATOR_2( "ERR_12042_BAD_MODIFY_SEPARATOR_2" ),
     ERR_12044( "ERR_12044" ),
     ERR_12045( "ERR_12045" ),
     ERR_12046( "ERR_12046" ),
@@ -749,15 +739,14 @@ public enum I18n
     ERR_12054( "ERR_12054" ),
     ERR_12055( "ERR_12055" ),
     ERR_12056( "ERR_12056" ),
-    ERR_12057( "ERR_12057" ),
-    ERR_12058( "ERR_12058" ),
-    ERR_12059( "ERR_12059" ),
-    ERR_12060( "ERR_12060" ),
-    ERR_12061( "ERR_12061" ),
-    ERR_12062( "ERR_12062" ),
-    ERR_12063( "ERR_12063" ),
-    ERR_12064( "ERR_12064" ),
-    ERR_12065( "ERR_12065" ),
+    ERR_12057_BAD_ATTRIBUTE( "ERR_12057_BAD_ATTRIBUTE" ),
+    ERR_12058_UNKNOWN_ENTRY_TYPE( "ERR_12058_UNKNOWN_ENTRY_TYPE" ),
+    ERR_12059_UNKNOWN_ENTRY( "ERR_12059_UNKNOWN_ENTRY" ),
+    ERR_12060_VERSION_NOT_A_NUMBER( "ERR_12060_VERSION_NOT_A_NUMBER" ),
+    ERR_12061_LDIF_PARSING_ERROR( "ERR_12061_LDIF_PARSING_ERROR" ),
+    ERR_12062_EMPTY_CONTINUATION_LINE( "ERR_12062_EMPTY_CONTINUATION_LINE" ),
+    ERR_12063_ERROR_WHILE_READING_LDIF_LINE( "ERR_12063_ERROR_WHILE_READING_LDIF_LINE" ),
+    ERR_12064_EMPTY_FILE_NAME( "ERR_12064_EMPTY_FILE_NAME" ),
     ERR_12066( "ERR_12066" ),
     ERR_12067( "ERR_12067" ),
     ERR_12068( "ERR_12068" ),

Modified: directory/shared/trunk/i18n/src/main/resources/org/apache/directory/shared/i18n/errors.properties
URL: http://svn.apache.org/viewvc/directory/shared/trunk/i18n/src/main/resources/org/apache/directory/shared/i18n/errors.properties?rev=993432&r1=993431&r2=993432&view=diff
==============================================================================
--- directory/shared/trunk/i18n/src/main/resources/org/apache/directory/shared/i18n/errors.properties
(original)
+++ directory/shared/trunk/i18n/src/main/resources/org/apache/directory/shared/i18n/errors.properties
Tue Sep  7 17:09:40 2010
@@ -696,32 +696,22 @@ ERR_12014_BASE64_DN_EXPECTED=The ldif en
 ERR_12015_INVALID_BASE64_DN=Invalid base 64 encoded DN
 ERR_12016_DN_EXPECTED=A ldif entry must start with a DN
 ERR_12017_INVALID_DN=The DN {0} is not valid
-ERR_12018=File {0} not found
-ERR_12019=Bad URL, file not found
-ERR_12020=File {0} is too big
-ERR_12021=File too big
-ERR_12022=File {0} error reading
-ERR_12023=Bad URL, file can't be read
-ERR_12024=Error while closing the stream : {0}
-ERR_12025=Protocols other than file: are not supported
-ERR_12026=Unsupported URL protocol
-ERR_12027=Bad URL {0}
-ERR_12028=Bad URL
-ERR_12029=The control does not have an OID
-ERR_12030=Bad control, no oid
-ERR_12031=The OID {0} is not valid
-ERR_12032=Bad control oid
-ERR_12033=The control must have a valid criticality
-ERR_12034=Bad control criticality
-ERR_12035=A modrdn operation must start with a "newrdn\:"
-ERR_12036=Bad modrdn operation
-ERR_12037=Bad modrdn operation, no newrdn
-ERR_12038=A modrdn operation must contains a "deleteoldrdn\:"
-ERR_12039=Bad modrdn operation, no deleteoldrdn
-ERR_12040=Bad state : we should have come from an ATTRVAL_SPEC
-ERR_12041=Bad modify separator
-ERR_12042=Bad state : we should have come from a MOD_SPEC or an ATTRVAL_SPEC
-ERR_12043=Bad modify state
+ERR_12018_FILE_NOT_FOUND=File {0} not found
+ERR_12019_BAD_URL_FILE_NOT_FOUND=Bad URL, file not found
+ERR_12020_FILE_TOO_BIG=File {0} is too big
+ERR_12022_ERROR_READING_FILE=File {0} error reading
+ERR_12023_ERROR_READING_BAD_URL=Bad URL, file can't be read
+ERR_12024_CANNOT_CLOSE_FILE=Error while closing the stream : {0}
+ERR_12025_BAD_PROTOCOL=Protocols other than file: are not supported
+ERR_12026_UNSUPPORTED_PROTOCOL=Unsupported URL protocol
+ERR_12027_BAD_URL=Bad URL {0}
+ERR_12029_CONTROL_WITHOUT_OID=The control does not have an OID
+ERR_12031_INVALID_OID=The OID {0} is not valid
+ERR_12033_INVALID_CRITICALITY=The control must have a valid criticality
+ERR_12035_BAD_MODRDN_OPERATION=A modrdn operation must start with a "newrdn\:"
+ERR_12038_NO_DELETEOLDRDN=A modrdn operation must contains a "deleteoldrdn\:"
+ERR_12040_BAD_MODIFY_SEPARATOR=Bad state : we should have come from an ATTRVAL_SPEC
+ERR_12042_BAD_MODIFY_SEPARATOR_2=Bad state : we should have come from a MOD_SPEC or an ATTRVAL_SPEC
 ERR_12044=The modified attribute and the attribute value spec must be equal
 ERR_12045=Bad modify attribute
 ERR_12046=A moddn operation must contains a "newsuperior\:"
@@ -735,15 +725,14 @@ ERR_12053=ChangeType misplaced
 ERR_12054=We can't have a Attribute/Value pair after a control or a changeType
 ERR_12055=AttributeType misplaced
 ERR_12056=Expecting an attribute type
-ERR_12057=Bad attribute
-ERR_12058=Unknown entry type
-ERR_12059=Unknown entry
-ERR_12060=The version is not a number
-ERR_12061=Ldif parsing error
-ERR_12062=Cannot have an empty continuation line
-ERR_12063=Error while reading ldif lines
-ERR_12064=Cannot parse an empty file name !
-ERR_12065=Empty filename
+ERR_12057_BAD_ATTRIBUTE=Bad attribute
+ERR_12058_UNKNOWN_ENTRY_TYPE=Unknown entry type
+ERR_12059_UNKNOWN_ENTRY=Unknown entry
+ERR_12060_VERSION_NOT_A_NUMBER=The version is not a number
+ERR_12061_LDIF_PARSING_ERROR=Ldif parsing error
+ERR_12062_EMPTY_CONTINUATION_LINE=Cannot have an empty continuation line
+ERR_12063_ERROR_WHILE_READING_LDIF_LINE=Error while reading ldif lines
+ERR_12064_EMPTY_FILE_NAME=Cannot parse an empty file name !
 ERR_12066=Cannot parse the file {0}, it does not exist
 ERR_12067=Filename {0} not found.
 ERR_12068=Cannot find file {0}

Modified: directory/shared/trunk/ldap-ldif/src/main/java/org/apache/directory/shared/ldap/ldif/LdifAttributesReader.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap-ldif/src/main/java/org/apache/directory/shared/ldap/ldif/LdifAttributesReader.java?rev=993432&r1=993431&r2=993432&view=diff
==============================================================================
--- directory/shared/trunk/ldap-ldif/src/main/java/org/apache/directory/shared/ldap/ldif/LdifAttributesReader.java
(original)
+++ directory/shared/trunk/ldap-ldif/src/main/java/org/apache/directory/shared/ldap/ldif/LdifAttributesReader.java
Tue Sep  7 17:09:40 2010
@@ -278,7 +278,7 @@ public class LdifAttributesReader extend
                 }
                 catch ( LdapException le )
                 {
-                    // 
+                    throw new LdapLdifException( I18n.err( I18n.ERR_12057_BAD_ATTRIBUTE )
);
                 }
             }
         }
@@ -487,7 +487,7 @@ public class LdifAttributesReader extend
             }
             catch ( IOException ioe )
             {
-                // Do nothing
+                throw new LdapLdifException( I18n.err( I18n.ERR_12024_CANNOT_CLOSE_FILE )
);
             }
         }
     }
@@ -551,7 +551,7 @@ public class LdifAttributesReader extend
             }
             catch ( IOException ioe )
             {
-                // Do nothing
+                throw new LdapLdifException( I18n.err( I18n.ERR_12024_CANNOT_CLOSE_FILE )
);
             }
         }
     }
@@ -616,7 +616,7 @@ public class LdifAttributesReader extend
             }
             catch ( IOException ioe )
             {
-                // Do nothing
+                throw new LdapLdifException( I18n.err( I18n.ERR_12024_CANNOT_CLOSE_FILE )
);
             }
         }
     }

Modified: directory/shared/trunk/ldap-ldif/src/main/java/org/apache/directory/shared/ldap/ldif/LdifEntry.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap-ldif/src/main/java/org/apache/directory/shared/ldap/ldif/LdifEntry.java?rev=993432&r1=993431&r2=993432&view=diff
==============================================================================
--- directory/shared/trunk/ldap-ldif/src/main/java/org/apache/directory/shared/ldap/ldif/LdifEntry.java
(original)
+++ directory/shared/trunk/ldap-ldif/src/main/java/org/apache/directory/shared/ldap/ldif/LdifEntry.java
Tue Sep  7 17:09:40 2010
@@ -124,7 +124,7 @@ public class LdifEntry implements Clonea
      * Set the Distinguished Name
      * 
      * @param dn The Distinguished Name
-     * throws LdapInvalidDnException If the DN is invalid
+     * @throws LdapInvalidDnException If the DN is invalid
      */
     public void setDn( String dn ) throws LdapInvalidDnException
     {
@@ -712,7 +712,16 @@ public class LdifEntry implements Clonea
 
                 case ModDn:
                 case ModRdn:
-                    result = result * 17 + ( deleteOldRdn ? 1 : -1 );
+                    result = result * 17;
+
+                    if ( deleteOldRdn )
+                    {
+                        result++;
+                    }
+                    else
+                    {
+                        result--;
+                    }
 
                     if ( newRdn != null )
                     {

Modified: directory/shared/trunk/ldap-ldif/src/main/java/org/apache/directory/shared/ldap/ldif/LdifReader.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap-ldif/src/main/java/org/apache/directory/shared/ldap/ldif/LdifReader.java?rev=993432&r1=993431&r2=993432&view=diff
==============================================================================
--- directory/shared/trunk/ldap-ldif/src/main/java/org/apache/directory/shared/ldap/ldif/LdifReader.java
(original)
+++ directory/shared/trunk/ldap-ldif/src/main/java/org/apache/directory/shared/ldap/ldif/LdifReader.java
Tue Sep  7 17:09:40 2010
@@ -619,8 +619,8 @@ public class LdifReader implements Itera
 
                         if ( !file.exists() )
                         {
-                            LOG.error( I18n.err( I18n.ERR_12018, fileName ) );
-                            throw new LdapLdifException( I18n.err( I18n.ERR_12019 ) );
+                            LOG.error( I18n.err( I18n.ERR_12018_FILE_NOT_FOUND, fileName
) );
+                            throw new LdapLdifException( I18n.err( I18n.ERR_12019_BAD_URL_FILE_NOT_FOUND
) );
                         }
                         else
                         {
@@ -628,8 +628,9 @@ public class LdifReader implements Itera
 
                             if ( length > sizeLimit )
                             {
-                                LOG.error( I18n.err( I18n.ERR_12020, fileName ) );
-                                throw new LdapLdifException( I18n.err( I18n.ERR_12021 ) );
+                                String message = I18n.err( I18n.ERR_12020_FILE_TOO_BIG, fileName
);
+                                LOG.error( message );
+                                throw new LdapLdifException( message );
                             }
                             else
                             {
@@ -648,13 +649,13 @@ public class LdifReader implements Itera
                                     // We can't reach this point, the file
                                     // existence has already been
                                     // checked
-                                    LOG.error( I18n.err( I18n.ERR_12018, fileName ) );
-                                    throw new LdapLdifException( I18n.err( I18n.ERR_12019
) );
+                                    LOG.error( I18n.err( I18n.ERR_12018_FILE_NOT_FOUND, fileName
) );
+                                    throw new LdapLdifException( I18n.err( I18n.ERR_12019_BAD_URL_FILE_NOT_FOUND
) );
                                 }
                                 catch ( IOException ioe )
                                 {
-                                    LOG.error( I18n.err( I18n.ERR_12022, fileName ) );
-                                    throw new LdapLdifException( I18n.err( I18n.ERR_12023
) );
+                                    LOG.error( I18n.err( I18n.ERR_12022_ERROR_READING_FILE,
fileName ) );
+                                    throw new LdapLdifException( I18n.err( I18n.ERR_12023_ERROR_READING_BAD_URL
) );
                                 }
                                 finally
                                 {
@@ -664,7 +665,7 @@ public class LdifReader implements Itera
                                     }
                                     catch ( IOException ioe )
                                     {
-                                        LOG.error( I18n.err( I18n.ERR_12024, ioe.getMessage()
) );
+                                        LOG.error( I18n.err( I18n.ERR_12024_CANNOT_CLOSE_FILE,
ioe.getMessage() ) );
                                         // Just do nothing ...
                                     }
                                 }
@@ -673,14 +674,15 @@ public class LdifReader implements Itera
                     }
                     else
                     {
-                        LOG.error( I18n.err( I18n.ERR_12025 ) );
-                        throw new LdapLdifException( I18n.err( I18n.ERR_12026 ) );
+                        LOG.error( I18n.err( I18n.ERR_12025_BAD_PROTOCOL ) );
+                        throw new LdapLdifException( I18n.err( I18n.ERR_12026_UNSUPPORTED_PROTOCOL
) );
                     }
                 }
                 catch ( MalformedURLException mue )
                 {
-                    LOG.error( I18n.err( I18n.ERR_12027, urlName ) );
-                    throw new LdapLdifException( I18n.err( I18n.ERR_12028 ) );
+                    String message = I18n.err( I18n.ERR_12027_BAD_URL, urlName );
+                    LOG.error( message );
+                    throw new LdapLdifException( message );
                 }
             }
             else
@@ -728,8 +730,8 @@ public class LdifReader implements Itera
         if ( pos > length )
         {
             // No OID : error !
-            LOG.error( I18n.err( I18n.ERR_12029 ) );
-            throw new LdapLdifException( I18n.err( I18n.ERR_12030 ) );
+            LOG.error( I18n.err( I18n.ERR_12029_CONTROL_WITHOUT_OID ) );
+            throw new LdapLdifException( I18n.err( I18n.ERR_12029_CONTROL_WITHOUT_OID ) );
         }
 
         int initPos = pos;
@@ -742,8 +744,8 @@ public class LdifReader implements Itera
         if ( pos == initPos )
         {
             // Not a valid OID !
-            LOG.error( I18n.err( I18n.ERR_12029 ) );
-            throw new LdapLdifException( I18n.err( I18n.ERR_12030 ) );
+            LOG.error( I18n.err( I18n.ERR_12029_CONTROL_WITHOUT_OID ) );
+            throw new LdapLdifException( I18n.err( I18n.ERR_12029_CONTROL_WITHOUT_OID ) );
         }
 
         // Create and check the OID
@@ -751,8 +753,9 @@ public class LdifReader implements Itera
 
         if ( !OID.isOID( oidString ) )
         {
-            LOG.error( I18n.err( I18n.ERR_12031, oidString ) );
-            throw new LdapLdifException( I18n.err( I18n.ERR_12032 ) );
+            String message = I18n.err( I18n.ERR_12031_INVALID_OID, oidString );
+            LOG.error( message );
+            throw new LdapLdifException( message );
         }
 
         LdifControl control = new LdifControl( oidString );
@@ -790,8 +793,8 @@ public class LdifReader implements Itera
         {
             // If we have a criticality, it should be either "true" or "false",
             // nothing else
-            LOG.error( I18n.err( I18n.ERR_12033 ) );
-            throw new LdapLdifException( I18n.err( I18n.ERR_12034 ) );
+            LOG.error( I18n.err( I18n.ERR_12033_INVALID_CRITICALITY ) );
+            throw new LdapLdifException( I18n.err( I18n.ERR_12033_INVALID_CRITICALITY ) );
         }
 
         if ( criticalPos > 0 )
@@ -865,10 +868,9 @@ public class LdifReader implements Itera
      * @param entry The entry where to store the value
      * @param line The line to parse
      * @param lowerLine The same line, lowercased
-     * @throws LdapLdifException If anything goes wrong
+     * @throws LdapException If anything goes wrong
      */
-    public void parseAttributeValue( LdifEntry entry, String line, String lowerLine ) throws
LdapLdifException,
-        LdapException
+    public void parseAttributeValue( LdifEntry entry, String line, String lowerLine ) throws
LdapException
     {
         int colonIndex = line.indexOf( ':' );
 
@@ -920,15 +922,15 @@ public class LdifReader implements Itera
             }
             else
             {
-                LOG.error( I18n.err( I18n.ERR_12035 ) );
-                throw new LdapLdifException( I18n.err( I18n.ERR_12036 ) );
+                LOG.error( I18n.err( I18n.ERR_12035_BAD_MODRDN_OPERATION ) );
+                throw new LdapLdifException( I18n.err( I18n.ERR_12035_BAD_MODRDN_OPERATION
) );
             }
 
         }
         else
         {
-            LOG.error( I18n.err( I18n.ERR_12035 ) );
-            throw new LdapLdifException( I18n.err( I18n.ERR_12037 ) );
+            LOG.error( I18n.err( I18n.ERR_12035_BAD_MODRDN_OPERATION ) );
+            throw new LdapLdifException( I18n.err( I18n.ERR_12035_BAD_MODRDN_OPERATION )
);
         }
 
         if ( iter.hasNext() )
@@ -944,14 +946,14 @@ public class LdifReader implements Itera
             }
             else
             {
-                LOG.error( I18n.err( I18n.ERR_12038 ) );
-                throw new LdapLdifException( I18n.err( I18n.ERR_12039 ) );
+                LOG.error( I18n.err( I18n.ERR_12038_NO_DELETEOLDRDN ) );
+                throw new LdapLdifException( I18n.err( I18n.ERR_12038_NO_DELETEOLDRDN ) );
             }
         }
         else
         {
-            LOG.error( I18n.err( I18n.ERR_12038 ) );
-            throw new LdapLdifException( I18n.err( I18n.ERR_12039 ) );
+            LOG.error( I18n.err( I18n.ERR_12038_NO_DELETEOLDRDN ) );
+            throw new LdapLdifException( I18n.err( I18n.ERR_12038_NO_DELETEOLDRDN ) );
         }
     }
 
@@ -993,8 +995,8 @@ public class LdifReader implements Itera
             {
                 if ( state != ATTRVAL_SPEC_OR_SEP )
                 {
-                    LOG.error( I18n.err( I18n.ERR_12040 ) );
-                    throw new LdapLdifException( I18n.err( I18n.ERR_12041 ) );
+                    LOG.error( I18n.err( I18n.ERR_12040_BAD_MODIFY_SEPARATOR ) );
+                    throw new LdapLdifException( I18n.err( I18n.ERR_12040_BAD_MODIFY_SEPARATOR
) );
                 }
                 else
                 {
@@ -1018,8 +1020,8 @@ public class LdifReader implements Itera
             {
                 if ( ( state != MOD_SPEC ) && ( state != ATTRVAL_SPEC ) )
                 {
-                    LOG.error( I18n.err( I18n.ERR_12042 ) );
-                    throw new LdapLdifException( I18n.err( I18n.ERR_12043 ) );
+                    LOG.error( I18n.err( I18n.ERR_12042_BAD_MODIFY_SEPARATOR_2 ) );
+                    throw new LdapLdifException( I18n.err( I18n.ERR_12042_BAD_MODIFY_SEPARATOR_2
) );
                 }
 
                 modified = StringTools.trim( line.substring( "add:".length() ) );
@@ -1032,8 +1034,8 @@ public class LdifReader implements Itera
             {
                 if ( ( state != MOD_SPEC ) && ( state != ATTRVAL_SPEC ) )
                 {
-                    LOG.error( I18n.err( I18n.ERR_12042 ) );
-                    throw new LdapLdifException( I18n.err( I18n.ERR_12043 ) );
+                    LOG.error( I18n.err( I18n.ERR_12042_BAD_MODIFY_SEPARATOR_2 ) );
+                    throw new LdapLdifException( I18n.err( I18n.ERR_12042_BAD_MODIFY_SEPARATOR_2
) );
                 }
 
                 modified = StringTools.trim( line.substring( "delete:".length() ) );
@@ -1046,8 +1048,8 @@ public class LdifReader implements Itera
             {
                 if ( ( state != MOD_SPEC ) && ( state != ATTRVAL_SPEC ) )
                 {
-                    LOG.error( I18n.err( I18n.ERR_12042 ) );
-                    throw new LdapLdifException( I18n.err( I18n.ERR_12043 ) );
+                    LOG.error( I18n.err( I18n.ERR_12042_BAD_MODIFY_SEPARATOR_2 ) );
+                    throw new LdapLdifException( I18n.err( I18n.ERR_12042_BAD_MODIFY_SEPARATOR_2
) );
                 }
 
                 modified = StringTools.trim( line.substring( "replace:".length() ) );
@@ -1060,8 +1062,8 @@ public class LdifReader implements Itera
             {
                 if ( ( state != ATTRVAL_SPEC ) && ( state != ATTRVAL_SPEC_OR_SEP
) )
                 {
-                    LOG.error( I18n.err( I18n.ERR_12040 ) );
-                    throw new LdapLdifException( I18n.err( I18n.ERR_12043 ) );
+                    LOG.error( I18n.err( I18n.ERR_12040_BAD_MODIFY_SEPARATOR ) );
+                    throw new LdapLdifException( I18n.err( I18n.ERR_12040_BAD_MODIFY_SEPARATOR
) );
                 }
 
                 // A standard AttributeType/AttributeValue pair
@@ -1348,7 +1350,7 @@ public class LdifReader implements Itera
             {
                 // Invalid attribute Value
                 LOG.error( I18n.err( I18n.ERR_12056 ) );
-                throw new LdapLdifException( I18n.err( I18n.ERR_12057 ) );
+                throw new LdapLdifException( I18n.err( I18n.ERR_12057_BAD_ATTRIBUTE ) );
             }
         }
 
@@ -1363,8 +1365,8 @@ public class LdifReader implements Itera
         }
         else
         {
-            LOG.error( I18n.err( I18n.ERR_12058 ) );
-            throw new LdapLdifException( I18n.err( I18n.ERR_12059 ) );
+            LOG.error( I18n.err( I18n.ERR_12058_UNKNOWN_ENTRY_TYPE ) );
+            throw new LdapLdifException( I18n.err( I18n.ERR_12059_UNKNOWN_ENTRY ) );
         }
 
         return entry;
@@ -1408,8 +1410,8 @@ public class LdifReader implements Itera
             // We should not have any other chars after the number
             if ( position != document.length )
             {
-                LOG.error( I18n.err( I18n.ERR_12060 ) );
-                throw new LdapLdifException( I18n.err( I18n.ERR_12061 ) );
+                LOG.error( I18n.err( I18n.ERR_12060_VERSION_NOT_A_NUMBER ) );
+                throw new LdapLdifException( I18n.err( I18n.ERR_12061_LDIF_PARSING_ERROR
) );
             }
 
             try
@@ -1418,8 +1420,8 @@ public class LdifReader implements Itera
             }
             catch ( NumberFormatException nfe )
             {
-                LOG.error( I18n.err( I18n.ERR_12060 ) );
-                throw new LdapLdifException( I18n.err( I18n.ERR_12061 ) );
+                LOG.error( I18n.err( I18n.ERR_12060_VERSION_NOT_A_NUMBER ) );
+                throw new LdapLdifException( I18n.err( I18n.ERR_12061_LDIF_PARSING_ERROR
) );
             }
 
             LOG.debug( "Ldif version : {}", versionNumber );
@@ -1493,8 +1495,8 @@ public class LdifReader implements Itera
                         }
                         else if ( sb.length() == 0 )
                         {
-                            LOG.error( I18n.err( I18n.ERR_12062 ) );
-                            throw new LdapLdifException( I18n.err( I18n.ERR_12061 ) );
+                            LOG.error( I18n.err( I18n.ERR_12062_EMPTY_CONTINUATION_LINE )
);
+                            throw new LdapLdifException( I18n.err( I18n.ERR_12061_LDIF_PARSING_ERROR
) );
                         }
                         else
                         {
@@ -1522,7 +1524,7 @@ public class LdifReader implements Itera
         }
         catch ( IOException ioe )
         {
-            throw new LdapLdifException( I18n.err( I18n.ERR_12063 ) );
+            throw new LdapLdifException( I18n.err( I18n.ERR_12063_ERROR_WHILE_READING_LDIF_LINE
) );
         }
 
         // Stores the current line if necessary.
@@ -1560,8 +1562,8 @@ public class LdifReader implements Itera
     {
         if ( StringTools.isEmpty( fileName ) )
         {
-            LOG.error( I18n.err( I18n.ERR_12064 ) );
-            throw new LdapLdifException( I18n.err( I18n.ERR_12065 ) );
+            LOG.error( I18n.err( I18n.ERR_12064_EMPTY_FILE_NAME ) );
+            throw new LdapLdifException( I18n.err( I18n.ERR_12064_EMPTY_FILE_NAME ) );
         }
 
         File file = new File( fileName );
@@ -1663,7 +1665,7 @@ public class LdifReader implements Itera
             }
             catch ( IOException ioe )
             {
-                // Nothing to do
+                throw new LdapLdifException( I18n.err( I18n.ERR_12024_CANNOT_CLOSE_FILE )
);
             }
 
         }

Modified: directory/shared/trunk/ldap-ldif/src/main/java/org/apache/directory/shared/ldap/ldif/LdifUtils.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap-ldif/src/main/java/org/apache/directory/shared/ldap/ldif/LdifUtils.java?rev=993432&r1=993431&r2=993432&view=diff
==============================================================================
--- directory/shared/trunk/ldap-ldif/src/main/java/org/apache/directory/shared/ldap/ldif/LdifUtils.java
(original)
+++ directory/shared/trunk/ldap-ldif/src/main/java/org/apache/directory/shared/ldap/ldif/LdifUtils.java
Tue Sep  7 17:09:40 2010
@@ -257,7 +257,7 @@ public final class LdifUtils
      *
      * @param ldif The LDIF string containing an attribute value
      * @return An Attributes instance
-     * @exception LdapException If the LDIF String cannot be converted to an Attributes
+     * @exception LdapLdifException If the LDIF String cannot be converted to an Attributes
      */
     public static Attributes convertAttributesFromLdif( String ldif ) throws LdapLdifException
     {
@@ -474,10 +474,6 @@ public final class LdifUtils
                         case REPLACE_ATTRIBUTE:
                             sb.append( "replace: " );
                             break;
-
-                        default:
-                            break; // Do nothing
-
                     }
 
                     sb.append( modification.getAttribute().getId() );
@@ -486,11 +482,8 @@ public final class LdifUtils
                     sb.append( convertToLdif( modification.getAttribute() ) );
                     sb.append( "-\n" );
                 }
-                break;
-
-            default:
-                break; // Do nothing
 
+                break;
         }
 
         sb.append( '\n' );



Mime
View raw message