Skip to content

Commit

Permalink
chore(TUP-36969) upgrade slf4j (#8213)
Browse files Browse the repository at this point in the history
* chore(TUP-36969) upgrade slf4j

* correct

* slf4j-log4j12-1.7.34.jar replaced with slf4j-reload4j-1.7.34.jar
  • Loading branch information
sbliu authored Nov 26, 2022
1 parent 9699972 commit 30a16fa
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 43 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1269,7 +1269,7 @@ public List<ModuleNeeded> getModulesNeeded(INode node) {
ModuleNeeded moduleNeeded = null;
if(!CheckLogManamger.isSelectLog4j2()) {
//TODO consider to let it works for all jobs, not only for tcompv0 components, mean move the code to ReplaceNodeInProcess and UpdateLog4jJarUtils when not log4j2
moduleNeeded = new ModuleNeeded(getName(), "", true, "mvn:org.slf4j/slf4j-log4j12/1.7.29");
moduleNeeded = new ModuleNeeded(getName(), "", true, "mvn:org.slf4j/slf4j-reload4j/1.7.34");
componentImportNeedsList.add(moduleNeeded);
}
moduleNeeded = new ModuleNeeded(getName(), "", true, "mvn:org.talend.libraries/talend-codegen-utils/0.31.0");
Expand Down
28 changes: 12 additions & 16 deletions main/plugins/org.talend.repository/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3832,10 +3832,9 @@

<libraryNeeded
context="plugin:org.talend.libraries.apache"
id="slf4j-log4j12-1.7.29.jar"
name="slf4j-log4j12-1.7.29.jar"
mvn_uri="mvn:org.slf4j/slf4j-log4j12/1.7.29"
uripath="platform:/plugin/org.talend.libraries.apache/lib/slf4j-log4j12-1.7.29.jar">
id="slf4j-reload4j-1.7.34.jar"
name="slf4j-reload4j-1.7.34.jar"
mvn_uri="mvn:org.slf4j/slf4j-reload4j/1.7.34">
</libraryNeeded>

<libraryNeeded
Expand All @@ -3848,18 +3847,16 @@

<libraryNeeded
context="plugin:org.talend.libraries.apache"
id="jul-to-slf4j-1.7.29.jar"
name="jul-to-slf4j-1.7.29.jar"
mvn_uri="mvn:org.slf4j/jul-to-slf4j/1.7.29"
uripath="platform:/plugin/org.talend.libraries.apache/lib/jul-to-slf4j-1.7.29.jar">
id="jul-to-slf4j-1.7.34.jar"
name="jul-to-slf4j-1.7.34.jar"
mvn_uri="mvn:org.slf4j/jul-to-slf4j/1.7.34">
</libraryNeeded>

<libraryNeeded
context="plugin:org.talend.libraries.apache"
id="jcl-over-slf4j-1.7.29.jar"
name="jcl-over-slf4j-1.7.29.jar"
mvn_uri="mvn:org.slf4j/jcl-over-slf4j/1.7.29"
uripath="platform:/plugin/org.talend.libraries.apache/lib/jcl-over-slf4j-1.7.29.jar">
id="jcl-over-slf4j-1.7.34.jar"
name="jcl-over-slf4j-1.7.34.jar"
mvn_uri="mvn:org.slf4j/jcl-over-slf4j/1.7.34">
</libraryNeeded>

<libraryNeeded
Expand Down Expand Up @@ -3912,10 +3909,9 @@

<libraryNeeded
context="plugin:org.talend.librariesmanager"
id="slf4j-api-1.7.29.jar"
name="slf4j-api-1.7.29.jar"
mvn_uri="mvn:org.slf4j/slf4j-api/1.7.29"
uripath="platform:/plugin/org.talend.librariesmanager/lib/slf4j-api-1.7.29.jar">
id="slf4j-api-1.7.34.jar"
name="slf4j-api-1.7.34.jar"
mvn_uri="mvn:org.slf4j/slf4j-api/1.7.34">
</libraryNeeded>
</extension>
<!--
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public class UpdateLog4jJarUtils {

private static final String LOG4J_VERSION = "2.17.1";

private static final String SLF4J_VERSION = "1.7.29";
private static final String SLF4J_VERSION = "1.7.34";

private static final String RELOG4J_VERSION = "1.2.22";

Expand All @@ -52,7 +52,7 @@ public static void addLog4jToModuleList(Collection<ModuleNeeded> jarList, boolea
public static final String[] MODULES_NEED_ADDED_BACK = { "log4j-jcl-"+LOG4J_VERSION+".jar", "log4j-jul-"+LOG4J_VERSION+".jar",
"log4j-slf4j-impl-"+LOG4J_VERSION+".jar", "log4j-api-"+LOG4J_VERSION+".jar", "log4j-core-"+LOG4J_VERSION+".jar",
"jcl-over-slf4j-"+SLF4J_VERSION+".jar",
"jul-to-slf4j-"+SLF4J_VERSION+".jar", "log4j-to-slf4j-"+LOG4J_VERSION+".jar", "slf4j-log4j12-"+SLF4J_VERSION+".jar", "reload4j-"+RELOG4J_VERSION+".jar",
"jul-to-slf4j-"+SLF4J_VERSION+".jar", "log4j-to-slf4j-"+LOG4J_VERSION+".jar", "slf4j-reload4j-"+SLF4J_VERSION+".jar", "reload4j-"+RELOG4J_VERSION+".jar",
"log4j-1.2-api-"+LOG4J_VERSION+".jar" };

private static void addBackJars(Collection<String> moduleNeededList, boolean isSelectLog4j2, List<String> modulesUsedBefore,
Expand Down Expand Up @@ -115,7 +115,7 @@ private static void addBackJars(Collection<String> moduleNeededList, boolean isS
}

moduleNeededList.add("log4j-to-slf4j-"+LOG4J_VERSION+".jar");//$NON-NLS-1$
moduleNeededList.add("slf4j-log4j12-"+SLF4J_VERSION+".jar");//$NON-NLS-1$
moduleNeededList.add("slf4j-reload4j-"+SLF4J_VERSION+".jar");//$NON-NLS-1$
moduleNeededList.add("reload4j-"+RELOG4J_VERSION+".jar");//$NON-NLS-1$
}
if (usedSlf4jApiJarBefore) {
Expand Down Expand Up @@ -193,8 +193,8 @@ private static void addBackModules(Collection<ModuleNeeded> moduleNeededList, bo
ModuleNeeded log4jToSlf4j = new ModuleNeeded("org.apache.logging.log4j", "log4j-to-slf4j-"+LOG4J_VERSION+".jar", null, true); //$NON-NLS-1$ //$NON-NLS-2$
log4jToSlf4j.setMavenUri("mvn:org.apache.logging.log4j/log4j-to-slf4j/"+LOG4J_VERSION);//$NON-NLS-1$
moduleNeededList.add(log4jToSlf4j);
ModuleNeeded slf4jLog4j12 = new ModuleNeeded("org.slf4j", "slf4j-log4j12-"+SLF4J_VERSION+".jar", null, true); //$NON-NLS-1$ //$NON-NLS-2$
slf4jLog4j12.setMavenUri("mvn:org.slf4j/slf4j-log4j12/"+SLF4J_VERSION);//$NON-NLS-1$
ModuleNeeded slf4jLog4j12 = new ModuleNeeded("org.slf4j", "slf4j-reload4j-"+SLF4J_VERSION+".jar", null, true); //$NON-NLS-1$ //$NON-NLS-2$
slf4jLog4j12.setMavenUri("mvn:org.slf4j/slf4j-reload4j/"+SLF4J_VERSION);//$NON-NLS-1$
moduleNeededList.add(slf4jLog4j12);
ModuleNeeded log4j = new ModuleNeeded("ch.qos.reload4j", "reload4j-"+RELOG4J_VERSION+".jar", null, true); //$NON-NLS-1$ //$NON-NLS-2$
log4j.setMavenUri("mvn:ch.qos.reload4j/reload4j/"+RELOG4J_VERSION);//$NON-NLS-1$
Expand Down Expand Up @@ -326,7 +326,7 @@ private static boolean isHighPriorityModuleNeeded(Set<ModuleNeeded> highPriority

public static final String[] NEED_REMOVE_MODULES = { "jcl-over-slf4j-\\d+\\.\\d+\\.\\d+\\.jar", //$NON-NLS-1$
"log4j-to-slf4j-\\d+\\.\\d+\\.\\d+\\.jar", //$NON-NLS-1$ //$NON-NLS-2$
"log4j-to-slf4j-\\d+\\.\\d+\\.\\d+\\.jar", "slf4j-log4j12-\\d+\\.\\d+\\.\\d+\\.jar","reload4j-\\d+\\.\\d+\\.\\d+\\.jar", "log4j-\\d+\\.\\d+\\.\\d+\\.jar", //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$
"log4j-to-slf4j-\\d+\\.\\d+\\.\\d+\\.jar", "slf4j-reload4j-\\d+\\.\\d+\\.\\d+\\.jar","reload4j-\\d+\\.\\d+\\.\\d+\\.jar", "log4j-\\d+\\.\\d+\\.\\d+\\.jar", //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$
"log4j-jcl-\\d+\\.\\d+\\.\\d+\\.jar", "log4j-jul-\\d+\\.\\d+\\.\\d+\\.jar", //$NON-NLS-1$//$NON-NLS-2$
"log4j-slf4j-impl-\\d+\\.\\d+\\.\\d+\\.jar", "log4j-1.2-api-\\d+\\.\\d+\\.\\d+\\.jar", //$NON-NLS-1$//$NON-NLS-2$
"log4j-core-\\d+\\.\\d+\\.\\d+\\.jar", "log4j-api-\\d+\\.\\d+\\.\\d+\\.jar", //$NON-NLS-1$//$NON-NLS-2$
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public void testAddLog4jToModuleList() {
}
if (!selectLog4j2) {
// case1: if original job need commons-logging:commons-logging:ja for log4j1
assertTrue(modules4log4j.contains("jcl-over-slf4j-1.7.25.jar"));
assertTrue(modules4log4j.contains("jcl-over-slf4j-1.7.34.jar"));
} else {
// case2: if original job need commons-logging:commons-logging:ja for log4j2
assertTrue(modules4log4j.contains("log4j-jcl-2.17.1.jar"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ public void testAddLog4jToJarList() {
assertTrue(modules4log4j2.contains("log4j-jul-2.17.1.jar"));
assertTrue(modules4log4j2.contains("log4j-slf4j-impl-2.17.1.jar"));

assertFalse(modules4log4j2.contains("jcl-over-slf4j-1.7.25.jar"));
assertFalse(modules4log4j2.contains("jcl-over-slf4j-1.7.34.jar"));
assertFalse(modules4log4j2.contains("log4j-to-slf4j-2.17.1.jar"));
assertFalse(modules4log4j2.contains("slf4j-log4j12-1.7.25.jar"));
assertFalse(modules4log4j2.contains("slf4j-log4j12-1.7.34.jar"));
assertFalse(modules4log4j2.contains("reload4j-1.2.22.jar"));

allLog4jModulesName = getAllLog4jModulesName();
Expand All @@ -42,10 +42,10 @@ public void testAddLog4jToJarList() {
assertFalse(modules4log4j1.contains("log4j-jul-2.17.1.jar"));
assertFalse(modules4log4j1.contains("log4j-slf4j-impl-2.17.1.jar"));

assertTrue(modules4log4j1.contains("jcl-over-slf4j-1.7.29.jar"));
assertTrue(modules4log4j1.contains("jul-to-slf4j-1.7.25.jar"));
assertTrue(modules4log4j1.contains("jcl-over-slf4j-1.7.34.jar"));
assertTrue(modules4log4j1.contains("jul-to-slf4j-1.7.34.jar"));
assertTrue(modules4log4j1.contains("log4j-to-slf4j-2.17.1.jar"));
assertTrue(modules4log4j1.contains("slf4j-log4j12-1.7.29.jar"));
assertTrue(modules4log4j1.contains("slf4j-log4j12-1.7.34.jar"));
assertTrue(modules4log4j1.contains("reload4j-1.2.22.jar"));

}
Expand All @@ -64,9 +64,9 @@ public void testAddLog4jToModuleList() {
assertTrue(modules4log4j2.contains("mvn:org.apache.logging.log4j/log4j-jul/2.17.1/jar"));
assertTrue(modules4log4j2.contains("mvn:org.apache.logging.log4j/log4j-slf4j-impl/2.17.1/jar"));

assertFalse(modules4log4j2.contains("mvn:org.slf4j/jcl-over-slf4j/1.7.25/jar"));
assertFalse(modules4log4j2.contains("mvn:org.slf4j/jcl-over-slf4j/1.7.34/jar"));
assertFalse(modules4log4j2.contains("mvn:org.apache.logging.log4j/log4j-to-slf4j/2.17.1/jar"));
assertFalse(modules4log4j2.contains("mvn:org.slf4j/slf4j-log4j12/1.7.25/jar"));
assertFalse(modules4log4j2.contains("mvn:org.slf4j/slf4j-log4j12/1.7.34/jar"));
assertFalse(modules4log4j2.contains("mvn:ch.qos.reload4j/reload4j/1.2.22/jar"));

allLog4jModules = getAllLog4jModules();
Expand All @@ -81,10 +81,10 @@ public void testAddLog4jToModuleList() {
assertFalse(modules4log4j1.contains("mvn:org.apache.logging.log4j/log4j-jul/2.17.1/jar"));
assertFalse(modules4log4j1.contains("mvn:org.apache.logging.log4j/log4j-slf4j-impl/2.17.1/jar"));

assertTrue(modules4log4j1.contains("mvn:org.slf4j/jcl-over-slf4j/1.7.29/jar"));
assertTrue(modules4log4j1.contains("mvn:org.slf4j/jul-to-slf4j/1.7.25/jar"));
assertTrue(modules4log4j1.contains("mvn:org.slf4j/jcl-over-slf4j/1.7.34/jar"));
assertTrue(modules4log4j1.contains("mvn:org.slf4j/jul-to-slf4j/1.7.34/jar"));
assertTrue(modules4log4j1.contains("mvn:org.apache.logging.log4j/log4j-to-slf4j/2.17.1/jar"));
assertTrue(modules4log4j1.contains("mvn:org.slf4j/slf4j-log4j12/1.7.29/jar"));
assertTrue(modules4log4j1.contains("mvn:org.slf4j/slf4j-log4j12/1.7.34/jar"));
assertTrue(modules4log4j1.contains("mvn:ch.qos.reload4j/reload4j/1.2.22/jar"));

}
Expand All @@ -98,10 +98,10 @@ private List<String> getAllLog4jModulesName() {
jarList.add("log4j-jul-2.17.1.jar");//$NON-NLS-1$
jarList.add("log4j-slf4j-impl-2.17.1.jar");//$NON-NLS-1$
// log1
jarList.add("jcl-over-slf4j-1.7.25.jar");//$NON-NLS-1$
jarList.add("jul-to-slf4j-1.7.25.jar");//$NON-NLS-1$
jarList.add("jcl-over-slf4j-1.7.34.jar");//$NON-NLS-1$
jarList.add("jul-to-slf4j-1.7.34.jar");//$NON-NLS-1$
jarList.add("log4j-to-slf4j-2.17.1.jar");//$NON-NLS-1$
jarList.add("slf4j-log4j12-1.7.25.jar");//$NON-NLS-1$
jarList.add("slf4j-log4j12-1.7.34.jar");//$NON-NLS-1$
jarList.add("reload4j-1.2.22.jar");//$NON-NLS-1$
return jarList;
}
Expand All @@ -125,17 +125,17 @@ private List<ModuleNeeded> getAllLog4jModules() {
jarList.add(log4jSlf4jImpl);

// log1
ModuleNeeded jclOverSlf4j = new ModuleNeeded("org.slf4j", "jcl-over-slf4j-1.7.25.jar", null, true); //$NON-NLS-1$ //$NON-NLS-2$
jclOverSlf4j.setMavenUri("mvn:org.slf4j/jcl-over-slf4j/1.7.25");//$NON-NLS-1$
ModuleNeeded jclOverSlf4j = new ModuleNeeded("org.slf4j", "jcl-over-slf4j-1.7.34.jar", null, true); //$NON-NLS-1$ //$NON-NLS-2$
jclOverSlf4j.setMavenUri("mvn:org.slf4j/jcl-over-slf4j/1.7.34");//$NON-NLS-1$
jarList.add(jclOverSlf4j);
ModuleNeeded julToSlf4j = new ModuleNeeded("org.slf4j", "jul-to-slf4j-1.7.25.jar", null, true); //$NON-NLS-1$ //$NON-NLS-2$
julToSlf4j.setMavenUri("mvn:org.slf4j/jul-to-slf4j/1.7.25");//$NON-NLS-1$
ModuleNeeded julToSlf4j = new ModuleNeeded("org.slf4j", "jul-to-slf4j-1.7.34.jar", null, true); //$NON-NLS-1$ //$NON-NLS-2$
julToSlf4j.setMavenUri("mvn:org.slf4j/jul-to-slf4j/1.7.34");//$NON-NLS-1$
jarList.add(julToSlf4j);
ModuleNeeded log4jToSlf4j = new ModuleNeeded("org.apache.logging.log4j", "log4j-to-slf4j-2.17.1.jar", null, true); //$NON-NLS-1$ //$NON-NLS-2$
log4jToSlf4j.setMavenUri("mvn:org.apache.logging.log4j/log4j-to-slf4j/2.17.1");//$NON-NLS-1$
jarList.add(log4jToSlf4j);
ModuleNeeded slf4jLog4j12 = new ModuleNeeded("org.slf4j", "slf4j-log4j12-1.7.25.jar", null, true); //$NON-NLS-1$ //$NON-NLS-2$
slf4jLog4j12.setMavenUri("mvn:org.slf4j/slf4j-log4j12/1.7.25");//$NON-NLS-1$
ModuleNeeded slf4jLog4j12 = new ModuleNeeded("org.slf4j", "slf4j-log4j12-1.7.34.jar", null, true); //$NON-NLS-1$ //$NON-NLS-2$
slf4jLog4j12.setMavenUri("mvn:org.slf4j/slf4j-log4j12/1.7.34");//$NON-NLS-1$
jarList.add(slf4jLog4j12);
ModuleNeeded log4j = new ModuleNeeded("ch.qos.reload4j", "reload4j-1.2.22.jar", null, true); //$NON-NLS-1$ //$NON-NLS-2$
log4j.setMavenUri("mvn:ch.qos.reload4j/reload4j/1.2.22");//$NON-NLS-1$
Expand Down

0 comments on commit 30a16fa

Please sign in to comment.