pSpaces / jSpace

Programming with Spaces in Java
MIT License
17 stars 12 forks source link

Fix QueryP and GetP for Tuples not present in the Space #23

Closed kaarejoergensen closed 6 years ago

kaarejoergensen commented 6 years ago

If QueryP or GetP is called for a Tuple that does not exist, the call is expected to return a null value (tutorial 1, section 1.6). If the Tuple does not exist, Tuple.hasNext() throws a NullPointerException, as the fields object is null.

Furthermore, on Get or Query calls, the tuple t is added to the corresponding list of Tuples even if the object is null, resulting in the corresponding Tuple object returned by Space.Query/GetP technically not being null, but rather being an empty object.

Fixes #20

kaarejoergensen commented 6 years ago

Upon further review, the null check in hasNext() is not necessary, as the underlying code creating null-value Tuples has been fixed.