Added null checks in toString.

This commit is contained in:
Tom Vahlman 2012-02-08 19:54:50 +01:00
parent a14f393004
commit a1aec28a59
2 changed files with 10 additions and 11 deletions
src/main/java/se/su/dsv/scipro/match/dataobject

@ -159,12 +159,12 @@ public class Match extends DomainObject {
@Override
public String toString() {
String projectIdeaId = projectIdea != null ? projectIdea.getId().toString() : null;
String supervisorId = supervisor != null ? supervisor.getId().toString() : null;
String projectIdeaId = projectIdea != null ? String.valueOf(projectIdea.getId()) : "";
String supervisorId = supervisor != null ? supervisor.getId().toString() : "";
return "Match [id=" + id + ", projectIdea=" + projectIdeaId
+ ", supervisor=" + supervisorId + ", type=" + getType()
+ ", status=" + getStatus() + ", dateCreated=" + getDateCreated() + "]";
return "Match [id=" + (id != null ? id :"") + ", projectIdea=" + projectIdeaId
+ ", supervisor=" + (supervisorId != null ? supervisorId :"") + ", type=" + (getType() != null ? getType() :"")
+ ", status=" + (getStatus() != null ? getStatus() :"") + ", dateCreated=" + (getDateCreated() != null ? getDateCreated() :"") + "]";
}
@Override

@ -161,12 +161,11 @@ public class ProjectIdea extends DomainObject {
@Override
public String toString() {
return "ProjectIdea [id=" + id + ", projectClass=" + projectClass
+ ", authors=" + authors + ", preferredSupervisor="
+ preferredSupervisor + ", externalSupervisorInfo="
+ externalSupervisorInfo + ", keywords=" + keywords + ", title="
+ title + ", watson=" + watson + ", project=" + project
+ ", match=" + match + "]";
return "ProjectIdea [id=" + (id != null ? id : "") + ", projectClass=" + (projectClass != null ? projectClass : "")
+ ", authors=" + (authors != null ? authors : "") + ", preferredSupervisor=" + (preferredSupervisor != null ? preferredSupervisor : "")
+ ", externalSupervisorInfo=" + (externalSupervisorInfo != null ? externalSupervisorInfo : "") + ", keywords=" + (keywords != null ? keywords : "")
+ ", title="+ (title != null ? title : "") + ", watson=" + (watson != null ? watson : "")
+ ", project=" + (project != null ? project : "") + ", match=" + (match != null ? match : "") + "]";
}