directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r371288 - /directory/trunks/common/ldap/src/main/java/org/apache/ldap/common/codec/util/LdapURL.java
Date Sun, 22 Jan 2006 13:32:14 GMT
Author: elecharny
Date: Sun Jan 22 05:32:11 2006
New Revision: 371288

URL: http://svn.apache.org/viewcvs?rev=371288&view=rev
Log:
Added a defensive control in the constructors : e can have a null string
or byte[] as a valid LdapURL

Modified:
    directory/trunks/common/ldap/src/main/java/org/apache/ldap/common/codec/util/LdapURL.java

Modified: directory/trunks/common/ldap/src/main/java/org/apache/ldap/common/codec/util/LdapURL.java
URL: http://svn.apache.org/viewcvs/directory/trunks/common/ldap/src/main/java/org/apache/ldap/common/codec/util/LdapURL.java?rev=371288&r1=371287&r2=371288&view=diff
==============================================================================
--- directory/trunks/common/ldap/src/main/java/org/apache/ldap/common/codec/util/LdapURL.java
(original)
+++ directory/trunks/common/ldap/src/main/java/org/apache/ldap/common/codec/util/LdapURL.java
Sun Jan 22 05:32:11 2006
@@ -285,6 +285,11 @@
      */
     public LdapURL( String string ) throws LdapURLEncodingException
     {
+        if ( string == null )
+        {
+            throw new LdapURLEncodingException( "The string is empty : this is not a valid
LdapURL." );
+        }
+        
         try 
         {
             bytes = string.getBytes( "UTF-8" );
@@ -307,6 +312,11 @@
      */
     public LdapURL(  byte[] bytes ) throws LdapURLEncodingException
     {
+        if ( ( bytes == null ) || ( bytes.length == 0 ) )
+        {
+            throw new LdapURLEncodingException( "The byte array is empty : this is not a
valid LdapURL." );
+        }
+        
         try
         {
             string = new String( bytes, "UTF-8" );



Mime
View raw message