Skip to content

Commit

Permalink
Merge pull request #42747 from ravinperera00/issue_41530
Browse files Browse the repository at this point in the history
Remove org.apache.commons.lang3 usage from Ballerina Runtime
  • Loading branch information
warunalakshitha authored Jun 4, 2024
2 parents e6639af + a9e2be7 commit 13d9542
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@

package io.ballerina.runtime.internal;

import io.ballerina.identifier.Utils;
import io.ballerina.runtime.api.creators.ErrorCreator;
import io.ballerina.runtime.api.utils.StringUtils;
import io.ballerina.runtime.api.values.BError;
import org.apache.commons.lang3.StringEscapeUtils;

import java.io.IOException;
import java.io.Reader;
Expand Down Expand Up @@ -707,7 +707,7 @@ private void reset(StateMachine sm) {
}

private char extractUnicodeChar(StateMachine sm) {
return StringEscapeUtils.unescapeJava("\\u" + sm.hexBuilder).charAt(0);
return Utils.unescapeJava("\\u" + sm.hexBuilder).charAt(0);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
import io.ballerina.runtime.internal.diagnostics.RuntimeDiagnosticLog;
import io.ballerina.runtime.internal.troubleshoot.StrandDump;
import io.ballerina.runtime.internal.util.RuntimeUtils;
import org.apache.commons.lang3.ArrayUtils;
import sun.misc.Signal;

import java.io.File;
Expand Down Expand Up @@ -96,11 +95,16 @@ public static void stopListeners(boolean isService) {

public static void addModuleConfigData(Map<Module, VariableKey[]> configurationData, Module m,
VariableKey[] variableKeys) {
VariableKey[] keys = configurationData.put(m, variableKeys);
if (keys == null) {
return;
VariableKey[] currKeys = configurationData.get(m);
VariableKey[] mergedKeyArray;
if (currKeys == null) {
mergedKeyArray = variableKeys;
} else {
mergedKeyArray = new VariableKey[currKeys.length + variableKeys.length];
System.arraycopy(currKeys, 0, mergedKeyArray, 0, currKeys.length);
System.arraycopy(variableKeys, 0, mergedKeyArray, currKeys.length, variableKeys.length);
}
configurationData.put(m, ArrayUtils.addAll(keys, variableKeys));
configurationData.put(m, mergedKeyArray);
}

public static void initConfigurableVariables(Module rootModule, Map<Module, VariableKey[]> configurationData,
Expand Down
1 change: 0 additions & 1 deletion bvm/ballerina-runtime/src/main/java/module-info.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
requires transactions.jta;
requires java.transaction;
requires java.naming;
requires org.apache.commons.lang3;
requires io.ballerina.identifier;
requires jdk.unsupported;

Expand Down

0 comments on commit 13d9542

Please sign in to comment.