Example usage for java.lang InstantiationError InstantiationError

List of usage examples for java.lang InstantiationError InstantiationError

Introduction

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

Prototype

public InstantiationError(String s) 

Source Link

Document

Constructs an InstantiationError with the specified detail message.

Usage

From source file:org.dentaku.services.metadata.validator.ValidatingVisitorBase.java

protected ValidatingVisitorBase() {
    try {//from   www.j  a va  2 s .  co m
        methodFilter.add(ValidatingVisitorBase.class.getMethod("visit",
                new Class[] { ModelElement.class, Object.class }));
    } catch (NoSuchMethodException e) {
        throw new InstantiationError("couldn't reflect our own visit method!");
    }
}

From source file:hudson.lifecycle.Lifecycle.java

/**
 * Gets the singleton instance./*from   w  w w .ja v  a  2s  . c  o m*/
 *
 * @return never null
 */
public synchronized static Lifecycle get() {
    if (INSTANCE == null) {
        String p = System.getProperty("hudson.lifecycle");
        if (p != null) {
            try {
                ClassLoader cl = Hudson.getInstance().getPluginManager().uberClassLoader;
                INSTANCE = (Lifecycle) cl.loadClass(p).newInstance();
            } catch (InstantiationException e) {
                InstantiationError x = new InstantiationError(e.getMessage());
                x.initCause(e);
                throw x;
            } catch (IllegalAccessException e) {
                IllegalAccessError x = new IllegalAccessError(e.getMessage());
                x.initCause(e);
                throw x;
            } catch (ClassNotFoundException e) {
                NoClassDefFoundError x = new NoClassDefFoundError(e.getMessage());
                x.initCause(e);
                throw x;
            }
        } else {
            // if run on Unix, we can do restart 
            if (!Hudson.isWindows()) {
                try {
                    INSTANCE = new UnixLifecycle();
                } catch (IOException e) {
                    LOGGER.log(Level.WARNING, "Failed to install embedded lifecycle implementation", e);
                }
            }

            // use the default one. final fallback.
            if (INSTANCE == null)
                INSTANCE = new Lifecycle() {
                };
        }
    }

    return INSTANCE;
}

From source file:org.wso2.carbon.throttle.core.CallerContext.java

public CallerContext(String ID) {
    if (ID == null || "".equals(ID)) {
        throw new InstantiationError("Couldn't create a CallContext for an empty remote caller ID");
    }/*from w  w  w.j a v a  2s .com*/
    this.ID = ID.trim();
}

From source file:edu.ksu.cis.santos.mdcf.dml.ast.AstNode.java

/**
 * Constructs an AST node whose type is equal to this node's type with the
 * provided child nodes.//from www  .ja va 2 s .  c  o  m
 * 
 * @param args
 *          The child nodes; no changes to the array will be made.
 * @return an AST node whose type is equal to this node's type and whose
 *         children are the provided nodes.
 * @throws {@link InstantiationError} if unsuccessful.
 */
public final <T extends AstNode> T make(final Object[] args) {
    try {
        @SuppressWarnings("unchecked")
        final T result = (T) getClass().getDeclaredConstructors()[0].newInstance(args);
        return result;
    } catch (final Exception e) {
        throw new InstantiationError(e.getMessage());
    }
}

From source file:org.wso2.carbon.throttle.core.ThrottleContext.java

/**
 * default constructor  expects a throttle configuration.
 *
 * @param throttleConfiguration - configuration data according to the policy
 *///from   ww w. j a  v  a 2s. c  om
public ThrottleContext(ThrottleConfiguration throttleConfiguration) {
    if (throttleConfiguration == null) {
        throw new InstantiationError(
                "Couldn't create the throttle context " + "from null a throttle configuration");
    }
    this.keyToTimeStampMap = new HashMap();
    this.callersMap = new TreeMap();
    this.nextCleanTime = 0;
    this.throttleConfiguration = throttleConfiguration;
    this.debugOn = log.isDebugEnabled();
}

From source file:springfox.documentation.schema.property.PojoPropertyBuilderFactory.java

/**
 * Applies to constructor//from www  .  j av  a 2s .c o  m
    new POJOPropertyBuilder(
config,
annotationIntrospector,
forSerialization,
new PropertyName(beanProperty.getName()))
 */
private POJOPropertyBuilder jackson27Instance(MapperConfig<?> config, BeanPropertyDefinition beanProperty,
        AnnotationIntrospector annotationIntrospector, boolean forSerialization) {
    try {
        Constructor<POJOPropertyBuilder> constructor = constructorWithParams(MapperConfig.class,
                AnnotationIntrospector.class, Boolean.TYPE, PropertyName.class);

        return constructor.newInstance(config, annotationIntrospector, forSerialization,
                new PropertyName(beanProperty.getName()));
    } catch (Exception e) {
        throw new InstantiationError("Unable to create an instance of POJOPropertyBuilder");
    }
}

From source file:org.apache.synapse.commons.throttle.core.CallerContext.java

public CallerContext(String ID) {
    if (ID == null || "".equals(ID)) {
        throw new InstantiationError("Couldn't create a CallContext for an empty " + "remote caller ID");
    }/*from  w w  w  .j a  va  2s.co  m*/
    this.id = ID.trim();
}

From source file:org.apache.synapse.commons.throttle.core.ThrottleContext.java

/**
 * default constructor  expects a throttle configuration.
 *
 * @param throttleConfiguration - configuration data according to the policy
 *//*from  w  ww  .  j ava  2  s . c  o m*/
public ThrottleContext(ThrottleConfiguration throttleConfiguration, ThrottleReplicator throttleReplicator) {
    if (throttleConfiguration == null) {
        throw new InstantiationError(
                "Couldn't create the throttle context " + "from null a throttle configuration");
    }
    this.throttleReplicator = throttleReplicator;
    this.keyToTimeStampMap = new ConcurrentHashMap();
    this.callersMap = new ConcurrentSkipListMap();
    this.nextCleanTime = 0;
    this.throttleConfiguration = throttleConfiguration;
    this.debugOn = log.isDebugEnabled();
    this.throttleWindowReplicator = ThrottleContextFactory.getThrottleWindowReplicatorInstance();
    ThrottleContextFactory.getThrottleContextCleanupTaskInstance().addThrottleContext(this);
}

From source file:stargate.drivers.hazelcast.HazelcastCoreDriver.java

public HazelcastCoreDriver(ADriverConfiguration config) {
    if (config == null) {
        throw new IllegalArgumentException("config is null");
    }// w ww.  ja  va2 s  .c om

    if (!(config instanceof HazelcastCoreDriverConfiguration)) {
        throw new IllegalArgumentException("config is not an instance of HazelcastDriverGroupConfiguration");
    }

    if (instance != null) {
        throw new InstantiationError("cannot instantiate HazelcastDriverGroup class. Instance already exists");
    }

    this.config = (HazelcastCoreDriverConfiguration) config;

    instance = this;
}

From source file:stargate.drivers.hazelcast.HazelcastCoreDriver.java

public HazelcastCoreDriver(HazelcastCoreDriverConfiguration config) {
    if (config == null) {
        throw new IllegalArgumentException("config is null");
    }//from ww w .  ja v  a2s.c o m

    if (instance != null) {
        throw new InstantiationError("cannot instantiate HazelcastDriverGroup class. Instance already exists");
    }

    this.config = config;

    instance = this;
}