首次发布FHIR实施指南后,后续构建出现空指针错误咨询
问题分析:FHIR IG Auto-Builder后续构建NullPointerException错误
错误信息
Publishing Content Failed: Cannot invoke "org.hl7.fhir.utilities.npm.PackageList.versions()" because "pl" is null (00:00.985 / 00:49.765, 1Gb) (00:00.000 / 00:49.765, 1Gb) Use -? to get command line help (00:00.000 / 00:49.765, 1Gb) (00:00.000 / 00:49.765, 1Gb) Stack Dump (for debugging): (00:00.000 / 00:49.765, 1Gb) java.lang.NullPointerException: Cannot invoke "org.hl7.fhir.utilities.npm.PackageList.versions()" because "pl" is null at org.hl7.fhir.igtools.renderers.PublicationChecker.checkPublicationRequest(PublicationChecker.java:202) at org.hl7.fhir.igtools.renderers.PublicationChecker.checkFolder(PublicationChecker.java:122) at org.hl7.fhir.igtools.renderers.PublicationChecker.check(PublicationChecker.java:56) at org.hl7.fhir.igtools.publisher.Publisher.createIg(Publisher.java:1237) at org.hl7.fhir.igtools.publisher.Publisher.execute(Publisher.java:1034) at org.hl7.fhir.igtools.publisher.Publisher.main(Publisher.java:15034)
项目目录结构
│ .gitignore │ CODE_OF_CONDUCT.md │ CODING_STYLE_GUIDES.md │ CONTRIBUTING.md │ fsh.ini │ ig.ini │ LICENSE │ package-list.json │ publication-request.json │ README.md │ sushi-config.yaml │ _gencontinuous.bat │ _gencontinuous.sh │ _genonce.bat │ _genonce.sh │ _updatePublisher.bat │ _updatePublisher.sh │ ├───.github │ ├───ISSUE_TEMPLATE │ │ config.yml │ │ public-comment-issue-template.yml │ │ │ └───workflows │ sushi-and-publisher.yml │ ├───input │ │ ignoreWarnings.txt │ │ │ ├───data │ │ features.yml │ │ │ ├───fsh │ │ │ │ │ ├───dataTypes │ │ │ ... │ │ │ │ │ ├───logicals │ │ │ ... │ │ │ │ │ └───profiles │ │ ... │ │ │ ├───intro-notes │ │ ... │ │ │ └───pagecontent │ index.md │ ├───template-core │ ├───content │ │ │ ... │ │ │ │ │ └───assets │ │ │ ... │ │ │ │ │ ├───css │ │ │ ... │ │ │ │ │ ├───images │ │ │ ... │ │ │ │ │ └───js │ │ ... │ │ │ ├───includes │ │ ... │ │ │ ├───layouts │ │ ... │ │ │ └───package │ ... │ package.json │ └───translations └───es ├───json │ ... ├───po │ ... │ └───xliff ...
关键文件内容
package-list.json
{ "package-id" : "hl7.fhir.cr.core", "title" : "Guías de Implementación HL7 FHIR: CR Core", "canonical" : "https://ministeriodesalud.go.cr/fhir/core", "category" : "National Base", "introduction" : "Esta IG define los perfiles de recursos y extensiones de CR Core.", "list" : [ { "version" : "current", "desc" : "Continuous Integration Build (latest in version control)", "path" : "https://ministeriodesalud.go.cr/fhir/core", "status" : "ci-build", "current" : true }, { "version" : "0.1.0-draft", "date" : "2025-03-07", "desc" : "Versión en desarrollo", "path" : "https://ministeriodesalud.go.cr/fhir/core/0.1.0-draft", "fhirversion" : "5.0.0", "status" : "draft", "sequence" : "CR Core R1" } ] }
publication-request.json
{ "package-id": "hl7.fhir.cr.core", "version": "0.1.0-draft", "path": "https://ig.cr.openfhir.org/core/", "mode": "working", "status": "draft", "sequence": "CR Core R1", "desc": "Versión de desarrollo | ", "changes": "changes.html", "first": true, "title": "Guías de Implementación HL7 FHIR: CR Core", "category": "National Base", "fhirversion": "5.0.0", "introduction": "Esta IG define los perfiles de recursos y extensiones de CR Core." }
template-core/package/package.json
{ "name": "hl7.fhir.cr.core", "version": "0.1.0-draft", "canonical": "https://ministeriodesalud.go.cr/fhir/core", "url": "https://ministeriodesalud.go.cr/fhir/core/0.1.0-draft", "title": "Guías de Implementación HL7 FHIR: CR Core", "description": "Esta IG define los perfiles de recursos y extensiones de CR Core.", "fhirversion": "5.0.0", "base": "fhir.base.template", "dependencies": { "fhir.base.template": "current" }, "keywords": [ "CR", "Core", "Costa Rica", "HL7", "FHIR", "Implementation Guide" ], "author": "Ministerio de Salud de Costa Rica", "maintainers": [ { "name": "Ministerio de Salud de Costa Rica", "url": "https://ministeriodesalud.go.cr" }, { "name": "Meddyg", "email": "alejandro@meddyg.com" } ], "jurisdiction": "http://unstats.un.org/unsd/methods/m49/m49.htm#188", "license": "CC0-1.0" }
问题排查与修复方案
核心问题点
publication-request.json中first字段未更新
首次发布完成后,first字段应设置为false。当前值为true,会导致发布检查逻辑误判为首次发布,尝试读取不存在的历史版本关联信息,最终引发空指针异常。路径不一致导致包列表匹配失败
package-list.json中0.1.0-draft版本的path为https://ministeriodesalud.go.cr/fhir/core/0.1.0-draftpublication-request.json的path为https://ig.cr.openfhir.org/core/
两者路径不匹配,发布检查时无法找到对应的包列表记录,导致pl(PackageList)对象为空。
修复步骤
- 修改
publication-request.json,将"first": true改为"first": false - 统一路径:将
publication-request.json的path修改为与package-list.json中对应版本一致的https://ministeriodesalud.go.cr/fhir/core/0.1.0-draft - 重新触发Auto-Builder构建,验证错误是否解决
内容的提问来源于stack exchange,提问作者Alejandro
相关产品推荐
相关产品推荐

