Example usage for java.lang Error Error

List of usage examples for java.lang Error Error

Introduction

In this page you can find the example usage for java.lang Error Error.

Prototype

public Error(Throwable cause) 

Source Link

Document

Constructs a new error with the specified cause and a detail message of (cause==null ?

Usage

From source file:jp.classmethod.aws.InstanceMetadataFactoryBean.java

@Override
public InstanceMetadata getObject() {
    Gson gson = new Gson();
    InstanceMetadata metadata = null;/*from  w w w.j  a va2s  .  c  o m*/
    try (Reader reader = createUserDataReader()) {
        metadata = gson.fromJson(reader, InstanceMetadata.class);
        return metadata;
    } catch (MalformedURLException e) {
        throw new Error(e);
    } catch (IOException e) {
        logger.warn("IOException {}", e.getMessage());
    } catch (Exception e) {
        logger.error("Exception {}", e.getMessage());
    }

    if (metadata == null) {
        metadata = new InstanceMetadata();
        metadata.setInstanceId("LOCAL");
    }

    logger.info("loaded {}", metadata);
    return metadata;
}

From source file:mx.bigdata.cfdi.CFDv3.java

private static final JAXBContext createContext() {
    try {/*from w  ww .  j av a  2s.  c  o m*/
        return JAXBContext.newInstance("mx.bigdata.cfdi.schema");
    } catch (Exception e) {
        throw new Error(e);
    }
}

From source file:nl.esciencecenter.xnatclient.data.XnatParser.java

public static List<? extends XnatObject> parseJsonResult(XnatObjectType type, String jsonStr)
        throws XnatParseException {
    switch (type) {
    case XNAT_PROJECT:
        return new XnatListParser<XnatProject>().parseJsonList(jsonStr);
    case XNAT_SESSION:
        return new XnatListParser<XnatSession>().parseJsonList(jsonStr);
    case XNAT_SUBJECT:
        return new XnatListParser<XnatSubject>().parseJsonList(jsonStr);
    case XNAT_RECONSTRUCTION:
        return new XnatListParser<XnatReconstruction>().parseJsonList(jsonStr);
    case XNAT_SCAN:
        return new XnatListParser<XnatScan>().parseJsonList(jsonStr);
    case XNAT_FILE:
        return new XnatListParser<XnatFile>().parseJsonList(jsonStr);
    default:/*from w  ww  .  ja  v a  2s .  c  o m*/
        throw new Error("Unknown XnatObject type" + type);
    }
}

From source file:edu.unc.lib.dl.xml.ModsXmlHelperTest.java

@Test
public void testGetFormattedLabelText() {
    Document mods = null;//ww  w.  jav a  2 s  .c o m
    SAXBuilder builder = new SAXBuilder();
    try {
        mods = builder.build("src/test/resources/samples/mods.xml");
    } catch (JDOMException e) {
        throw new Error(e);
    } catch (IOException e) {
        throw new Error(e);
    }
    String result = ModsXmlHelper.getFormattedLabelText(mods.getRootElement());
    assertTrue("Must match expected output",
            "The SCHOLARLY COMMUNICATIONS CONVOCATION: Final Report".equals(result));
    log.info(result);
}

From source file:com.lemon.util.JSONUtils.java

private JSONUtils() {
    throw new Error("Do not need instantiate!");
}

From source file:io.servicecomb.swagger.generator.springmvc.processor.annotation.GetMappingMethodAnnotationProcessor.java

@Override
public void process(Object annotation, OperationGenerator operationGenerator) {
    GetMapping mappingAnnotation = (GetMapping) annotation;
    Operation operation = operationGenerator.getOperation();

    // path/value?
    this.processPath(mappingAnnotation.path(), operationGenerator);
    this.processPath(mappingAnnotation.value(), operationGenerator);
    this.processMethod(RequestMethod.GET, operationGenerator);
    this.processConsumes(mappingAnnotation.consumes(), operation);
    this.processProduces(mappingAnnotation.produces(), operation);

    if (StringUtils.isEmpty(operationGenerator.getHttpMethod())
            && StringUtils.isEmpty(operationGenerator.getSwaggerGenerator().getHttpMethod())) {
        throw new Error("HttpMethod must not both be empty in class and method");
    }/*from  w  w w  . ja  va2s . co m*/
}

From source file:io.servicecomb.swagger.generator.springmvc.processor.annotation.PutMappingMethodAnnotationProcessor.java

@Override
public void process(Object annotation, OperationGenerator operationGenerator) {
    PutMapping mappingAnnotation = (PutMapping) annotation;
    Operation operation = operationGenerator.getOperation();

    // path/value?
    this.processPath(mappingAnnotation.path(), operationGenerator);
    this.processPath(mappingAnnotation.value(), operationGenerator);
    this.processMethod(RequestMethod.PUT, operationGenerator);
    this.processConsumes(mappingAnnotation.consumes(), operation);
    this.processProduces(mappingAnnotation.produces(), operation);

    if (StringUtils.isEmpty(operationGenerator.getHttpMethod())
            && StringUtils.isEmpty(operationGenerator.getSwaggerGenerator().getHttpMethod())) {
        throw new Error("HttpMethod must not both be empty in class and method");
    }// w w w .jav a2s. co  m
}

From source file:cc.pp.analyzer.paoding.knife.FakeKnife.java

public int dissect(Collector collector, Beef beef, int offset) {
    throw new Error("this knife doesn't accept any beef");
}

From source file:io.servicecomb.swagger.generator.springmvc.processor.annotation.PostMappingMethodAnnotationProcessor.java

@Override
public void process(Object annotation, OperationGenerator operationGenerator) {
    PostMapping mappingAnnotation = (PostMapping) annotation;
    Operation operation = operationGenerator.getOperation();

    // path/value?
    this.processPath(mappingAnnotation.path(), operationGenerator);
    this.processPath(mappingAnnotation.value(), operationGenerator);
    this.processMethod(RequestMethod.POST, operationGenerator);
    this.processConsumes(mappingAnnotation.consumes(), operation);
    this.processProduces(mappingAnnotation.produces(), operation);

    if (StringUtils.isEmpty(operationGenerator.getHttpMethod())
            && StringUtils.isEmpty(operationGenerator.getSwaggerGenerator().getHttpMethod())) {
        throw new Error("HttpMethod must not both be empty in class and method");
    }//from  w  ww. j  a  v a  2 s  .  c o  m
}

From source file:io.servicecomb.swagger.generator.springmvc.processor.annotation.PatchMappingMethodAnnotationProcessor.java

@Override
public void process(Object annotation, OperationGenerator operationGenerator) {
    PatchMapping mappingAnnotation = (PatchMapping) annotation;
    Operation operation = operationGenerator.getOperation();

    // path/value?
    this.processPath(mappingAnnotation.path(), operationGenerator);
    this.processPath(mappingAnnotation.value(), operationGenerator);
    this.processMethod(RequestMethod.PATCH, operationGenerator);
    this.processConsumes(mappingAnnotation.consumes(), operation);
    this.processProduces(mappingAnnotation.produces(), operation);

    if (StringUtils.isEmpty(operationGenerator.getHttpMethod())
            && StringUtils.isEmpty(operationGenerator.getSwaggerGenerator().getHttpMethod())) {
        throw new Error("HttpMethod must not both be empty in class and method");
    }//www . j  a  v a2s .com
}