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

Null pointer exception when getting groups #56

Open
cjmyers opened this issue Jun 4, 2017 · 2 comments
Open

Null pointer exception when getting groups #56

cjmyers opened this issue Jun 4, 2017 · 2 comments

Comments

@cjmyers
Copy link

cjmyers commented Jun 4, 2017

I’m trying to work around the duplicate entry bug by creating the part in two steps. Create the part first then add the sequence. However, this is throwing an exception (see below). Here is my log messages:

postIceJson: https://localhost:8443/rest/parts
post: {"type":"PART","name":"A1_AmtR","status":"Complete","shortDescription":"","longDescription":"","bioSafetyLevel":0,"principalInvestigator":"Chris Myers","principalInvestigatorEmail":"[email protected]","fundingSource":""}
postIceJson: https://localhost:8443/rest/parts: response received
postIceJson: success
resp:200
body:{"id":93,"type":"PART","parents":[],"index":0,"recordId":"0211088c-872f-45bf-a2af-ece5bd5c7b8f","ownerId":0,"creatorId":0,"status":"","creationTime":0,"modificationTime":0,"bioSafetyLevel":1,"principalInvestigatorId":0,"basePairCount":0,"featureCount":0,"viewCount":0,"hasAttachment":false,"hasSample":false,"hasSequence":false,"hasOriginalSequence":false,"canEdit":false,"accessPermissions":[],"publicRead":false,"linkedParts":[]}
postIceFile: https://localhost:8443/rest/file/sequence/
formData: {"file": ... ,"entryRecordId": 93, "entryType": "PART" }
postIceFile: https://localhost:8443/rest/file/sequence/: response received

And here is the ICE error trace:

22:30:14.005 [1182432132@qtp-1354277996-51] INFO org.jbei.ice - Administrator: created new Part
22:30:14.158 [1182432132@qtp-1354277996-51] ERROR org.jbei.ice - null
java.lang.NullPointerException: null
at org.jbei.ice.lib.group.GroupController.getAllPublicGroupsForAccount(GroupController.java:191)
at org.jbei.ice.lib.entry.EntryCreator.createEntry(EntryCreator.java:100)
at org.jbei.ice.lib.parsers.sbol.SBOLParser.createNewEntry(SBOLParser.java:168)
at org.jbei.ice.lib.parsers.sbol.SBOLParser.createICEComponentDefinitionRecord(SBOLParser.java:229)
at org.jbei.ice.lib.parsers.sbol.SBOLParser.parseToEntry(SBOLParser.java:75)
at org.jbei.ice.lib.entry.sequence.PartSequence.parseSequenceFile(PartSequence.java:106)
at org.jbei.ice.services.rest.FileResource.uploadSequence(FileResource.java:280)

@cjmyers
Copy link
Author

cjmyers commented Jun 4, 2017

Adding a null pointer check here seems to fix this:

public ArrayList getAllPublicGroupsForAccount(Account account) {
ArrayList groups = new ArrayList<>();
if (account==null || account.getGroups()==null) return groups; <———— NEW LINE
for (Group group : account.getGroups()) {
if (group.getType() == GroupType.PUBLIC)
groups.add(group);
}
return groups;
}

@hplahar hplahar closed this as completed Jun 6, 2017
@hplahar hplahar reopened this Jun 6, 2017
@hplahar
Copy link
Collaborator

hplahar commented Jun 6, 2017

Checked in the code but re-opening to look into more detail if there is a larger problem

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

No branches or pull requests

2 participants