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.berkeley.compbio.sequtils.strings.AggregateSequenceFragment.java

protected synchronized void rescanSpectrum() {
    /*      SequenceSpectrum baseSpectrum = getBaseSpectrum();
          if (baseSpectrum != null && baseSpectrum.getOriginalSequenceLength() != UNKNOWN_LENGTH)
             {/*w w w.j  a va2  s .  c  o  m*/
             return;
             }*/
    final SequenceSpectrum baseSpectrum = theScanner.getEmpty();
    length = 0;

    // PERF sort the fragments?
    for (final SequenceFragment sf : theSFs) {
        try {
            length += sf.getLength();
            baseSpectrum.incrementBy(sf.getSpectrum(baseSpectrum.getClass(), baseSpectrum.getFactory()));
        } catch (SequenceSpectrumException e) {
            logger.error("Error", e);
            throw new Error(e);
        }
    }
    fireUpdated(baseSpectrum);
}

From source file:edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.Field.java

public Field(String config, String varName) {
    name = varName;/*from  w w w . ja v a  2s  .  c  o m*/
    JSONObject jsonObj = null;
    try {
        jsonObj = new JSONObject(config);
    } catch (JSONException je) {
        throw new Error(je);
    }
    originalJson = config;
    setValuesFromJson(jsonObj, varName);
}

From source file:edu.utexas.cs.tactex.servercustomers.factoredcustomer.TimeseriesGenerator.java

private void initArima101x101ModelParams() {
    InputStream paramsStream;//from   w w w. j  a v a2 s  . co m
    String paramsName = tsStructure.modelParamsName;
    switch (tsStructure.modelParamsSource) {
    case BUILTIN:
        throw new Error("Unknown builtin model parameters with name: " + paramsName);
        // break;
    case CLASSPATH:
        paramsStream = Thread.currentThread().getContextClassLoader().getResourceAsStream(paramsName);
        break;
    case FILEPATH:
        try {
            paramsStream = new FileInputStream(paramsName);
        } catch (FileNotFoundException e) {
            throw new Error("Could not find file to initialize model parameters: " + paramsName);
        }
        break;
    default:
        throw new Error("Unexpected reference timeseries source type: " + tsStructure.refSeriesSource);
    }
    if (paramsStream == null)
        throw new Error("Model parameters input stream is uninitialized!");

    try {
        modelParams.load(paramsStream);
    } catch (java.io.IOException e) {
        throw new Error("Error reading model parameters from file: " + paramsName + "; caught IOException: "
                + e.toString());
    }

    Y0 = Double.parseDouble((String) modelParams.get("Y0"));
    Yd = ParserFunctions.parseDoubleArray((String) modelParams.get("Yd"));
    Yh = ParserFunctions.parseDoubleArray((String) modelParams.get("Yh"));
    phi1 = Double.parseDouble((String) modelParams.get("phi1"));
    Phi1 = Double.parseDouble((String) modelParams.get("Phi1"));
    theta1 = Double.parseDouble((String) modelParams.get("theta1"));
    Theta1 = Double.parseDouble((String) modelParams.get("Theta1"));
    lambda = Double.parseDouble((String) modelParams.get("lambda"));
    gamma = Double.parseDouble((String) modelParams.get("gamma"));
    sigma = Double.parseDouble((String) modelParams.get("sigma"));

    //randomSeedRepo =
    //        (RandomSeedRepo) SpringApplicationContext.getBean("randomSeedRepo");

    arimaNoise = new Random(service.getRandomSeedRepo()
            .getRandomSeed("factoredcustomer.TimeseriesGenerator", SeedIdGenerator.getId(), "ArimaNoise")
            .getValue());
}

From source file:asmlib.Type.java

private Type(String bytecodeName) {
    _bytecodeName = bytecodeName;/* w  w w .  ja v  a 2 s.  c  o  m*/

    if (bytecodeName.isEmpty())
        throw new AssertionError("Empty bytecodeName");
    if (bytecodeName.length() == 1 && !isPrimitive())
        throw new Error("Invalid bytecodeName");
}

From source file:fr.lirmm.graphik.graal.store.test.TestUtil.java

public static AtomSet[] getAtomSet() {
    if (rdbmsStore != null) {
        try {/* w  w  w.j  av a2s  .c  om*/
            rdbmsStore.getDriver().getConnection().createStatement().executeQuery("DROP SCHEMA PUBLIC CASCADE");
        } catch (SQLException e) {
            // TODO treat this exception e.printStackTrace(); throw new
            throw new Error("Untreated exception");
        }
        rdbmsStore.close();
    }

    if (graphStore != null) {
        graphStore.close();
    }

    if (neo4jStore != null) {
        neo4jStore.close();
    }

    try {
        rdbmsStore = new DefaultRdbmsStore(new HSQLDBDriver(HSQLDB_TEST, null));
        graphStore = new BlueprintsGraphDBStore(new TinkerGraph());
        rm(NEO4J_TEST);
        neo4jStore = new Neo4jStore(NEO4J_TEST);

        return new AtomSet[] { new DefaultInMemoryGraphAtomSet(), new LinkedListAtomSet(), rdbmsStore,
                graphStore, neo4jStore };
    } catch (AtomSetException e) { // TODO treat this exception
                                   // e.printStackTrace();
        throw new Error("Untreated exception", e);
    }
}

From source file:net.kourlas.voipms_sms.activities.ConversationActivity.java

public static void sendMessage(Activity sourceActivity, long databaseId) {
    Context applicationContext = sourceActivity.getApplicationContext();
    Database database = Database.getInstance(applicationContext);
    Preferences preferences = Preferences.getInstance(applicationContext);

    Message message = database.getMessageWithDatabaseId(preferences.getDid(), databaseId);
    SendMessageTask task = new SendMessageTask(sourceActivity.getApplicationContext(), message, sourceActivity);

    if (preferences.getEmail().equals("") || preferences.getPassword().equals("")
            || preferences.getDid().equals("")) {
        // Do not show an error; this method should never be called unless the email, password and DID are set
        task.cleanup(false);/*from  w w  w  .  jav  a 2 s . c om*/
        return;
    }

    if (!Utils.isNetworkConnectionAvailable(applicationContext)) {
        Toast.makeText(applicationContext,
                applicationContext.getString(R.string.conversation_send_error_network), Toast.LENGTH_SHORT)
                .show();
        task.cleanup(false);
        return;
    }

    try {
        String voipUrl = "https://www.voip.ms/api/v1/rest.php?" + "api_username="
                + URLEncoder.encode(preferences.getEmail(), "UTF-8") + "&" + "api_password="
                + URLEncoder.encode(preferences.getPassword(), "UTF-8") + "&" + "method=sendSMS" + "&" + "did="
                + URLEncoder.encode(preferences.getDid(), "UTF-8") + "&" + "dst="
                + URLEncoder.encode(message.getContact(), "UTF-8") + "&" + "message="
                + URLEncoder.encode(message.getText(), "UTF-8");
        task.start(voipUrl);
    } catch (UnsupportedEncodingException ex) {
        // This should never happen since the encoding (UTF-8) is hardcoded
        throw new Error(ex);
    }
}

From source file:com.googlecode.arit.mbeans.MBeanScanner.java

public void clean(ClassLoader classLoader) {
    ArrayList<MBeanServer> mbeanServers = MBeanServerFactory.findMBeanServer(null);
    for (MBeanServer mbs : mbeanServers) {
        MBeanAccessor mbeanAccessor = mbsInspector.inspect(mbs);
        if (mbeanAccessor == null) {
            String errorMsg = "Unable to inspect MBeanServer of type " + mbs.getClass().getName();
            LOG.error(errorMsg);//from  ww  w.  j  av  a2s. c  o m
            if (messages != null) {
                messages.addMessage(errorMsg);
            }
        } else {
            Set<ObjectName> mbeans;
            try {
                mbeans = mbs.queryNames(new ObjectName("*:*"), null);
            } catch (MalformedObjectNameException ex) {
                // We should never get here
                throw new Error(ex);
            }

            for (ObjectName name : mbeans) {
                Object mbean = mbeanAccessor.retrieve(name);
                if (mbean.getClass().getClassLoader().equals(classLoader)) {
                    try {
                        mbs.unregisterMBean(name);
                    } catch (JMException ex) {
                        String errorMsg = "Error during cleanup of mbean - unregistration of mbean "
                                + name.toString() + " failed";
                        LOG.error(errorMsg, ex);
                        if (messages != null) {
                            messages.addMessage(errorMsg);
                        }
                    }
                }
            }
        }
    }
}

From source file:edu.cornell.mannlib.vitro.webapp.edit.n3editing.controller.EditRequestAJAXController.java

private EditConfigurationAJAXGenerator getAJAXGenerator(String editConfGeneratorName, VitroRequest vreq,
        HttpSession session) throws Exception {

    EditConfigurationAJAXGenerator EditConfigurationVTwoGenerator = null;

    Object object = null;/*from   www  .j  av a2  s  .c  o  m*/
    try {
        Class classDefinition = Class.forName(editConfGeneratorName);
        object = classDefinition.newInstance();
        EditConfigurationVTwoGenerator = (EditConfigurationAJAXGenerator) object;
    } catch (InstantiationException e) {
        System.out.println(e);
    } catch (IllegalAccessException e) {
        System.out.println(e);
    } catch (ClassNotFoundException e) {
        System.out.println(e);
    }

    if (EditConfigurationVTwoGenerator == null) {
        throw new Error("Could not find EditConfigurationVTwoGenerator " + editConfGeneratorName);
    } else {
        return EditConfigurationVTwoGenerator;
    }

}

From source file:com.manydesigns.portofino.model.database.ForeignKey.java

@Override
public void init(Model model) {
    super.init(model);

    assert fromTable != null;
    assert name != null;
    assert toSchema != null;
    assert toTableName != null;

    if (references.isEmpty()) {
        throw new Error(MessageFormat.format("Foreign key {0} has no references", getQualifiedName()));
    }//  w w  w  . java 2s .  c om

}

From source file:beast.math.MathUtils.java

/**
 * @param logpdf array of unnormalised log probabilities
 * @return a sample according to an unnormalised probability distribution
 *
 * Use this if probabilities are rounding to zero when converted to real space
 *///from w w w . j  a v  a 2s.com
public static int randomChoiceLogPDF(double[] logpdf) {

    double scalingFactor = Double.NEGATIVE_INFINITY;

    for (double aLogpdf : logpdf) {
        if (aLogpdf > scalingFactor) {
            scalingFactor = aLogpdf;
        }
    }

    if (scalingFactor == Double.NEGATIVE_INFINITY) {
        throw new Error("randomChoiceLogPDF falls through -- all -INF components in input distribution");
    }

    for (int j = 0; j < logpdf.length; j++) {
        logpdf[j] = logpdf[j] - scalingFactor;
    }

    double[] pdf = new double[logpdf.length];

    for (int j = 0; j < logpdf.length; j++) {
        pdf[j] = Math.exp(logpdf[j]);
    }

    return randomChoicePDF(pdf);

}