Skip to content
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

ah-6766-NPE #6847

Merged
merged 2 commits into from Oct 8, 2020
Merged

ah-6766-NPE #6847

merged 2 commits into from Oct 8, 2020

Conversation

ahaessly
Copy link
Contributor

revert code back to previous code that did not throw NPE. Add 2 unit tests to guard against this.

@gatk-bot
Copy link

Travis reported job failures from build 31523
Failures in the following jobs:

Test Type JDK Job ID Logs
cloud openjdk8 31523.1 logs

@droazen droazen self-assigned this Sep 29, 2020
Copy link
Collaborator

@droazen droazen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ahaessly Back to you with a couple of minor comments. Thanks for the fix!

.collect(Collectors.toList());
return String.join(AnnotationUtils.ALLELE_SPECIFIC_RAW_DELIM, alleleStrings);

public static String makeRawAnnotationString(final List<Allele> vcAlleles, final Map<Allele, List<Integer>> perAlleleValues) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since you are reverting this method back to a version that handles nulls, I think you should remove the perAlleleValues.values().removeIf(Objects::isNull); line you added to computeSBAnnotation() above as well, for consistency with the pre-bug behavior.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reverted to previous code

* Test for issue #6766
*/
@Test
public void testCombineRawData() {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Give the test a more specific name: testCombineRawDataNullPointerExceptionIssue6766()

// These are both 0 because we did not set any SB data for either allele
Assert.assertEquals(combinedListString, "0,0|0,0");
} catch (NullPointerException npe) {
Assert.fail("This code should not be throwing a NullPointerException");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you confirm that with the previous version of the StrandBiasUtils methods we do get a NullPointerException here?

* Test for issue #6766
*/
@Test
public void testMakeRawAnnotationStrings() {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Give this one a more specific name too: testMakeRawAnnotationStringsNullPointerExceptionIssue6766()

try {
StrandBiasUtils.makeRawAnnotationString(vc.getAlleles(), perAlleleValues);
} catch (NullPointerException npe) {
Assert.fail("This code should not be throwing a NullPointerException");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same question here: did the NullPointerException get triggered with the previous version of StrandBiasUtils?

@ahaessly
Copy link
Contributor Author

ahaessly commented Oct 4, 2020

yes, both tests did trigger a null pointer exception with the previous code. (there are comments in one test because it had to do something a little weird to actually trigger the NPE.

Copy link
Collaborator

@droazen droazen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@droazen droazen merged commit e71940e into master Oct 8, 2020
@droazen droazen deleted the ah_6766_NPE_CombineGVCFs branch October 8, 2020 15:38
mwalker174 pushed a commit that referenced this pull request Nov 3, 2020
Reverted code back to previous version that did not throw NPE. Add 2 unit tests to guard against this.

Resolves #6766
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants