Fixed NPE in package loader when package description is null. Also renamed tests that would have caught this problem sooner.
This commit is contained in:
parent
e8f2bca6ef
commit
d99db2dbcc
|
@ -217,11 +217,13 @@ public class JpaPackageCache extends BasePackageCacheManager implements IHapiPac
|
|||
}
|
||||
|
||||
boolean currentVersion = updateCurrentVersionFlagForAllPackagesBasedOnNewIncomingVersion(thePackageId, packageVersionId);
|
||||
String packageDesc;
|
||||
if (npmPackage.description().length() > NpmPackageVersionEntity.PACKAGE_DESC_LENGTH) {
|
||||
packageDesc = npmPackage.description().substring(0, NpmPackageVersionEntity.PACKAGE_DESC_LENGTH - 4) + "...";
|
||||
} else {
|
||||
packageDesc = npmPackage.description();
|
||||
String packageDesc = null;
|
||||
if (npmPackage.description() != null) {
|
||||
if (npmPackage.description().length() > NpmPackageVersionEntity.PACKAGE_DESC_LENGTH) {
|
||||
packageDesc = npmPackage.description().substring(0, NpmPackageVersionEntity.PACKAGE_DESC_LENGTH - 4) + "...";
|
||||
} else {
|
||||
packageDesc = npmPackage.description();
|
||||
}
|
||||
}
|
||||
if (currentVersion) {
|
||||
getProcessingMessages(npmPackage).add("Marking package " + thePackageId + "#" + thePackageVersionId + " as current version");
|
||||
|
|
|
@ -39,7 +39,7 @@ public class IgInstallerDstu3Test extends BaseJpaDstu3Test {
|
|||
@Autowired
|
||||
private IPackageCacheManager myPackageCacheManager;
|
||||
private Server myServer;
|
||||
private NpmTestR4.FakeNpmServlet myFakeNpmServlet;
|
||||
private NpmR4Test.FakeNpmServlet myFakeNpmServlet;
|
||||
@Autowired
|
||||
private INpmPackageVersionDao myPackageVersionDao;
|
||||
private int myPort;
|
||||
|
@ -50,7 +50,7 @@ public class IgInstallerDstu3Test extends BaseJpaDstu3Test {
|
|||
|
||||
myServer = new Server(0);
|
||||
ServletHandler proxyHandler = new ServletHandler();
|
||||
myFakeNpmServlet = new NpmTestR4.FakeNpmServlet();
|
||||
myFakeNpmServlet = new NpmR4Test.FakeNpmServlet();
|
||||
ServletHolder servletHolder = new ServletHolder(myFakeNpmServlet);
|
||||
proxyHandler.addServletWithMapping(servletHolder, "/*");
|
||||
myServer.setHandler(proxyHandler);
|
||||
|
|
|
@ -31,7 +31,7 @@ import java.util.Map;
|
|||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.fail;
|
||||
|
||||
public class NpmTestDstu3 extends BaseJpaDstu3Test {
|
||||
public class NpmDstu3Test extends BaseJpaDstu3Test {
|
||||
|
||||
private static final Logger ourLog = LoggerFactory.getLogger(FakeNpmServlet.class);
|
||||
@Autowired
|
||||
|
@ -99,7 +99,7 @@ public class NpmTestDstu3 extends BaseJpaDstu3Test {
|
|||
ourLog.info("Fail Outcome: {}", myFhirCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(e.getOperationOutcome()));
|
||||
|
||||
OperationOutcome oo = (OperationOutcome) e.getOperationOutcome();
|
||||
assertEquals("Profile http://fhir.de/StructureDefinition/condition-de-basis/0.2, Element 'Condition.subject': minimum required = 1, but only found 0", oo.getIssueFirstRep().getDiagnostics());
|
||||
assertEquals("Condition.subject: minimum required = 1, but only found 0 (from http://fhir.de/StructureDefinition/condition-de-basis/0.2)", oo.getIssueFirstRep().getDiagnostics());
|
||||
}
|
||||
|
||||
}
|
|
@ -64,9 +64,9 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
|
|||
import static org.junit.jupiter.api.Assertions.assertNull;
|
||||
import static org.junit.jupiter.api.Assertions.fail;
|
||||
|
||||
public class NpmTestR4 extends BaseJpaR4Test {
|
||||
public class NpmR4Test extends BaseJpaR4Test {
|
||||
|
||||
private static final Logger ourLog = LoggerFactory.getLogger(NpmTestR4.class);
|
||||
private static final Logger ourLog = LoggerFactory.getLogger(NpmR4Test.class);
|
||||
@Autowired
|
||||
public IPackageInstallerSvc igInstaller;
|
||||
@Autowired
|
|
@ -19,9 +19,9 @@ import java.util.stream.Collectors;
|
|||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
public class NpmSearchTestR4 extends BaseJpaR4Test {
|
||||
public class NpmSearchR4Test extends BaseJpaR4Test {
|
||||
|
||||
private static final Logger ourLog = LoggerFactory.getLogger(NpmSearchTestR4.class);
|
||||
private static final Logger ourLog = LoggerFactory.getLogger(NpmSearchR4Test.class);
|
||||
@Autowired
|
||||
public IPackageInstallerSvc igInstaller;
|
||||
@Autowired
|
Loading…
Reference in New Issue