Return-Path: X-Original-To: apmail-directory-commits-archive@www.apache.org Delivered-To: apmail-directory-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id A16DA17A03 for ; Sun, 19 Jul 2015 20:46:26 +0000 (UTC) Received: (qmail 90751 invoked by uid 500); 19 Jul 2015 20:46:26 -0000 Delivered-To: apmail-directory-commits-archive@directory.apache.org Received: (qmail 90708 invoked by uid 500); 19 Jul 2015 20:46:26 -0000 Mailing-List: contact commits-help@directory.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@directory.apache.org Delivered-To: mailing list commits@directory.apache.org Received: (qmail 90699 invoked by uid 99); 19 Jul 2015 20:46:26 -0000 Received: from eris.apache.org (HELO hades.apache.org) (140.211.11.105) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 19 Jul 2015 20:46:26 +0000 Received: from hades.apache.org (localhost [127.0.0.1]) by hades.apache.org (ASF Mail Server at hades.apache.org) with ESMTP id EDFDFAC0762 for ; Sun, 19 Jul 2015 20:46:25 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1691853 [2/2] - in /directory/shared/trunk/ldap/model/src: checkstyle/ main/java/org/apache/directory/api/ldap/model/constants/ main/java/org/apache/directory/api/ldap/model/csn/ main/java/org/apache/directory/api/ldap/model/entry/ main/ja... Date: Sun, 19 Jul 2015 20:46:24 -0000 To: commits@directory.apache.org From: seelmann@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20150719204625.EDFDFAC0762@hades.apache.org> Modified: directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/url/LdapUrl.java URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/url/LdapUrl.java?rev=1691853&r1=1691852&r2=1691853&view=diff ============================================================================== --- directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/url/LdapUrl.java (original) +++ directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/url/LdapUrl.java Sun Jul 19 20:46:23 2015 @@ -193,18 +193,20 @@ public class LdapUrl int pos = 0; // The scheme - if ( ( ( pos = Strings.areEquals( chars, 0, LDAP_SCHEME ) ) == StringConstants.NOT_EQUAL ) - && ( ( pos = Strings.areEquals( chars, 0, LDAPS_SCHEME ) ) == StringConstants.NOT_EQUAL ) ) + pos = Strings.areEquals( chars, 0, LDAP_SCHEME ); + if ( pos == StringConstants.NOT_EQUAL ) { - throw new LdapURLEncodingException( I18n.err( I18n.ERR_04398 ) ); - } - else - { - scheme = new String( chars, 0, pos ); + pos = Strings.areEquals( chars, 0, LDAPS_SCHEME ); + if ( pos == StringConstants.NOT_EQUAL ) + { + throw new LdapURLEncodingException( I18n.err( I18n.ERR_04398 ) ); + } } + scheme = new String( chars, 0, pos ); // The hostport - if ( ( pos = parseHostPort( chars, pos ) ) == -1 ) + pos = parseHostPort( chars, pos ); + if ( pos == -1 ) { throw new LdapURLEncodingException( I18n.err( I18n.ERR_04399 ) ); } @@ -228,7 +230,8 @@ public class LdapUrl } // An optional Dn - if ( ( pos = parseDN( chars, pos ) ) == -1 ) + pos = parseDN( chars, pos ); + if ( pos == -1 ) { throw new LdapURLEncodingException( I18n.err( I18n.ERR_04401 ) ); } @@ -246,7 +249,8 @@ public class LdapUrl pos++; - if ( ( pos = parseAttributes( chars, pos ) ) == -1 ) + pos = parseAttributes( chars, pos ); + if ( pos == -1 ) { throw new LdapURLEncodingException( I18n.err( I18n.ERR_04403 ) ); } @@ -264,7 +268,8 @@ public class LdapUrl pos++; - if ( ( pos = parseScope( chars, pos ) ) == -1 ) + pos = parseScope( chars, pos ); + if ( pos == -1 ) { throw new LdapURLEncodingException( I18n.err( I18n.ERR_04404 ) ); } @@ -287,7 +292,8 @@ public class LdapUrl return; } - if ( ( pos = parseFilter( chars, pos ) ) == -1 ) + pos = parseFilter( chars, pos ); + if ( pos == -1 ) { throw new LdapURLEncodingException( I18n.err( I18n.ERR_04405 ) ); } @@ -305,7 +311,8 @@ public class LdapUrl pos++; - if ( ( pos = parseExtensions( chars, pos ) ) == -1 ) + pos = parseExtensions( chars, pos ); + if ( pos == -1 ) { throw new LdapURLEncodingException( I18n.err( I18n.ERR_04406 ) ); } @@ -380,7 +387,7 @@ public class LdapUrl { case '[' : // This is an IP Literal address - return parseIpLiteral( chars, pos+1 ); + return parseIpLiteral( chars, pos + 1 ); case '0' : case '1' : @@ -420,6 +427,9 @@ public class LdapUrl case ',' : case ';' : case '=' : // A reg-name return parseRegName( chars, pos ); + + default: + break; } host = new String( chars, start, pos - start ); @@ -539,7 +549,7 @@ public class LdapUrl pos++; } - if ( ! hexFound ) + if ( !hexFound ) { return -1; } @@ -654,7 +664,7 @@ public class LdapUrl case '%' : if ( Chars.isHex( chars, pos + 1 ) && Chars.isHex( chars, pos + 2 ) ) { - pos+=3; + pos += 3; } else { @@ -831,7 +841,8 @@ public class LdapUrl { int hostPos = pos; - if ( ( pos = parseHost( chars, pos ) ) == -1 ) + pos = parseHost( chars, pos ); + if ( pos == -1 ) { return -1; } @@ -853,7 +864,8 @@ public class LdapUrl } // As we have a ':', we must have a valid port (between 0 and 65535). - if ( ( pos = parsePort( chars, pos ) ) == -1 ) + pos = parsePort( chars, pos ); + if ( pos == -1 ) { return -1; } @@ -1603,6 +1615,10 @@ public class LdapUrl case IPV6 : case IPV_FUTURE : sb.append( '[' ).append( host ).append( ']' ); + break; + + default: + throw new IllegalArgumentException( "Unexpected HostTypeEnum " + hostType ); } }