我在课堂上获得ClassFormatError
的例外:
import org.restlet.ext.jaxb.JaxbRepresentation;
import com.common.client.model.Error;
public final class ErrorHelper {
/**
* Private constructor as this is a utility class.
*/
private ErrorHelper() {
// do nothing.
}
/**
* Creates a new Error.
*
* @param code
* The error code.
* @param message
* The error message.
* @return The new error.
*/
public static Error createError(int code, String message) {
Error error = new Error();
error.setCode(String.valueOf(code));
error.setMessage(message);
return error;
}
/**
* This method creates a JaxbRepresentation of the Error object.
*
* @param code
* The error code.
* @param message
* The error message.
* @return The JaxbRepresentation of the error.
* @deprecated call getErrorRepresentation from BaseResource
*/
public static JaxbRepresentation<Error> getJaxbErrorRepresentation(
int code, String message) {
Error error = ErrorHelper.createError(code, message);
JaxbRepresentation<Error> representation = new JaxbRepresentation<Error>(
error);
representation.setContextPath(Constants.JAXB_MODEL_PACKAGE);
return representation;
}
}
任何想法?