mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-06 13:17:41 +00:00
GUACAMOLE-96: Do not rely on Map.remove(key, value) which is specific to Java 8.
This commit is contained in:
@@ -83,10 +83,22 @@ public class ArbitraryAttributeMap extends HashMap<String, String> {
|
||||
if (!(o instanceof ArbitraryAttributeModel))
|
||||
return false;
|
||||
|
||||
// The attribute should be removed only if the value matches
|
||||
// Remove only if key is actually present
|
||||
ArbitraryAttributeModel model = (ArbitraryAttributeModel) o;
|
||||
return ArbitraryAttributeMap.this.remove(model.getName(),
|
||||
model.getValue());
|
||||
if (!ArbitraryAttributeMap.this.containsKey(model.getName()))
|
||||
return false;
|
||||
|
||||
// The attribute should be removed only if the value matches
|
||||
String currentValue = ArbitraryAttributeMap.this.get(model.getName());
|
||||
if (currentValue == null) {
|
||||
if (model.getValue() != null)
|
||||
return false;
|
||||
}
|
||||
else if (!currentValue.equals(model.getValue()))
|
||||
return false;
|
||||
|
||||
ArbitraryAttributeMap.this.remove(model.getName());
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user