Example usage for java.lang OutOfMemoryError OutOfMemoryError

List of usage examples for java.lang OutOfMemoryError OutOfMemoryError

Introduction

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

Prototype

public OutOfMemoryError(String s) 

Source Link

Document

Constructs an OutOfMemoryError with the specified detail message.

Usage

From source file:uk.ac.diamond.scisoft.analysis.dataset.ShortDataset.java

private static short[] createArray(final int size) { // PRIM_TYPE
    short[] array = null; // PRIM_TYPE

    try {//w ww  . jav a  2  s  .  c  om
        array = new short[size]; // PRIM_TYPE
    } catch (OutOfMemoryError e) {
        logger.error("The size of the dataset ({}) that is being created is too large "
                + "and there is not enough memory to hold it.", size);
        throw new OutOfMemoryError("The dimensions given are too large, and there is "
                + "not enough memory available in the Java Virtual Machine");
    }
    return array;
}