From: James Moger Date: Thu, 25 Sep 2014 14:20:03 +0000 (-0400) Subject: Fix failure to clear/delete ticket topic and description X-Git-Tag: v1.6.1~25^2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=388f49ada1b32bd2e99c964a0278094e4f21c3fb;p=gitblit.git Fix failure to clear/delete ticket topic and description --- diff --git a/src/main/java/com/gitblit/wicket/pages/EditTicketPage.java b/src/main/java/com/gitblit/wicket/pages/EditTicketPage.java index 1adc7136..074ffa60 100644 --- a/src/main/java/com/gitblit/wicket/pages/EditTicketPage.java +++ b/src/main/java/com/gitblit/wicket/pages/EditTicketPage.java @@ -52,6 +52,7 @@ import com.gitblit.utils.StringUtils; import com.gitblit.wicket.GitBlitWebSession; import com.gitblit.wicket.WicketUtils; import com.gitblit.wicket.panels.MarkdownTextArea; +import com.google.common.base.Optional; /** * Page for editing a ticket. @@ -268,7 +269,7 @@ public class EditTicketPage extends RepositoryPage { change.setField(Field.title, title); } - String description = descriptionEditor.getText(); + String description = Optional.fromNullable(descriptionEditor.getText()).or(""); if ((StringUtils.isEmpty(ticket.body) && !StringUtils.isEmpty(description)) || (!StringUtils.isEmpty(ticket.body) && !ticket.body.equals(description))) { // description change @@ -287,9 +288,9 @@ public class EditTicketPage extends RepositoryPage { change.setField(Field.type, type); } - String topic = topicModel.getObject(); + String topic = Optional.fromNullable(topicModel.getObject()).or(""); if ((StringUtils.isEmpty(ticket.topic) && !StringUtils.isEmpty(topic)) - || (!StringUtils.isEmpty(topic) && !topic.equals(ticket.topic))) { + || (!StringUtils.isEmpty(ticket.topic) && !ticket.topic.equals(topic))) { // topic change change.setField(Field.topic, topic); }