-
Notifications
You must be signed in to change notification settings - Fork 118
Bug fix to prevent an issue mapping a single FHIR resource from crash… #1398
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -151,12 +151,29 @@ synchronized AvroConverter getConverter(String resourceType) throws ProfileExcep | |||||
| return converterMap.get(resourceType); | ||||||
| } | ||||||
|
|
||||||
| /* | ||||||
| @VisibleForTesting | ||||||
| @Nullable GenericRecord convertToAvro(Resource resource) throws ProfileException { | ||||||
| AvroConverter converter = getConverter(resource.getResourceType().name()); | ||||||
| // TODO: Check why Bunsen returns IndexedRecord instead of GenericRecord. | ||||||
| return (GenericRecord) converter.resourceToAvro(resource); | ||||||
| } | ||||||
| */ | ||||||
|
|
||||||
| // Catch any RuntimeException and log the error instead of crashing the whole pipeline for an issue with one FHIR resource. | ||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please move this comment inside the function; this does not really document what the function does. |
||||||
| @VisibleForTesting | ||||||
| @Nullable GenericRecord convertToAvro(Resource resource) throws ProfileException { | ||||||
| AvroConverter converter = getConverter(resource.getResourceType().name()); | ||||||
| // TODO: Check why Bunsen returns IndexedRecord instead of GenericRecord. | ||||||
| GenericRecord gr = null; | ||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please make sure that you run |
||||||
| try { | ||||||
| gr = (GenericRecord) converter.resourceToAvro(resource); | ||||||
| } catch (RuntimeException e) { | ||||||
| String errorMsg = "Unable to process resource " + resource.getResourceType().name() + "/" + resource.getId() + ": " + e.toString(); | ||||||
| log.error(errorMsg); | ||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| } | ||||||
| return gr; | ||||||
| } | ||||||
|
|
||||||
| @VisibleForTesting | ||||||
| Resource convertToHapi(GenericRecord record, String resourceType) throws ProfileException { | ||||||
|
|
||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove this older version.