Thread.dumpStack() circumvents whatever logging is configured and writes
directly to stderr. Logging an exception with the associated warning does the right thing and logs the stack trace via the logging system. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5318 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -164,8 +164,7 @@ public class DObject
|
||||
|
||||
} else {
|
||||
log.warning("Refusing subscriber that's already in the list", "dobj", which(),
|
||||
"subscriber", sub);
|
||||
Thread.dumpStack();
|
||||
"subscriber", sub, new Exception());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -225,8 +224,7 @@ public class DObject
|
||||
_listeners = els;
|
||||
} else {
|
||||
log.warning("Refusing repeat listener registration [dobj=" + which() +
|
||||
", list=" + listener + "]");
|
||||
Thread.dumpStack();
|
||||
", list=" + listener + "]", new Exception());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -802,10 +800,7 @@ public class DObject
|
||||
// if we're on the authoritative server, we update the set immediately
|
||||
boolean alreadyApplied = false;
|
||||
if (_omgr != null && _omgr.isManager(this)) {
|
||||
if (!set.add(entry)) {
|
||||
// DSet will have logged a warning
|
||||
Thread.dumpStack();
|
||||
}
|
||||
set.add(entry);
|
||||
alreadyApplied = true;
|
||||
}
|
||||
// dispatch an entry added event
|
||||
@@ -823,8 +818,8 @@ public class DObject
|
||||
if (_omgr != null && _omgr.isManager(this)) {
|
||||
oldEntry = set.removeKey(key);
|
||||
if (oldEntry == null) {
|
||||
log.warning("Requested to remove non-element", "set", name, "key", key);
|
||||
Thread.dumpStack();
|
||||
log.warning("Requested to remove non-element", "set", name, "key", key,
|
||||
new Exception());
|
||||
}
|
||||
}
|
||||
// dispatch an entry removed event
|
||||
@@ -850,7 +845,8 @@ public class DObject
|
||||
if (_omgr != null && _omgr.isManager(this)) {
|
||||
oldEntry = set.update(entry);
|
||||
if (oldEntry == null) {
|
||||
Thread.dumpStack();
|
||||
log.warning("Set update had no old entry", "name", name, "entry", entry,
|
||||
new Exception());
|
||||
}
|
||||
}
|
||||
// dispatch an entry updated event
|
||||
|
||||
@@ -210,8 +210,7 @@ public class DSet<E extends DSet.Entry>
|
||||
{
|
||||
// the crazy sanity checks
|
||||
if (_size < 0 || _size > _entries.length || (_size > 0 && _entries[_size-1] == null)) {
|
||||
log.warning("DSet in a bad way", "size", _size, "entries", _entries);
|
||||
Thread.dumpStack();
|
||||
log.warning("DSet in a bad way", "size", _size, "entries", _entries, new Exception());
|
||||
}
|
||||
|
||||
return new Iterator<E>() {
|
||||
@@ -232,8 +231,7 @@ public class DSet<E extends DSet.Entry>
|
||||
}
|
||||
if (_ssize != _size) {
|
||||
log.warning("Size changed during iteration", "ssize", _ssize, "nsize", _size,
|
||||
"entries", _entries);
|
||||
Thread.dumpStack();
|
||||
"entries", _entries, new Exception());
|
||||
}
|
||||
}
|
||||
protected int _index = 0;
|
||||
@@ -282,7 +280,8 @@ public class DSet<E extends DSet.Entry>
|
||||
|
||||
// if the element is already in the set, bail now
|
||||
if (eidx >= 0) {
|
||||
log.warning("Refusing to add duplicate entry [entry=" + elem + ", set=" + this + "].");
|
||||
log.warning("Refusing to add duplicate entry", "entry", elem, "set", this,
|
||||
new Exception());
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -294,8 +293,8 @@ public class DSet<E extends DSet.Entry>
|
||||
if (_size >= elength) {
|
||||
// sanity check
|
||||
if (elength > 2048) {
|
||||
log.warning("Requested to expand to questionably large size [l=" + elength + "].");
|
||||
Thread.dumpStack();
|
||||
log.warning("Requested to expand to questionably large size", "l", elength,
|
||||
new Exception());
|
||||
}
|
||||
|
||||
// create a new array and copy our data into it
|
||||
@@ -340,8 +339,7 @@ public class DSet<E extends DSet.Entry>
|
||||
{
|
||||
// don't fail, but generate a warning if we're passed a null key
|
||||
if (key == null) {
|
||||
log.warning("Requested to remove null key.");
|
||||
Thread.dumpStack();
|
||||
log.warning("Requested to remove null key.", new Exception());
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user