Use for-each. Use final. Remove redundant modifiers.
This commit is contained in:
@@ -85,8 +85,8 @@ public class LoadTestCase extends TestCase{
|
||||
|
||||
//isolates all logging classes, application in the same classloader too.
|
||||
//filters exeptions to simlify handling in test
|
||||
for(int i = 0; i < LOG_PCKG.length; i++ ){
|
||||
if( name.startsWith( LOG_PCKG[i] ) &&
|
||||
for (final String element : LOG_PCKG) {
|
||||
if( name.startsWith( element ) &&
|
||||
name.indexOf("Exception") == -1 ){
|
||||
return def(name);
|
||||
}
|
||||
|
||||
@@ -25,7 +25,6 @@ import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Enumeration;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
@@ -179,8 +178,8 @@ public class PathableClassLoader extends URLClassLoader {
|
||||
* Specify a collection of logical libraries. See addLogicalLib.
|
||||
*/
|
||||
public void addLogicalLib(final String[] logicalLibs) {
|
||||
for(int i=0; i<logicalLibs.length; ++i) {
|
||||
addLogicalLib(logicalLibs[i]);
|
||||
for (final String logicalLib : logicalLibs) {
|
||||
addLogicalLib(logicalLib);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -260,9 +259,7 @@ public class PathableClassLoader extends URLClassLoader {
|
||||
final URL[] path = ucl.getURLs();
|
||||
URL shortestMatch = null;
|
||||
int shortestMatchLen = Integer.MAX_VALUE;
|
||||
for(int i=0; i<path.length; ++i) {
|
||||
final URL u = path[i];
|
||||
|
||||
for (final URL u : path) {
|
||||
// extract the filename bit on the end of the url
|
||||
String filename = u.toString();
|
||||
if (!filename.endsWith(".jar")) {
|
||||
@@ -302,8 +299,8 @@ public class PathableClassLoader extends URLClassLoader {
|
||||
}
|
||||
|
||||
if (lookasides != null) {
|
||||
for(final Iterator i = lookasides.entrySet().iterator(); i.hasNext(); ) {
|
||||
final Map.Entry entry = (Map.Entry) i.next();
|
||||
for (final Object element : lookasides.entrySet()) {
|
||||
final Map.Entry entry = (Map.Entry) element;
|
||||
final String prefix = (String) entry.getKey();
|
||||
if (name.startsWith(prefix) == true) {
|
||||
final ClassLoader loader = (ClassLoader) entry.getValue();
|
||||
|
||||
@@ -24,7 +24,6 @@ import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Enumeration;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
@@ -118,8 +117,8 @@ public class WeakHashtableTestCase extends TestCase {
|
||||
/** Tests public Set entrySet() */
|
||||
public void testEntrySet() throws Exception {
|
||||
final Set entrySet = weakHashtable.entrySet();
|
||||
for (final Iterator it = entrySet.iterator(); it.hasNext();) {
|
||||
final Map.Entry entry = (Map.Entry) it.next();
|
||||
for (final Object element : entrySet) {
|
||||
final Map.Entry entry = (Map.Entry) element;
|
||||
final Object key = entry.getKey();
|
||||
if (keyOne.equals(key)) {
|
||||
assertEquals(valueOne, entry.getValue());
|
||||
@@ -293,15 +292,15 @@ public class WeakHashtableTestCase extends TestCase {
|
||||
t[i].setDaemon(true); // Otherwise we cannot exit
|
||||
t[i].start();
|
||||
}
|
||||
for (int i = 0; i < t.length; i++) {
|
||||
t[i].join(WAIT_FOR_THREAD_COMPLETION);
|
||||
if (t[i].isAlive()) {
|
||||
for (final Thread element : t) {
|
||||
element.join(WAIT_FOR_THREAD_COMPLETION);
|
||||
if (element.isAlive()) {
|
||||
break; // at least one thread is stuck
|
||||
}
|
||||
}
|
||||
int active=0;
|
||||
for (int i = 0; i < t.length; i++) {
|
||||
if (t[i].isAlive()) {
|
||||
for (final Thread element : t) {
|
||||
if (element.isAlive()) {
|
||||
active++;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user