List of usage examples for java.lang NullPointerException printStackTrace
public void printStackTrace()
From source file:com.karthikb351.vitinfo2.fragment.LoginFragment.java
private void loginToServer(String campus, String registerNumber, String dateOfBirth, String mobileNumber) { NetworkController networkController = NetworkController.getInstance(getActivity(), campus, registerNumber, dateOfBirth, mobileNumber);/* ww w .j a va 2 s . c o m*/ final ResultListener resultListener = new ResultListener() { @Override public void onSuccess() { progress = PROGRESS_END; progressBar.setProgress(progress); startActivity(new Intent(thisActivity, MainActivity.class)); } @Override public void onFailure(Status status) { try { Toast.makeText(thisActivity, status.getMessage(), Toast.LENGTH_SHORT).show(); loadingMessage.setText(""); progress = PROGRESS_START; progressBar.setProgress(progress); } catch (NullPointerException e) { e.printStackTrace(); } } @Override public void onProgress() { try { thisActivity.runOnUiThread(new Runnable() { @Override public void run() { progress = progress + PROGRESS_INCREMENT; progressBar.incrementProgressBy(PROGRESS_INCREMENT); } }); } catch (NullPointerException e) { e.printStackTrace(); } } }; RequestConfig requestConfig = new RequestConfig(new ResultListener() { @Override public void onSuccess() { try { ((MainApplication) thisActivity.getApplication()).getDataHolderInstance() .refreshData(thisActivity, resultListener); } catch (NullPointerException ignore) { } } @Override public void onFailure(Status status) { resultListener.onFailure(status); } @Override public void onProgress() { try { thisActivity.runOnUiThread(new Runnable() { @Override public void run() { progress = progress + PROGRESS_INCREMENT; progressBar.incrementProgressBy(PROGRESS_INCREMENT); } }); } catch (NullPointerException e) { e.printStackTrace(); } } }); requestConfig.addRequest(RequestConfig.REQUEST_SYSTEM); requestConfig.addRequest(RequestConfig.REQUEST_REFRESH); requestConfig.addRequest(RequestConfig.REQUEST_GRADES); requestConfig.addRequest(RequestConfig.REQUEST_TOKEN); networkController.dispatch(requestConfig); }
From source file:com.siacra.beans.ProyectoBean.java
public void updateProyecto() { try {/*from w ww. jav a 2 s.c o m*/ Proyecto proyecto = getProyectoService().getProyectoById(this.getIdproyecto()); try { Responsabilidad responsabilidad = getResponsabilidadService() .getResponsabilidadById(proyecto.getResponsabilidad().getIdresponsabilidad()); proyecto.setResponsabilidad(responsabilidad); } catch (NullPointerException e) { e.printStackTrace(); } proyecto.setFechainicio(getFechainicio()); proyecto.setFechafin(getFechafin()); proyecto.setEstadoproyecto(getEstadoproyecto()); proyecto.setNombreproyecto(getNombreproyecto()); proyecto.setObservacion(getObservacion()); proyecto.setDescripcion(getDescripcion()); getProyectoService().updateProyecto(proyecto); addMessage("El proyecto fue actualizado correctamente"); refreshProyectos(); } catch (Exception e) { e.printStackTrace(); } }
From source file:com.michael.feng.utils.YahooWeather4a.YahooWeatherUtils.java
private WeatherInfo parseWeatherInfo(Context context, Document doc) { WeatherInfo weatherInfo = new WeatherInfo(); try {/* www . java 2 s .c o m*/ Node titleNode = doc.getElementsByTagName("title").item(0); if (titleNode.getTextContent().equals(YAHOO_WEATHER_ERROR)) { return null; } weatherInfo.setTitle(titleNode.getTextContent()); weatherInfo.setDescription(doc.getElementsByTagName("description").item(0).getTextContent()); weatherInfo.setLanguage(doc.getElementsByTagName("language").item(0).getTextContent()); weatherInfo.setLastBuildDate(doc.getElementsByTagName("lastBuildDate").item(0).getTextContent()); Node locationNode = doc.getElementsByTagName("yweather:location").item(0); weatherInfo.setLocationCity(locationNode.getAttributes().getNamedItem("city").getNodeValue()); weatherInfo.setLocationRegion(locationNode.getAttributes().getNamedItem("region").getNodeValue()); weatherInfo.setLocationCountry(locationNode.getAttributes().getNamedItem("country").getNodeValue()); Node windNode = doc.getElementsByTagName("yweather:wind").item(0); weatherInfo.setWindChill(windNode.getAttributes().getNamedItem("chill").getNodeValue()); weatherInfo.setWindDirection(windNode.getAttributes().getNamedItem("direction").getNodeValue()); weatherInfo.setWindSpeed(windNode.getAttributes().getNamedItem("speed").getNodeValue()); Node atmosphereNode = doc.getElementsByTagName("yweather:atmosphere").item(0); weatherInfo .setAtmosphereHumidity(atmosphereNode.getAttributes().getNamedItem("humidity").getNodeValue()); weatherInfo.setAtmosphereVisibility( atmosphereNode.getAttributes().getNamedItem("visibility").getNodeValue()); weatherInfo .setAtmospherePressure(atmosphereNode.getAttributes().getNamedItem("pressure").getNodeValue()); weatherInfo.setAtmosphereRising(atmosphereNode.getAttributes().getNamedItem("rising").getNodeValue()); Node astronomyNode = doc.getElementsByTagName("yweather:astronomy").item(0); weatherInfo.setAstronomySunrise(astronomyNode.getAttributes().getNamedItem("sunrise").getNodeValue()); weatherInfo.setAstronomySunset(astronomyNode.getAttributes().getNamedItem("sunset").getNodeValue()); weatherInfo.setConditionTitle(doc.getElementsByTagName("title").item(2).getTextContent()); weatherInfo.setConditionLat(doc.getElementsByTagName("geo:lat").item(0).getTextContent()); weatherInfo.setConditionLon(doc.getElementsByTagName("geo:long").item(0).getTextContent()); Node currentConditionNode = doc.getElementsByTagName("yweather:condition").item(0); weatherInfo.setCurrentCode( Integer.parseInt(currentConditionNode.getAttributes().getNamedItem("code").getNodeValue())); weatherInfo.setCurrentText(currentConditionNode.getAttributes().getNamedItem("text").getNodeValue()); weatherInfo.setCurrentTempF( Integer.parseInt(currentConditionNode.getAttributes().getNamedItem("temp").getNodeValue())); weatherInfo.setCurrentConditionDate( currentConditionNode.getAttributes().getNamedItem("date").getNodeValue()); Node forecast1ConditionNode = doc.getElementsByTagName("yweather:forecast").item(0); weatherInfo.setForecast1Code( Integer.parseInt(forecast1ConditionNode.getAttributes().getNamedItem("code").getNodeValue())); weatherInfo .setForecast1Text(forecast1ConditionNode.getAttributes().getNamedItem("text").getNodeValue()); weatherInfo .setForecast1Date(forecast1ConditionNode.getAttributes().getNamedItem("date").getNodeValue()); weatherInfo.setForecast1Day(forecast1ConditionNode.getAttributes().getNamedItem("day").getNodeValue()); weatherInfo.setForecast1TempHighF( Integer.parseInt(forecast1ConditionNode.getAttributes().getNamedItem("high").getNodeValue())); weatherInfo.setForecast1TempLowF( Integer.parseInt(forecast1ConditionNode.getAttributes().getNamedItem("low").getNodeValue())); Node forecast2ConditionNode = doc.getElementsByTagName("yweather:forecast").item(1); weatherInfo.setForecast2Code( Integer.parseInt(forecast2ConditionNode.getAttributes().getNamedItem("code").getNodeValue())); weatherInfo .setForecast2Text(forecast2ConditionNode.getAttributes().getNamedItem("text").getNodeValue()); weatherInfo .setForecast2Date(forecast2ConditionNode.getAttributes().getNamedItem("date").getNodeValue()); weatherInfo.setForecast2Day(forecast2ConditionNode.getAttributes().getNamedItem("day").getNodeValue()); weatherInfo.setForecast2TempHighF( Integer.parseInt(forecast2ConditionNode.getAttributes().getNamedItem("high").getNodeValue())); weatherInfo.setForecast2TempLowF( Integer.parseInt(forecast2ConditionNode.getAttributes().getNamedItem("low").getNodeValue())); } catch (NullPointerException e) { e.printStackTrace(); Toast.makeText(context, "Parse XML failed - Unrecognized Tag", Toast.LENGTH_SHORT).show(); weatherInfo = null; } return weatherInfo; }
From source file:de.teambluebaer.patientix.helper.RestfulHelper.java
/** * Method which post data to the server/* www . jav a 2 s. com*/ * * @param restMethod Method which to be set * @param pM Parameter-Map for the post request */ public synchronized void postDataToServer(final String restMethod, final ArrayList<NameValuePair> pM) { if (DEBUG) { Log.d("pm", pM.toArray().toString()); Log.d("restMethod", restMethod); } response = null; client = createHttpClient(); try { if (DEBUG) { Log.d("POST_URL: ", POST_URL); } post = new HttpPost(POST_URL); post.setEntity(new UrlEncodedFormEntity(pM)); Log.d("Http", new UrlEncodedFormEntity(pM).toString()); response = client.execute(post); responseArray = IOUtils.toByteArray(response.getEntity().getContent()); responseString = getStringFromInputStream(responseArray); responseCode = response.getStatusLine().getStatusCode(); } catch (NullPointerException e) { e.printStackTrace(); Log.d("Fehler: ", String.valueOf(true)); Log.d("Fehler", e.toString()); } catch (ClientProtocolException e) { e.printStackTrace(); Log.d("Fehler: ", String.valueOf(true)); Log.d("Fehler", e.toString()); } catch (UnsupportedEncodingException e) { e.printStackTrace(); Log.d("Fehler: ", String.valueOf(true)); Log.d("Fehler", e.toString()); } catch (IOException e) { e.printStackTrace(); responseCode = 503; Log.d("Fehler: ", String.valueOf(true)); Log.d("Fehler", e.toString()); } }
From source file:org.eclipse.orion.server.git.objects.Blame.java
@PropertyDescription(name = ProtocolConstants.KEY_CHILDREN) private JSONArray getBlameJSON() throws URISyntaxException, JSONException, IOException { if (lines.size() > 0 && commits.size() > 0) { ArrayList<JSONArray> commitRanges = new ArrayList<JSONArray>(); JSONObject tempObj = null;//from ww w .j av a 2 s. c om String lineId = null; String currentCommitId = null; for (int i = 0; i < commits.size(); i++) { commitRanges.add(new JSONArray()); } try { for (int i = 0; i < lines.size(); i++) { lineId = lines.get(i); if (lineId != null && !lineId.equals(currentCommitId)) { if (tempObj != null) { tempObj.put(GitConstants.KEY_END_RANGE, i); for (int j = 0; j < commits.size(); j++) { if (commits.get(j).getId().getName().equals(currentCommitId)) { commitRanges.get(j).put(tempObj); break; } } } tempObj = new JSONObject(); tempObj.put(GitConstants.KEY_START_RANGE, i + 1); currentCommitId = lineId; } } tempObj.put(GitConstants.KEY_END_RANGE, lines.size()); for (int j = 0; j < commits.size(); j++) { if (commits.get(j).getId().getName().equals(lineId)) { commitRanges.get(j).put(tempObj); break; } } } catch (NullPointerException e) { e.printStackTrace(); } JSONArray returnJSON = new JSONArray(); RevCommit tempCommit; PersonIdent person; for (int i = 0; i < commitRanges.size(); i++) { tempObj = new JSONObject(); tempCommit = commits.get(i); person = tempCommit.getAuthorIdent(); URI commitURI = BaseToCommitConverter.getCommitLocation(cloneLocation, tempCommit.getId().getName(), BaseToCommitConverter.REMOVE_FIRST_2); tempObj = new JSONObject(); tempObj.put(GitConstants.KEY_COMMIT_TIME, (long) tempCommit.getCommitTime() * 1000); tempObj.put(GitConstants.KEY_AUTHOR_EMAIL, person.getEmailAddress()); tempObj.put(GitConstants.KEY_AUTHOR_NAME, person.getName()); tempObj.put(GitConstants.KEY_AUTHOR_IMAGE, UserUtilities.getImageLink(person.getEmailAddress())); person = tempCommit.getCommitterIdent(); tempObj.put(GitConstants.KEY_COMMITTER_EMAIL, person.getEmailAddress()); tempObj.put(GitConstants.KEY_COMMITTER_NAME, person.getName()); tempObj.put(GitConstants.KEY_COMMIT, commitURI); tempObj.put(ProtocolConstants.KEY_CHILDREN, commitRanges.get(i)); tempObj.put(GitConstants.KEY_COMMIT_MESSAGE, tempCommit.getFullMessage()); tempObj.put(ProtocolConstants.KEY_NAME, tempCommit.getId().getName()); returnJSON.put(tempObj); } return returnJSON; } return null; }
From source file:com.softminds.matrixcalculator.base_activities.SplashScreen.java
@Override protected void onCreate(Bundle savedInstanceState) { int SPLASH_TIME_OUT = 2000; ((GlobalValues) getApplication()).SetDonationKeyStatus(); if (!((GlobalValues) getApplication()).DonationKeyFound()) { //if user is non pro then only check for offer key HashMap<String, Object> hashMap = new HashMap<>(); hashMap.put("promotion_offer", false); remoteConfig.setDefaults(hashMap); remoteConfig.setConfigSettings(/*from w ww . ja v a 2 s . com*/ new FirebaseRemoteConfigSettings.Builder().setDeveloperModeEnabled(BuildConfig.DEBUG).build()); final Task<Void> fetch = remoteConfig.fetch(TimeUnit.HOURS.toSeconds(6)); //if offer exist then activate pro features fetch.addOnSuccessListener(new OnSuccessListener<Void>() { @Override public void onSuccess(Void aVoid) { remoteConfig.activateFetched(); UpdateKey(); } }); } //init the key status here SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this); boolean isDark = preferences.getBoolean("DARK_THEME_KEY", false); if (isDark) setTheme(R.style.AppThemeDark); else setTheme(R.style.AppTheme); super.onCreate(savedInstanceState); setContentView(R.layout.splash_screen); TextView textView = findViewById(R.id.textView9); String s = "Version " + BuildConfig.VERSION_NAME; textView.setText(s); RelativeLayout Root = findViewById(R.id.splash_screen); try { if (isDark) { Root.setBackgroundColor(ContextCompat.getColor(this, R.color.DarkcolorPrimaryDark)); } else Root.setBackgroundColor(ContextCompat.getColor(getApplicationContext(), R.color.colorPrimaryDark)); } catch (NullPointerException e) { Toast.makeText(getApplicationContext(), R.string.FatalError, Toast.LENGTH_SHORT).show(); e.printStackTrace(); finish(); } new Handler().postDelayed(new Runnable() { @Override public void run() { Intent intent = new Intent(getApplicationContext(), MainActivity.class); startActivity(intent); finish(); } }, SPLASH_TIME_OUT); if (PreferenceManager.getDefaultSharedPreferences(getApplicationContext()).getBoolean("PERSIST_ENABLER", false)) { try { FileInputStream fis = getApplicationContext().openFileInput("persist_data.mat"); ObjectInputStream os = new ObjectInputStream(fis); ArrayList<MatrixV2> vars = (ArrayList<MatrixV2>) os.readObject(); Log.d("TTT", "ABOUT TO RESTORE " + String.valueOf(vars.size())); os.close(); fis.close(); Log.d("TTT", "Previously on MainList " + String.valueOf(((GlobalValues) getApplication()).GetCompleteList().size())); ((GlobalValues) getApplication()).GetCompleteList().clear(); ((GlobalValues) getApplication()).GetCompleteList().addAll(vars); Log.d("TTT", "Total Value " + String.valueOf(((GlobalValues) getApplication()).GetCompleteList().size())); Toast.makeText(getApplicationContext(), "Restored all Variables", Toast.LENGTH_SHORT).show(); } catch (FileNotFoundException | ClassNotFoundException e) { // Nothing to restore simply skip e.printStackTrace(); } catch (IOException e) { Toast.makeText(getApplicationContext(), "Cannot Load Persisted Variable. I/O Error", Toast.LENGTH_SHORT).show(); e.printStackTrace(); } } }
From source file:org.wahtod.wififixer.ui.AboutFragment.java
private void refreshViews() { try {// w ww . j a v a 2 s. c o m if (mNetwork.SSID.length() > 0) _views.setSsid(mNetwork.SSID); else _views.setSsid(mNetwork.BSSID); _views.setBssid(mNetwork.BSSID); _views.setCapabilities(StringUtil.getLongCapabilitiesString(mNetwork.capabilities)); _views.setFrequency(mNetwork.frequency); _views.setLevel(mNetwork.level); } catch (NullPointerException e) { LogUtil.log(getActivity(), "Null in RefreshViews"); e.printStackTrace(); } }
From source file:com.drevelopment.couponcodes.bukkit.coupon.BukkitCouponHandler.java
@Override public ArrayList<String> getCoupons() { ArrayList<String> c = new ArrayList<String>(); try {/*from w w w. ja v a 2s. c o m*/ ResultSet rs = databaseHandler.query("SELECT name FROM couponcodes"); if (rs == null) return c; while (rs.next()) c.add(rs.getString(1)); } catch (NullPointerException e) { e.printStackTrace(); } catch (SQLException e) { e.printStackTrace(); } return c; }
From source file:edu.umn.cs.spatialHadoop.core.OGCESRIShape.java
@Override public boolean isIntersected(Shape s) { Rectangle s_mbr = s.getMBR(); Rectangle this_mbr = this.getMBR(); if (s_mbr == null || this_mbr == null) return false; // Filter step if (!s_mbr.isIntersected(this_mbr)) return false; try {/* w ww . j a va 2s . c o m*/ if (s instanceof OGCESRIShape) return geom.intersects(((OGCESRIShape) s).geom); } catch (NullPointerException e) { // TODO Auto-generated catch block e.printStackTrace(); } ArrayList<OGCGeometry> points = new ArrayList<OGCGeometry>(); points.add( new OGCPoint(new com.esri.core.geometry.Point(s_mbr.x1, s_mbr.y1), geom.getEsriSpatialReference())); points.add( new OGCPoint(new com.esri.core.geometry.Point(s_mbr.x2, s_mbr.y2), geom.getEsriSpatialReference())); OGCGeometryCollection all_points = new OGCConcreteGeometryCollection(points, geom.getEsriSpatialReference()); return geom.intersects(all_points.envelope()); }
From source file:edu.scripps.fl.curves.plot.CurvePlot.java
protected void addCurve(Curve curve, YIntervalSeries validSeries, YIntervalSeries invalidSeries, FitFunction fitFunction, double min, double max) { MyXYErrorRenderer renderer = (MyXYErrorRenderer) plot.getRenderer(); Paint paint = plot.getDrawingSupplier().getNextPaint(); addSeries(validSeries, paint, true, true); if (isDisplayInvalidPoints() && invalidSeries.getItemCount() > 0) { int idx = addSeries(invalidSeries, paint, true, false); float size = (float) DefaultDrawingSupplier.DEFAULT_SHAPE_SEQUENCE[0].getBounds().getWidth(); DrawingSupplier ds = this.getDrawingSupplier(); if (ds instanceof CurvePlotDrawingSupplier) size = (float) ((CurvePlotDrawingSupplier) ds).getShapeSize() / 2; size = (float) Math.floor((size - 1) / 2); renderer.setSeriesShape(idx, ShapeUtilities.createDiagonalCross(size, size)); }//from w ww . j a va2 s . com if (null != fitFunction) try { YIntervalSeries functionSeries = sampleFunction2DToSeries(curve, fitFunction, min, max, getWidth(), (Comparable<?>) (dataset.getSeriesCount() + 1)); addSeries(functionSeries, paint, false, false); } catch (NullPointerException ex) { ex.printStackTrace(); } }