Example usage for java.lang IllegalAccessException printStackTrace

List of usage examples for java.lang IllegalAccessException printStackTrace

Introduction

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

Prototype

public void printStackTrace() 

Source Link

Document

Prints this throwable and its backtrace to the standard error stream.

Usage

From source file:com.wit.android.support.fragment.manage.BaseFragmentFactory.java

/**
 * Processes all annotated fields marked with {@link com.wit.android.support.fragment.annotation.FactoryFragment @FactoryFragment}
 * annotation and puts them into the given <var>items</var> array.
 *
 * @param classOfFactory Class of this fragment factory.
 * @param items          Initial array of fragment items.
 *///from w  w  w  .  j a  va 2 s.c om
@SuppressWarnings("unchecked")
private void processAnnotatedFragments(final Class<?> classOfFactory, final SparseArray<FragmentItem> items) {
    FragmentAnnotations.iterateFields(classOfFactory, new FragmentAnnotations.FieldProcessor() {

        /**
         */
        @Override
        public void onProcessField(@NonNull Field field, @NonNull String name) {
            if (field.isAnnotationPresent(FactoryFragment.class) && int.class.equals(field.getType())) {
                final FactoryFragment factoryFragment = field.getAnnotation(FactoryFragment.class);
                try {
                    final int id = (int) field.get(BaseFragmentFactory.this);
                    items.put(id, new FragmentItem(id, TextUtils.isEmpty(factoryFragment.taggedName())
                            ? getFragmentTag(id)
                            : createFragmentTag(
                                    (Class<? extends FragmentController.FragmentFactory>) classOfFactory,
                                    factoryFragment.taggedName()),
                            factoryFragment.type()));
                } catch (IllegalAccessException e) {
                    e.printStackTrace();
                }
            }
        }
    });
}

From source file:com.mtbs3d.minecrift.provider.MCController.java

public void setCreated(boolean created) {
    setupControllerCreated();/*from w w w  . j a  va2  s  .c o m*/
    if (fieldCreated != null) {
        try {
            fieldCreated.set(null, (Object) created);
        } catch (IllegalAccessException e) {
            e.printStackTrace();
        }
    }
}

From source file:chibi.gemmaanalysis.cli.deprecated.ProbeMapperCli.java

/**
 * @param blatResultInputStream/* w  w w.  jav  a2  s  .  co m*/
 * @param output
 * @return
 * @throws IOException
 * @throws SQLException
 * @throws InstantiationException
 * @throws IllegalAccessException
 * @throws ClassNotFoundException
 */
public Map<String, Collection<BlatAssociation>> runOnBlatResults(InputStream blatResultInputStream,
        Writer output) throws IOException, SQLException {

    GoldenPathSequenceAnalysis goldenPathAnalysis = new GoldenPathSequenceAnalysis(this.databaseName);

    BlatResultParser brp = new BlatResultParser();
    brp.parse(blatResultInputStream);

    writeHeader(output);

    Collection<BlatResult> blatResults = brp.getResults();

    // Fill in the taxon.
    assert this.taxon != null;
    for (BlatResult blatResult : blatResults) {
        blatResult.getQuerySequence().setTaxon(taxon);
        try {
            FieldUtils.writeField(blatResult.getTargetChromosome(), "taxon", taxon, true);
            FieldUtils.writeField(blatResult.getTargetAlignedRegion().getChromosome(), "taxon", taxon, true);
        } catch (IllegalAccessException e) {
            e.printStackTrace();
        }
    }

    Map<String, Collection<BlatAssociation>> allRes = probeMapper.processBlatResults(goldenPathAnalysis,
            blatResults, this.config);

    printBlatAssociations(output, allRes);

    blatResultInputStream.close();
    output.close();
    return allRes;
}

From source file:org.jbuilt.utils.ValueClosure.java

@Override
public boolean equals(Object other) {

    if (other == this) {
        return true;
    }// w ww  . ja v a2 s  .c o  m

    if (other instanceof ValueExpression) {
        ValueExpression otherVE = (ValueExpression) other;
        Class type = null;
        try {
            type = PropertyUtils.getPropertyType(this.bean, this.prop);
        } catch (IllegalAccessException e) {
            e.printStackTrace();
        } catch (InvocationTargetException e) {
            e.printStackTrace();
        } catch (NoSuchMethodException e) {
            e.printStackTrace();
        }
        if (type != null) {
            return type.equals(otherVE.getType(context.getELContext()));
        }
    }
    return false;
}

From source file:fr.inria.atlanmod.neoemf.graph.blueprints.datastore.BlueprintsPersistenceBackendFactory.java

@Override
public BlueprintsPersistenceBackend createPersistentBackend(File file, Map<?, ?> options)
        throws InvalidDataStoreException {
    BlueprintsPersistenceBackend graphDB = null;
    PropertiesConfiguration neoConfig = null;
    PropertiesConfiguration configuration = null;
    try {//www.  j  a v a 2  s . com
        // Try to load previous configurations
        Path path = Paths.get(file.getAbsolutePath()).resolve(CONFIG_FILE);
        try {
            configuration = new PropertiesConfiguration(path.toFile());
        } catch (ConfigurationException e) {
            throw new InvalidDataStoreException(e);
        }
        // Initialize value if the config file has just been created
        if (!configuration.containsKey(BlueprintsResourceOptions.OPTIONS_BLUEPRINTS_GRAPH_TYPE)) {
            configuration.setProperty(BlueprintsResourceOptions.OPTIONS_BLUEPRINTS_GRAPH_TYPE,
                    BlueprintsResourceOptions.OPTIONS_BLUEPRINTS_GRAPH_TYPE_DEFAULT);
        } else if (options.containsKey(BlueprintsResourceOptions.OPTIONS_BLUEPRINTS_GRAPH_TYPE)) {
            // The file already existed, check that the issued options
            // are not conflictive
            String savedGraphType = configuration
                    .getString(BlueprintsResourceOptions.OPTIONS_BLUEPRINTS_GRAPH_TYPE);
            String issuedGraphType = options.get(BlueprintsResourceOptions.OPTIONS_BLUEPRINTS_GRAPH_TYPE)
                    .toString();
            if (!savedGraphType.equals(issuedGraphType)) {
                NeoLogger.log(NeoLogger.SEVERITY_ERROR, "Unable to create graph as type " + issuedGraphType
                        + ", expected graph type was " + savedGraphType + ")");
                throw new InvalidDataStoreException("Unable to create graph as type " + issuedGraphType
                        + ", expected graph type was " + savedGraphType + ")");
            }
        }

        // Copy the options to the configuration
        for (Entry<?, ?> e : options.entrySet()) {
            configuration.setProperty(e.getKey().toString(), e.getValue().toString());
        }

        // Check we have a valid graph type, it is needed to get the
        // graph name
        String graphType = configuration.getString(BlueprintsResourceOptions.OPTIONS_BLUEPRINTS_GRAPH_TYPE);
        if (graphType == null) {
            throw new InvalidDataStoreException("Graph type is undefined for " + file.getAbsolutePath());
        }

        String[] segments = graphType.split("\\.");
        if (segments.length >= 2) {
            String graphName = segments[segments.length - 2];
            String upperCaseGraphName = Character.toUpperCase(graphName.charAt(0)) + graphName.substring(1);
            String configClassQualifiedName = MessageFormat.format(
                    "fr.inria.atlanmod.neoemf.graph.blueprints.{0}.config.Blueprints{1}Config", graphName,
                    upperCaseGraphName);
            try {
                ClassLoader classLoader = BlueprintsPersistenceBackendFactory.class.getClassLoader();
                Class<?> configClass = classLoader.loadClass(configClassQualifiedName);
                Field configClassInstanceField = configClass.getField("eINSTANCE");
                AbstractBlueprintsConfig configClassInstance = (AbstractBlueprintsConfig) configClassInstanceField
                        .get(configClass);
                Method configMethod = configClass.getMethod("putDefaultConfiguration", Configuration.class,
                        File.class);
                configMethod.invoke(configClassInstance, configuration, file);
                Method setGlobalSettingsMethod = configClass.getMethod("setGlobalSettings");
                setGlobalSettingsMethod.invoke(configClassInstance);
            } catch (ClassNotFoundException e1) {
                NeoLogger.log(NeoLogger.SEVERITY_WARNING,
                        "Unable to find the configuration class " + configClassQualifiedName);
                e1.printStackTrace();
            } catch (NoSuchFieldException e2) {
                NeoLogger.log(NeoLogger.SEVERITY_WARNING,
                        MessageFormat.format(
                                "Unable to find the static field eINSTANCE in class Blueprints{0}Config",
                                upperCaseGraphName));
                e2.printStackTrace();
            } catch (NoSuchMethodException e3) {
                NeoLogger.log(NeoLogger.SEVERITY_ERROR,
                        MessageFormat.format(
                                "Unable to find configuration methods in class Blueprints{0}Config",
                                upperCaseGraphName));
                e3.printStackTrace();
            } catch (InvocationTargetException e4) {
                NeoLogger.log(NeoLogger.SEVERITY_ERROR, MessageFormat.format(
                        "An error occured during the exection of a configuration method", upperCaseGraphName));
                e4.printStackTrace();
            } catch (IllegalAccessException e5) {
                NeoLogger.log(NeoLogger.SEVERITY_ERROR, MessageFormat.format(
                        "An error occured during the exection of a configuration method", upperCaseGraphName));
                e5.printStackTrace();
            }
        } else {
            NeoLogger.log(NeoLogger.SEVERITY_WARNING, "Unable to compute graph type name from " + graphType);
        }

        Graph baseGraph = null;
        try {
            baseGraph = GraphFactory.open(configuration);
        } catch (RuntimeException e) {
            throw new InvalidDataStoreException(e);
        }
        if (baseGraph instanceof KeyIndexableGraph) {
            graphDB = new BlueprintsPersistenceBackend((KeyIndexableGraph) baseGraph);
        } else {
            NeoLogger.log(NeoLogger.SEVERITY_ERROR,
                    "Graph type " + file.getAbsolutePath() + " does not support Key Indices");
            throw new InvalidDataStoreException(
                    "Graph type " + file.getAbsolutePath() + " does not support Key Indices");
        }
        // Save the neoconfig file
        Path neoConfigPath = Paths.get(file.getAbsolutePath()).resolve(NEO_CONFIG_FILE);
        try {
            neoConfig = new PropertiesConfiguration(neoConfigPath.toFile());
        } catch (ConfigurationException e) {
            throw new InvalidDataStoreException(e);
        }
        if (!neoConfig.containsKey(BACKEND_PROPERTY)) {
            neoConfig.setProperty(BACKEND_PROPERTY, BLUEPRINTS_BACKEND);
        }
    } finally {
        if (configuration != null) {
            try {
                configuration.save();
            } catch (ConfigurationException e) {
                // Unable to save configuration, supposedly it's a minor error,
                // so we log it without rising an exception
                NeoLogger.log(NeoLogger.SEVERITY_ERROR, e);
            }
        }
        if (neoConfig != null) {
            try {
                neoConfig.save();
            } catch (ConfigurationException e) {
                NeoLogger.log(NeoLogger.SEVERITY_ERROR, e);
            }
        }
    }
    return graphDB;
}

From source file:com.appeaser.sublimepickerlibrary.datepicker.DayPickerViewPager.java

private void callPopulate() {
    if (!mAlreadyTriedAccessingMethod) {
        initializePopulateMethod();//w  w  w  .  j a v  a2 s.c o  m
    }

    if (mPopulateMethod != null) {
        // Multi-catch block cannot be used before API 19
        //noinspection TryWithIdenticalCatches
        try {
            mPopulateMethod.invoke(this);
        } catch (IllegalAccessException e) {
            e.printStackTrace();
        } catch (InvocationTargetException e) {
            e.printStackTrace();
        }
    } else {
        Log.e(TAG, "Could not call `ViewPager.populate()`");
    }
}

From source file:com.dotweblabs.twirl.gae.GaeUnmarshaller.java

private void setFieldValue(Field field, Object instance, Object value) {
    boolean accessible = field.isAccessible();
    Class<?> clazz = field.getType();
    try {//from w  w w .  ja  va  2  s  .  c  om
        if ((field.getModifiers() & java.lang.reflect.Modifier.FINAL) == java.lang.reflect.Modifier.FINAL) {
            // do nothing for a final field
            // usually static UID fields
        } else {
            if (field.getType().isPrimitive() && value == null) {
                Object defaultValue = PrimitiveDefaults.getDefaultValue(clazz);
                field.setAccessible(true);
                field.set(instance, defaultValue);
                field.setAccessible(accessible);
            } else {
                field.setAccessible(true);
                field.set(instance, value);
                field.setAccessible(accessible);
            }
        }
    } catch (IllegalAccessException e) {
        e.printStackTrace();
    }
}

From source file:com.redhat.rhn.frontend.dto.SystemSearchResult.java

/**
 * This method will look up the value of "matchingField" it will then
 * return the value of the variable name which matches it.
 * NOTE:  This method requires that the result has been elaborated, or else data
 * is potentially missing.  As an alternate you can use "getMatchingFieldValue" to
 * use the data returned from search server.
 * @return String of the matching field value
 *///from  ww  w .j av  a2 s .  c om
public String getLookupMatchingField() {
    String value = "";
    String field = getMatchingField();
    log.info("Will look up field <" + field + "> to determine why" + " this matched");
    try {
        if ((field != null) && (!StringUtils.isBlank(field))) {
            value = BeanUtils.getProperty(this, field);
            log.info("SystemSearchResult.Id = " + getId() + " BeanUtils.getProperty(sr, " + field + ") = "
                    + value);
        } else {
            log.info("SystemSearchResult.ID = " + getId() + " matchingField was null or blank");
        }
    } catch (IllegalAccessException e) {
        e.printStackTrace();
        // ignore
    } catch (NoSuchMethodException e) {
        log.info("SystemSearchResult.lookupMatchingField() " + "NoSuchMethodException caught looking up: "
                + field + ", for system id = " + getId() + ">");
    } catch (InvocationTargetException e) {
        e.printStackTrace();
        // ignore
    }
    return value;
}

From source file:eionet.eunis.stripes.actions.CountryFactsheetActionBean.java

/**
 * Populates from request parameters the statistics bean that will be used as helper for various operations.
 *///from w  w  w. j  a  va2 s.  c  o m
private void populateStatisticsBean() {

    try {
        Map map = new HashMap();
        map.putAll(getContext().getRequest().getParameterMap());
        map.put("country", country.getAreaNameEnglish());

        putIfNotExists(map, "yearMin", "null");
        putIfNotExists(map, "yearMax", "null");
        putIfNotExists(map, "designationCat", "null");
        putIfNotExists(map, "designation", "null");
        putIfNotExists(map, "DB_NATURA2000", "null");
        putIfNotExists(map, "DB_CORINE", "null");
        putIfNotExists(map, "DB_DIPLOMA", "null");
        putIfNotExists(map, "DB_CDDA_NATIONAL", "null");
        putIfNotExists(map, "DB_BIOGENETIC", "null");
        putIfNotExists(map, "DB_EMERALD", "null");
        putIfNotExists(map, "DB_CDDA_INTERNATIONAL", "null");

        BeanUtils.populate(statisticsBean, map);

    } catch (IllegalAccessException e) {
        e.printStackTrace();
    } catch (InvocationTargetException e) {
        e.printStackTrace();
    }
}

From source file:org.Microsoft.Telemetry.IntermediateHistoryStore.java

@Override
protected void serviceInit(Configuration conf) throws Exception {

    try {//www  . ja  v  a  2s .c  om

        //Method m = originalStorage.getClass().getDeclaredMethod("serviceInit", Configuration.class);
        Method m = originalStorage.getClass().getMethod("serviceInit", Configuration.class);
        m.setAccessible(true);
        m.invoke(originalStorage, (Object) conf);

    } catch (NoSuchMethodException noSuchMethodException) {

        LOG.error(PATTERN_LOG_ERROR + "no Such Method Exception :", noSuchMethodException);
        noSuchMethodException.printStackTrace();

    } catch (SecurityException securityException) {

        LOG.error(PATTERN_LOG_ERROR + "Security Exception :", securityException);
        securityException.printStackTrace();

    } catch (IllegalAccessException illegalAccessException) {

        LOG.error(PATTERN_LOG_ERROR + "Illegal Access Exception :", illegalAccessException);
        illegalAccessException.printStackTrace();

    } catch (IllegalArgumentException illegalArgumentException) {

        LOG.error(PATTERN_LOG_ERROR + "Illegal Argument Exception :", illegalArgumentException);
        illegalArgumentException.printStackTrace();

    } catch (InvocationTargetException invocationTargetException) {

        Throwable cause = invocationTargetException.getCause();
        LOG.error(PATTERN_LOG_ERROR + "Invocation Target Exception failed because of:" + cause.getMessage(),
                invocationTargetException);
        invocationTargetException.printStackTrace();

    }
}