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:edu.unc.lib.dl.util.Checksum.java

/**
 * Constructor for Checksum class/* w  w  w. j  a v a 2  s  .  c o  m*/
 */
public Checksum() {
    try {
        initializeMessageDigest();
    } catch (NoSuchAlgorithmException e) {
        throw new Error("The default algorithm should be available.");
    }
}

From source file:edu.unc.lib.dl.util.JRDFGraphUtil.java

public static String getRelatedLiteralObject(Graph graph, PID pid, URI predicate) {
    String result = null;//from   w w  w .ja v  a2  s  . c om
    ClosableIterator<Triple> tripleIter = null;
    try {
        URIReference subject = graph.getElementFactory().createResource(new URI("info:fedora/" + pid.getPid()));
        URIReference pred = graph.getElementFactory().createResource(predicate);
        Triple findTop = graph.getTripleFactory().createTriple(subject, pred, ANY_OBJECT_NODE);
        tripleIter = graph.find(findTop);
        if (tripleIter.hasNext()) {
            Triple t = tripleIter.next();
            Literal n = (Literal) t.getObject();
            result = n.getLexicalForm();
        }
    } catch (GraphException e) {
        log.error("programmer error: ", e);
        throw new Error(e);
    } catch (TripleFactoryException e) {
        log.error("programmer error: ", e);
        throw new Error(e);
    } catch (GraphElementFactoryException e) {
        log.error("programmer error: ", e);
        throw new Error(e);
    } catch (URISyntaxException e) {
        log.error("programmer error: ", e);
        throw new Error(e);
    } finally {
        if (tripleIter != null)
            tripleIter.close();
    }
    return result;
}

From source file:com.ihongqiqu.util.LocationUtils.java

/**
 * Don't let anyone instantiate this class.
 */
private LocationUtils() {
    throw new Error("Do not need instantiate!");
}

From source file:com.manydesigns.portofino.buttons.ButtonsLogic.java

public static List<ButtonInfo> getButtonsForClass(Class<?> someClass, String list) {
    try {/*from   w  ww  .ja  va  2  s  . c o m*/
        return classButtons.get(new MCKey(someClass, list));
    } catch (ExecutionException e) {
        throw new Error(e);
    }
}

From source file:mx.bigdata.sat.cfdi.TFDv11.java

private static JAXBContext createContext() {
    if (CONTEXT == null) {
        try {/* w w w.  j av a 2s  .  co  m*/
            return JAXBContext.newInstance("mx.bigdata.sat.cfdi.v33.schema");
        } catch (JAXBException e) {
            throw new Error(e);
        }
    }
    return CONTEXT;
}

From source file:com.examples.with.different.packagename.concolic.Tracer.java

/**
 * Used when a bug has been discovered. Will throw an Error with the given
 * message, as well as issue a trace with level Tracer.BUG.
 * /*from   w w w.j  a  v  a  2  s .c om*/
 * @param trace
 *            the string to display.
 * @exception Error
 *                always thrown.
 */
public static void bug(String trace) throws Error {
    log.error(trace);
    throw new Error(trace);
}

From source file:com.orange.ngsi2.model.ErrorTest.java

@Test
public void checkSerializationComplete() throws JsonProcessingException {
    ObjectMapper objectMapper = new ObjectMapper().registerModule(new Jdk8Module());

    Error parseError = new Error("400");
    parseError.setDescription(Optional.of("The incoming JSON payload cannot be parsed"));
    parseError.setAffectedItems(Optional.of(Collections.singleton("entities")));
    String json = objectMapper.writeValueAsString(parseError);
    assertTrue(json.contains("error"));
    assertTrue(json.contains("description"));
    assertTrue(json.contains("affectedItems"));
}

From source file:com.google.walkaround.slob.server.ChangeDataSerializer.java

public static JSONObject dataToClientJson(ChangeData<String> data, long resultingRevision) {
    Preconditions.checkArgument(resultingRevision <= MAX_DOUBLE_INTEGER, "Resulting revision %s is too large",
            resultingRevision);/*ww w. ja v  a2  s.c o m*/

    // Assume payload is JSON, and parse it to avoid nested json.
    // TODO(danilatos): Consider using ChangeData<JSONObject> instead.
    // The reason I haven't done it yet is because it's not immutable,
    // and also for reasons described in ChangeData.
    JSONObject payloadJson;
    try {
        payloadJson = new JSONObject(data.getPayload());
    } catch (JSONException e) {
        throw new IllegalArgumentException("Invalid payload for " + data, e);
    }

    JSONObject json = new JSONObject();
    try {
        Preconditions.checkArgument(resultingRevision >= 0, "invalid rev %s", resultingRevision);
        json.put("revision", resultingRevision);
        long sanityCheck = json.getLong("revision");
        if (sanityCheck != resultingRevision) {
            throw new AssertionError("resultingRevision " + resultingRevision
                    + " not losslessly represented in JSON, got back " + sanityCheck);
        }
        json.put("sid", data.getClientId().getId());
        json.put("op", payloadJson);
        return json;
    } catch (JSONException e) {
        throw new Error(e);
    }
}

From source file:com.xruby.debug.DebugCommandLineOptions.java

/**
 * Constructor/*w  w w .  j  a  v a 2s .  c  o  m*/
 *
 * @param args Arguments
 */
public DebugCommandLineOptions(String[] args) {
    pathList = new ArrayList<String>();

    GnuParser parser = new GnuParser();

    Options options = new Options();
    options.addOption(SOURCE_PATH_S, SOURCE_PATH, true, "path for the source code, seperated by semicolon");
    options.addOption(CLASS_PATH_S, CLASS_PATH, true, "classpath for debugee");

    CommandLine line;
    try {
        line = parser.parse(options, args, true);
    } catch (ParseException e) {
        throw new Error(e.toString());
    }

    if (line.hasOption(SOURCE_PATH_S)) {
        String paths = line.getOptionValue(SOURCE_PATH_S);
        StringTokenizer st = new StringTokenizer(paths, SEPARATOR);

        while (st.hasMoreTokens()) {
            String path = st.nextToken();
            pathList.add(path);
        }
    }

    if (line.hasOption(CLASS_PATH_S)) {
        this.classPath = line.getOptionValue(CLASS_PATH_S);
    }

    String[] tmp = line.getArgs();
    entrance = new StringBuffer();
    for (String str : tmp) {
        entrance.append(str).append(" ");
    }
}

From source file:com.manydesigns.portofino.actions.admin.tables.forms.TableForm.java

public TableForm(Table copyFrom) {
    try {/*from  w ww.  j a  v a  2 s .c  om*/
        BeanUtils.copyProperties(this, copyFrom);
        actualEntityName = copyFrom.getActualEntityName();
    } catch (Exception e) {
        throw new Error(e);
    }
}