Java 类java.lang.InstantiationException 实例源码

项目:pluotsorbet    文件:constructor.java   
/**
 * Runs the test using the specified harness.
 *
 * @param harness  the test harness (<code>null</code> not permitted).
 */
public void test(TestHarness harness)
{
    InstantiationException object1 = new InstantiationException();
    harness.check(object1 != null);
    harness.check(object1.toString(), "java.lang.InstantiationException");

    InstantiationException object2 = new InstantiationException("nothing happens");
    harness.check(object2 != null);
    harness.check(object2.toString(), "java.lang.InstantiationException: nothing happens");

    InstantiationException object3 = new InstantiationException(null);
    harness.check(object3 != null);
    harness.check(object3.toString(), "java.lang.InstantiationException");

}
项目:pluotsorbet    文件:TryCatch.java   
/**
 * Runs the test using the specified harness.
 *
 * @param harness  the test harness (<code>null</code> not permitted).
 */
public void test(TestHarness harness)
{
    // flag that is set when exception is caught
    boolean caught = false;
    try {
        throw new InstantiationException("InstantiationException");
    }
    catch (InstantiationException e) {
        // correct exception was caught
        caught = true;
    }
    harness.check(caught);
}
项目:strusJavaApi    文件:JacksonTest.java   
@Test
public void mixinCreateTest3( ) throws ClassNotFoundException, NoSuchMethodException, InstantiationException, IllegalAccessException, InvocationTargetException {
    Query query = new Query( )
        .setFirstRank( 0 )
        .setNofRanks( 20 )
        .addWeightingScheme(
            new WeightingScheme( "bm25" )
                .addParameter( "b", 0.77f )
                .addParameter( "k1", 2 )
                .addParameter( "avgdoclen", 11943 )
                .addParameter( "metadata_doclen", "doclen" )
                .addParameter( "match", "feat" ) )
        .addSummarizer(
            new SummarizerConfiguration( "docid", "attribute" )
                .addParameter( "name", "docid" ) )
        .addSummarizer(
            new SummarizerConfiguration( "attr1", "attribute" )
                .addParameter( "name", "attr1" ) )
        .addSummarizer(
            new SummarizerConfiguration( "doclen", "metadata" )
                .addParameter( "name", "doclen" ) )
        .defineFeature( "feat", "word", "aword0", 1.0f )
        .defineFeature( "feat", new Term( "word", "aword1" ), 1.0f )
        .defineFeature( "sel",
            new Term( "word", "aword1" ), 1.0f )
        .defineFeature( "sel",
            new Expression( "contains", 0, 0 )
                .addExpression( 
                    new Expression( "contains", 0, 0 )
                        .addTerm( "word", "aword0" )
                        .addTerm( "word", "aword1" ) )
                .addTerm( "word", "aword2" ), 1.0f )                    
        .addSelect( "sel" )
        // AND of OR-groups (CNF), first is a shortcut for a single and condition
        .addMetadataRestriction(
            new MetadataRestriction( MetadataCondition.COMPARE_GREATER_OR_EQUALS, "doclen", 2 )                 
        )
        .addMetadataRestriction(
            new MetadataRestriction( )
                .addCondition( MetadataCondition.COMPARE_GREATER, "doclen", 3 )
                .addCondition( MetadataCondition.COMPARE_LESS_OR_EQUALS, "doclen", 100 )                    
        );

        // long for:
        //    QueryResponse response = new QueryResponse( query );
        // in private static class in WebService:
        Class<?> queryRequestClazz = Class.forName( "net.strus.service.impl.ws.WebService$QueryRequest" );
        Constructor<?> constructor = queryRequestClazz.getDeclaredConstructor( Query.class );
        constructor.setAccessible( true );
        Object request = constructor.newInstance( query );

        LOGGER.fine( request.toString( ) );
}
项目:javify    文件:ParserFactory.java   
/**
    * Create a new SAX parser using the `org.xml.sax.parser' system property.
    *
    * <p>The named class must exist and must implement the
    * {@link org.xml.sax.Parser Parser} interface.</p>
    *
    * @exception java.lang.NullPointerException There is no value
    *            for the `org.xml.sax.parser' system property.
    * @exception java.lang.ClassNotFoundException The SAX parser
    *            class was not found (check your CLASSPATH).
    * @exception IllegalAccessException The SAX parser class was
    *            found, but you do not have permission to load
    *            it.
    * @exception InstantiationException The SAX parser class was
    *            found but could not be instantiated.
    * @exception java.lang.ClassCastException The SAX parser class
    *            was found and instantiated, but does not implement
    *            org.xml.sax.Parser.
    * @see #makeParser(java.lang.String)
    * @see org.xml.sax.Parser
    */
   public static Parser makeParser ()
throws ClassNotFoundException,
IllegalAccessException, 
InstantiationException,
NullPointerException,
ClassCastException
   {
String className = System.getProperty("org.xml.sax.parser");
if (className == null) {
    throw new NullPointerException("No value for sax.parser property");
} else {
    return makeParser(className);
}
   }
项目:javify    文件:ParserFactory.java   
/**
    * Create a new SAX parser object using the class name provided.
    *
    * <p>The named class must exist and must implement the
    * {@link org.xml.sax.Parser Parser} interface.</p>
    *
    * @param className A string containing the name of the
    *                  SAX parser class.
    * @exception java.lang.ClassNotFoundException The SAX parser
    *            class was not found (check your CLASSPATH).
    * @exception IllegalAccessException The SAX parser class was
    *            found, but you do not have permission to load
    *            it.
    * @exception InstantiationException The SAX parser class was
    *            found but could not be instantiated.
    * @exception java.lang.ClassCastException The SAX parser class
    *            was found and instantiated, but does not implement
    *            org.xml.sax.Parser.
    * @see #makeParser()
    * @see org.xml.sax.Parser
    */
   public static Parser makeParser (String className)
throws ClassNotFoundException,
IllegalAccessException, 
InstantiationException,
ClassCastException
   {
return (Parser) NewInstance.newInstance (
    NewInstance.getClassLoader (), className);
   }
项目:jvm-stm    文件:ParserFactory.java   
/**
    * Create a new SAX parser using the `org.xml.sax.parser' system property.
    *
    * <p>The named class must exist and must implement the
    * {@link org.xml.sax.Parser Parser} interface.</p>
    *
    * @exception java.lang.NullPointerException There is no value
    *            for the `org.xml.sax.parser' system property.
    * @exception java.lang.ClassNotFoundException The SAX parser
    *            class was not found (check your CLASSPATH).
    * @exception IllegalAccessException The SAX parser class was
    *            found, but you do not have permission to load
    *            it.
    * @exception InstantiationException The SAX parser class was
    *            found but could not be instantiated.
    * @exception java.lang.ClassCastException The SAX parser class
    *            was found and instantiated, but does not implement
    *            org.xml.sax.Parser.
    * @see #makeParser(java.lang.String)
    * @see org.xml.sax.Parser
    */
   public static Parser makeParser ()
throws ClassNotFoundException,
IllegalAccessException, 
InstantiationException,
NullPointerException,
ClassCastException
   {
String className = System.getProperty("org.xml.sax.parser");
if (className == null) {
    throw new NullPointerException("No value for sax.parser property");
} else {
    return makeParser(className);
}
   }
项目:jvm-stm    文件:ParserFactory.java   
/**
    * Create a new SAX parser object using the class name provided.
    *
    * <p>The named class must exist and must implement the
    * {@link org.xml.sax.Parser Parser} interface.</p>
    *
    * @param className A string containing the name of the
    *                  SAX parser class.
    * @exception java.lang.ClassNotFoundException The SAX parser
    *            class was not found (check your CLASSPATH).
    * @exception IllegalAccessException The SAX parser class was
    *            found, but you do not have permission to load
    *            it.
    * @exception InstantiationException The SAX parser class was
    *            found but could not be instantiated.
    * @exception java.lang.ClassCastException The SAX parser class
    *            was found and instantiated, but does not implement
    *            org.xml.sax.Parser.
    * @see #makeParser()
    * @see org.xml.sax.Parser
    */
   public static Parser makeParser (String className)
throws ClassNotFoundException,
IllegalAccessException, 
InstantiationException,
ClassCastException
   {
return (Parser) NewInstance.newInstance (
    NewInstance.getClassLoader (), className);
   }
项目:JamVM-PH    文件:ParserFactory.java   
/**
    * Create a new SAX parser using the `org.xml.sax.parser' system property.
    *
    * <p>The named class must exist and must implement the
    * {@link org.xml.sax.Parser Parser} interface.</p>
    *
    * @exception java.lang.NullPointerException There is no value
    *            for the `org.xml.sax.parser' system property.
    * @exception java.lang.ClassNotFoundException The SAX parser
    *            class was not found (check your CLASSPATH).
    * @exception IllegalAccessException The SAX parser class was
    *            found, but you do not have permission to load
    *            it.
    * @exception InstantiationException The SAX parser class was
    *            found but could not be instantiated.
    * @exception java.lang.ClassCastException The SAX parser class
    *            was found and instantiated, but does not implement
    *            org.xml.sax.Parser.
    * @see #makeParser(java.lang.String)
    * @see org.xml.sax.Parser
    */
   public static Parser makeParser ()
throws ClassNotFoundException,
IllegalAccessException, 
InstantiationException,
NullPointerException,
ClassCastException
   {
String className = System.getProperty("org.xml.sax.parser");
if (className == null) {
    throw new NullPointerException("No value for sax.parser property");
} else {
    return makeParser(className);
}
   }
项目:JamVM-PH    文件:ParserFactory.java   
/**
    * Create a new SAX parser object using the class name provided.
    *
    * <p>The named class must exist and must implement the
    * {@link org.xml.sax.Parser Parser} interface.</p>
    *
    * @param className A string containing the name of the
    *                  SAX parser class.
    * @exception java.lang.ClassNotFoundException The SAX parser
    *            class was not found (check your CLASSPATH).
    * @exception IllegalAccessException The SAX parser class was
    *            found, but you do not have permission to load
    *            it.
    * @exception InstantiationException The SAX parser class was
    *            found but could not be instantiated.
    * @exception java.lang.ClassCastException The SAX parser class
    *            was found and instantiated, but does not implement
    *            org.xml.sax.Parser.
    * @see #makeParser()
    * @see org.xml.sax.Parser
    */
   public static Parser makeParser (String className)
throws ClassNotFoundException,
IllegalAccessException, 
InstantiationException,
ClassCastException
   {
return (Parser) NewInstance.newInstance (
    NewInstance.getClassLoader (), className);
   }
项目:classpath    文件:ParserFactory.java   
/**
    * Create a new SAX parser using the `org.xml.sax.parser' system property.
    *
    * <p>The named class must exist and must implement the
    * {@link org.xml.sax.Parser Parser} interface.</p>
    *
    * @exception java.lang.NullPointerException There is no value
    *            for the `org.xml.sax.parser' system property.
    * @exception java.lang.ClassNotFoundException The SAX parser
    *            class was not found (check your CLASSPATH).
    * @exception IllegalAccessException The SAX parser class was
    *            found, but you do not have permission to load
    *            it.
    * @exception InstantiationException The SAX parser class was
    *            found but could not be instantiated.
    * @exception java.lang.ClassCastException The SAX parser class
    *            was found and instantiated, but does not implement
    *            org.xml.sax.Parser.
    * @see #makeParser(java.lang.String)
    * @see org.xml.sax.Parser
    */
   public static Parser makeParser ()
throws ClassNotFoundException,
IllegalAccessException, 
InstantiationException,
NullPointerException,
ClassCastException
   {
String className = System.getProperty("org.xml.sax.parser");
if (className == null) {
    throw new NullPointerException("No value for sax.parser property");
} else {
    return makeParser(className);
}
   }
项目:classpath    文件:ParserFactory.java   
/**
    * Create a new SAX parser object using the class name provided.
    *
    * <p>The named class must exist and must implement the
    * {@link org.xml.sax.Parser Parser} interface.</p>
    *
    * @param className A string containing the name of the
    *                  SAX parser class.
    * @exception java.lang.ClassNotFoundException The SAX parser
    *            class was not found (check your CLASSPATH).
    * @exception IllegalAccessException The SAX parser class was
    *            found, but you do not have permission to load
    *            it.
    * @exception InstantiationException The SAX parser class was
    *            found but could not be instantiated.
    * @exception java.lang.ClassCastException The SAX parser class
    *            was found and instantiated, but does not implement
    *            org.xml.sax.Parser.
    * @see #makeParser()
    * @see org.xml.sax.Parser
    */
   public static Parser makeParser (String className)
throws ClassNotFoundException,
IllegalAccessException, 
InstantiationException,
ClassCastException
   {
return (Parser) NewInstance.newInstance (
    NewInstance.getClassLoader (), className);
   }