Merge pull request #2180 from jamesagnew/im_20201118_fix_package_load_when_no_desc
Fixed NPE in package loader when package description is null
This commit is contained in:
commit
275b25c2cc
|
@ -0,0 +1,4 @@
|
||||||
|
---
|
||||||
|
type: fix
|
||||||
|
issue: 2180
|
||||||
|
title: "Loading a package without a description was causing a null pointer exception. This has been fixed."
|
|
@ -217,11 +217,13 @@ public class JpaPackageCache extends BasePackageCacheManager implements IHapiPac
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean currentVersion = updateCurrentVersionFlagForAllPackagesBasedOnNewIncomingVersion(thePackageId, packageVersionId);
|
boolean currentVersion = updateCurrentVersionFlagForAllPackagesBasedOnNewIncomingVersion(thePackageId, packageVersionId);
|
||||||
String packageDesc;
|
String packageDesc = null;
|
||||||
if (npmPackage.description().length() > NpmPackageVersionEntity.PACKAGE_DESC_LENGTH) {
|
if (npmPackage.description() != null) {
|
||||||
packageDesc = npmPackage.description().substring(0, NpmPackageVersionEntity.PACKAGE_DESC_LENGTH - 4) + "...";
|
if (npmPackage.description().length() > NpmPackageVersionEntity.PACKAGE_DESC_LENGTH) {
|
||||||
} else {
|
packageDesc = npmPackage.description().substring(0, NpmPackageVersionEntity.PACKAGE_DESC_LENGTH - 4) + "...";
|
||||||
packageDesc = npmPackage.description();
|
} else {
|
||||||
|
packageDesc = npmPackage.description();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (currentVersion) {
|
if (currentVersion) {
|
||||||
getProcessingMessages(npmPackage).add("Marking package " + thePackageId + "#" + thePackageVersionId + " as current version");
|
getProcessingMessages(npmPackage).add("Marking package " + thePackageId + "#" + thePackageVersionId + " as current version");
|
||||||
|
|
|
@ -39,7 +39,7 @@ public class IgInstallerDstu3Test extends BaseJpaDstu3Test {
|
||||||
@Autowired
|
@Autowired
|
||||||
private IPackageCacheManager myPackageCacheManager;
|
private IPackageCacheManager myPackageCacheManager;
|
||||||
private Server myServer;
|
private Server myServer;
|
||||||
private NpmTestR4.FakeNpmServlet myFakeNpmServlet;
|
private NpmR4Test.FakeNpmServlet myFakeNpmServlet;
|
||||||
@Autowired
|
@Autowired
|
||||||
private INpmPackageVersionDao myPackageVersionDao;
|
private INpmPackageVersionDao myPackageVersionDao;
|
||||||
private int myPort;
|
private int myPort;
|
||||||
|
@ -50,7 +50,7 @@ public class IgInstallerDstu3Test extends BaseJpaDstu3Test {
|
||||||
|
|
||||||
myServer = new Server(0);
|
myServer = new Server(0);
|
||||||
ServletHandler proxyHandler = new ServletHandler();
|
ServletHandler proxyHandler = new ServletHandler();
|
||||||
myFakeNpmServlet = new NpmTestR4.FakeNpmServlet();
|
myFakeNpmServlet = new NpmR4Test.FakeNpmServlet();
|
||||||
ServletHolder servletHolder = new ServletHolder(myFakeNpmServlet);
|
ServletHolder servletHolder = new ServletHolder(myFakeNpmServlet);
|
||||||
proxyHandler.addServletWithMapping(servletHolder, "/*");
|
proxyHandler.addServletWithMapping(servletHolder, "/*");
|
||||||
myServer.setHandler(proxyHandler);
|
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.assertEquals;
|
||||||
import static org.junit.jupiter.api.Assertions.fail;
|
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);
|
private static final Logger ourLog = LoggerFactory.getLogger(FakeNpmServlet.class);
|
||||||
@Autowired
|
@Autowired
|
||||||
|
@ -99,7 +99,7 @@ public class NpmTestDstu3 extends BaseJpaDstu3Test {
|
||||||
ourLog.info("Fail Outcome: {}", myFhirCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(e.getOperationOutcome()));
|
ourLog.info("Fail Outcome: {}", myFhirCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(e.getOperationOutcome()));
|
||||||
|
|
||||||
OperationOutcome oo = (OperationOutcome) 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.assertNull;
|
||||||
import static org.junit.jupiter.api.Assertions.fail;
|
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
|
@Autowired
|
||||||
public IPackageInstallerSvc igInstaller;
|
public IPackageInstallerSvc igInstaller;
|
||||||
@Autowired
|
@Autowired
|
|
@ -19,9 +19,9 @@ import java.util.stream.Collectors;
|
||||||
import static org.hamcrest.MatcherAssert.assertThat;
|
import static org.hamcrest.MatcherAssert.assertThat;
|
||||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
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
|
@Autowired
|
||||||
public IPackageInstallerSvc igInstaller;
|
public IPackageInstallerSvc igInstaller;
|
||||||
@Autowired
|
@Autowired
|
Loading…
Reference in New Issue