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:com.proofpoint.zookeeper.io.TempLocalDirectory.java

public void cleanup() {
    try {//w  w w.  j av  a2s.c  om
        FileUtils.deleteDirectory(path);
        log.debug("Cleaned up local temp dir: " + path.getAbsolutePath());
    } catch (IOException e) {
        log.warn(e, "Error cleaning up temp local directory: %s", path.getAbsolutePath());
        throw new Error(e);
    }
}

From source file:cf.spring.NatsVcapFactoryBean.java

@SuppressWarnings("unchecked")
@Override//from   w  ww. j a v  a2  s .c  o  m
public void afterPropertiesSet() throws Exception {
    for (VcapSubscriptionConfig subscription : subscriptions) {
        final Object bean = subscription.getBean();
        final String methodName = subscription.getMethodName();
        final Method method = bean.getClass().getMethod(methodName, Publication.class);
        final ParameterizedType parameterTypes = (ParameterizedType) method.getGenericParameterTypes()[0];
        Class<MessageBody<Object>> parameterType = (Class<MessageBody<Object>>) parameterTypes
                .getActualTypeArguments()[0];
        final String queueGroup = subscription.getQueueGroup();
        cfNats.subscribe(parameterType, queueGroup, new PublicationHandler<MessageBody<Object>, Object>() {
            @Override
            public void onMessage(Publication publication) {
                try {
                    method.invoke(bean, publication);
                } catch (IllegalAccessException e) {
                    throw new Error(e);
                } catch (InvocationTargetException e) {
                    throw new NatsException(e.getTargetException());
                }
            }
        });
    }
}

From source file:org.brutusin.rpc.RpcAction.java

public Map<String, JsonSchema> getDynamicInputSchemas(String[] fieldNames, JsonNode data) {
    if (fieldNames == null || fieldNames.length == 0) {
        throw new IllegalArgumentException("Field names are required");
    }//from   ww  w  . ja va 2 s .c  o  m
    Map<String, JsonSchema> ret = new LinkedHashMap<String, JsonSchema>();

    DynamicSchemaProvider schemaProvider;
    Class<?> inputClass = Miscellaneous.getClass(getInputType());
    if (DynamicSchemaProvider.class.isAssignableFrom(inputClass)) {
        try {
            schemaProvider = (DynamicSchemaProvider) inputClass.newInstance();
        } catch (Exception ex) {
            throw new Error(ex);
        }
        for (String fieldName : fieldNames) {
            if (!ret.containsKey(fieldName)) {
                ret.put(fieldName, schemaProvider.getDynamicSchema(fieldName, data));
            }
        }
    } else {
        for (String fieldName : fieldNames) {
            if (!ret.containsKey(fieldName)) {
                Expression exp = JsonCodec.getInstance().compile(fieldName);
                ret.put(fieldName, exp.projectSchema(JsonCodec.getInstance().getSchema(inputClass)));
            }
        }
    }
    return ret;
}

From source file:com.davidsoergel.stats.HeatmapSeries.java

public void incrementPoint(double x, double y, double zIncrement, final double startx, final double endx,
        final double starty, final double endy) throws StatsException {
    throw new Error("Completely broken");
}

From source file:io.servicecomb.serviceregistry.config.AbstractPropertiesLoader.java

protected void loadPropertiesFromExtendedClass(Configuration configuration, Map<String, String> propertiesMap) {
    String extendedPropertyClass = readExtendedPropertyClassName(configuration, EXTENDED_CLASS);
    if (StringUtils.isEmpty(extendedPropertyClass)) {
        extendedPropertyClass = readExtendedPropertyClassName(configuration, EXTENDED_CLASS_FOR_COMPATIBLE);
        if (StringUtils.isEmpty(extendedPropertyClass)) {
            return;
        }//from   www  . ja  v a 2 s. co m
    }

    try {
        Class<?> classExternalProperty = Class.forName(extendedPropertyClass);
        if (!PropertyExtended.class.isAssignableFrom(classExternalProperty)) {
            String errMsg = String.format(
                    "Define propertyExtendedClass %s in yaml, but not implement the interface PropertyExtended.",
                    extendedPropertyClass);
            LOGGER.error(errMsg);
            throw new Error(errMsg);
        }

        PropertyExtended instance = (PropertyExtended) classExternalProperty.newInstance();
        Map<String, String> extendedPropertiesMap = instance.getExtendedProperties();
        if (extendedPropertiesMap != null && !extendedPropertiesMap.isEmpty()) {
            propertiesMap.putAll(extendedPropertiesMap);
        }
    } catch (ClassNotFoundException | InstantiationException | IllegalAccessException e) {
        String errMsg = "Fail to create instance of class: " + extendedPropertyClass;
        LOGGER.error(errMsg);
        throw new Error(errMsg, e);
    }
}

From source file:com.davidsoergel.trees.htpn.AbstractExtendedHierarchicalTypedPropertyNode.java

public void copyFrom(final ExtendedHierarchicalTypedPropertyNode<K, V, ?> node) //throws HierarchicalPropertyNodeException
{
    //setKey(node.getKey());
    //setValue(node.getValue());
    setType(node.getType());// w w w . j ava 2 s . c  o  m

    try {
        setDefaultAndNullable(node.getDefaultValue(), node.isNullable()); // applies inheritance and default if needed
    } catch (HierarchicalPropertyNodeException e) {
        logger.error("Error", e);
        throw new Error(e);
    }

    helpmessage = node.getHelpmessage();
    editable = node.isEditable();
    obsolete = node.isObsolete();
    changed = node.isChanged();
    //      isDefault = node.isDefault();

    clearChildren();

    for (HierarchicalTypedPropertyNode<K, V, ?> child : node.getChildNodes()) //getChildren())
    {
        newChild(child.getPayload()).copyFrom(child);
    }
}

From source file:com.eviware.soapui.plugins.PluginManagerTest.java

@Before
public void setUp() throws Exception {
    originalUserHome = System.getProperty("user.home");
    File fakeHomeDirectory = SoapUITools.createTemporaryDirectory();
    System.setProperty("user.home", fakeHomeDirectory.getAbsolutePath());
    pluginsDirectory = new File(fakeHomeDirectory, ".soapuios/plugins");
    if (!pluginsDirectory.mkdirs()) {
        throw new Error("Couldn't create directory " + pluginsDirectory);
    }/*from   w ww  .  j av  a2  s .  com*/
    pluginManager = makePluginManager();
    MockitoAnnotations.initMocks(this);
    pluginManager.fileOperations = fileOperations;
    pluginManager.pluginLoader = pluginLoader;
    pluginManager.loadPlugins();
    setUpPluginsAndFiles();
}

From source file:com.manydesigns.portofino.pageactions.m2m.configuration.SelectionProviderReference.java

public void init(Table table) {
    if (displayModeName != null) {
        displayMode = DisplayMode.valueOf(displayModeName);
    } else {/*  w w  w . j  av  a 2  s. com*/
        displayMode = DisplayMode.DROPDOWN;
    }

    if (!StringUtils.isEmpty(foreignKeyName)) {
        foreignKey = DatabaseLogic.findForeignKeyByName(table, foreignKeyName);
    } else if (!StringUtils.isEmpty(selectionProviderName)) {
        selectionProvider = DatabaseLogic.findSelectionProviderByName(table, selectionProviderName);
    } else {
        throw new Error("foreignKey and selectionProvider are both null");
    }
}

From source file:it.cnr.isti.smartfed.papers.qbrokage.ApplicationGenerator.java

public Application getApplication(int userId, int numVertex, int numCloudlet,
        AbstractRealDistribution distribution) {
    if (numCloudlet < numVertex)
        throw new Error("Cannot create an application with more cloudlets (" + numCloudlet + ") than vertexes ("
                + numVertex + ")");

    int[] assignment = DistributionAssignment.getAssignmentArray(numVertex, numCloudlet, distribution);

    Application application = new Application();

    for (int i = 0; i < numVertex; i++) {
        if (assignment[i] > 0) {
            int mips = mipsAmount.sample();
            int cores = coreAmount.sample();
            int ramMB = ramAmount.sample();
            int bandMB = bwAmount.sample();
            int diskMB = diskAmount.sample();

            Vm sample = VmFactory.getCustomVm(userId, mips, cores, ramMB, bandMB, diskMB);

            ArrayList<Cloudlet> cloudletList = new ArrayList<Cloudlet>();
            for (int c = 0; c < assignment[i]; c++)
                cloudletList.add(CloudletProvider.getDefault());

            ApplicationVertex av = new ApplicationVertex(userId, cloudletList, sample);
            av.setBudget(ApplicationGenerator.BUDGET);
            av.setCountry("Italy");
            application.addVertex(av);/* w  w  w .  j a va  2 s.co  m*/
        }
    }

    return application;
}

From source file:BBPApplet.java

/***************************************************************************
 * Initialise the applet by attempting to create and start a Player object
 * capable of playing the media specified in the applet tag.
 **************************************************************************/
public void init() {

    setLayout(new BorderLayout());
    setBackground(Color.lightGray);
    try {/*from w  w  w .  j av  a2  s . c om*/
        nameOfMedia2Play = (new URL(getDocumentBase(), getParameter(MEDIA_NAME_PROPERTY))).toExternalForm();
        locator = new MediaLocator(nameOfMedia2Play);
        player = Manager.createPlayer(locator);
        player.addControllerListener(this);
        player.start();
    } catch (Exception e) {
        throw new Error("Couldn't initialise BBPApplet: " + e.getMessage());
    }
}