這是我的代碼(從答覆採取張貼在SO question):這個checkstyle信息是什麼意思?
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();
}
}
這是maven-checkstyle-plugin
說:
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
是什麼意思,如何解決呢?
它看起來像checkstyle有一個問題,解析ConverterException的類文件。所以,雖然消息說UrlConverter.java,但問題真的在於ConverterException.java – 2010-08-05 17:44:49
看起來像這樣,但我現在可以做什麼? – yegor256 2010-08-06 06:06:24