You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2006/01/22 14:32:14 UTC
svn commit: r371288 -
/directory/trunks/common/ldap/src/main/java/org/apache/ldap/common/codec/util/LdapURL.java
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" );