[ 
https://issues.apache.org/struts/browse/WW-2744?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

James Holmes updated WW-2744:
-----------------------------

    Fix Version/s: 2.1.3

What version of Struts 2 did it work with before and what version is it not 
working in? Have you tried using Struts 2.0.14? Does this error still occur in 
Struts 2.0.14?

> My custom type converter does not work anymore
> ----------------------------------------------
>
>                 Key: WW-2744
>                 URL: https://issues.apache.org/struts/browse/WW-2744
>             Project: Struts 2
>          Issue Type: Bug
>    Affects Versions: 2.0.11
>            Reporter: Mads Riise Rasmussen
>             Fix For: 2.1.3
>
>
> My custom type converter does not work anymore. I can see in the log that 
> convertFromString i called but the setter for the corresponding bean property 
> is never called. I have done some different testing and simply cannot get it 
> to work anymore.
> package com.softscan.service.web.converter;
> import java.net.Inet4Address;
> import java.net.InetAddress;
> import java.net.UnknownHostException;
> import java.util.ArrayList;
> import java.util.Iterator;
> import java.util.List;
> import java.util.Map;
> import org.apache.log4j.Logger;
> import org.apache.struts2.util.StrutsTypeConverter;
> import com.opensymphony.xwork2.util.TypeConversionException;
> public class Inet4AddressConverter extends StrutsTypeConverter {
>       @SuppressWarnings("unused")
>       private static final Logger log = 
> Logger.getLogger(Inet4AddressConverter.class);
>       
>       @SuppressWarnings("unchecked")
>       @Override
>       public Object convertFromString(Map context, String[] values, Class 
> toClass) throws TypeConversionException {
>               List<InetAddress> result = new ArrayList<InetAddress>();
>         for (int i = 0; i < values.length; i++) {
>               try {
>                               log.debug("# Inet4Address: " + 
> Inet4Address.getByName(values[i]));
>                       result.add(Inet4Address.getByName(values[i]));
>                       } catch (UnknownHostException e) {
>                               throw new TypeConversionException("Unknown 
> host");
>                       }
>         }
>         return result;
>       }
>       @SuppressWarnings("unchecked")
>       @Override
>       public String convertToString(Map context, Object o) {
>               List l = (List)o;
>         String result = "<";
>         for (Iterator i = l.iterator(); i.hasNext(); ) {
>             result = result + "[" + i.next() + "]";
>         }
>         result = result + ">";
>         return result;
>       }
> }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to