Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
*/
@Deprecated
public class BytesURLConnection extends URLConnection {
protected byte[] content;
protected final byte[] content;

protected int offset;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
*/
@Deprecated
public class BytesURLStreamHandler extends URLStreamHandler {
byte[] content;
final byte[] content;

int offset;

Expand Down
1 change: 1 addition & 0 deletions src/main/java/org/codehaus/classworlds/ClassRealm.java
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* @author <a href="mailto:[email protected]">bob mcwhirter</a>
* @author <a href="mailto:[email protected]">Jason van Zyl</a>
*/
@SuppressWarnings("rawtypes")
@Deprecated
public interface ClassRealm {
String getId();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
*
* @author Andrew Williams
*/
@SuppressWarnings({"UnnecessaryLocalVariable", "DeprecatedIsStillUsed", "rawtypes"})
@Deprecated
public class ClassRealmAdapter implements ClassRealm {

Expand All @@ -35,7 +36,7 @@ public static ClassRealmAdapter getInstance(org.codehaus.plexus.classworlds.real
return adapter;
}

private org.codehaus.plexus.classworlds.realm.ClassRealm realm;
private final org.codehaus.plexus.classworlds.realm.ClassRealm realm;

private ClassRealmAdapter(org.codehaus.plexus.classworlds.realm.ClassRealm newRealm) {
this.realm = newRealm;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
*
* @author Andrew Williams
*/
@SuppressWarnings({"UnnecessaryLocalVariable", "rawtypes"})
@Deprecated
public class ClassRealmReverseAdapter extends org.codehaus.plexus.classworlds.realm.ClassRealm {

Expand All @@ -35,7 +36,7 @@ public static ClassRealmReverseAdapter getInstance(ClassRealm oldRealm) {
return adapter;
}

private ClassRealm realm;
private final ClassRealm realm;

private ClassRealmReverseAdapter(ClassRealm oldRealm) {
super(ClassWorldReverseAdapter.getInstance(oldRealm.getWorld()), oldRealm.getId(), oldRealm.getClassLoader());
Expand Down Expand Up @@ -100,6 +101,7 @@ public URL getResource(String name) {
return realm.getResource(name);
}

@SuppressWarnings("unchecked")
public Enumeration findResources(String name) throws IOException {
return realm.findResources(name);
}
Expand Down
1 change: 1 addition & 0 deletions src/main/java/org/codehaus/classworlds/ClassWorld.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
*
* @author Andrew Williams
*/
@SuppressWarnings("rawtypes")
@Deprecated
public class ClassWorld {
private ClassWorldAdapter adapter;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,15 @@
*
* @author Andrew Williams
*/
@SuppressWarnings("rawtypes")
@Deprecated
public class ClassWorldAdapter extends ClassWorld {

public static ClassWorldAdapter getInstance(org.codehaus.plexus.classworlds.ClassWorld newWorld) {
return new ClassWorldAdapter(newWorld);
}

private org.codehaus.plexus.classworlds.ClassWorld world;
private final org.codehaus.plexus.classworlds.ClassWorld world;

private ClassWorldAdapter(org.codehaus.plexus.classworlds.ClassWorld newWorld) {
super(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public class ClassWorldException extends Exception {
/**
* The world.
*/
private ClassWorld world;
private final ClassWorld world;

// ------------------------------------------------------------
// Constructors
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,10 @@
*
* @author Andrew Williams
*/
@SuppressWarnings({"unchecked", "rawtypes"})
@Deprecated
public class ClassWorldReverseAdapter extends org.codehaus.plexus.classworlds.ClassWorld {
private static HashMap instances = new HashMap();
private static final HashMap instances = new HashMap();

public static ClassWorldReverseAdapter getInstance(ClassWorld oldWorld) {
if (instances.containsKey(oldWorld)) return (ClassWorldReverseAdapter) instances.get(oldWorld);
Expand All @@ -38,7 +39,7 @@ public static ClassWorldReverseAdapter getInstance(ClassWorld oldWorld) {
return adapter;
}

private ClassWorld world;
private final ClassWorld world;

private ClassWorldReverseAdapter(ClassWorld newWorld) {
super();
Expand Down
4 changes: 3 additions & 1 deletion src/main/java/org/codehaus/classworlds/Configurator.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
*/
@Deprecated
public class Configurator {
private ConfiguratorAdapter config;
private final ConfiguratorAdapter config;

/** Construct.
*
Expand Down Expand Up @@ -108,6 +108,7 @@ protected void loadGlob(String line, ClassRealm realm) throws MalformedURLExcept
* @throws FileNotFoundException If the line does not represent
* a valid path element in the filesystem.
*/
@SuppressWarnings("RedundantThrows")
protected void loadGlob(String line, ClassRealm realm, boolean optionally)
throws MalformedURLException, FileNotFoundException {
config.loadGlob(line, realm, optionally);
Expand All @@ -121,6 +122,7 @@ protected void loadGlob(String line, ClassRealm realm, boolean optionally)
* @throws ConfigurationException If the property does not
* exist or if there is a syntax error.
*/
@SuppressWarnings("RedundantThrows")
protected String filter(String text) throws ConfigurationException {
return config.filter(text);
}
Expand Down
11 changes: 4 additions & 7 deletions src/main/java/org/codehaus/classworlds/ConfiguratorAdapter.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,15 @@ public class ConfiguratorAdapter extends Configurator {

public static ConfiguratorAdapter getInstance(
org.codehaus.plexus.classworlds.launcher.Configurator newConfig, Launcher launcher) {
ConfiguratorAdapter adapter = new ConfiguratorAdapter(newConfig, launcher);

return adapter;
return new ConfiguratorAdapter(newConfig, launcher);
}

public static ConfiguratorAdapter getInstance(
org.codehaus.plexus.classworlds.launcher.Configurator newConfig, ClassWorld world) {
ConfiguratorAdapter adapter = new ConfiguratorAdapter(newConfig, world);

return adapter;
return new ConfiguratorAdapter(newConfig, world);
}

private org.codehaus.plexus.classworlds.launcher.Configurator config;
private final org.codehaus.plexus.classworlds.launcher.Configurator config;

private ConfiguratorAdapter(org.codehaus.plexus.classworlds.launcher.Configurator config, Launcher launcher) {
super(launcher);
Expand All @@ -55,6 +51,7 @@ public void associateRealms() {
config.associateRealms();
}

@SuppressWarnings("DuplicateThrows")
public void configureAdapter(InputStream is)
throws IOException, MalformedURLException, ConfigurationException, DuplicateRealmException,
NoSuchRealmException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,10 @@
import java.net.URL;
import java.util.Enumeration;

@SuppressWarnings("rawtypes")
@Deprecated
public class DefaultClassRealm implements ClassRealm {
private ClassRealmAdapter adapter;
private final ClassRealmAdapter adapter;

public DefaultClassRealm(ClassWorld world, String id) {
this(world, id, null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public class DuplicateRealmException extends ClassWorldException {
/**
* The realm id.
*/
private String id;
private final String id;

// ------------------------------------------------------------
// Constructors
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public class NoSuchRealmException extends ClassWorldException {
/**
* The realm id.
*/
private String id;
private final String id;

// ------------------------------------------------------------
// Constructors
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/org/codehaus/plexus/classworlds/ClassWorld.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
* @author <a href="mailto:[email protected]">bob mcwhirter</a>
*/
public class ClassWorld implements Closeable {
private Map<String, ClassRealm> realms;
private final Map<String, ClassRealm> realms;

private final List<ClassWorldListener> listeners = new ArrayList<>();

Expand Down Expand Up @@ -101,9 +101,10 @@ public synchronized ClassRealm newRealm(String id, ClassLoader classLoader, Pred
* Closes all contained class realms.
* @since 2.7.0
*/
@SuppressWarnings("RedundantThrows")
@Override
public synchronized void close() throws IOException {
realms.values().stream().forEach(this::disposeRealm);
realms.values().forEach(this::disposeRealm);
realms.clear();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public class ClassWorldException extends Exception {
/**
* The world.
*/
private ClassWorld world;
private final ClassWorld world;

// ------------------------------------------------------------
// Constructors
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,7 @@ public void parse(InputStream is)
* a valid path element in the filesystem.
* @throws ConfigurationException will never occur (thrown for backwards compatibility)
*/
@SuppressWarnings("RedundantThrows")
protected void loadGlob(String line, boolean optionally)
throws MalformedURLException, FileNotFoundException, ConfigurationException {
File globFile = new File(line);
Expand All @@ -333,20 +334,12 @@ protected void loadGlob(String line, boolean optionally)

final String suffix = localName.substring(starLoc + 1);

File[] matches = dir.listFiles((dir1, name) -> {
if (!name.startsWith(prefix)) {
return false;
}
File[] matches = dir.listFiles((dir1, name) -> name.startsWith(prefix) || name.endsWith(suffix));

if (!name.endsWith(suffix)) {
return false;
if (matches != null) {
for (File match : matches) {
handler.addLoadFile(match);
}

return true;
});

for (File match : matches) {
handler.addLoadFile(match);
}
}

Expand Down Expand Up @@ -390,7 +383,7 @@ protected String filter(String text) throws ConfigurationException {
propValue = systemProperties.getProperty(propName);

/* do our best if we are not running from surefire */
if (propName.equals("basedir") && (propValue == null || propValue.equals(""))) {
if (propName.equals("basedir") && (propValue == null || propValue.isEmpty())) {
propValue = (new File("")).getAbsolutePath();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,7 @@ public static void main(String[] args) {

System.exit(exitCode);
} catch (Exception e) {
//noinspection CallToPrintStackTrace
e.printStackTrace();

System.exit(100);
Expand Down
Loading
Loading