Skip to content

Commit

Permalink
refactor: Remove commons-io as dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
aalmiray committed Feb 7, 2023
1 parent f743e66 commit 9abb3a9
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 16 deletions.
1 change: 0 additions & 1 deletion core/jarviz-core/jarviz-core.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ config {

dependencies {
api "org.slf4j:jcl-over-slf4j:$slf4jVersion"
api "commons-io:commons-io:$commonsIoVersion"
}

project.rootProject.gradle.addBuildListener(new BuildAdapter() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,13 @@
*/
package org.kordamp.jarviz.core.services;

import org.apache.commons.io.IOUtils;
import org.kordamp.jarviz.core.JarFileResolver;
import org.kordamp.jarviz.core.JarProcessor;
import org.kordamp.jarviz.core.JarvizException;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Enumeration;
Expand Down Expand Up @@ -79,7 +80,8 @@ public Optional<List<String>> getResult() throws JarvizException {
String name = entry.getName();
if (name.equals(target)) {
foundServices = true;
services.addAll(withJarEntry(jarFile, entry, inputStream -> IOUtils.readLines(inputStream, StandardCharsets.UTF_8).stream()
services.addAll(withJarEntry(jarFile, entry, inputStream -> new BufferedReader(new InputStreamReader(inputStream,
StandardCharsets.UTF_8)).lines()
.filter(s -> isNotBlank(s) && !s.startsWith("#"))
.collect(toList())));
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
*/
package org.kordamp.jarviz.util;

import org.apache.commons.io.function.IOFunction;
import org.kordamp.jarviz.bundle.RB;
import org.kordamp.jarviz.core.JarvizException;

Expand Down Expand Up @@ -82,4 +81,9 @@ public static Integer readMajorVersion(JarFile jarFile, JarEntry entry) {
throw new JarvizException(RB.$("ERROR_READING_JAR_ENTRY", entry.getName(), jarFile.getName()));
}
}

@FunctionalInterface
public interface IOFunction<T, R> {
R apply(final T t) throws IOException;
}
}
12 changes: 0 additions & 12 deletions settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -54,16 +54,4 @@ projects {
id 'java-library'
}
}
}

enforce {
mergeStrategy = 'append'

rule(enforcer.rules.EnforceBytecodeVersion) { r ->

}

rule(enforcer.rules.ForceDependencies) { r ->
// r.dependencies.addAll "org.apache.maven:maven-artifact:$mavenVersion",
}
}

0 comments on commit 9abb3a9

Please sign in to comment.