Java 类java.lang.IllegalAccessException 实例源码

项目:appc-android-bluetooth    文件:BluetoothCommonServiceIds.java   
public static String getDescription(UUID serviceId)
{
    Field[] fields = BluetoothCommonServiceIds.class.getDeclaredFields();

    for(Field f: fields)
    {
        try {
            BluetoothServiceId id = (BluetoothServiceId)f.get(null);

            if(id.mUuid.equals(serviceId))
                return id.mDescription;
        }
        catch (IllegalAccessException e){
            e.printStackTrace();
        }
    }

    return null;
}
项目:appc-android-bluetooth    文件:BluetoothCommonServiceIds.java   
public static BluetoothServiceId getByDescription(String description)
{
    Field[] fields = BluetoothCommonServiceIds.class.getDeclaredFields();

    for(Field f: fields)
    {
        try {
            BluetoothServiceId id = (BluetoothServiceId)f.get(null);

            if(id.mDescription.equals(description))
                return id;
        }
        catch(IllegalAccessException e){
            e.printStackTrace();
        }
    }

    return null;
}
项目:appc-android-bluetooth    文件:BluetoothCommonServiceIds.java   
public static UUID getUuidByDescription(String description)
{
    Field[] fields = BluetoothCommonServiceIds.class.getDeclaredFields();

    for(Field f: fields)
    {
        try {
            BluetoothServiceId id = (BluetoothServiceId)f.get(null);

            if(id.mDescription.equals(description))
                return id.mUuid;
        }
        catch(IllegalAccessException e){
            e.printStackTrace();
        }
    }

    return null;
}
项目:mc_backup    文件:LocalBrowserDB.java   
private static int getFaviconId(String name) {
    try {
        Class<?> drawablesClass = R.raw.class;

        // Look for a favicon with the id R.raw.bookmarkdefaults_favicon_*.
        Field faviconField = drawablesClass.getField(name.replace("_title_", "_favicon_"));
        faviconField.setAccessible(true);

        return faviconField.getInt(null);
    } catch (IllegalAccessException | NoSuchFieldException e) {
        // We'll end up here for any default bookmark that doesn't have a favicon in
        // resources/raw/ (i.e., about:firefox). When this happens, the Favicons service will
        // fall back to the default branding icon for about pages. Non-about pages should always
        // specify an icon; otherwise, the placeholder globe favicon will be used.
        Log.d(LOGTAG, "No raw favicon resource found for " + name);
    }

    Log.e(LOGTAG, "Failed to find favicon resource ID for " + name);
    return FAVICON_ID_NOT_FOUND;
}
项目: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)
{
    IllegalAccessException object1 = new IllegalAccessException();
    harness.check(object1 != null);
    harness.check(object1.toString(), "java.lang.IllegalAccessException");

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

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

}
项目:soen343-ezim    文件:EzimConf.java   
/**
 * instantiate an object from a given string
 * @param c class of the object to instantiate
 * @param s string to instantiate from
 * @return instance of the specified class
 * @throws NoSuchMethodException
 * @throws IllegalAccessException
 * @throws InvocationTargetException
 */
@SuppressWarnings("unchecked")
private static <T> T castFromStr(Class<T> c, String s)
    throws NoSuchMethodException
        , IllegalAccessException
        , InvocationTargetException
{
    if (String.class == c)
        return (T) s;

    Method m = c.getMethod("valueOf", String.class);

    if (null == m)
    {
        throw new NoSuchMethodException
        (
            "Class " + c.getName()
                + " does not have the valueOf() method."
        );
    }

    return (T) m.invoke(null, s);
}
项目:HappyNewYear    文件:HNY.java   
@Override
 public void onCreate(Bundle savedInstanceState) {
     super.onCreate(savedInstanceState);

     this.setContentView(R.layout.main);
     this.rnd = new Random();
     this.handler = new Handler();
     this.sp = new SoundPool(16, AudioManager.STREAM_MUSIC, 0);
     this.sp.setOnLoadCompleteListener(this);

     try {
         this.buildSnd();
     } catch (IllegalAccessException e) {
         Log.e(HNY.TAG, "Oops: " + e.getMessage());
     }

     this.buildNumberPickers();
     this.buildVibesButtons();
     this.buildMainButton();
     this.buildInfoButton();
     this.setState(HNY.IDLE);
}
项目:HappyNewYear    文件:HNY.java   
private void buildSnd()
    throws IllegalAccessException {

    this.snd = new HashMap<String, Map<String, Integer>>();
    this.sndLoading = 0;

    for (Field f: R.raw.class.getFields()) {
        final String name = f.getName();
        final int split1 = name.indexOf('_') + 1;
        final int split2 = name.indexOf('_', split1);
        final String sndPx = name.substring(split1, split2);
        final String sndLabel = name.substring(split2 + 1);
        Map<String, Integer> sndList;

        if (!this.snd.containsKey(sndPx)) {
            sndList = new HashMap<String, Integer>();
            this.snd.put(sndPx, sndList);
        } else {
            sndList = this.snd.get(sndPx);
        }

        this.sndLoading++;
        sndList.put(sndLabel, this.sp.load(this, f.getInt(null), 1));
    }
}
项目:cacheonix-core    文件:Loader.java   
/**
  * Get the Thread Context Loader which is a JDK 1.2 feature. If we
  * are running under JDK 1.1 or anything else goes wrong the method
  * returns <code>null<code>.
  *
  *  */
private static ClassLoader getTCL() throws IllegalAccessException, 
  InvocationTargetException {

  // Are we running on a JDK 1.2 or later system?
  Method method = null;
  try {
    method = Thread.class.getMethod("getContextClassLoader", null);
  } catch (NoSuchMethodException e) {
    // We are running on JDK 1.1
    return null;
  }

  return (ClassLoader) method.invoke(Thread.currentThread(), null);
}
项目:internet_of_things_simulator    文件:TEnumHelper.java   
/**
 * Given a TEnum class and integer value, this method will return
 * the associated constant from the given TEnum class.
 * This method MUST be modified should the name of the 'findByValue' method
 * change.
 *
 * @param enumClass TEnum from which to return a matching constant.
 * @param value Value for which to return the constant.
 *
 * @return The constant in 'enumClass' whose value is 'value' or null if
 *         something went wrong.
 */
public static TEnum getByValue(Class<? extends TEnum> enumClass, int value) {
  try {
    Method method = enumClass.getMethod("findByValue", int.class);
    return (TEnum) method.invoke(null, value);
  } catch (NoSuchMethodException nsme) {
    return null;
  } catch (IllegalAccessException iae) {
    return null;
  } catch (InvocationTargetException ite) {
    return null;
  }
}
项目:nabs    文件:Loader.java   
/**
  * Get the Thread Context Loader which is a JDK 1.2 feature. If we
  * are running under JDK 1.1 or anything else goes wrong the method
  * returns <code>null<code>.
  *
  *  */
private static ClassLoader getTCL() throws IllegalAccessException, 
  InvocationTargetException {

  // Are we running on a JDK 1.2 or later system?
  Method method = null;
  try {
    method = Thread.class.getMethod("getContextClassLoader", null);
  } catch (NoSuchMethodException e) {
    // We are running on JDK 1.1
    return null;
  }

  return (ClassLoader) method.invoke(Thread.currentThread(), null);
}
项目: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 IllegalAccessException("IllegalAccessException");
    }
    catch (IllegalAccessException e) {
        // correct exception was caught
        caught = true;
    }
    harness.check(caught);
}
项目:sve    文件:JavaInterface.java   
protected SveValue sve_callMethod(Object o, Method m, SveValue[] arg0) throws SveVariableNotFoundException, SveRuntimeException {
    try {

        if (m == null) return new SveValue(Type.NIL);

        Object[] args = new Object[m.getParameterTypes().length];
        if (arg0.length != args.length) return new SveValue(Type.NIL);

        for (int i = 0; i < args.length; i++) {
            Class<?> t = m.getParameterTypes()[i];
            args[i] = sve_CreateJavaObject(arg0[i], t);
        }

        Class<?> r = m.getReturnType();
        if (r.getName().equals(int.class.getName())) return new SveValue((int) m.invoke(o, args));
        if (r.getName().equals(long.class.getName())) return new SveValue((long) m.invoke(o, args));
        if (r.getName().equals(boolean.class.getName())) return new SveValue((boolean) m.invoke(o, args));
        if (r.getName().equals(double.class.getName())) return new SveValue((double) m.invoke(o, args));
        if (r.getName().equals(short.class.getName())) return new SveValue((short) m.invoke(o, args));
        if (r.getName().equals(float.class.getName())) return new SveValue((float) m.invoke(o, args));
        if (r.getName().equals(String.class.getName())) return new SveValue((String) m.invoke(o, args));

        return sve_GetFromJavaObject(m.invoke(o, args));
    } catch (IllegalAccessException | IllegalArgumentException
            | InvocationTargetException e) {
        e.printStackTrace();
        throw new SveRuntimeException(0, ExceptionType.OTHER, e.toString());
    }
}
项目:sve    文件:JavaInterface.java   
protected SveValue sve_GetConstructor(final Object o, final Constructor<?> m) {
    SveValue method = new SveValue(Type.FUNCTION_JAVA);
    method.method = new SveApiFunction() {

        @Override
        public SveValue call(SveValue[] arg0) throws SveRuntimeException {
            try {

                Object[] args = new Object[m.getParameterTypes().length];
                if (arg0.length != args.length) return new SveValue(Type.NIL);

                for (int i = 0; i < args.length; i++) {
                    Class<?> t = m.getParameterTypes()[i];
                    args[i] = sve_CreateJavaObject(arg0[i], t);
                }

                return sve_GetFromJavaObject(m.newInstance(args));
            } catch (IllegalAccessException | IllegalArgumentException
                    | InvocationTargetException | InstantiationException e) {
                e.printStackTrace();
                throw new SveRuntimeException(0, ExceptionType.OTHER, e.toString());
            }
        }
    };
    method.table.setLocalVar("@fullname", new SveValue(m.toString()));
    return method;
}
项目:incubator-blur    文件:TEnumHelper.java   
/**
 * Given a TEnum class and integer value, this method will return
 * the associated constant from the given TEnum class.
 * This method MUST be modified should the name of the 'findByValue' method
 * change.
 *
 * @param enumClass TEnum from which to return a matching constant.
 * @param value Value for which to return the constant.
 *
 * @return The constant in 'enumClass' whose value is 'value' or null if
 *         something went wrong.
 */
public static TEnum getByValue(Class<? extends TEnum> enumClass, int value) {
  try {
    Method method = enumClass.getMethod("findByValue", int.class);
    return (TEnum) method.invoke(null, value);
  } catch (NoSuchMethodException nsme) {
    return null;
  } catch (IllegalAccessException iae) {
    return null;
  } catch (InvocationTargetException ite) {
    return null;
  }
}
项目:galaxy-sdk-java    文件:TEnumHelper.java   
/**
 * Given a TEnum class and integer value, this method will return
 * the associated constant from the given TEnum class.
 * This method MUST be modified should the name of the 'findByValue' method
 * change.
 *
 * @param enumClass TEnum from which to return a matching constant.
 * @param value Value for which to return the constant.
 *
 * @return The constant in 'enumClass' whose value is 'value' or null if
 *         something went wrong.
 */
public static TEnum getByValue(Class<? extends TEnum> enumClass, int value) {
  try {
    Method method = enumClass.getMethod("findByValue", int.class);
    return (TEnum) method.invoke(null, value);
  } catch (NoSuchMethodException nsme) {
    return null;
  } catch (IllegalAccessException iae) {
    return null;
  } catch (InvocationTargetException ite) {
    return null;
  }
}
项目:CadalWorkspace    文件:TEnumHelper.java   
/**
 * Given a TEnum class and integer value, this method will return
 * the associated constant from the given TEnum class.
 * This method MUST be modified should the name of the 'findByValue' method
 * change.
 *
 * @param enumClass TEnum from which to return a matching constant.
 * @param value Value for which to return the constant.
 *
 * @return The constant in 'enumClass' whose value is 'value' or null if
 *         something went wrong.
 */
public static TEnum getByValue(Class<? extends TEnum> enumClass, int value) {
  try {
    Method method = enumClass.getMethod("findByValue", int.class);
    return (TEnum) method.invoke(null, value);
  } catch (NoSuchMethodException nsme) {
    return null;
  } catch (IllegalAccessException iae) {
    return null;
  } catch (InvocationTargetException ite) {
    return null;
  }
}
项目:CadalWorkspace    文件:TEnumHelper.java   
/**
 * Given a TEnum class and integer value, this method will return
 * the associated constant from the given TEnum class.
 * This method MUST be modified should the name of the 'findByValue' method
 * change.
 *
 * @param enumClass TEnum from which to return a matching constant.
 * @param value Value for which to return the constant.
 *
 * @return The constant in 'enumClass' whose value is 'value' or null if
 *         something went wrong.
 */
public static TEnum getByValue(Class<? extends TEnum> enumClass, int value) {
  try {
    Method method = enumClass.getMethod("findByValue", int.class);
    return (TEnum) method.invoke(null, value);
  } catch (NoSuchMethodException nsme) {
    return null;
  } catch (IllegalAccessException iae) {
    return null;
  } catch (InvocationTargetException ite) {
    return null;
  }
}
项目:JCL    文件:CannotInvokeException.java   
/**
 * Constructs a CannotInvokeException with an IllegalAccessException.
 */
public CannotInvokeException(IllegalAccessException e) {
    super("by " + e.toString());
    err = e;
}
项目:intellij-ce-playground    文件:ReflectiveOperationException.java   
protected void thrower() throws ClassNotFoundException, NoSuchMethodException, IllegalAccessException {
    // TODO
}
项目: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( ) );
}
项目:scouter    文件:CannotInvokeException.java   
/**
 * Constructs a CannotInvokeException with an IllegalAccessException.
 */
public CannotInvokeException(IllegalAccessException e) {
    super("by " + e.toString());
    err = e;
}
项目:CustomEntitiesAPI    文件:CannotInvokeException.java   
/**
 * Constructs a CannotInvokeException with an IllegalAccessException.
 */
public CannotInvokeException(IllegalAccessException e) {
    super("by " + e.toString());
    err = e;
}
项目:CustomEntitiesAPI1.8    文件:CannotInvokeException.java   
/**
 * Constructs a CannotInvokeException with an IllegalAccessException.
 */
public CannotInvokeException(IllegalAccessException e) {
    super("by " + e.toString());
    err = e;
}
项目:proxyhotswap    文件:CannotInvokeException.java   
/**
 * Constructs a CannotInvokeException with an IllegalAccessException.
 */
public CannotInvokeException(IllegalAccessException e) {
    super("by " + e.toString());
    err = e;
}
项目:EndHQ-Libraries    文件:CannotInvokeException.java   
/**
 * Constructs a CannotInvokeException with an IllegalAccessException.
 */
public CannotInvokeException(IllegalAccessException e) {
    super("by " + e.toString());
    err = e;
}
项目:HotswapAgent    文件:CannotInvokeException.java   
/**
 * Constructs a CannotInvokeException with an IllegalAccessException.
 */
public CannotInvokeException(IllegalAccessException e) {
    super("by " + e.toString());
    err = e;
}
项目:align-api-project    文件:DBServiceImpl.java   
public DBServiceImpl() throws ClassNotFoundException, InstantiationException, IllegalAccessException {
Class.forName("com.mysql.jdbc.Driver").newInstance();
//Class.forName("org.postgresql.Driver").newInstance();
   }
项目:align-api-project    文件:DBServiceImpl.java   
public DBServiceImpl( String driver, String prefix, String DBPort ) throws ClassNotFoundException, InstantiationException, IllegalAccessException {
Class.forName(driver).newInstance();
driverPrefix = prefix;
port = DBPort;
   }
项目:org.openntf.domino    文件:CannotInvokeException.java   
/**
 * Constructs a CannotInvokeException with an IllegalAccessException.
 */
public CannotInvokeException(IllegalAccessException e) {
    super("by " + e.toString());
    err = e;
}
项目: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);
   }