This is my code (taken from reply posted at SO question):
package my;
import java.net.MalformedURLException;
import java.net.URL;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.convert.Converter;
import javax.faces.convert.ConverterException;
import javax.faces.convert.FacesConverter;
@FacesConverter(forClass = URL.class)
public class UrlConverter implements Converter {
@Override
public final Object getAsObject(
final FacesContext context,
final UIComponent component,
final String value) throws ConverterException {
try {
return new URL(value);
} catch (MalformedURLException ex) {
throw new ConverterException(
String.format("Cannot convert %s to URL", value),
ex
);
}
}
@Override
public final String getAsString(
final FacesContext context,
final UIComponent component,
final Object value) {
return ((URL)value).toString();
}
}
This is what maven-checkstyle-plugin
says:
UrlConverter.java:0: Got an exception - java.lang.ClassFormatError:
Absent Code attribute in method that is not native or abstract
in class file javax/faces/convert/ConverterException
What does it mean and how to solve it?