Skip to content

Commit

Permalink
Fix #20264: NullPointerException when refreshing repository
Browse files Browse the repository at this point in the history
configuration
  • Loading branch information
rombert committed Mar 2, 2016
1 parent 1c783a7 commit f6516a9
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ public static MantisVersion convert(ProjectVersionData versionData) {

MantisVersion version = new MantisVersion(versionData.getName());
version.setDescription(versionData.getDescription());
version.setTime(MantisUtils.transform(versionData.getDate_order()));
if ( versionData.getDate_order() != null)
version.setTime(MantisUtils.transform(versionData.getDate_order()));
version.setReleased(versionData.getReleased());

return version;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,27 @@
package com.itsolut.mantis.core.soap;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;

import java.math.BigInteger;
import java.util.Calendar;
import java.util.List;

import org.junit.Test;

import biz.futureware.mantis.rpc.soap.client.ObjectRef;
import biz.futureware.mantis.rpc.soap.client.ProjectData;
import biz.futureware.mantis.rpc.soap.client.ProjectVersionData;

import com.google.common.base.Predicate;
import com.google.common.collect.Iterables;
import com.itsolut.mantis.core.exception.MantisException;
import com.itsolut.mantis.core.model.MantisETA;
import com.itsolut.mantis.core.model.MantisProject;
import com.itsolut.mantis.core.model.MantisVersion;

/**
* @author Robert Munteanu
Expand Down Expand Up @@ -78,4 +85,29 @@ public boolean apply(MantisProject input) {

assertEquals(Integer.valueOf(1), project.getParentProjectId());
}

@Test
public void convertProjectVersion() {

MantisVersion version = MantisConverter.convert(newVersion());

assertEquals("Version 1", version.getName());
assertEquals("Description", version.getDescription());
assertFalse(version.isReleased());
assertNotNull(version.getTime());
}

@Test
public void convertProjectVersion_nullDate() {

MantisVersion version = MantisConverter.convert(newVersion());
version.setTime(null);

assertNull(version.getTime());
}

private ProjectVersionData newVersion() {

return new ProjectVersionData(BigInteger.ONE, "Version 1", BigInteger.TEN, Calendar.getInstance(), "Description", Boolean.FALSE, Boolean.FALSE);
}
}

0 comments on commit f6516a9

Please sign in to comment.