From cfb823f077ee713781a18c9554d5d05412ec6106 Mon Sep 17 00:00:00 2001 From: md_5 Date: Wed, 29 May 2013 12:00:57 +1000 Subject: [PATCH] Close #395 - work around trove quirks --- .../bungee/util/CaseInsensitiveHashingStrategy.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/proxy/src/main/java/net/md_5/bungee/util/CaseInsensitiveHashingStrategy.java b/proxy/src/main/java/net/md_5/bungee/util/CaseInsensitiveHashingStrategy.java index 984c43d0..b2ea94e4 100644 --- a/proxy/src/main/java/net/md_5/bungee/util/CaseInsensitiveHashingStrategy.java +++ b/proxy/src/main/java/net/md_5/bungee/util/CaseInsensitiveHashingStrategy.java @@ -2,20 +2,20 @@ package net.md_5.bungee.util; import gnu.trove.strategy.HashingStrategy; -class CaseInsensitiveHashingStrategy implements HashingStrategy +class CaseInsensitiveHashingStrategy implements HashingStrategy { static final CaseInsensitiveHashingStrategy INSTANCE = new CaseInsensitiveHashingStrategy(); @Override - public int computeHashCode(String object) + public int computeHashCode(Object object) { - return object.toLowerCase().hashCode(); + return ( (String) object ).toLowerCase().hashCode(); } @Override - public boolean equals(String o1, String o2) + public boolean equals(Object o1, Object o2) { - return o1.toLowerCase().equals( o2.toLowerCase() ); + return o1 instanceof String && o2 instanceof String && ( (String) o1 ).toLowerCase().equals( ( (String) o2 ).toLowerCase() ); } }