List of usage examples for java.lang ClassNotFoundException printStackTrace
public void printStackTrace()
From source file:Connexion.Charts.java
public Charts() { try {//from ww w . jav a2s. c om Class.forName("com.mysql.jdbc.Driver"); } catch (ClassNotFoundException e) { /* Grer les ventuelles erreurs ici. */ } int a = 0; int b = 0; int c = 0; try { ResultSet resultat1 = this.connect .createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE) .executeQuery("SELECT code_service FROM hospitalisation WHERE code_service = 'REA'"); // on rcupre le nombre de lignes de la requte if (resultat1.last()) { a = resultat1.getRow(); } System.out.println(a); } catch (SQLException e) { e.printStackTrace(); } try { ResultSet resultat2 = this.connect .createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE) .executeQuery("SELECT code_service FROM hospitalisation WHERE code_service = 'CHG'"); // on rcupre le nombre de lignes de la requte if (resultat2.last()) { b = resultat2.getRow(); } System.out.println(b); } catch (SQLException e) { e.printStackTrace(); } try { ResultSet resultat3 = this.connect .createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE) .executeQuery("SELECT code_service FROM hospitalisation WHERE code_service = 'CAR'"); // on rcupre le nombre de lignes de la requte if (resultat3.last()) { c = resultat3.getRow(); } } catch (SQLException e) { e.printStackTrace(); } DefaultPieDataset union = new DefaultPieDataset(); //remplir l'ensemble union.setValue("REA", a); union.setValue("CAR", b); union.setValue("CHG", c); JFreeChart repart = ChartFactory.createPieChart3D("Nombre d'hospitalisation par service", union, true, true, false); ChartPanel crepart = new ChartPanel(repart); this.add(crepart); this.pack(); this.setVisible(true); }
From source file:fr.pasteque.pos.ticket.TicketInfo.java
/** Deserialize as shared ticket */ public TicketInfo(byte[] data) throws IOException { ByteArrayInputStream bis = new ByteArrayInputStream(data); ObjectInputStream in = new ObjectInputStream(bis); try {/*from ww w .j av a 2 s .c o m*/ m_sId = (String) in.readObject(); tickettype = in.readInt(); m_iTicketId = in.readInt(); m_Customer = (CustomerInfoExt) in.readObject(); m_dDate = (Date) in.readObject(); attributes = (Properties) in.readObject(); m_aLines = (List<TicketLineInfo>) in.readObject(); this.customersCount = (Integer) in.readObject(); this.tariffAreaId = (Integer) in.readObject(); this.discountProfileId = (Integer) in.readObject(); this.discountRate = in.readDouble(); } catch (ClassNotFoundException cnfe) { // Should never happen cnfe.printStackTrace(); } in.close(); m_User = null; m_sActiveCash = null; payments = new ArrayList<PaymentInfo>(); taxes = null; }
From source file:it.appify.generator.WebAppGenerator.java
protected MethodSpec initializeServices(TypeOracle typeOracle) { Builder initializeServiceBuilder = MethodSpec.methodBuilder("initializeServices") .addModifiers(Modifier.PUBLIC, Modifier.FINAL).addAnnotation(Override.class); JClassType[] types = typeOracle.getTypes(); for (JClassType jClassType : types) { Service serviceAnnotation = jClassType.findAnnotationInTypeHierarchy(Service.class); if (serviceAnnotation == null) { continue; }/*from w ww .j a va 2 s. c o m*/ try { Class<?> serviceClass = Class .forName(jClassType.getPackage().getName() + "." + jClassType.getSimpleSourceName()); initializeServiceBuilder.addStatement( "final $T service" + jClassType.getSimpleSourceName() + " = new $T(this)", serviceClass, serviceClass); JMethod[] methods = jClassType.getMethods(); JMethod startMethod = null; JMethod stopMethod = null; for (JMethod jMethod : methods) { Start startAnnotation = jMethod.getAnnotation(Start.class); Stop stopAnnotation = jMethod.getAnnotation(Stop.class); if (startAnnotation != null) { startMethod = jMethod; } if (stopAnnotation != null) { stopMethod = jMethod; } } String startMethodName = startMethod != null ? startMethod.getName() : null; String stopMethoName = stopMethod != null ? stopMethod.getName() : null; TypeSpec serviceHandler = createServiceLifeCycleHandlers( "service" + jClassType.getSimpleSourceName(), serviceAnnotation.name(), startMethodName, stopMethoName); initializeServiceBuilder.addStatement("bindService($L)", serviceHandler); } catch (ClassNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } } return initializeServiceBuilder.build(); }
From source file:org.apache.horn.core.LayeredNeuralNetwork.java
@Override public void readFields(DataInput input) throws IOException { super.readFields(input); this.finalLayerIdx = input.readInt(); this.dropRate = input.readFloat(); // read neuron classes int neuronClasses = input.readInt(); this.neuronClassList = Lists.newArrayList(); for (int i = 0; i < neuronClasses; ++i) { try {/*from w w w . j a v a 2 s .c om*/ Class<? extends Neuron> clazz = (Class<? extends Neuron>) Class.forName(input.readUTF()); neuronClassList.add(clazz); } catch (ClassNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } } // read squash functions int squashingFunctionSize = input.readInt(); this.squashingFunctionList = Lists.newArrayList(); for (int i = 0; i < squashingFunctionSize; ++i) { this.squashingFunctionList.add(FunctionFactory.createFloatFunction(WritableUtils.readString(input))); } // read weights and construct matrices of previous updates int numOfMatrices = input.readInt(); this.weightMatrixList = Lists.newArrayList(); this.prevWeightUpdatesList = Lists.newArrayList(); for (int i = 0; i < numOfMatrices; ++i) { FloatMatrix matrix = FloatMatrixWritable.read(input); this.weightMatrixList.add(matrix); this.prevWeightUpdatesList.add(new DenseFloatMatrix(matrix.getRowCount(), matrix.getColumnCount())); } }
From source file:net.cloudpath.xpressconnect.screens.GetCredentials.java
public int isConnectionFound() { List localList = ((WifiManager) getSystemService("wifi")).getConfiguredNetworks(); if (localList == null) { Util.log(this.mLogger, "No networks in the network list. (So the network isn't found.)"); return -1; }/*w w w . j a v a 2 s . c o m*/ if (this.mParser == null) { Util.log(this.mLogger, "Parser isn't bound in isConnectionFound()!"); return -2; } if (this.mParser.selectedProfile == null) { Util.log(this.mLogger, "No profile is selected in isConnectionFound()!"); return -2; } if (this.mFailure == null) { Util.log(this.mLogger, "Failure class is null in isConnectionFound()!"); return -2; } Util.log(this.mLogger, "Your device currently has " + localList.size() + " wireless network(s) configured."); int i = 0; if (i < localList.size()) { WifiConfigurationProxy localWifiConfigurationProxy; SettingElement localSettingElement; try { localWifiConfigurationProxy = new WifiConfigurationProxy((WifiConfiguration) localList.get(i), this.mLogger); localSettingElement = this.mParser.selectedProfile.getSetting(1, 40001); if (localSettingElement == null) { Util.log(this.mLogger, "Unable to locate the SSID element!"); this.mFailure.setFailReason(FailureReason.useErrorIcon, getResources() .getString(this.mParcelHelper.getIdentifier("xpc_no_ssid_defined", "string")), 6); return -2; } } catch (IllegalArgumentException localIllegalArgumentException) { Util.log(this.mLogger, "IllegalArgumentException in isConnectionFound()!"); localIllegalArgumentException.printStackTrace(); return -2; } catch (NoSuchFieldException localNoSuchFieldException) { Util.log(this.mLogger, "NoSuchFieldException in isConnectionFound()!"); localNoSuchFieldException.printStackTrace(); return -2; } catch (ClassNotFoundException localClassNotFoundException) { Util.log(this.mLogger, "ClassNotFoundException in isConnectionFound()!"); localClassNotFoundException.printStackTrace(); return -2; } catch (IllegalAccessException localIllegalAccessException) { Util.log(this.mLogger, "IllegalAccessException in isConnectionFound()!"); localIllegalAccessException.printStackTrace(); return -2; } String[] arrayOfString; if (localSettingElement.additionalValue != null) { arrayOfString = localSettingElement.additionalValue.split(":"); if (arrayOfString.length != 3) { Util.log(this.mLogger, "The SSID element provided in the configuration file is invalid!"); this.mFailure.setFailReason(FailureReason.useErrorIcon, getResources() .getString(this.mParcelHelper.getIdentifier("xpc_ssid_element_invalid", "string")), 6); return -2; } if (this.mParser.savedConfigInfo != null) this.mParser.savedConfigInfo.ssid = arrayOfString[2]; if (localWifiConfigurationProxy.getSsid() != null) break label429; Util.log(this.mLogger, "SSID was null parsing network string."); } label429: while (!localWifiConfigurationProxy.getSsid().equals("\"" + arrayOfString[2] + "\"")) { i++; break; } Util.log(this.mLogger, "Our SSID already exists. It will be replaced."); return localWifiConfigurationProxy.getNetworkId(); } return -1; }
From source file:edu.cmu.tetrad.util.TetradSerializableUtils.java
/** * @return all of the classes x in the given directory (recursively) such * that clazz.isAssignableFrom(x).//from w w w. j a v a 2 s. c o m */ private List<Class> getAssignableClasses(File path, Class<TetradSerializable> clazz) { if (!path.isDirectory()) { throw new IllegalArgumentException("Not a directory: " + path); } @SuppressWarnings("Convert2Diamond") List<Class> classes = new LinkedList<>(); File[] files = path.listFiles(); for (File file : files) { if (file.isDirectory()) { classes.addAll(getAssignableClasses(file, clazz)); } else { String packagePath = file.getPath(); packagePath = packagePath.replace('\\', '.'); packagePath = packagePath.replace('/', '.'); packagePath = packagePath.substring(packagePath.indexOf("edu.cmu"), packagePath.length()); int index = packagePath.indexOf(".class"); if (index == -1) { continue; } packagePath = packagePath.substring(0, index); try { Class _clazz = getClass().getClassLoader().loadClass(packagePath); if (clazz.isAssignableFrom(_clazz) && !_clazz.isInterface()) { classes.add(_clazz); } } catch (ClassNotFoundException e) { e.printStackTrace(); } } } return classes; }
From source file:mercury.JsonController.java
/** * *//*from www . j a v a 2 s. c om*/ protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { this.log.debug("processRequest start: " + this.getMemoryInfo()); String submitButton = null; String thisPage = null; HttpSession session = request.getSession(); JSONObject jsonResponse = null; Integer status = null; request.setCharacterEncoding("UTF-8"); response.setCharacterEncoding("UTF-8"); response.setContentType("text/html;charset=UTF-8"); try { submitButton = request.getParameter("submitButton"); thisPage = request.getParameter("thisPage"); AuthorizationPoints atps = (AuthorizationPoints) request.getSession().getAttribute("LOGGED_USER_ATPS"); if (atps == null) { atps = new AuthorizationPoints(null); request.getSession().setAttribute("LOGGED_USER_ATPS", atps); } AuthorizationBO authBO = new AuthorizationBO(); String handlerName = JsonController.targetJsonHandlers.getProperty(thisPage); if (thisPage.equals("ping") && submitButton.equals("ping")) { jsonResponse = new SuccessDTO("OK") .toJSONObject(BaseHandler.getI18nProperties(session, "biblivre3")); } else if (authBO.authorize(atps, handlerName, submitButton)) { RootJsonHandler handler = (RootJsonHandler) Class.forName(handlerName).newInstance(); jsonResponse = handler.process(request, response); } else { if (atps == null) { status = 403; } jsonResponse = this.jsonFailure(session, "warning", "ERROR_NO_PERMISSION"); } } catch (ClassNotFoundException e) { System.out.println("====== [mercury.Controller.processRequest()] Exception 1: " + e); jsonResponse = this.jsonFailure(session, "error", "DIALOG_VOID"); } catch (ExceptionUser e) { System.out.println("====== [mercury.Controller.processRequest()] Exception 2: " + e.getKeyText()); jsonResponse = this.jsonFailure(session, "error", e.getKeyText()); } catch (Exception e) { System.out.println("====== [mercury.Controller.processRequest()] Exception 3: " + e); e.printStackTrace(); jsonResponse = this.jsonFailure(session, "error", "DIALOG_VOID"); } finally { // Print response to browser if (status != null) { response.setStatus(status); } if (jsonResponse != null) { try { jsonResponse.putOnce("success", true); // Only put success on response if not already present. } catch (JSONException e) { } response.getWriter().print(jsonResponse.toString()); } } }
From source file:edu.cmu.tetradapp.util.TetradSerializableUtils.java
/** * Returns all of the classes x in the given directory (recursively) such * that clazz.isAssignableFrom(x).// ww w .j a v a 2s .c om */ public List<Class> getAssignableClasses(File path, Class<TetradSerializable> clazz) { if (!path.isDirectory()) { throw new IllegalArgumentException("Not a directory: " + path); } List<Class> classes = new LinkedList<Class>(); File[] files = path.listFiles(); for (File file : files) { if (file.isDirectory()) { classes.addAll(getAssignableClasses(file, clazz)); } else { String packagePath = file.getPath(); packagePath = packagePath.replace('\\', '.'); packagePath = packagePath.replace('/', '.'); packagePath = packagePath.substring(packagePath.indexOf("edu.cmu"), packagePath.length()); int index = packagePath.indexOf(".class"); if (index == -1) { continue; } packagePath = packagePath.substring(0, index); try { Class _clazz = getClass().getClassLoader().loadClass(packagePath); if (clazz.isAssignableFrom(_clazz) && !_clazz.isInterface()) { classes.add(_clazz); } } catch (ClassNotFoundException e) { e.printStackTrace(); } } } return classes; }
From source file:fr.cobaltians.cobalt.Cobalt.java
/********************************************************************************************** * PLUGINS FILE// ww w . j ava 2 s .c om **********************************************************************************************/ public HashMap<String, Class<? extends CobaltAbstractPlugin>> getPlugins() { HashMap<String, Class<? extends CobaltAbstractPlugin>> pluginsMap = new HashMap<String, Class<? extends CobaltAbstractPlugin>>(); try { JSONObject configuration = getConfiguration(); JSONObject plugins = configuration.getJSONObject(kPlugins); Iterator<String> pluginsIterator = plugins.keys(); while (pluginsIterator.hasNext()) { String pluginName = pluginsIterator.next(); try { JSONObject plugin = plugins.getJSONObject(pluginName); String pluginClassName = plugin.getString(kAndroid); try { Class<?> pluginClass = Class.forName(pluginClassName); if (CobaltAbstractPlugin.class.isAssignableFrom(pluginClass)) { pluginsMap.put(pluginName, (Class<? extends CobaltAbstractPlugin>) pluginClass); } else if (Cobalt.DEBUG) Log.e(Cobalt.TAG, TAG + " - getPlugins: " + pluginClass + " does not inherit from CobaltAbstractActivity!\n" + pluginName + " plugin message will not be processed."); } catch (ClassNotFoundException exception) { if (Cobalt.DEBUG) { Log.e(Cobalt.TAG, TAG + " - getPlugins: " + pluginClassName + " class not found!\n" + pluginName + " plugin message will not be processed."); exception.printStackTrace(); } } } catch (JSONException exception) { if (Cobalt.DEBUG) { Log.e(Cobalt.TAG, TAG + " - getPlugins: " + pluginName + " field is not a JSONObject or does not contain an android field or is not a String.\n" + pluginName + " plugin message will not be processed."); exception.printStackTrace(); } } } } catch (JSONException exception) { if (Cobalt.DEBUG) { Log.w(Cobalt.TAG, TAG + " - getPlugins: plugins field of cobalt.conf not found or not a JSONObject."); exception.printStackTrace(); } } return pluginsMap; }
From source file:org.candlepin.swagger.CandlepinSwaggerModelConverter.java
protected JavaType getInnerType(String innerType) { try {//from w ww .j ava 2 s .c o m Class<?> innerClass = Class.forName(innerType); if (innerClass != null) { TypeFactory tf = pMapper.getTypeFactory(); return tf.constructType(innerClass); } } catch (ClassNotFoundException e) { e.printStackTrace(); } return null; }