Example usage for java.lang NullPointerException printStackTrace

List of usage examples for java.lang NullPointerException printStackTrace

Introduction

In this page you can find the example usage for java.lang NullPointerException printStackTrace.

Prototype

public void printStackTrace() 

Source Link

Document

Prints this throwable and its backtrace to the standard error stream.

Usage

From source file:com.optimusinfo.elasticpath.cortex.checkout.AsyncTaskGetCheckout.java

@Override
protected void onPostExecute(String responseCheckOut) {
    super.onPostExecute(responseCheckOut);
    try {/*from  www  .j  a  va 2  s  .c  o m*/
        if (responseCheckOut != null && responseCheckOut.length() != 0) {
            if (0 == responseCheckOut
                    .compareTo(Integer.toString(Constants.ApiResponseCode.UNAUTHORIZED_ACCESS))) {
                mListener.onAuthenticationFailed();
            } else {
                mListener.onTaskSuccessful(new Gson().fromJson(responseCheckOut, CheckoutModel.class));
            }
        }
    } catch (NullPointerException e) {
        e.printStackTrace();
    } catch (JsonParseException e) {
        e.printStackTrace();
        mListener.onTaskFailed(Constants.ErrorCodes.ERROR_SERVER);
    }
}

From source file:com.optimusinfo.elasticpath.cortex.cart.AsyncTaskUpdateCartItem.java

@Override
protected Integer doInBackground(Void... params) {
    int responseCode = 0;
    try {/*  w w w  .  ja  va 2 s .c  o m*/
        JSONObject objInput = new JSONObject();
        objInput.put("quantity", mQuantityToAdd);
        responseCode = Utils.putRequest(URL, objInput, accessToken, headerContentTypeValue,
                headerContentTypeString, headerAuthorizationTypeString, headerAccessTokenInitializer);
    } catch (NullPointerException e) {
        e.printStackTrace();
    } catch (JsonParseException e) {
        e.printStackTrace();
    } catch (JSONException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    return responseCode;
}

From source file:com.optimusinfo.elasticpath.cortex.authentication.AsyncTaskAuthentication.java

@Override
protected void onPostExecute(String entityResponse) {
    super.onPostExecute(entityResponse);
    try {/*from w  w  w .  jav  a2  s  .  com*/
        mListener.onTaskComplete(mObjGson.fromJson(entityResponse, Authentication.class));
    } catch (NullPointerException e) {
        e.printStackTrace();
    } catch (JsonParseException e) {
        e.printStackTrace();
        mListener.onTaskFailed(Constants.ErrorCodes.ERROR_SERVER, entityResponse);
    }
}

From source file:com.hygenics.parser.CreateTablesWithReference.java

/**
 * Private method that creates the tables
 *//*from w  ww .ja  v a  2  s.  co m*/
private void createTables() {
    if (this.baseschema == null) {
        String query;
        String attrs = null;
        for (String table : tables.keySet()) {
            String[] spl = (this.baseschema + "." + table).split("\\.");
            log.info("Creating Table " + spl[1] + " ON SCHEMA " + spl[0]);
            if (template.checkTable(this.baseschema + "." + table, spl[0]) == false) {

                if (tables.get(table).size() > 0) {
                    query = "CREATE TABLE " + this.baseschema + "." + table + " (";

                    for (String attr : tables.get(table)) {
                        attrs = (attrs == null) ? attr + " text, id serial PRIMARY KEY NOT NULL"
                                : attrs + "," + attr + " text";
                    }

                    query += attrs + ");";

                    template.execute(query);
                    query = null;
                    attrs = null;
                } else {
                    log.info("No Attributes!\n Cannot Create Table " + table + "!");
                }
            }
        }
    } else {
        try {
            throw new NullPointerException("Base Schema Not Specified!");
        } catch (NullPointerException e) {
            e.printStackTrace();
        }
    }
}

From source file:com.test.weeklly.gplus.ShareActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.share_activity);
    Bundle bun = getIntent().getExtras();
    post = bun.getString("gpost");
    mPlusClientFragment = PlusClientFragment.getPlusClientFragment(this, MomentUtil.VISIBLE_ACTIVITIES);
    mSharing = savedInstanceState != null && savedInstanceState.getBoolean(STATE_SHARING, false);
    try {/*from w w w .j  a va 2 s.  com*/
        mSharing = true;
        mPlusClientFragment.signIn(REQUEST_CODE_PLUS_CLIENT_FRAGMENT);
    } catch (NullPointerException e) {
        e.printStackTrace();
    }
}

From source file:com.bordengrammar.bordengrammarapp.HomeFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View myInflatedView = inflater.inflate(R.layout.fragment_home, container, false);
    GoogleMap map = ((SupportMapFragment) getFragmentManager().findFragmentById(R.id.map)).getMap();
    ut.logIt("1");
    try {/*from   w  w w.j ava2s  .c o m*/
        Marker borden = map.addMarker(new MarkerOptions().position(BORDEN).snippet("This is where we are")
                .title("Borden Grammar School")
                .icon(BitmapDescriptorFactory.fromResource(R.drawable.ic_launcher)));
        map.setMapType(GoogleMap.MAP_TYPE_SATELLITE);
        map.setMyLocationEnabled(true);
        map.moveCamera(CameraUpdateFactory.newLatLngZoom(BORDEN, 15));
    } catch (NullPointerException e) {
        e.printStackTrace();
    }

    assert myInflatedView != null;
    TextView t = (TextView) myInflatedView.findViewById(R.id.tweet);
    //t.setText('"' + readPrefs("twitter") + '"');
    if (!readPrefs("link").isEmpty()) {
        t.setText('"' + readPrefs("twitter") + '"' + " - View Link");
        t.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(getActivity().getApplicationContext(), LinkActivity.class);
                intent.putExtra("link", readPrefs("link"));
                startActivity(intent);
            }
        });
    } else {

    }
    TextView t1;

    t1 = (TextView) myInflatedView.findViewById(R.id.date);
    String t1source = "<b>" + "&#64;" + "bordengrammar" + "</b>" + " | " + readPrefs("twittertime");
    t1.setText(Html.fromHtml(t1source));

    TextView info = (TextView) myInflatedView.findViewById(R.id.info);
    String sourceString = "<b>" + "Borden Grammar School" + "</b> "
            + "is a selective boy's grammar school in Sittingbourne, with a fierce commitment to educate, inspire and prepare students academically and socially";
    info.setText(Html.fromHtml(sourceString));

    //now for contact stuff

    return myInflatedView;
}

From source file:it.unibas.spicybenchmark.operators.generators.ext.simpack.tree.TreeEditDistanceGeneratorSimPack.java

public double compute(Configuration configuration) {
    ITreeNode tree1 = CommonSimPack.generateSample(configuration.getExpectedInstanceAbsolutePath());
    ITreeNode tree2 = CommonSimPack.generateSample(configuration.getTranslatedInstanceAbsolutePath());
    try {/*from w ww.ja  v  a  2 s  .c  o m*/
        ITreeNodeComparator comparator = loadTreeNodeComparator(configuration);
        AbstractDistanceConversion conversion = loadDistanceConversion(configuration);
        double weightInsert = configuration.getTreeEditDistanceValienteWeightInsert();
        double weightDelete = configuration.getTreeEditDistanceValienteWeightDelete();
        double weightSubstitute = configuration.getTreeEditDistanceValienteWeightSubstitute();
        TreeEditDistance calc = new TreeEditDistance(new SimpleTreeAccessor(tree1),
                new SimpleTreeAccessor(tree2), comparator, conversion);
        calc.setWeightInsert(weightInsert);
        calc.setWeightDelete(weightDelete);
        calc.setWeightSubstitute(weightSubstitute);
        calc.calculate();
        double treeEditDistance = calc.getTreeEditDistance();
        logger.debug("TED " + treeEditDistance);
        logger.debug("TreeNodeComparator " + calc.getComparator());
        logger.debug("Similarity " + calc.getSimilarity());
        logger.debug("ShortestPath " + calc.getShortestPath());
        logger.debug("Weight Delete " + calc.getWeightDelete());
        logger.debug("Weight Insert " + calc.getWeightInsert());
        logger.debug("Weight Substitute " + calc.getWeightSubstitute());
        logger.debug("getWorstCaseRetainStructure " + calc.getWorstCaseRetainStructure());
        logger.debug("getWorstCaseSubstituteAll " + calc.getWorstCaseSubstituteAll());
        logger.debug("getWorstCaseSumOfNodes " + calc.getWorstCaseSumOfNodes());
        logger.debug("----------------------");
        return treeEditDistance;
    } catch (NullPointerException e) {
        e.printStackTrace();
    } catch (InvalidElementException e) {
        e.printStackTrace();
    }
    return Double.NaN;
}

From source file:com.repay.android.adddebt.EditDebtActivity.java

protected void submitToDB() {
    if (mNegate) { // Make negative if owed
        mNewAmount = mNewAmount.negate();
    }/*from  ww  w  .j  ava  2 s .  com*/
    mDebt.setDescription(mDescription);
    try {
        mFriend.setDebt(mFriend.getDebt().subtract(mDebt.getAmount()));
        mFriend.setDebt(mFriend.getDebt().add(mNewAmount));
        mDebt.setAmount(mNewAmount);
        mDB.updateDebt(mDebt); // Aaand update
        mDB.updateFriendRecord(mFriend); // Update cached total
    } catch (NullPointerException e) {
        e.printStackTrace();
    } catch (SQLException e) {
        e.printStackTrace();
    } finally {
        finish();
    }
}

From source file:com.grizzly.rest.WebServiceFactory.java

public <T extends sendRestData, X> EasyRestCall<T, X> getRestCallInstance(Class<T> entityClass,
        Class<X> responseClass, boolean isTest) {

    EasyRestCall<T, X> myRestCall = null;

    if (isTest) {
        myRestCall = new EasyRestCall<>(entityClass, responseClass, 1);
    } else {//from   w  w  w  .j ava2  s.  co m
        myRestCall = new EasyRestCall<>(entityClass, responseClass);
    }

    try {
        if (context != null) {
            myRestCall.setContext(getContext());

            if (!responseClass.getCanonicalName().equalsIgnoreCase(Void.class.getCanonicalName())) {

                String uuid = UUID.randomUUID().toString();
                if (cachedRequests.containsKey(myRestCall.getUrl())) {
                    uuid = cachedRequests.get(myRestCall.getUrl());
                }
                myRestCall.setCachedFileName(uuid);
                cachedRequests.put(myRestCall.getUrl(), uuid);
            }
        }
    } catch (NullPointerException e) {
        e.printStackTrace();
    }

    return myRestCall;
}

From source file:com.grizzly.rest.WebServiceFactory.java

public <T, X> GenericRestCall<T, X> getGenericRestCallInstance(Class<T> entityClass, Class<X> responseClass,
        boolean isTest) {

    GenericRestCall<T, X> myRestCall = null;

    if (isTest) {
        myRestCall = new GenericRestCall<>(entityClass, responseClass, 1);
    } else {// www  .  j av  a 2  s.  com
        myRestCall = new GenericRestCall<>(entityClass, responseClass);
    }

    try {
        if (context != null) {
            myRestCall.setContext(getContext());

            if (!responseClass.getCanonicalName().equalsIgnoreCase(Void.class.getCanonicalName())) {

                String uuid = UUID.randomUUID().toString();
                if (cachedRequests.containsKey(myRestCall.getUrl())) {
                    uuid = cachedRequests.get(myRestCall.getUrl());
                }
                myRestCall.setCachedFileName(uuid);
                cachedRequests.put(myRestCall.getUrl(), uuid);
            }
        }
    } catch (NullPointerException e) {
        e.printStackTrace();
    }

    return myRestCall;
}