List of usage examples for java.lang NullPointerException printStackTrace
public void printStackTrace()
From source file:com.dastanapps.camera2.view.Cam2AutoFitTextureView.java
@Override public boolean onTouch(View v, MotionEvent event) { if (mCharacteristics != null && mPreviewBuilder != null && mPreviewSession != null) { switch (event.getAction()) { case MotionEvent.ACTION_DOWN: touchToFocus(event);//from w ww. ja v a 2s . c o m pinchToZoom(event); setPosition(event); break; case MotionEvent.ACTION_UP: break; } try { mPreviewSession.setRepeatingRequest(mPreviewBuilder.build(), mCaptureCallback, null); } catch (CameraAccessException e) { e.printStackTrace(); } catch (NullPointerException ex) { ex.printStackTrace(); } return true; } return true; }
From source file:com.softminds.matrixcalculator.OperationFragments.FunctionalFragment.java
@Override public void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (resultCode == 1452) { if (((GlobalValues) getActivity().getApplication()).DonationKeyFound()) { try { final Function function = ((GlobalValues) getActivity().getApplication()).getFunction(); Runnable runnable = new Runnable() { @Override// www . j a va 2s. co m public void run() { MatrixV2 m = function.ComputeFunction(SquareList.get(ClickPos)); Message message = new Message(); message.setData(m.getDataBundled()); myHandler.sendMessage(message); } }; Thread thread = new Thread(runnable); thread.start(); } catch (NullPointerException e) { Log.d("Exception : ", "Function at Global Context is Null"); e.printStackTrace(); } } else { AlertDialog.Builder builder = new AlertDialog.Builder(getContext()); builder.setCancelable(true); builder.setPositiveButton(R.string.Upgrade, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { final String ProPackage = "com.softminds.matrixcalculator.pro.key"; try { Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + ProPackage)); startActivity(intent); Toast.makeText(getContext(), R.string.OpeningPlay, Toast.LENGTH_SHORT).show(); } catch (ActivityNotFoundException e) { //if Play store is not installed startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://play.google.com/store/apps/details?id=" + ProPackage))); } dialogInterface.dismiss(); } }); builder.setNegativeButton(R.string.Nope, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { dialogInterface.dismiss(); } }); builder.setTitle(getString(R.string.Upgrade)); builder.setMessage(R.string.UpgradeMess); builder.show(); } } }
From source file:com.cyberway.issue.crawler.datamodel.ServerCache.java
/** * Get the {@link CrawlServer} associated with <code>curi</code>. * @param cauri CandidateURI we're to get server from. * @return CrawlServer instance that matches the passed CandidateURI. *//*from w w w . j a v a 2 s . c om*/ public CrawlServer getServerFor(CandidateURI cauri) { CrawlServer cs = null; try { String key = CrawlServer.getServerKey(cauri); // TODOSOMEDAY: make this robust against those rare cases // where authority is not a hostname. if (key != null) { cs = getServerFor(key); } } catch (URIException e) { logger.severe(e.getMessage() + ": " + cauri); e.printStackTrace(); } catch (NullPointerException npe) { logger.severe(npe.getMessage() + ": " + cauri); npe.printStackTrace(); } return cs; }
From source file:routercc8.DistanceVector.java
public String getMin(String nodo) { try {/*from w w w . java 2 s. c om*/ String minimo = mins.get(nodo); return minimo; } catch (NullPointerException e) { e.printStackTrace(); return null; } }
From source file:com.sopinet.trazeo.app.chat.GcmIntentService.java
public void sendNotification(String groupId, String time, String type, String text, String username) { Group group = Group.getGroupById(groupId); boolean showMessage = true; if (group != null) { Message message = null;/* ww w . ja v a 2 s . c o m*/ switch (type) { case TEXT: message = new Message(username, text, time, Message.RECEIVED); message.chat = group.chat; message.save(); break; case RIDE_STARTED: String memberName = ""; try { String[] splitted = text.split(";"); memberName = splitted[0]; if (!group.rideCreator.equals("owner")) group.ride_id = splitted[1]; } catch (NullPointerException e) { e.printStackTrace(); } message = new Message(username, String.format(getString(R.string.gcm_ride_started), memberName, group.name), time, Message.NOTIFICATION); message.chat = group.chat; message.save(); group.hasride = "true"; break; case RIDE_FINISHED: message = new Message(username, String.format(getString(R.string.gcm_ride_finished), group.name), time, Message.NOTIFICATION); message.chat = group.chat; message.save(); group.hasride = "false"; showMessage = text.equals("showMessage"); break; case CHILD_IN: message = new Message(username, String.format(getString(R.string.gcm_child_in), text, group.name), time, Message.NOTIFICATION); message.chat = group.chat; message.save(); break; case CHILD_OUT: message = new Message(username, String.format(getString(R.string.gcm_child_out), text, group.name), time, Message.NOTIFICATION); message.chat = group.chat; message.save(); break; } group.hasMessage = 1; group.save(); if (message != null) { launchNotification(message, group, type, showMessage); } } }
From source file:mx.developerbus.foodbus.FoodBus_Main.java
public LatLng getLocation() { // Get the location manager LocationManager locationManager = (LocationManager) getSystemService(LOCATION_SERVICE); Criteria criteria = new Criteria(); String bestProvider = locationManager.getBestProvider(criteria, false); Location location = locationManager.getLastKnownLocation(bestProvider); Double lat, lon;/*w w w . j a v a 2 s .c om*/ try { lat = location.getLatitude(); lon = location.getLongitude(); return new LatLng(lat, lon); } catch (NullPointerException e) { e.printStackTrace(); return null; } }
From source file:eu.celarcloud.jcatascopia.serverpack.AgentRegister.java
public void run() { if (this.server.inDebugMode()) System.out.println(//from www . j a v a 2s . c o m "AgentRegister>> processing the following message...\n" + msg[0] + " " + msg[1] + " " + msg[2]); try { JSONParser parser = new JSONParser(); JSONObject json; json = (JSONObject) parser.parse(msg[2]); //parse content if (msg[1].equals("AGENT.JOIN")) joinM(json); else if (msg[1].equals("AGENT.CONNECT")) connect(json); else if (msg[1].equals("AGENT.METRICS")) metrics(json); else this.response(Status.ERROR, msg[1] + " request does not exist"); } catch (NullPointerException e) { this.server.writeToLog(Level.SEVERE, e); e.printStackTrace(); } catch (Exception e) { this.server.writeToLog(Level.SEVERE, e); } }
From source file:org.lunci.dumbthing.account.LinkFacebook.java
@Override public void unlink() { if (BuildConfig.DEBUG) { Log.i(TAG, "unlinkFacebook"); }/*from w w w . ja v a 2s . com*/ callUnlinkConfirmDialog(R.string.unlink_facebook_warning, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { final SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(getActivity()); try { Session session = Session.getActiveSession(); if (session == null) { final String token = pref.getString(Keys.Preference_Facebook_AccessToken, ""); final long expire = pref.getLong(Keys.Preference_Facebook_AccessToken_Expire, 0); final Date expDate = new Date(); expDate.setTime(expire); final long lastRefresh = pref.getLong(Keys.Preference_Facebook_Last_Refresh_Date, 0); final Date lastDate = new Date(); lastDate.setTime(lastRefresh); final Set<String> permissions = pref.getStringSet(Keys.Preference_Facebook_Permissions, null); final List<String> permissionList = new ArrayList<>(); permissionList.addAll(permissions); // final Set<String> declinedPermissions=pref.getStringSet(Keys.Preference_Facebook_Declined_Permissions, null); final String source = pref.getString(Keys.Preference_Facebook_AccessToken_Source, ""); final AccessTokenSource tokenSource = AccessTokenSource.valueOf(source); final AccessToken accessToken = AccessToken.createFromExistingAccessToken(token, expDate, lastDate, tokenSource, permissionList); session = Session.openActiveSessionWithAccessToken(getActivity(), accessToken, null); } if (session != null) session.closeAndClearTokenInformation(); else { Log.w(TAG, "Unable to retrieve session"); } } catch (NullPointerException ex) { ex.printStackTrace(); } finally { final SharedPreferences.Editor editor = pref.edit(); editor.putBoolean(Keys.Preference_Facebook_Linked, false).commit(); mButtonContainer.updateLinked(false); } } }); }
From source file:com.siacra.beans.ProyectoBean.java
public void loadProyecto(Proyecto proyecto) { try {/*from w w w . j a v a 2s. c o m*/ Responsabilidad responsabilidad = getResponsabilidadService() .getResponsabilidadById(proyecto.getResponsabilidad().getIdresponsabilidad()); setIdresponsabilidad(responsabilidad.getIdresponsabilidad()); } catch (NullPointerException e) { e.printStackTrace(); } setIdEscuela(proyecto.getEscuela().getIdescuela()); setIdproyecto(proyecto.getIdproyecto()); setNombreproyecto(proyecto.getNombreproyecto()); setObservacion(proyecto.getObservacion()); setDescripcion(proyecto.getDescripcion()); setFechainicio(proyecto.getFechainicio()); setFechafin(proyecto.getFechafin()); setEstadoproyecto(proyecto.getEstadoproyecto()); }
From source file:eu.celarcloud.jcatascopia.serverpack.MetricProcessor.java
public void run() { if (this.server.inDebugMode()) System.out.println("\nMetricProcessor>> processing the following message...\n" + msg); try {//from w w w . jav a 2s.co m JSONParser parser = new JSONParser(); JSONObject json; json = (JSONObject) parser.parse(msg); //check if metrics are from an intermediate server if (json.get("serverID") == null) processor(json); else redistProcessor(json); } catch (NullPointerException e) { this.server.writeToLog(Level.SEVERE, e); e.printStackTrace(); } catch (Exception e) { this.server.writeToLog(Level.SEVERE, e); e.printStackTrace(); } return; }