java.lang.ClassCastException: java.lang.String cannot be cast to [Ljava.lang.String;

Apereo Issues | Sander Bos | 7 years ago
  1. 0

    I have configured the Cas20ProxyReceivingTicketValidationFilter with the parameter <init-param> <param-name>allowedProxyChains</param-name> <param-value>https://fina138:8443/cas/proxyCallback</param-value> </init-param> (although actually the value does not matter at all) The error I get is java.lang.ClassCastException: java.lang.String cannot be cast to [Ljava.lang.String; at org.jasig.cas.client.validation.ProxyList.contains(ProxyList.java:34) at org.jasig.cas.client.validation.Cas20ProxyTicketValidator.customParseResponse(Cas20ProxyTicketValidator.java:47) at org.jasig.cas.client.validation.Cas20ServiceTicketValidator.parseResponseFromServer(Cas20ServiceTicketValidator.java:94) at org.jasig.cas.client.validation.AbstractUrlBasedTicketValidator.validate(AbstractUrlBasedTicketValidator.java:188) at org.jasig.cas.client.validation.AbstractTicketValidationFilter.doFilter(AbstractTicketValidationFilter.java:132) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) The reason is Cas20ProxyReceivingTicketValidationFilter.java protected final List constructListOfProxies(final String proxies) { if (CommonUtils.isBlank(proxies)) { return new ArrayList(); } final String[] splitProxies = proxies.split("\n"); final List items = Arrays.asList(splitProxies); final ProxyListEditor editor = new ProxyListEditor(); editor.setValue(items); return (List) editor.getValue(); } The string is split on newlines but not any further. Then editor.setValue and editor.getValue is called which do essentially nothing, so you end up with a list of strings instead of a list of string arrays (one string array is one proxy chain, and you want to create a list of string arrays). Note on fix: I guess a fix is to not do any string splits here, and instead call editor.setAsText(proxies). But that is not enough, because then in ProxyListEditor you have to do setValue(proxyChains); instead of setValue(new ProxyList(proxyChains)); at the minimum.

    Apereo Issues | 7 years ago | Sander Bos
    java.lang.ClassCastException: java.lang.String cannot be cast to [Ljava.lang.String;
  2. 0

    I have configured the Cas20ProxyReceivingTicketValidationFilter with the parameter <init-param> <param-name>allowedProxyChains</param-name> <param-value>https://fina138:8443/cas/proxyCallback</param-value> </init-param> (although actually the value does not matter at all) The error I get is java.lang.ClassCastException: java.lang.String cannot be cast to [Ljava.lang.String; at org.jasig.cas.client.validation.ProxyList.contains(ProxyList.java:34) at org.jasig.cas.client.validation.Cas20ProxyTicketValidator.customParseResponse(Cas20ProxyTicketValidator.java:47) at org.jasig.cas.client.validation.Cas20ServiceTicketValidator.parseResponseFromServer(Cas20ServiceTicketValidator.java:94) at org.jasig.cas.client.validation.AbstractUrlBasedTicketValidator.validate(AbstractUrlBasedTicketValidator.java:188) at org.jasig.cas.client.validation.AbstractTicketValidationFilter.doFilter(AbstractTicketValidationFilter.java:132) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) The reason is Cas20ProxyReceivingTicketValidationFilter.java protected final List constructListOfProxies(final String proxies) { if (CommonUtils.isBlank(proxies)) { return new ArrayList(); } final String[] splitProxies = proxies.split("\n"); final List items = Arrays.asList(splitProxies); final ProxyListEditor editor = new ProxyListEditor(); editor.setValue(items); return (List) editor.getValue(); } The string is split on newlines but not any further. Then editor.setValue and editor.getValue is called which do essentially nothing, so you end up with a list of strings instead of a list of string arrays (one string array is one proxy chain, and you want to create a list of string arrays). Note on fix: I guess a fix is to not do any string splits here, and instead call editor.setAsText(proxies). But that is not enough, because then in ProxyListEditor you have to do setValue(proxyChains); instead of setValue(new ProxyList(proxyChains)); at the minimum.

    Apereo Issues | 7 years ago | Sander Bos
    java.lang.ClassCastException: java.lang.String cannot be cast to [Ljava.lang.String;
  3. 0

    impossible to filter a field which data type is integer/numeric

    GitHub | 4 years ago | erwanj
    java.lang.ClassCastException: java.lang.String cannot be cast to [Ljava.lang.String;
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Trying to read from a file but keep getting errors - Java Programming Help - KnowCoding.com

    knowcoding.com | 1 year ago
    java.lang.ClassCastException: java.lang.String cannot be cast to [Ljava.lang.String;

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. java.lang.ClassCastException

      java.lang.String cannot be cast to [Ljava.lang.String;

      at org.jasig.cas.client.validation.ProxyList.contains()
    2. Jasig CAS Client for Java - Core
      AbstractTicketValidationFilter.doFilter
      1. org.jasig.cas.client.validation.ProxyList.contains(ProxyList.java:34)
      2. org.jasig.cas.client.validation.Cas20ProxyTicketValidator.customParseResponse(Cas20ProxyTicketValidator.java:47)
      3. org.jasig.cas.client.validation.Cas20ServiceTicketValidator.parseResponseFromServer(Cas20ServiceTicketValidator.java:94)
      4. org.jasig.cas.client.validation.AbstractUrlBasedTicketValidator.validate(AbstractUrlBasedTicketValidator.java:188)
      5. org.jasig.cas.client.validation.AbstractTicketValidationFilter.doFilter(AbstractTicketValidationFilter.java:132)
      5 frames
    3. Glassfish Core
      ApplicationFilterChain.internalDoFilter
      1. org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
      1 frame