LDAP-257: Got rid of commons-lang dependency in core. Upped some versions.

This commit is contained in:
Mattias Hellborg Arthursson
2013-08-28 13:45:17 +02:00
parent 36cbb8894e
commit 7d50459ae1
35 changed files with 361 additions and 418 deletions

View File

@@ -16,7 +16,6 @@
package org.springframework.ldap.ldif.parser;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.InitializingBean;
@@ -32,6 +31,7 @@ import org.springframework.ldap.ldif.support.SeparatorPolicy;
import org.springframework.ldap.schema.DefaultSchemaSpecification;
import org.springframework.ldap.schema.Specification;
import org.springframework.util.Assert;
import org.springframework.util.StringUtils;
import javax.naming.NamingException;
import javax.naming.directory.Attribute;
@@ -324,7 +324,7 @@ public class LdifParser implements Parser, InitializingBean {
private void addAttributeToRecord(String buffer, LdapAttributes record) {
try {
if (StringUtils.isNotEmpty(buffer) && record != null) {
if (StringUtils.hasLength(buffer) && record != null) {
//Validate previous attribute and add to record.
Attribute attribute = attributePolicy.parse(buffer);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2005-2010 the original author or authors.
* Copyright 2005-2013 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -15,6 +15,14 @@
*/
package org.springframework.ldap.ldif.support;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.ldap.core.LdapAttribute;
import org.springframework.ldap.ldif.InvalidAttributeFormatException;
import org.springframework.util.StringUtils;
import sun.misc.BASE64Decoder;
import javax.naming.directory.Attribute;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
@@ -23,16 +31,6 @@ import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.naming.directory.Attribute;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.ldap.core.LdapAttribute;
import org.springframework.ldap.ldif.InvalidAttributeFormatException;
import sun.misc.BASE64Decoder;
/**
* Ensures the buffer represents a valid attribute as defined by RFC2849.
*
@@ -322,7 +320,7 @@ public class DefaultAttributeValidationPolicy implements AttributeValidationPoli
private LdapAttribute parseStringAttribute(Matcher matcher) {
String id = matcher.group(1);
String value = matcher.group(3);
List<String> options = Arrays.asList((StringUtils.isEmpty(matcher.group(2)) ? new String[] {} : matcher.group(2).replaceFirst(";","").split(OPTION_SEPARATOR)));
List<String> options = Arrays.asList((!StringUtils.hasLength(matcher.group(2)) ? new String[] {} : matcher.group(2).replaceFirst(";","").split(OPTION_SEPARATOR)));
if (options.isEmpty()) {
return new LdapAttribute(id, value, ordered);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2005-2010 the original author or authors.
* Copyright 2005-2013 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -15,9 +15,9 @@
*/
package org.springframework.ldap.ldif.support;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.util.StringUtils;
/**
* Policy object for enforcing LDIF record separation rules. Designed explicitly
@@ -70,7 +70,7 @@ public class SeparatorPolicy {
log.trace("Assessing --> [" + line + "]");
if (record) {
if (StringUtils.isEmpty(line)) {
if (!StringUtils.hasLength(line)) {
record = false;
skip = false;
return LineIdentifier.EndOfRecord;
@@ -99,11 +99,11 @@ public class SeparatorPolicy {
}
}
} else {
if (StringUtils.isNotEmpty(line) && line.matches(VERSION_IDENTIFIER) && !skip) {
if (StringUtils.hasLength(line) && line.matches(VERSION_IDENTIFIER) && !skip) {
//Version Identifiers are ignored by parser.
return LineIdentifier.VersionIdentifier;
} else if (StringUtils.isNotEmpty(line) && line.matches(NewRecord)) {
} else if (StringUtils.hasLength(line) && line.matches(NewRecord)) {
record = true;
skip = false;
return LineIdentifier.NewRecord;