List of usage examples for java.lang ClassNotFoundException printStackTrace
public void printStackTrace()
From source file:com.fratello.longevity.smooth.catalog.CompareFilter.java
public boolean loadObject() { try {//from www. j a v a2s.c om FileInputStream door = new FileInputStream( new File(new File(FileUtils.getTempDirectoryPath() + "NicksProgram"), "defaultsettings.ser")); ObjectInputStream reader = new ObjectInputStream(door); CompareFilter x = new CompareFilter(); try { x = (CompareFilter) reader.readObject(); } catch (ClassNotFoundException e) { e.printStackTrace(); } reader.close(); if (x == null) return false; setCompareFilter(x); } catch (IOException e) { } return true; }
From source file:edu.jhu.hlt.parma.inference.transducers.StringEditModelTrainer.java
private StringEditModel readModel(String filename) { System.err.println("Reading model from: " + filename); try {// w w w . ja v a 2 s . c o m ObjectInputStream objIn = new ObjectInputStream(new FileInputStream(filename)); return (StringEditModel) objIn.readObject(); } catch (IOException e) { System.out.println(e.getMessage()); e.printStackTrace(); System.exit(1); } catch (ClassNotFoundException c) { System.out.println(c.getMessage()); c.printStackTrace(); System.exit(1); } return null; }
From source file:io.selendroid.server.model.internal.execute_native.FindRId.java
@Override public Object executeScript(JSONArray args) { Class rClazz;//from w w w. j a va 2s .c o m try { rClazz = serverInstrumentation.getTargetContext().getClassLoader() .loadClass(serverInstrumentation.getTargetContext().getPackageName() + ".R$id"); } catch (ClassNotFoundException e) { SelendroidLogger.error("Cannot find id", e); return ""; } String using = null; try { using = args.getString(0); } catch (JSONException e) { e.printStackTrace(); } for (Field field : rClazz.getFields()) { if (field.getName().equalsIgnoreCase(using)) { try { return field.getInt(null); } catch (IllegalAccessException e) { e.printStackTrace(); } } } return ""; }
From source file:ByteFIFOTest.java
private void dst() { try {/*from w ww .j a v a2 s . c o m*/ boolean justAddOne = true; int count = 0; byte[] dstData = new byte[srcData.length]; while (count < dstData.length) { if (!justAddOne) { byte[] buf = fifo.removeAll(); if (buf.length > 0) { System.arraycopy(buf, 0, dstData, count, buf.length); count += buf.length; } System.out.println("just removed " + buf.length + " bytes"); } else { byte b = fifo.remove(); dstData[count] = b; count++; System.out.println("just removed exactly 1 byte"); } justAddOne = !justAddOne; } System.out.println("received all data, count=" + count); ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(dstData)); String[] line = (String[]) ois.readObject(); for (int i = 0; i < line.length; i++) { System.out.println("line[" + i + "]=" + line[i]); } } catch (ClassNotFoundException x1) { x1.printStackTrace(); } catch (IOException iox) { iox.printStackTrace(); } catch (InterruptedException x) { x.printStackTrace(); } }
From source file:com.weibo.api.motan.config.springsupport.MotanBeanDefinitionParser.java
@Override public BeanDefinition parse(Element element, ParserContext parserContext) { try {/*from w ww.j av a 2 s . co m*/ return parse(element, parserContext, beanClass, required); } catch (ClassNotFoundException e) { e.printStackTrace(); throw new RuntimeException(e); } }
From source file:no.uka.findmyapp.android.rest.client.RestProcessor.java
private void saveAndReturnData(ServiceModel serviceModel, Serializable returnedObject) { if (serviceModel.getContentProviderUri() != null) { try {//from www . j a v a 2 s. com if (isInstanceOfJavaNativeType(Class.forName(serviceModel.getReturnType())) == false) { prepareAndSendToContentProvider(serviceModel, returnedObject); } } catch (ClassNotFoundException e) { e.printStackTrace(); } } if (serviceModel.getBroadcastNotification() != null) { sendIntentBroadcast(serviceModel.getBroadcastNotification(), returnedObject); } }
From source file:com.mcapanel.plugin.PluginConnector.java
@SuppressWarnings("unchecked") private void doMethodAndRespond(String method, String paramStr) { JSONObject out = new JSONObject(); out.put("plugin", "McAdminPanel"); out.put("type", "response"); out.put("method", method); String[] params = paramStr.length() != 0 ? paramStr.split(", ") : new String[0]; try {//from w w w.j a va2 s . com Class<?>[] paramClasses = new Class<?>[params.length]; for (int i = 0; i < params.length; i++) paramClasses[i] = Class.forName("java.lang.String"); Method m = methodHandler.getClass().getDeclaredMethod(method, paramClasses); String ret = (String) m.invoke(methodHandler, (Object[]) params); if (m.getReturnType().equals(Void.TYPE)) return; out.put("response", ret); } catch (ClassNotFoundException e) { e.printStackTrace(); } catch (NoSuchMethodException e) { e.printStackTrace(); } catch (SecurityException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (IllegalArgumentException e) { e.printStackTrace(); } catch (InvocationTargetException e) { e.printStackTrace(); } if (!out.containsKey("response")) out.put("response", "No such method"); String cmd = "mcadminpanelplugincmd " + out.toJSONString(); OutputStream writer = server.getWriter(); try { writer.write((cmd + "\n").getBytes()); writer.flush(); } catch (IOException e) { } }
From source file:com.twitter.hraven.hadoopJobMonitor.conf.AppConfiguraiton.java
public Object getPolicyObject(String policyClassName) { try {//from w w w . j a v a 2 s.c o m Class<?> policyClass = Class.forName(policyClassName); return policyClass.newInstance(); } catch (ClassNotFoundException e) { LOG.error(policyClassName + " is not in classpath!"); e.printStackTrace(); } catch (InstantiationException e) { LOG.error("Cannot instantiate " + policyClassName + "!"); e.printStackTrace(); } catch (IllegalAccessException e) { LOG.error(policyClassName + " does not have a public, no-arg constructor!"); e.printStackTrace(); } LOG.warn("Using default policy instead of the configured policy: " + policyClassName); return DefaultPolicy.getInstance(); }
From source file:com.cnm.cnmrc.fragment.vodtvch.VodTvchBase.java
private void loadingData() { FragmentTransaction ft = getActivity().getSupportFragmentManager().beginTransaction(); Class<?> classObject;/*from w ww . j a v a 2s . c om*/ try { classObject = Class.forName(packageName + mClassTypeArray[selectedCategory]); Object obj = classObject.newInstance(); Base base = ((Base) obj).newInstance(mCategoryArray[selectedCategory]); //ft.addToBackStack(null); ft.replace(R.id.loading_data_panel, base); ft.commit(); } catch (ClassNotFoundException e) { e.printStackTrace(); } catch (java.lang.InstantiationException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } }
From source file:atd.backend.Register.java
@Override protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { RequestDispatcher rd = null;/*from w w w . j ava2s . c o m*/ System.out.println(req.getParameter("checkbox")); if (req.getParameter("checkbox") != null) { String username = req.getParameter("username").toLowerCase(); String realName = req.getParameter("realname"); try { Class.forName("org.apache.commons.codec.digest.DigestUtils"); } catch (ClassNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } String wachtwoord = org.apache.commons.codec.digest.DigestUtils.sha256Hex(req.getParameter("password")); if (UsersDAO.searchUser(username) != null) { req.setAttribute("errorReg", "<div class=\"alert alert-danger\" role=\"alert\"> <span class=\"sr-only\">Error:</span> Username is bezet</div>"); rd = req.getRequestDispatcher("register/register.jsp"); rd.forward(req, resp); return; } if (username.equals("") || realName.equals("") || wachtwoord.equals("")) { req.setAttribute("errorReg", "<div class=\"alert alert-danger\" role=\"alert\"> <span class=\"sr-only\">Error:</span> Er is een veld leeg</div>"); rd = req.getRequestDispatcher("register/register.jsp"); rd.forward(req, resp); return; } // Hier moet nog een uurloon veld komen UsersDAO.setUser(new User(0, realName, username, Privilege.MONTEUR, 10.00), wachtwoord); req.setAttribute("error", "<div class=\"alert alert-success\" role=\"alert\"> <span class=\"sr-only\">Info:</span> nieuwe gebruiker is aangemaakt </div>"); rd = req.getRequestDispatcher("login/login.jsp"); rd.forward(req, resp); } else { String username = req.getParameter("username").toLowerCase(); String realName = req.getParameter("realname"); try { Class.forName("org.apache.commons.codec.digest.DigestUtils"); } catch (ClassNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } String wachtwoord = org.apache.commons.codec.digest.DigestUtils.sha256Hex(req.getParameter("password")); String postcode = req.getParameter("postcode"); String email = req.getParameter("email"); String kenteken = req.getParameter("kenteken"); String merk = req.getParameter("merk"); String type = req.getParameter("type"); if (KlantenDAO.searchKlant(username) != null) { req.setAttribute("errorReg", "<div class=\"alert alert-danger\" role=\"alert\"> <span class=\"sr-only\">Error:</span> Username bestaat al</div>"); rd = req.getRequestDispatcher("register/register.jsp"); rd.forward(req, resp); return; } if (username.equals("") || realName.equals("") || wachtwoord.equals("") || postcode.equals("") || email.equals("") || kenteken.equals("") || merk.equals("") || type.equals("")) { req.setAttribute("errorReg", "<div class=\"alert alert-danger\" role=\"alert\"> <span class=\"sr-only\">Error:</span> Er is een veld leeg</div>"); rd = req.getRequestDispatcher("register/register.jsp"); rd.forward(req, resp); return; } AutoDAO.setAuto(new Auto(0, kenteken, merk, type)); Klant k = new Klant(0, realName, username, postcode, email, AutoDAO.searchAuto(kenteken), Privilege.KLANT); KlantenDAO.setKlant(k, wachtwoord); sendRegMail(k); req.setAttribute("error", "<div class=\"alert alert-success\" role=\"alert\"> <span class=\"sr-only\">Info:</span> Gebruiker " + k.getUsername() + " is aangemaakt </div>"); rd = req.getRequestDispatcher("login/login.jsp"); rd.forward(req, resp); } }