I'm doing the following
String s = caseInsensitiveMap.get("buyerCode");
and I'm getting the error
java.lang.ClassCastException: [Ljava.lang.String; incompatible with java.lang.String
I just cannot figure out what I'm doing wrong. Googling the answer seems to point towards needing to use a String[]
somewhere, but I have no idea where.
More relevent information:
caseInsensitiveMap : Map caseInsensitiveMap - com.msw.commerce.me.commands.MSWOrgCmdImpl.setRequestProperties(TypedProperty)
.get() : String java.util.Map.get(Object key)
I have also attempted to do
String s = caseInsensitiveMap.get((Object) "buyerCode");
to explicitly cast the string "buyerCode"
to it's needed Object type, but I get the same error.
Can someone please tell me what I'm doing wrong? From what I can see, I'm matching all of the types here. .get()
takes an Object, and I'm giving it an object. It returns a String, and I'm assigning it to a String.
Edit: more code
public void setRequestProperties(TypedProperty reqProperties)
throws ECException {
Map<String, String> reqMap = reqProperties.getMap();
Map<String, String> caseInsensitiveMap = new TreeMap<String, String>(
String.CASE_INSENSITIVE_ORDER);
caseInsensitiveMap.putAll(reqMap);
Here are the docs for TypedProperty