pSpaces / jSpace

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

SpaceRepository.closeGate compares URIs incorrectly #11

Closed TheAIBot closed 6 years ago

TheAIBot commented 6 years ago

Example. Create a gate with the following URI: SpaceRepository.addGate("tcp://127.0.0.1:1231/?keep"); Now close it again. SpaceRepository.closeGate("tcp://127.0.0.1:1231/?keep");

The gate is still open because closeGate couldn't find the gate(I think it would make sense if it throws an error if it can't find it and it would detect issues like this).

closeGate uses the following filter to find the gate to close: https://github.com/pSpaces/jSpace/blob/24af926cec6a275a59023272a5cae74737b81d70/common/src/main/java/org/jspace/SpaceRepository.java#L155

g.getURI() Creates the gates uri the following way: https://github.com/pSpaces/jSpace/blob/af63badc737ebb00533cda860f04e8157ceca59e/common/src/main/java/org/jspace/gate/KeepServerGate.java#L71

Where KEEP_CODE is "KEEP". So it compare these two different URIs.

Gate created with this URI "tcp://127.0.0.1:1231/?keep" KeepServerGate.getURI() returns this: "socket:///127.0.0.1:1231/?KEEP"

I don't know how the URI.equals method work but according to it, the above URIs are not the same.

michele-loreti commented 6 years ago

Fixed.