Fixed some problems reported by Find Bugs (mostly to shut it up)

This commit is contained in:
Trustin Lee 2009-02-13 09:11:42 +00:00
parent 7e8a1cd9c2
commit ae004b5331
5 changed files with 21 additions and 38 deletions

View File

@ -79,14 +79,15 @@ class ServletChannelHandler extends SimpleChannelHandler {
ChannelBuffer buffer = (ChannelBuffer) e.getMessage(); ChannelBuffer buffer = (ChannelBuffer) e.getMessage();
if (stream) { if (stream) {
byte[] b = null;
reconnectLock.lock(); reconnectLock.lock();
if (outputStream == null) {
awaitingEvents.add(e);
return;
}
byte[] b = new byte[buffer.readableBytes()];
buffer.readBytes(b);
try { try {
if (outputStream == null) {
awaitingEvents.add(e);
return;
}
b = new byte[buffer.readableBytes()];
buffer.readBytes(b);
outputStream.write(b); outputStream.write(b);
outputStream.flush(); outputStream.flush();
e.getFuture().setSuccess(); e.getFuture().setSuccess();
@ -175,8 +176,8 @@ class ServletChannelHandler extends SimpleChannelHandler {
public boolean awaitReconnect() { public boolean awaitReconnect() {
reconnectLock.lock(); reconnectLock.lock();
connected = false;
try { try {
connected = false;
reconnectCondition.await(reconnectTimeout, TimeUnit.MILLISECONDS); reconnectCondition.await(reconnectTimeout, TimeUnit.MILLISECONDS);
} }
catch (InterruptedException e) { catch (InterruptedException e) {

View File

@ -27,7 +27,6 @@
*/ */
package org.jboss.netty.util; package org.jboss.netty.util;
import java.io.Serializable;
import java.util.AbstractCollection; import java.util.AbstractCollection;
import java.util.AbstractMap; import java.util.AbstractMap;
import java.util.AbstractSet; import java.util.AbstractSet;
@ -245,7 +244,7 @@ public final class ConcurrentHashMap<K, V> extends AbstractMap<K, V>
/** /**
* The number of elements in this segment's region. * The number of elements in this segment's region.
*/ */
volatile int count; transient volatile int count;
/** /**
* Number of updates that alter the size of the table. This is used * Number of updates that alter the size of the table. This is used
@ -265,7 +264,7 @@ public final class ConcurrentHashMap<K, V> extends AbstractMap<K, V>
/** /**
* The per-segment table. * The per-segment table.
*/ */
volatile HashEntry<K, V>[] table; transient volatile HashEntry<K, V>[] table;
/** /**
* The load factor for the hash table. Even though this value is same * The load factor for the hash table. Even though this value is same
@ -1225,9 +1224,7 @@ public final class ConcurrentHashMap<K, V> extends AbstractMap<K, V>
/* /*
* This class is needed for JDK5 compatibility. * This class is needed for JDK5 compatibility.
*/ */
static class SimpleEntry<K, V> implements Entry<K, V>, Serializable { static class SimpleEntry<K, V> implements Entry<K, V> {
private static final long serialVersionUID = -7482812091037709145L;
private final K key; private final K key;
@ -1290,8 +1287,6 @@ public final class ConcurrentHashMap<K, V> extends AbstractMap<K, V>
*/ */
final class WriteThroughEntry extends SimpleEntry<K, V> { final class WriteThroughEntry extends SimpleEntry<K, V> {
private static final long serialVersionUID = 7779181742399903646L;
WriteThroughEntry(K k, V v) { WriteThroughEntry(K k, V v) {
super(k, v); super(k, v);
} }

View File

@ -27,7 +27,6 @@
*/ */
package org.jboss.netty.util; package org.jboss.netty.util;
import java.io.Serializable;
import java.util.AbstractCollection; import java.util.AbstractCollection;
import java.util.AbstractMap; import java.util.AbstractMap;
import java.util.AbstractSet; import java.util.AbstractSet;
@ -245,7 +244,7 @@ public final class ConcurrentIdentityHashMap<K, V> extends AbstractMap<K, V>
/** /**
* The number of elements in this segment's region. * The number of elements in this segment's region.
*/ */
volatile int count; transient volatile int count;
/** /**
* Number of updates that alter the size of the table. This is used * Number of updates that alter the size of the table. This is used
@ -265,7 +264,7 @@ public final class ConcurrentIdentityHashMap<K, V> extends AbstractMap<K, V>
/** /**
* The per-segment table. * The per-segment table.
*/ */
volatile HashEntry<K, V>[] table; transient volatile HashEntry<K, V>[] table;
/** /**
* The load factor for the hash table. Even though this value is same * The load factor for the hash table. Even though this value is same
@ -1225,7 +1224,7 @@ public final class ConcurrentIdentityHashMap<K, V> extends AbstractMap<K, V>
/* /*
* This class is needed for JDK5 compatibility. * This class is needed for JDK5 compatibility.
*/ */
static class SimpleEntry<K, V> implements Entry<K, V>, Serializable { static class SimpleEntry<K, V> implements Entry<K, V> {
private static final long serialVersionUID = -8144765946475398746L; private static final long serialVersionUID = -8144765946475398746L;
@ -1290,8 +1289,6 @@ public final class ConcurrentIdentityHashMap<K, V> extends AbstractMap<K, V>
*/ */
final class WriteThroughEntry extends SimpleEntry<K, V> { final class WriteThroughEntry extends SimpleEntry<K, V> {
private static final long serialVersionUID = 6097929717041808840L;
WriteThroughEntry(K k, V v) { WriteThroughEntry(K k, V v) {
super(k, v); super(k, v);
} }

View File

@ -27,7 +27,6 @@
*/ */
package org.jboss.netty.util; package org.jboss.netty.util;
import java.io.Serializable;
import java.lang.ref.Reference; import java.lang.ref.Reference;
import java.lang.ref.ReferenceQueue; import java.lang.ref.ReferenceQueue;
import java.lang.ref.WeakReference; import java.lang.ref.WeakReference;
@ -284,7 +283,7 @@ public final class ConcurrentIdentityWeakKeyHashMap<K, V> extends AbstractMap<K,
/** /**
* The number of elements in this segment's region. * The number of elements in this segment's region.
*/ */
volatile int count; transient volatile int count;
/** /**
* Number of updates that alter the size of the table. This is used * Number of updates that alter the size of the table. This is used
@ -304,7 +303,7 @@ public final class ConcurrentIdentityWeakKeyHashMap<K, V> extends AbstractMap<K,
/** /**
* The per-segment table. * The per-segment table.
*/ */
volatile HashEntry<K, V>[] table; transient volatile HashEntry<K, V>[] table;
/** /**
* The load factor for the hash table. Even though this value is same * The load factor for the hash table. Even though this value is same
@ -1305,9 +1304,7 @@ public final class ConcurrentIdentityWeakKeyHashMap<K, V> extends AbstractMap<K,
/* /*
* This class is needed for JDK5 compatibility. * This class is needed for JDK5 compatibility.
*/ */
static class SimpleEntry<K, V> implements Entry<K, V>, Serializable { static class SimpleEntry<K, V> implements Entry<K, V> {
private static final long serialVersionUID = 8931408205638274090L;
private final K key; private final K key;
@ -1370,8 +1367,6 @@ public final class ConcurrentIdentityWeakKeyHashMap<K, V> extends AbstractMap<K,
*/ */
final class WriteThroughEntry extends SimpleEntry<K, V> { final class WriteThroughEntry extends SimpleEntry<K, V> {
private static final long serialVersionUID = 4475636861021292972L;
WriteThroughEntry(K k, V v) { WriteThroughEntry(K k, V v) {
super(k, v); super(k, v);
} }

View File

@ -27,7 +27,6 @@
*/ */
package org.jboss.netty.util; package org.jboss.netty.util;
import java.io.Serializable;
import java.lang.ref.Reference; import java.lang.ref.Reference;
import java.lang.ref.ReferenceQueue; import java.lang.ref.ReferenceQueue;
import java.lang.ref.WeakReference; import java.lang.ref.WeakReference;
@ -284,7 +283,7 @@ public final class ConcurrentWeakKeyHashMap<K, V> extends AbstractMap<K, V> impl
/** /**
* The number of elements in this segment's region. * The number of elements in this segment's region.
*/ */
volatile int count; transient volatile int count;
/** /**
* Number of updates that alter the size of the table. This is used * Number of updates that alter the size of the table. This is used
@ -304,7 +303,7 @@ public final class ConcurrentWeakKeyHashMap<K, V> extends AbstractMap<K, V> impl
/** /**
* The per-segment table. * The per-segment table.
*/ */
volatile HashEntry<K, V>[] table; transient volatile HashEntry<K, V>[] table;
/** /**
* The load factor for the hash table. Even though this value is same * The load factor for the hash table. Even though this value is same
@ -319,7 +318,7 @@ public final class ConcurrentWeakKeyHashMap<K, V> extends AbstractMap<K, V> impl
* The collected weak-key reference queue for this segment. This should * The collected weak-key reference queue for this segment. This should
* be (re)initialized whenever table is assigned, * be (re)initialized whenever table is assigned,
*/ */
volatile ReferenceQueue<Object> refQueue; transient volatile ReferenceQueue<Object> refQueue;
Segment(int initialCapacity, float lf) { Segment(int initialCapacity, float lf) {
loadFactor = lf; loadFactor = lf;
@ -1305,9 +1304,7 @@ public final class ConcurrentWeakKeyHashMap<K, V> extends AbstractMap<K, V> impl
/* /*
* This class is needed for JDK5 compatibility. * This class is needed for JDK5 compatibility.
*/ */
static class SimpleEntry<K, V> implements Entry<K, V>, Serializable { static class SimpleEntry<K, V> implements Entry<K, V> {
private static final long serialVersionUID = -2743063770440054676L;
private final K key; private final K key;
@ -1370,8 +1367,6 @@ public final class ConcurrentWeakKeyHashMap<K, V> extends AbstractMap<K, V> impl
*/ */
final class WriteThroughEntry extends SimpleEntry<K, V> { final class WriteThroughEntry extends SimpleEntry<K, V> {
private static final long serialVersionUID = 856037622737854185L;
WriteThroughEntry(K k, V v) { WriteThroughEntry(K k, V v) {
super(k, v); super(k, v);
} }