Protect against NPE when toString() is called before object is fully initialized.

Spring seems to be doing this (part of of it's debug logging) with newer releases.

git-svn-id: https://svn.apache.org/repos/asf/incubator/activemq/trunk@439346 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Hiram R. Chirino 2006-09-01 15:06:13 +00:00
parent 2b51c3357e
commit e16114f99b
1 changed files with 8 additions and 2 deletions

View File

@ -310,7 +310,10 @@ public class TransportConnector implements Connector {
public String getName(){
if( name==null ){
name = getUri().toString();
uri = getUri();
if( uri != null ) {
name = uri.toString();
}
}
return name;
}
@ -319,7 +322,10 @@ public class TransportConnector implements Connector {
}
public String toString() {
return getName();
String rc = getName();
if( rc == null )
rc = super.toString();
return rc;
}
public boolean isDisableAsyncDispatch() {