Skip to content

Commit

Permalink
SAK-49905 Remove old commons-lang (sakaiproject#12474)
Browse files Browse the repository at this point in the history
  • Loading branch information
ottenhoff authored Apr 1, 2024
1 parent cbf7496 commit a9723b1
Show file tree
Hide file tree
Showing 30 changed files with 73 additions and 127 deletions.
4 changes: 0 additions & 4 deletions assignment/tool/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,6 @@
<groupId>org.sakaiproject.basiclti</groupId>
<artifactId>basiclti-util</artifactId>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
Expand Down
4 changes: 0 additions & 4 deletions basiclti/basiclti-blis/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,6 @@
<groupId>com.googlecode.json-simple</groupId>
<artifactId>json-simple</artifactId>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-math3</artifactId>
Expand Down
4 changes: 2 additions & 2 deletions basiclti/web-ifp/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
<artifactId>sakai-component-manager</artifactId>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@
import javax.portlet.RenderResponse;
import javax.servlet.ServletRequest;

import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.math.NumberUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.math.NumberUtils;
import org.apache.velocity.VelocityContext;
import org.apache.velocity.app.VelocityEngine;
import org.apache.velocity.context.Context;
Expand Down
4 changes: 2 additions & 2 deletions common/import-parsers/blackboard_6/impl/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@
<artifactId>jsoup</artifactId>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
Expand Down
8 changes: 4 additions & 4 deletions delegatedaccess/impl/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,12 @@

<!-- third party dependencies -->
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
</dependency>
<dependency>
<groupId>commons-configuration</groupId>
<artifactId>commons-configuration</artifactId>
<groupId>org.apache.commons</groupId>
<artifactId>commons-configuration2</artifactId>
</dependency>
<dependency>
<groupId>com.sun.mail</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@
import lombok.Setter;
import lombok.extern.slf4j.Slf4j;

import org.apache.commons.configuration.ConfigurationException;
import org.apache.commons.configuration.PropertiesConfiguration;
import org.apache.commons.configuration.reloading.InvariantReloadingStrategy;
import org.apache.commons.configuration2.ex.ConfigurationException;
import org.apache.commons.configuration2.PropertiesConfiguration;
import org.apache.commons.configuration2.builder.fluent.Configurations;

import org.sakaiproject.component.api.ServerConfigurationService;
import org.springframework.dao.DataAccessException;
Expand Down Expand Up @@ -78,15 +78,10 @@ private void initStatements(String vendor) {
URL url = getClass().getClassLoader().getResource(vendor + ".properties");

try {
statements = new PropertiesConfiguration(); //must use blank constructor so it doesn't parse just yet (as it will split)
statements.setReloadingStrategy(new InvariantReloadingStrategy()); //don't watch for reloads
statements.setThrowExceptionOnMissing(true); //throw exception if no prop
statements.setDelimiterParsingDisabled(true); //don't split properties
statements.load(url); //now load our file
statements = new Configurations().properties(url);
} catch (ConfigurationException e) {
log.error(e.getClass() + ": " + e.getMessage(), e);
return;
}
log.error("Could not load properties file for vendor: {}", vendor, e);
}
}

/**
Expand All @@ -99,7 +94,7 @@ private String getStatement(String key) {
try {
return statements.getString(key);
} catch (NoSuchElementException e) {
log.error("Statement: '" + key + "' could not be found in: " + statements.getFileName(), e);
log.warn("Statement: [{}] could not be found in properties file, {}", key, e.toString());
return null;
}
}
Expand Down
5 changes: 0 additions & 5 deletions deploy/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -679,11 +679,6 @@
<artifactId>commons-io</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
Expand Down
4 changes: 2 additions & 2 deletions external-calendaring-service/api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@
<artifactId>commons-codec</artifactId>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
</dependency>
<dependency>
<groupId>org.mnode.ical4j</groupId>
Expand Down
4 changes: 2 additions & 2 deletions help/help-component/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@
<scope>provided</scope>
</dependency>
<dependency>
<groupId>commons-configuration</groupId>
<artifactId>commons-configuration</artifactId>
<groupId>org.apache.commons</groupId>
<artifactId>commons-configuration2</artifactId>
</dependency>
<dependency>
<groupId>org.hsqldb</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@

import lombok.extern.slf4j.Slf4j;

import org.apache.commons.configuration.ConfigurationException;
import org.apache.commons.configuration.PropertiesConfiguration;
import org.apache.commons.configuration.reloading.InvariantReloadingStrategy;
import org.apache.commons.configuration2.builder.fluent.Configurations;
import org.apache.commons.configuration2.ex.ConfigurationException;
import org.apache.commons.configuration2.PropertiesConfiguration;

import org.sakaiproject.api.app.help.TutorialEntityProvider;
import org.sakaiproject.component.cover.ServerConfigurationService;
Expand All @@ -42,17 +42,17 @@ public class TutorialEntityProviderImpl implements TutorialEntityProvider, AutoR
private static PropertiesConfiguration tutorialProps;

private void initConfig() {

URL url = getClass().getClassLoader().getResource("Tutorial.config");


URL url = getClass().getClassLoader().getResource("Tutorial.config");
if (url == null) {
log.warn("Configuration file Tutorial.config not found");
return;
}

try {
tutorialProps = new PropertiesConfiguration(); //must use blank constructor so it doesn't parse just yet (as it will split)
tutorialProps.setReloadingStrategy(new InvariantReloadingStrategy()); //don't watch for reloads
tutorialProps.setThrowExceptionOnMissing(false); //throw exception if no prop
tutorialProps.setDelimiterParsingDisabled(true); //don't split properties
tutorialProps.load(url); //now load our file
tutorialProps = new Configurations().properties(url);
} catch (ConfigurationException e) {
log.error(e.getClass() + ": " + e.getMessage());
log.warn("Could not load Tutorials properties, {}", e.toString());
return;
}
}
Expand Down
4 changes: 2 additions & 2 deletions hierarchy/impl/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,8 @@
<scope>test</scope>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
Expand Down
8 changes: 2 additions & 6 deletions jsf/jsf-widgets/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -92,17 +92,13 @@
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
</dependency>
<dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>javax.servlet.jsp-api</artifactId>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
</dependency>
<dependency>
<groupId>antlr</groupId>
Expand Down
4 changes: 2 additions & 2 deletions jsf/myfaces-widgets/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@
<artifactId>javax.servlet.jsp-api</artifactId>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
</dependency>
<dependency>
<groupId>antlr</groupId>
Expand Down
4 changes: 0 additions & 4 deletions jsf2/jsf2-widgets/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,6 @@
<groupId>javax.servlet.jsp</groupId>
<artifactId>javax.servlet.jsp-api</artifactId>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
Expand Down
4 changes: 0 additions & 4 deletions kernel/kernel-impl/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,6 @@
<groupId>commons-dbcp</groupId>
<artifactId>commons-dbcp</artifactId>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

package org.sakaiproject.config.impl;

import java.lang.IllegalArgumentException;
import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
Expand All @@ -37,7 +38,6 @@
import lombok.extern.slf4j.Slf4j;

import org.apache.commons.codec.binary.Base64;
import org.apache.commons.lang.IllegalClassException;
import org.apache.commons.lang3.StringUtils;

import org.jasypt.encryption.pbe.PBEStringEncryptor;
Expand Down Expand Up @@ -286,9 +286,9 @@ public List<ConfigItem> getConfigItems() {
*
* @param hItem a HibernateConfigItem
* @return a ConfigItem
* @throws IllegalClassException this can occur during deserialization when creating a ConfigItem
* @throws IllegalArgumentException this can occur during deserialization when creating a ConfigItem
*/
public ConfigItem createConfigItem(HibernateConfigItem hItem) throws IllegalClassException {
public ConfigItem createConfigItem(HibernateConfigItem hItem) throws IllegalArgumentException {
if (hItem == null) {
return null;
}
Expand Down Expand Up @@ -330,9 +330,9 @@ public ConfigItem createConfigItem(HibernateConfigItem hItem) throws IllegalClas
*
* @param item a ConfigItem
* @return a HibernateConfigItem
* @throws IllegalClassException thrown when the item.getValue doesn't return the right type
* @throws IllegalArgumentException thrown when the item.getValue doesn't return the right type
*/
public HibernateConfigItem createHibernateConfigItem(ConfigItem item) throws IllegalClassException {
public HibernateConfigItem createHibernateConfigItem(ConfigItem item) throws IllegalArgumentException {
if (item == null || neverPersistItems.contains(item.getName())) {
return null;
}
Expand All @@ -347,7 +347,7 @@ public HibernateConfigItem createHibernateConfigItem(ConfigItem item) throws Ill
serialValue = serializeValue(item.getValue(), item.getType(), item.isSecured());
serialDefaultValue = serializeValue(item.getDefaultValue(), item.getType(), item.isSecured());
serialRawValue = serializeValue(getRawProperty(item.getName()), ServerConfigurationService.TYPE_STRING, item.isSecured());
} catch (IllegalClassException ice) {
} catch (IllegalArgumentException ice) {
log.error("Skip ConfigItem {}, {}", item, ice.getMessage());
return null;
}
Expand Down Expand Up @@ -376,9 +376,9 @@ public HibernateConfigItem createHibernateConfigItem(ConfigItem item) throws Ill
* @param hItem a HibernateConfigItem
* @param item a ConfigItem
* @return a HibernateConfigItem if it was updated or null if it was not updated
* @throws IllegalClassException thrown when the item.getValue doesn't return the right type
* @throws IllegalArgumentException thrown when the item.getValue doesn't return the right type
*/
public HibernateConfigItem updateHibernateConfigItem(HibernateConfigItem hItem, ConfigItem item) throws IllegalClassException {
public HibernateConfigItem updateHibernateConfigItem(HibernateConfigItem hItem, ConfigItem item) throws IllegalArgumentException {
if (hItem == null || item == null) {
return null;
}
Expand Down Expand Up @@ -413,7 +413,7 @@ public HibernateConfigItem updateHibernateConfigItem(HibernateConfigItem hItem,
// different update
hItem.setDefaultValue(serializeValue(item.getDefaultValue(), item.getType(), item.isSecured()));
}
} catch (IllegalClassException ice) {
} catch (IllegalArgumentException ice) {
log.error("Skip ConfigItem = {}, {}", item, ice.getMessage());
return null;
}
Expand Down Expand Up @@ -608,7 +608,7 @@ private String getRawProperty(String name) {
return value;
}

private Object deSerializeValue(String value, String type, boolean secured) throws IllegalClassException {
private Object deSerializeValue(String value, String type, boolean secured) throws IllegalArgumentException {
if (value == null || type == null) {
return null;
}
Expand Down Expand Up @@ -638,12 +638,12 @@ private Object deSerializeValue(String value, String type, boolean secured) thro
} else if (ServerConfigurationService.TYPE_ARRAY.equals(type)) {
obj = string.split(HibernateConfigItem.ARRAY_SEPARATOR);
} else {
throw new IllegalClassException("deSerializeValue() invalid TYPE, while deserializing");
throw new IllegalArgumentException("deSerializeValue() invalid TYPE, while deserializing");
}
return obj;
}

private String serializeValue(Object obj, String type, boolean secured) throws IllegalClassException {
private String serializeValue(Object obj, String type, boolean secured) throws IllegalArgumentException {
if (obj == null || type == null) {
return null;
}
Expand All @@ -654,28 +654,28 @@ private String serializeValue(Object obj, String type, boolean secured) throws I
if (obj instanceof String) {
string = String.valueOf(obj);
} else {
throw new IllegalClassException(String.class, obj);
throw new IllegalArgumentException("Expected String, but got " + obj.getClass().getSimpleName());
}
} else if (ServerConfigurationService.TYPE_INT.equals(type)) {
if (obj instanceof Integer) {
string = Integer.toString((Integer) obj);
} else {
throw new IllegalClassException(Integer.class, obj);
throw new IllegalArgumentException("Expected Integer, but got " + obj.getClass().getSimpleName());
}
} else if (ServerConfigurationService.TYPE_BOOLEAN.equals(type)) {
if (obj instanceof Boolean) {
string = Boolean.toString((Boolean) obj);
} else {
throw new IllegalClassException(Boolean.class, obj);
throw new IllegalArgumentException("Expected Boolean, but got " + obj.getClass().getSimpleName());
}
} else if (ServerConfigurationService.TYPE_ARRAY.equals(type)) {
if (obj instanceof String[]) {
string = StringUtils.join((String[]) obj, HibernateConfigItem.ARRAY_SEPARATOR);
} else {
throw new IllegalClassException("serializeValue() expected an array of type String[]");
throw new IllegalArgumentException("serializeValue() expected an array of type String[]");
}
} else {
throw new IllegalClassException("serializeValue() invalid TYPE, while serializing");
throw new IllegalArgumentException("serializeValue() invalid TYPE, while serializing");
}

if (secured) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public void init() {
sessionClassWhitelist.add(Locale.class.getName());
sessionClassWhitelist.add("org.sakaiproject.event.api.SimpleEvent");
sessionClassWhitelist.add("org.sakaiproject.authz.api.SimpleRole");
sessionClassWhitelist.add("org.apache.commons.lang.mutable.MutableLong");
sessionClassWhitelist.add("org.apache.commons.lang3.mutable.MutableLong");

sessionAttributeBlacklist = new HashSet<String>(6); // number should match items count below
sessionAttributeBlacklist.add(SESSION_LAST_BREAKDOWN_KEY);
Expand Down
4 changes: 0 additions & 4 deletions kernel/kernel-storage-util/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,6 @@
<groupId>commons-dbcp</groupId>
<artifactId>commons-dbcp</artifactId>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
Expand Down
Loading

0 comments on commit a9723b1

Please sign in to comment.