summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/main/java/com/gitblit/tickets/ITicketService.java18
-rw-r--r--src/main/java/com/gitblit/wicket/pages/TicketPage.java15
2 files changed, 21 insertions, 12 deletions
diff --git a/src/main/java/com/gitblit/tickets/ITicketService.java b/src/main/java/com/gitblit/tickets/ITicketService.java
index 7e7ea9e8..5e3e372a 100644
--- a/src/main/java/com/gitblit/tickets/ITicketService.java
+++ b/src/main/java/com/gitblit/tickets/ITicketService.java
@@ -673,21 +673,24 @@ public abstract class ITicketService implements IManager {
Repository db = null;
try {
db = repositoryManager.getRepository(repository.name);
- TicketMilestone milestone = getMilestone(repository, oldName);
+ TicketMilestone tm = getMilestone(repository, oldName);
+ if (tm == null) {
+ return false;
+ }
StoredConfig config = db.getConfig();
config.unsetSection(MILESTONE, oldName);
- config.setString(MILESTONE, newName, STATUS, milestone.status.name());
- config.setString(MILESTONE, newName, COLOR, milestone.color);
- if (milestone.due != null) {
+ config.setString(MILESTONE, newName, STATUS, tm.status.name());
+ config.setString(MILESTONE, newName, COLOR, tm.color);
+ if (tm.due != null) {
config.setString(MILESTONE, newName, DUE,
- new SimpleDateFormat(DUE_DATE_PATTERN).format(milestone.due));
+ new SimpleDateFormat(DUE_DATE_PATTERN).format(tm.due));
}
config.save();
milestonesCache.remove(repository.name);
TicketNotifier notifier = createNotifier();
- for (QueryResult qr : milestone.tickets) {
+ for (QueryResult qr : tm.tickets) {
Change change = new Change(createdBy);
change.setField(Field.milestone, newName);
TicketModel ticket = updateTicket(repository, qr.number, change);
@@ -741,6 +744,9 @@ public abstract class ITicketService implements IManager {
Repository db = null;
try {
TicketMilestone tm = getMilestone(repository, milestone);
+ if (tm == null) {
+ return false;
+ }
db = repositoryManager.getRepository(repository.name);
StoredConfig config = db.getConfig();
config.unsetSection(MILESTONE, milestone);
diff --git a/src/main/java/com/gitblit/wicket/pages/TicketPage.java b/src/main/java/com/gitblit/wicket/pages/TicketPage.java
index e1e81628..ca1bf310 100644
--- a/src/main/java/com/gitblit/wicket/pages/TicketPage.java
+++ b/src/main/java/com/gitblit/wicket/pages/TicketPage.java
@@ -249,9 +249,12 @@ public class TicketPage extends RepositoryPage {
add(new Label("milestone"));
} else {
// link to milestone query
- TicketMilestone milestone = app().tickets().getMilestone(repository, ticket.milestone);
+ TicketMilestone tm = app().tickets().getMilestone(repository, ticket.milestone);
+ if (tm == null) {
+ tm = new TicketMilestone(ticket.milestone);
+ }
PageParameters milestoneParameters;
- if (milestone.isOpen()) {
+ if (tm.isOpen()) {
milestoneParameters = WicketUtils.newOpenTicketsParameter(repositoryName);
} else {
milestoneParameters = WicketUtils.newRepositoryParameter(repositoryName);
@@ -260,10 +263,10 @@ public class TicketPage extends RepositoryPage {
int progress = 0;
int open = 0;
int closed = 0;
- if (milestone != null) {
- progress = milestone.getProgress();
- open = milestone.getOpenTickets();
- closed = milestone.getClosedTickets();
+ if (tm != null) {
+ progress = tm.getProgress();
+ open = tm.getOpenTickets();
+ closed = tm.getClosedTickets();
}
Fragment milestoneProgress = new Fragment("milestone", "milestoneProgressFragment", this);