List of usage examples for java.lang ClassNotFoundException printStackTrace
public void printStackTrace()
From source file:com.cnm.cnmrc.fragment.vodtvch.VodTvchMain.java
/** * ? ? ? fragment VodTvch ?? loadingDataForSidrebar()? * addToBackStack? ?. ? MainActivity onBackPressed()? back * key ?. ? VodTvch fragment addToBackStack ?? ?, * ?? Base back key . back key? ??... Base? * destoryView()? ? ?. !!!!!!! ? isFirstDepth true * . 4? ?(,?,TV,)?. vod (1st selectedCategory arg : * 2nd title arg) : (0:) / (1:?) / (2:TV) / (3:) */// ww w. j a v a 2s. c om private void loadingDataForSidrebar() { FragmentManager fm = getActivity().getSupportFragmentManager(); Log.i("hwang", "before vodTvch fragment count (no add to stack) --> " + Integer.toString(fm.getBackStackEntryCount())); FragmentTransaction ft = getActivity().getSupportFragmentManager().beginTransaction(); Class<?> classObject; try { String packageName = this.getClass().getPackage().getName() + "."; classObject = Class.forName(packageName + mClassTypeArray[selectedCategory]); // VodList, VodSemi, VodDetail, TvchList, TvchSemi, TvchDetail Object obj = classObject.newInstance(); // vod (1st arg : 2nd arg) : (0:) / (1:?) / (2:TV) / (3:) // tvch (1st arg : 2nd arg) : (0:?) / (1:?) / (2:HD?) / (3:?) // true : 1 depth (vod: VodSemi, VodSemi, VodSemi, VodList) // true : 1 depth (tvch: TvchSemi, TvchList, TvchSemi, TvchSemi) Bundle bundle = new Bundle(); bundle.putString("genreId", ""); // ? ... Base base = ((Base) obj).newInstance(selectedCategory, mCategoryArray[selectedCategory], true, bundle); // true depth ?.(,?,TV,)(?,?,HD?,) //ft.addToBackStack(null); // addTBackStack onBackPressed() ? ?... remove fragment onDestroyView() ?. // 2013-12-10 update vodsemi after config>adultcert change if (mClassTypeArray[selectedCategory].equals("VodSemi")) { ft.replace(R.id.loading_data_panel, base, "vod_semi_for_config"); } else { ft.replace(R.id.loading_data_panel, base); } ft.commit(); //fm.executePendingTransactions(); // fragment? ? pending recursive error, ?? pending . } catch (ClassNotFoundException e) { e.printStackTrace(); } catch (java.lang.InstantiationException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } Log.i("hwang", "after vodTvch fragment count (no add to stack) --> " + Integer.toString(fm.getBackStackEntryCount())); // ------------------------------------ // ? bottom menu? depth level // ------------------------------------ Fragment f = getActivity().getSupportFragmentManager().findFragmentById(R.id.fragment_rc_bottom_menu); if (f != null) ((RcBottomMenu) f).setDepthLevelClear(); // set 1 depth }
From source file:com.redhat.example.rules.unittest.CsvTestHelper.java
@SuppressWarnings("unchecked") private static <T> List<T> loadCsv(String fileName, Class<T> clazz, String[] fieldMapping, boolean ignoreNull, CellProcessor... processors) {//from w w w. j a v a 2 s . co m List<T> resultList = new ArrayList<T>(); // support of Immutable classes. java.lang.*, Date, BigDecimal, BigInteger if (Date.class.isAssignableFrom(clazz)) { CellProcessor p = null; for (int i = 0; i < fieldMapping.length; i++) { if (RuleFactWatcher.Constants.valueAttributeStr.equals(fieldMapping[i])) { p = processors[i]; } } CellProcessor dateProcessor = p; for (Map<String, Object> map : readCsvIntoMaps(fileName, true)) { T v = null; String strV = (String) map.get(RuleFactWatcher.Constants.valueAttributeStr); v = dateProcessor.execute(strV, null); resultList.add(v); } return resultList; } else if (Number.class.isAssignableFrom(clazz)) { for (Map<String, Object> map : readCsvIntoMaps(fileName, true)) { String strV = (String) map.get(RuleFactWatcher.Constants.valueAttributeStr); if (strV == null) { resultList.add(null); } else if (RuleFactWatcher.isImmutable(clazz)) { resultList.add((T) getImmutableObject(clazz, strV)); } } return resultList; } else if (clazz.equals(String.class)) { for (Map<String, Object> map : readCsvIntoMaps(fileName, true)) { String strV = (String) map.get(RuleFactWatcher.Constants.valueAttributeStr); resultList.add((T) strV); } return resultList; } else if (clazz == Object.class) { for (Map<String, Object> map : readCsvIntoMaps(fileName, true)) { String strV = (String) map.get(RuleFactWatcher.Constants.valueAttributeStr); String typeV = (String) map.get(RuleFactWatcher.Constants.typeAttributeStr); Class<?> clazzActual = null; try { clazzActual = (typeV != null) ? Class.forName(typeV) : null; } catch (ClassNotFoundException e) { e.printStackTrace(); } Object obj = getImmutableObject(clazzActual, strV); resultList.add((T) obj); } return resultList; } ICsvDozerBeanReader beanReader = null; try { Reader reader = new InputStreamReader(new FileInputStream(fileName), FILE_ENCODING); beanReader = new CsvDozerBeanReader(reader, CsvPreference.STANDARD_PREFERENCE); beanReader.getHeader(true); beanReader.configureBeanMapping(clazz, fieldMapping); T oneRecord; while ((oneRecord = beanReader.read(clazz, processors)) != null) { resultList.add(oneRecord); } } catch (Exception e) { e.printStackTrace(); fail("fail to load: " + fileName); } finally { IOUtils.closeQuietly(beanReader); } if (ignoreNull) { int i = 0; for (Map<String, Object> map : readCsvIntoMaps(fileName, false)) { try { T bean = clazz.newInstance(); T loadedBean = resultList.get(i); for (String key : map.keySet()) { Object value = map.get(key); if (value != null && key.indexOf("#") == -1) { setProperty(bean, key, RuleFactWatcher.getProperty(loadedBean, key)); } } resultList.set(i, bean); i++; } catch (Exception e) { e.printStackTrace(); fail("fail to newInstance() of class:" + clazz.getSimpleName()); } } } return resultList; }
From source file:com.nextgis.maplibui.service.TrackerService.java
private void initTargetIntent(String targetActivity) { Intent intentActivity = new Intent(); if (!TextUtils.isEmpty(targetActivity)) { Class<?> targetClass = null; try {/* w ww . jav a 2 s . com*/ targetClass = Class.forName(targetActivity); } catch (ClassNotFoundException e) { e.printStackTrace(); } if (targetClass != null) { intentActivity = new Intent(this, targetClass); } } intentActivity.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP); mOpenActivity = PendingIntent.getActivity(this, 0, intentActivity, PendingIntent.FLAG_UPDATE_CURRENT); }
From source file:edu.cornell.med.icb.goby.modes.TallyBasesMode.java
/** * Run the tally bases mode.//from ww w . j a va 2s .com * * @throws java.io.IOException error reading / writing */ @Override public void execute() throws IOException { if (basenames.length != 2) { System.err.println("Exactly two basenames are supported at this time."); System.exit(1); } final CountsArchiveReader[] archives = new CountsArchiveReader[basenames.length]; int i = 0; for (final String basename : basenames) { archives[i++] = new CountsArchiveReader(basename, alternativeCountArhive); } final CountsArchiveReader archiveA = archives[0]; final CountsArchiveReader archiveB = archives[1]; // keep only common reference sequences between the two input count archives. final ObjectSet<String> identifiers = new ObjectOpenHashSet<String>(); identifiers.addAll(archiveA.getIdentifiers()); identifiers.retainAll(archiveB.getIdentifiers()); // find the optimal offset A vs B: final int offset = offsetString.equals("auto") ? optimizeOffset(archiveA, archiveB, identifiers) : Integer.parseInt(offsetString); System.out.println("offset: " + offset); final RandomAccessSequenceCache cache = new RandomAccessSequenceCache(); if (cache.canLoad(genomeCacheFilename)) { try { cache.load(genomeCacheFilename); } catch (ClassNotFoundException e) { System.err.println("Cannot load cache from disk. Consider deleting the cache and rebuilding."); e.printStackTrace(); System.exit(1); } } else { Reader reader = null; try { if (genomeFilename.endsWith(".fa") || genomeFilename.endsWith(".fasta")) { reader = new FileReader(genomeFilename); cache.loadFasta(reader); } else if (genomeFilename.endsWith(".fa.gz") || genomeFilename.endsWith(".fasta.gz")) { reader = new InputStreamReader(new GZIPInputStream(new FileInputStream(genomeFilename))); cache.loadFasta(reader); } else { System.err.println("The format of the input file is not supported at this time."); System.exit(1); } } finally { IOUtils.closeQuietly(reader); } } System.out.println("Will use genome cache basename: " + genomeCacheFilename); cache.save(genomeCacheFilename); final Random random = new Random(new Date().getTime()); final double delta = cutoff; final int countThreshold = 30; final PrintStream output = new PrintStream(outputFilename); writeHeader(output, windowSize); for (final String referenceSequenceId : identifiers) { if (isReferenceIncluded(referenceSequenceId)) { final int referenceIndex = cache.getReferenceIndex(referenceSequenceId); if (referenceIndex != -1) { // sequence in cache. System.out.println("Processing sequence " + referenceSequenceId); final double sumA = getSumOfCounts(archiveA.getCountReader(referenceSequenceId)); final double sumB = getSumOfCounts(archiveB.getCountReader(referenceSequenceId)); final int referenceSize = cache.getSequenceSize(referenceIndex); // process this sequence: final AnyTransitionCountsIterator iterator = new AnyTransitionCountsIterator( archiveA.getCountReader(referenceSequenceId), new OffsetCountsReader(archiveB.getCountReader(referenceSequenceId), offset)); while (iterator.hasNextTransition()) { iterator.nextTransition(); final int position = iterator.getPosition(); final int countA = iterator.getCount(0); final int countB = iterator.getCount(1); if (countA + countB >= countThreshold) { final double foldChange = Math.log1p(countA) - Math.log1p(countB) - Math.log(sumA) + Math.log(sumB); if (foldChange >= delta || foldChange <= -delta) { if (random.nextDouble() < sampleRate) { tallyPosition(cache, referenceIndex, position, foldChange, windowSize, referenceSize, referenceSequenceId, output, countA, countB, sumA, sumB); } } } } iterator.close(); } } output.flush(); } output.close(); }
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 {//from ww w . j a v a 2 s .c om // 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:coral.reef.service.ReefCoralDAO.java
public ReefCoralDAO(String dbname, boolean setup, String dbmode, String dbprov, String dbdriver) { try {/*w w w. ja va2 s .c om*/ Class.forName(dbdriver); String dbconnectstr = "jdbc:" + dbprov + ":" + dbmode + ":" + dbname; logger.info("setup/connect to db: " + dbconnectstr); conn = DriverManager.getConnection(dbconnectstr, "sa", // username ""); if (!setup) { DatabaseMetaData meta = conn.getMetaData(); ResultSet res = meta.getTables(null, null, "DATAS", new String[] { "TABLE" }); setup = !res.next(); } if (!setup) { DatabaseMetaData meta = conn.getMetaData(); ResultSet res = meta.getTables(null, null, "STATES", new String[] { "TABLE" }); setup = !res.next(); } if (dbmode.equals("mem") || setup) { logger.info("SETUP DATABASE"); Statement stat = conn.createStatement(); // stat.execute("delete from datas;"); // stat.execute("delete from states;"); stat.execute("drop table if exists DATAS;"); stat.execute( "CREATE TABLE DATAS ( id BIGINT, collection VARCHAR(10), name VARCHAR(80), value VARCHAR(1024));"); stat.execute("CREATE INDEX IDATAS ON DATAS ( id, name );"); stat.execute("drop table if exists STATES;"); stat.execute( "CREATE TABLE STATES ( id BIGINT, collection VARCHAR(10), template VARCHAR(80), block INTEGER, round INTEGER, stage INTEGER, msg VARCHAR(1024));"); stat.execute("COMMIT"); conn.commit(); stat.close(); } } catch (ClassNotFoundException e) { e.printStackTrace(); } catch (SQLException e) { e.printStackTrace(); } }
From source file:com.wso2telco.core.dbutils.DbUtils.java
/** * Connect.// w ww . j a va 2 s. c o m * * @return the connection * @throws Exception * the exception */ public Connection connect() throws Exception { System.out.println("-------- JDBC Connection Init ------------"); Connection connection = null; try { Class.forName(driverClass); connection = DriverManager.getConnection(connectionUrl, connectionUsername, connectionPassword); } catch (ClassNotFoundException e) { System.out.println("JDBC Driver Error"); e.printStackTrace(); return null; } catch (SQLException e) { System.out.println("Connection Failed! Check output console"); e.printStackTrace(); return null; } connection.setAutoCommit(false); return connection; }
From source file:de.tud.kom.p2psim.impl.skynet.visualization.SkyNetVisualization.java
private void createLookAndFeel() { LookAndFeelInfo[] lfs = UIManager.getInstalledLookAndFeels(); boolean hasNimbus = false; boolean hasWindows = false; for (int i = 0; i < lfs.length; i++) { if (lfs[i].getClassName().equals("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel")) { hasNimbus = true;// w w w .j a va 2 s . c om } else if (lfs[i].getClassName().equals("com.sun.java.swing.plaf.windows.WindowsLookAndFeel")) { hasWindows = true; } } String lafName = null; if (hasNimbus) { lafName = "com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel"; } else if (hasWindows) { lafName = "com.sun.java.swing.plaf.windows.WindowsLookAndFeel"; } else { lafName = "javax.swing.plaf.metal.MetalLookAndFeel"; } try { UIManager.setLookAndFeel(lafName); } catch (ClassNotFoundException e) { e.printStackTrace(); } catch (InstantiationException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (UnsupportedLookAndFeelException e) { e.printStackTrace(); } }
From source file:edu.cornell.med.icb.goby.modes.EmpiricalPMode.java
@Override public AbstractCommandLineMode configure(String[] args) throws IOException, JSAPException { final JSAPResult jsapResult = parseJsapArguments(args); inputFilename = jsapResult.getString("input"); label = jsapResult.getString("label"); outputFilename = jsapResult.getString("output"); statisticName = jsapResult.getString("statistic"); forceEstimation = jsapResult.getBoolean("force-estimation"); //fdr = jsapResult.getBoolean("fdr"); testN = jsapResult.getInt("test-n", Integer.MAX_VALUE); {/* w w w .ja v a 2 s . c o m*/ densityFilename = jsapResult.getString("density-filename"); if (densityFilename != null) { if (new File(densityFilename).exists()) { try { // if we are given a serialized statistic, we override the stat name with that of the actual // statistic used to estimate the density: density = EstimatedDistribution.load(densityFilename); //testDensities = EstimatedTestDistributions.load(EmpiricalPValueEstimator.suggestFilename(densityFilename)); statisticName = density.getStatAdaptor().statName(); /* assert density.getStatAdaptor().statName().equals(testDensities.getStatAdaptor().statName()) : "null and test distributions must be estimated with the same statistic"; */ } catch (ClassNotFoundException e) { e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates. System.exit(1); } useExistingDensity = true; // force loading of the pre-existing density and estimation of p-values: doc.acceptsOption("EmpiricalPMode:serialized-estimator-filename=" + densityFilename); if (forceEstimation) { doc.acceptsOption("EmpiricalPMode:estimate-empirical-P=true"); doc.acceptsOption("EmpiricalPMode:estimate-intra-group-differences=false"); } else { doc.acceptsOption("EmpiricalPMode:estimate-empirical-P=false"); doc.acceptsOption("EmpiricalPMode:estimate-intra-group-differences=true"); } } } } if (statisticName != null) { boolean result = doc.acceptsOption("EmpiricalPMode:statistic=" + statisticName); assert result : "EmpiricalPMode:statistic= definition must be accepted."; } return this; }
From source file:me.piebridge.android.preference.PreferenceFragment.java
@Override public void onStop() { super.onStop(); // FIXME: mPreferenceManager.dispatchActivityStop(); callVoidMethod(mPreferenceManager, "dispatchActivityStop", null, null); // FIXME: mPreferenceManager.setOnPreferenceTreeClickListener(null); try {//from w w w.j a v a 2s . c om Class<?> clazz = Class.forName("android.preference.PreferenceManager$OnPreferenceTreeClickListener"); callVoidMethod(mPreferenceManager, "setOnPreferenceTreeClickListener", new Class[] { clazz }, new Object[] { null }); } catch (ClassNotFoundException e) { e.printStackTrace(); } }