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:
@@ -132,8 +132,7 @@ public class PulldownFieldEditor extends FieldEditor
|
||||
}
|
||||
|
||||
// cause shit to blow up minorly
|
||||
log.warning("Value in dobj is not settable, disabling choice.");
|
||||
Thread.dumpStack();
|
||||
log.warning("Value in dobj is not settable, disabling choice.", new Exception());
|
||||
_value.setEnabled(false);
|
||||
}
|
||||
|
||||
|
||||
@@ -175,8 +175,7 @@ public class SpeakUtil
|
||||
public static void sendMessage (DObject speakObj, ChatMessage msg)
|
||||
{
|
||||
if (speakObj == null) {
|
||||
log.warning("Dropping speak message, no speak obj '" + msg + "'.");
|
||||
Thread.dumpStack();
|
||||
log.warning("Dropping speak message, no speak obj '" + msg + "'.", new Exception());
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -122,11 +122,9 @@ public class ObjectInputStream extends DataInputStream
|
||||
// sanity check
|
||||
if (cmap == null) {
|
||||
// this will help with debugging
|
||||
log.warning("Internal stream error, no class metadata [code=" + code +
|
||||
", ois=" + this + "].");
|
||||
Thread.dumpStack();
|
||||
log.warning(
|
||||
"ObjectInputStream mappings " + StringUtil.toString(_classmap) + ".");
|
||||
log.warning("Internal stream error, no class metadata", "code", code,
|
||||
"ois", this, new Exception());
|
||||
log.warning("ObjectInputStream mappings", "map", _classmap);
|
||||
String errmsg = "Read object code for which we have no registered class " +
|
||||
"metadata [code=" + code + "]";
|
||||
throw new RuntimeException(errmsg);
|
||||
|
||||
@@ -113,9 +113,8 @@ public class Streamer
|
||||
if (stream == null) {
|
||||
// make sure this is a streamable class
|
||||
if (!isStreamable(target)) {
|
||||
Thread.dumpStack();
|
||||
throw new IOException("Requested to stream invalid class '" +
|
||||
target.getName() + "'");
|
||||
throw new IOException(
|
||||
"Requested to stream invalid class '" + target.getName() + "'");
|
||||
}
|
||||
|
||||
// create a streamer for this class and cache it
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -306,8 +306,8 @@ public class ClientManager
|
||||
{
|
||||
ClientObject clobj = _objmap.get(username);
|
||||
if (clobj == null) {
|
||||
log.warning("Requested to release unmapped client object [username=" + username + "].");
|
||||
Thread.dumpStack();
|
||||
log.warning("Requested to release unmapped client object", "username", username,
|
||||
new Exception());
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -334,8 +334,8 @@ public class ClientManager
|
||||
{
|
||||
ClientObject clobj = _objmap.remove(oldname);
|
||||
if (clobj == null) {
|
||||
log.warning("Requested to rename unmapped client object [username=" + oldname + "].");
|
||||
Thread.dumpStack();
|
||||
log.warning("Requested to rename unmapped client object", "username", oldname,
|
||||
new Exception());
|
||||
return false;
|
||||
}
|
||||
_objmap.put(newname, clobj);
|
||||
@@ -409,8 +409,7 @@ public class ClientManager
|
||||
client.connectionFailed(fault);
|
||||
|
||||
} else if (!(conn instanceof AuthingConnection)) {
|
||||
log.info("Unmapped connection failed? [conn=" + conn + ", fault=" + fault + "].");
|
||||
Thread.dumpStack();
|
||||
log.info("Unmapped connection failed?", "conn", conn, "fault", fault, new Exception());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -165,15 +165,13 @@ public class InvocationManager
|
||||
_omgr.requireEventThread(); // sanity check
|
||||
|
||||
if (marsh == null) {
|
||||
log.warning("Refusing to unregister null marshaller.");
|
||||
Thread.dumpStack();
|
||||
log.warning("Refusing to unregister null marshaller.", new Exception());
|
||||
return;
|
||||
}
|
||||
|
||||
if (_dispatchers.remove(marsh.getInvocationCode()) == null) {
|
||||
log.warning("Requested to remove unregistered marshaller? " +
|
||||
"[marsh=" + marsh + "].");
|
||||
Thread.dumpStack();
|
||||
"[marsh=" + marsh + "].", new Exception());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -21,8 +21,6 @@
|
||||
|
||||
package com.threerings.presents.server;
|
||||
|
||||
import com.samskivert.util.StringUtil;
|
||||
|
||||
import com.threerings.presents.client.InvocationReceiver.Registration;
|
||||
import com.threerings.presents.data.ClientObject;
|
||||
import com.threerings.presents.dobj.InvocationNotificationEvent;
|
||||
@@ -57,14 +55,13 @@ public abstract class InvocationSender
|
||||
// specific client
|
||||
Registration rreg = target.receivers.get(receiverCode);
|
||||
if (rreg == null) {
|
||||
log.warning("Unable to locate receiver for invocation service notification " +
|
||||
"[clobj=" + target.who() + ", code=" + receiverCode +
|
||||
", methId=" + methodId + ", args=" + StringUtil.toString(args) + "].");
|
||||
Thread.dumpStack();
|
||||
log.warning("Unable to locate receiver for invocation service notification",
|
||||
"clobj", target.who(), "code", receiverCode, "methId", methodId,
|
||||
"args", args, new Exception());
|
||||
|
||||
} else {
|
||||
// Log.info("Sending notification [target=" + target + ", code=" + receiverCode +
|
||||
// ", methodId=" + methodId + ", args=" + StringUtil.toString(args) + "].");
|
||||
// log.info("Sending notification", "target", target, "code", receiverCode,
|
||||
// "methodId", methodId, "args", args);
|
||||
|
||||
// create and dispatch an invocation notification event
|
||||
target.postEvent(
|
||||
|
||||
@@ -874,8 +874,8 @@ public class PresentsClient
|
||||
public void eventReceived (DEvent event)
|
||||
{
|
||||
if (event instanceof PresentsDObjectMgr.AccessObjectEvent) {
|
||||
log.warning("Ignoring event that shouldn't be forwarded " + event + ".");
|
||||
Thread.dumpStack();
|
||||
log.warning("Ignoring event that shouldn't be forwarded " + event + ".",
|
||||
new Exception());
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -218,9 +218,8 @@ public class PresentsDObjectMgr
|
||||
public <T extends DObject> T registerObject (T object)
|
||||
{
|
||||
if (_dobjThread != null && !isDispatchThread()) {
|
||||
log.warning("Registering DObject on non-dobject thread: " +
|
||||
"[class=" + object.getClass().getName() + "]");
|
||||
Thread.dumpStack();
|
||||
log.warning("Registering DObject on non-dobject thread",
|
||||
"class", object.getClass().getName(), new Exception());
|
||||
}
|
||||
|
||||
int oid = getNextOid();
|
||||
|
||||
@@ -166,8 +166,7 @@ public abstract class Connection implements NetEventHandler
|
||||
{
|
||||
// we shouldn't be closed twice
|
||||
if (isClosed()) {
|
||||
log.warning("Attempted to re-close connection " + this + ".");
|
||||
Thread.dumpStack();
|
||||
log.warning("Attempted to re-close connection " + this + ".", new Exception());
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -186,8 +185,7 @@ public abstract class Connection implements NetEventHandler
|
||||
{
|
||||
// if we're already closed, then something is seriously funny
|
||||
if (isClosed()) {
|
||||
log.warning("Failure reported on closed connection " + this + ".");
|
||||
Thread.dumpStack();
|
||||
log.warning("Failure reported on closed connection " + this + ".", new Exception());
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -847,16 +847,14 @@ public class ConnectionManager extends LoopingThread
|
||||
{
|
||||
// sanity check
|
||||
if (conn == null || msg == null) {
|
||||
log.warning("postMessage() bogosity [conn=" + conn + ", msg=" + msg + "].");
|
||||
Thread.dumpStack();
|
||||
log.warning("postMessage() bogosity", "conn", conn, "msg", msg, new Exception());
|
||||
return;
|
||||
}
|
||||
|
||||
// more sanity check; messages must only be posted from the dobjmgr thread
|
||||
if (!_omgr.isDispatchThread()) {
|
||||
log.warning("Message posted on non-distributed object thread [conn=" + conn +
|
||||
", msg=" + msg + ", thread=" + Thread.currentThread() + "].");
|
||||
Thread.dumpStack();
|
||||
log.warning("Message posted on non-distributed object thread", "conn", conn,
|
||||
"msg", msg, "thread", Thread.currentThread(), new Exception());
|
||||
// let it through though as we don't want to break things unnecessarily
|
||||
}
|
||||
|
||||
|
||||
@@ -76,8 +76,7 @@ public class SafeSubscriber<T extends DObject>
|
||||
public void subscribe (DObjectManager omgr)
|
||||
{
|
||||
if (_active) {
|
||||
log.warning("Active safesub asked to resubscribe " + this + ".");
|
||||
Thread.dumpStack();
|
||||
log.warning("Active safesub asked to resubscribe " + this + ".", new Exception());
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -88,8 +87,7 @@ public class SafeSubscriber<T extends DObject>
|
||||
// logically impossible)
|
||||
if (_object != null) {
|
||||
log.warning("Incroyable! A safesub has an object and was " +
|
||||
"non-active!? " + this + ".");
|
||||
Thread.dumpStack();
|
||||
"non-active!? " + this + ".", new Exception());
|
||||
// make do in the face of insanity
|
||||
_subscriber.objectAvailable(_object);
|
||||
return;
|
||||
@@ -125,8 +123,7 @@ public class SafeSubscriber<T extends DObject>
|
||||
if (_object == null && !_pending) {
|
||||
return;
|
||||
}
|
||||
log.warning("Inactive safesub asked to unsubscribe " + this + ".");
|
||||
Thread.dumpStack();
|
||||
log.warning("Inactive safesub asked to unsubscribe " + this + ".", new Exception());
|
||||
}
|
||||
|
||||
// note that we no longer desire to be subscribed
|
||||
@@ -136,8 +133,7 @@ public class SafeSubscriber<T extends DObject>
|
||||
// make sure we don't have an object reference
|
||||
if (_object != null) {
|
||||
log.warning("Incroyable! A safesub has an object and is " +
|
||||
"pending!? " + this + ".");
|
||||
Thread.dumpStack();
|
||||
"pending!? " + this + ".", new Exception());
|
||||
} else {
|
||||
// nothing to do but wait for the subscription to complete
|
||||
// at which point we'll pitch the object post-haste
|
||||
@@ -148,8 +144,7 @@ public class SafeSubscriber<T extends DObject>
|
||||
// make sure we have our object
|
||||
if (_object == null) {
|
||||
log.warning("Zut alors! A safesub _was_ active and not " +
|
||||
"pending yet has no object!? " + this + ".");
|
||||
Thread.dumpStack();
|
||||
"pending yet has no object!? " + this + ".", new Exception());
|
||||
// nothing to do since we're apparently already unsubscribed
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -247,9 +247,7 @@ public class MessageBundle
|
||||
}
|
||||
|
||||
if (reportMissing) {
|
||||
log.warning("Missing translation message " +
|
||||
"[bundle=" + _path + ", key=" + key + "].");
|
||||
Thread.dumpStack();
|
||||
log.warning("Missing translation message", "bundle", _path, "key", key, new Exception());
|
||||
}
|
||||
|
||||
return null;
|
||||
@@ -319,9 +317,8 @@ public class MessageBundle
|
||||
}
|
||||
|
||||
} else {
|
||||
log.warning("Missing translation message " +
|
||||
"[bundle=" + _path + ", key=" + key + "].");
|
||||
Thread.dumpStack();
|
||||
log.warning("Missing translation message", "bundle", _path, "key", key,
|
||||
new Exception());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -47,10 +47,9 @@ public class TimeUtil
|
||||
protected static final byte MAX_UNIT = DAY;
|
||||
|
||||
/**
|
||||
* Get a translatable string specifying the magnitude of the specified
|
||||
* duration. Results will be between "1 second" and "X hours", with
|
||||
* all times rounded to the nearest unit. "0 units" will never be
|
||||
* displayed, the minimum is 1.
|
||||
* Get a translatable string specifying the magnitude of the specified duration. Results will
|
||||
* be between "1 second" and "X hours", with all times rounded to the nearest unit. "0 units"
|
||||
* will never be displayed, the minimum is 1.
|
||||
*/
|
||||
public static String getTimeOrderString (long duration, byte minUnit)
|
||||
{
|
||||
@@ -58,12 +57,11 @@ public class TimeUtil
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a translatable string specifying the magnitude of the specified
|
||||
* duration, with the units of time bounded between the minimum and
|
||||
* maximum specified. "0 units" will never be returned, the minimum is 1.
|
||||
* Get a translatable string specifying the magnitude of the specified duration, with the units
|
||||
* of time bounded between the minimum and maximum specified. "0 units" will never be returned,
|
||||
* the minimum is 1.
|
||||
*/
|
||||
public static String getTimeOrderString (
|
||||
long duration, byte minUnit, byte maxUnit)
|
||||
public static String getTimeOrderString (long duration, byte minUnit, byte maxUnit)
|
||||
{
|
||||
// enforce sanity
|
||||
minUnit = (byte) Math.min(minUnit, maxUnit);
|
||||
@@ -85,8 +83,7 @@ public class TimeUtil
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a translatable string specifying the duration, down to the
|
||||
* minimum granularity.
|
||||
* Get a translatable string specifying the duration, down to the minimum granularity.
|
||||
*/
|
||||
public static String getTimeString (long duration, byte minUnit)
|
||||
{
|
||||
@@ -117,8 +114,7 @@ public class TimeUtil
|
||||
}
|
||||
|
||||
/**
|
||||
* Internal method to get the quantity for the specified unit.
|
||||
* (Not very OO)
|
||||
* Internal method to get the quantity for the specified unit. (Not very OO)
|
||||
*/
|
||||
protected static int getQuantityPerUnit (byte unit)
|
||||
{
|
||||
@@ -132,8 +128,7 @@ public class TimeUtil
|
||||
}
|
||||
|
||||
/**
|
||||
* Internal method to get the translation key for the specified unit.
|
||||
* (Not very OO)
|
||||
* Internal method to get the translation key for the specified unit. (Not very OO)
|
||||
*/
|
||||
protected static String getTransKey (byte unit)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user