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.profile.address.AddressActivity.java

/**
 * Set up regions/*w w  w . java  2s.c  o m*/
 * 
 * @param listObj
 */
public void setUpRegions(Regions listObj) {
    try {
        mRegions = listObj;
        if (mRegions.mElement != null) {
            mSPProvince.setEnabled(true);
            mSPProvince.setVisibility(View.VISIBLE);
            RegionSpinnerAdapter mAdapter = new RegionSpinnerAdapter(getApplicationContext(),
                    android.R.layout.simple_spinner_item, mRegions.mElement);
            mSPProvince.setAdapter(mAdapter);
            if (mRegions.mElement.length > 0) {
                if (mObjAddress != null && posRegion == 0) {
                    String regionName = mObjAddress.mAddressDesc.mRegion;
                    if (regionName != null) {
                        posRegion = GeographiesModel.getRegionsPosition(mObjAddress.mAddressDesc.mRegion,
                                mRegions.mElement);
                    }
                }
            }
        } else {
            mSPProvince.setVisibility(View.INVISIBLE);
            mSPProvince.setEnabled(false);
        }

        if (true == mSPProvince.isEnabled() && posRegion != 0) {
            mSPProvince.setSelection(posRegion);
        }
    } catch (NullPointerException ex) {
        ex.printStackTrace();
    }

}

From source file:edu.umn.cs.spatialHadoop.core.GridRecordWriter.java

/**
 * Write the given shape to the cellIndex indicated.
 * @param cellIndex//w ww  .j  av a 2s  .co m
 * @param shape
 * @throws IOException
 */
protected synchronized void writeInternal(int cellIndex, S shape) throws IOException {
    if (cellIndex < 0) {
        // A special marker to close a cell
        closeCell(-cellIndex);
        return;
    }
    try {
        cellsMbr[cellIndex].expand(shape.getMBR());
    } catch (NullPointerException e) {
        e.printStackTrace();
    }
    // Convert shape to text
    text.clear();
    shape.toText(text);
    // Write text representation to the file
    OutputStream cellStream = getIntermediateCellStream(cellIndex);
    cellStream.write(text.getBytes(), 0, text.getLength());
    cellStream.write(NEW_LINE);
    intermediateCellSize[cellIndex] += text.getLength() + NEW_LINE.length;
    intermediateCellRecordCount[cellIndex]++;
}

From source file:eu.cloudscale.showcase.db.services.AService.java

@Override
public List findAllShoppingCartLinesBySC(IShoppingCart shoppingCart) {
    try {//from   ww  w . ja v  a  2  s .  c  om
        return shoppingCartDao.findAllBySC(shoppingCart);
    } catch (NullPointerException e) {
        e.printStackTrace();
        return null;
    }
}

From source file:com.optimusinfo.elasticpath.cortex.profile.address.AddressActivity.java

/**
 * Set up countries/*from  w ww .  j a v a 2 s  . c om*/
 * 
 * @param listObj
 */
public void setUpCountries(Geographies listObj) {
    try {
        mGeographies = listObj;
        CountrySpinnerAdapter mAdapter = new CountrySpinnerAdapter(getApplicationContext(),
                android.R.layout.simple_spinner_item, mGeographies.mElement);
        mSPCountry.setAdapter(mAdapter);
        if (mObjAddress != null && posCountry == 0) {
            String countryName = mObjAddress.mAddressDesc.mCountryName;
            posCountry = GeographiesModel.getCountriesPosition(countryName, mGeographies.mElement);
        }

        if (posCountry != 0) {
            mSPCountry.setSelection(posCountry);
        }

        mSPCountry.setOnItemSelectedListener(new OnItemSelectedListener() {

            @Override
            public void onItemSelected(AdapterView<?> parentView, View selectedItemView, int position,
                    long id) {
                String regionsUrl = GeographiesModel
                        .getRegionsUrl(((GeographyElement) mSPCountry.getItemAtPosition(position)))
                        .concat(Constants.ZoomUrl.URL_ZOOM_ELEMENT);
                if (regionsUrl != null) {
                    getRegions(regionsUrl);
                }
            }

            @Override
            public void onNothingSelected(AdapterView<?> arg0) {
                // TODO
            }
        });
    } catch (NullPointerException ex) {
        ex.printStackTrace();
    }
}

From source file:timer.com.maydaysdk.MayDayVideoCallFragment.java

@Override
public View onCreateView(LayoutInflater inflater, final ViewGroup container, Bundle savedInstanceState) {

    View viewInfo = inflater.inflate(R.layout.videochat, container, false);

    // Initialize view
    mLinearLayoutControls = (LinearLayout) viewInfo.findViewById(R.id.linearLayout_Controls);
    mLinearLayoutVideo = (LinearLayout) viewInfo.findViewById(R.id.linearLayout_video);
    mImageViewMute = (ImageView) viewInfo.findViewById(R.id.imageView_mute_audio);
    mImageViewFullScreen = (ImageView) viewInfo.findViewById(R.id.imageView_fullscreen);
    mImageViewAnswer = (ImageView) viewInfo.findViewById(R.id.imageView_answer);
    ImageView imageViewHang = (ImageView) viewInfo.findViewById(R.id.imageView_hangup);
    mAlertDialog = new AlertDialog.Builder(getActivity()).create();

    mImageViewFullScreen.setOnClickListener(this);
    mImageViewMute.setOnClickListener(this);
    imageViewHang.setOnClickListener(this);
    mImageViewAnswer.setOnClickListener(this);

    Bundle bundle = getArguments();//from   w  w w  . j  a va  2 s  .c  om
    if (bundle.getString(MayDayConstant.AGENT_NAME) != null) {
        mAgentName = bundle.getString(MayDayConstant.AGENT_NAME);
    }

    if (bundle.getString(MayDayConstant.DOMAIN_ADDRESS) != null) {
        mDomainAddress = bundle.getString(MayDayConstant.DOMAIN_ADDRESS);
    }

    if (bundle.getString(MayDayConstant.VIDEO_CALL) != null) {
        mVideoCall = bundle.getString(MayDayConstant.VIDEO_CALL);
    }

    try {
        //get last device register name
        mDevice = RCClient.listDevices().get(0);
    } catch (NullPointerException e) {
        e.printStackTrace();
    }

    mScalingType = VideoRendererGui.ScalingType.SCALE_ASPECT_FILL;
    mVideoView = (GLSurfaceView) viewInfo.findViewById(R.id.glView_call);

    final Intent intent = getActivity().getIntent();
    if (intent.getExtras() != null) {
        if (intent.getAction().equals(RCDevice.OUTGOING_CALL)
                || intent.getAction().equals(RCDevice.INCOMING_MESSAGE)) {
            mImageViewAnswer.setVisibility(View.INVISIBLE);
        } else {
            mImageViewAnswer.setVisibility(View.VISIBLE);
        }
    }

    // Get device resolution width and height
    Point size = new Point();
    getActivity().getWindowManager().getDefaultDisplay().getSize(size);
    final int windowWidth = size.x;
    final int windowHeight = size.y;

    // GLVideo resize from top to left corner
    mLinearLayoutVideo.setOnTouchListener(new View.OnTouchListener() {
        @Override
        public boolean onTouch(View v, MotionEvent event) {

            RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) mLinearLayoutVideo
                    .getLayoutParams();
            switch (event.getAction()) {
            case MotionEvent.ACTION_DOWN:
                break;
            case MotionEvent.ACTION_MOVE:
                int x_cord = (int) event.getRawX();
                int y_cord = (int) event.getRawY();

                if (x_cord > windowWidth) {
                    x_cord = windowWidth;
                }
                if (y_cord > windowHeight) {
                    y_cord = windowHeight;
                }

                layoutParams.leftMargin = x_cord - LEFT_MARGIN;
                layoutParams.topMargin = y_cord - TOP_MARGIN;

                mLinearLayoutVideo.setLayoutParams(layoutParams);
                break;
            default:
                break;
            }
            return true;

        }
    });

    // Setup video stuff
    VideoRendererGui.setView(mVideoView, new Runnable() {

        @Override
        public void run() {
            if (mVideoCall != null) {
                if (mVideoCall.equalsIgnoreCase(MayDayConstant.OUTGOING)) {
                    callAgent();
                }
            } else {
                videoContextReady(intent);
            }
        }
    });

    // Create video renderers.
    mRemoteRender = VideoRendererGui.create(REMOTE_X, REMOTE_Y, REMOTE_WIDTH, REMOTE_HEIGHT, mScalingType,
            false);
    mLocalRender = VideoRendererGui.create(LOCAL_X_CONNECTING, LOCAL_Y_CONNECTING, LOCAL_WIDTH_CONNECTING,
            LOCAL_HEIGHT_CONNECTING, mScalingType, true);
    mImageViewMute.setVisibility(View.INVISIBLE);

    return viewInfo;
}

From source file:ca.mudar.parkcatcher.ui.activities.MainActivity.java

@Override
protected void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);

    try {/*  w w w .  j  a  va2s  . c  om*/
        outState.putString(Const.KEY_BUNDLE_SELECTED_TAB,
                getSupportActionBar().getSelectedTab().getTag().toString());
    } catch (NullPointerException e) {
        e.printStackTrace();
    }
}

From source file:kr.co.cashqc.MainActivity.java

public void setHttpRequest() {
    try {/*w w w .j  a  v  a  2s .  c o m*/
        String num = getPhoneNumber();
        String register = Util.loadSharedPreferences(getApplicationContext(), Global.RegisterKey222);
        Log.e("JAY", "loadshared = " + register);
        if (register != null) {
            // if (true) {
            String url = "http://cashq.co.kr/m/set_tokenid_add.php" + "?biz_code=central" + "&phone=" + num
                    + "&token_id=" + getRegId();

            Log.e("test", "register  :  " + register);
            Log.e("test", "url  :  " + url);

            new HttpRequest(mHttpRequestListener, url, "list");
        } else {
            new kr.co.cashqc.gcm.Timer(new TimerListener() {

                public void onTick() {
                    setHttpRequest();
                }
            }, 3000);
        }
    } catch (NullPointerException e) {
        e.printStackTrace();
    }
}

From source file:net.sourceforge.jwbf.actions.mw.editing.GetRevision.java

@SuppressWarnings("unchecked")
private void findContent(final Element root) throws ApiException {

    Iterator<Element> el = root.getChildren().iterator();
    while (el.hasNext()) {
        Element element = (Element) el.next();
        if (element.getQualifiedName().equalsIgnoreCase("error")) {
            throw new ApiException(element.getAttributeValue("code"), element.getAttributeValue("info"));
        } else if (element.getQualifiedName().equalsIgnoreCase("rev")) {

            try {
                sa.setText(element.getText());
                //               LOG.debug("found text");
            } catch (NullPointerException e) {
                // TODO: handle exception
            }//from w w w.j av  a2s  .  c  o m

            sa.setEditSummary(getAsStringValues(element, "comment"));
            sa.setEditor(getAsStringValues(element, "user"));

            try {
                sa.setEditTimestamp(getAsStringValues(element, "timestamp"));
            } catch (ParseException e) {
                e.printStackTrace();
            }

        } else {
            findContent(element);
        }

    }

}

From source file:de.tap.easy_xkcd.fragments.comics.ComicFragment.java

protected void pageSelected(int position) {
    try {/*  w w w .ja  v a  2s  . c om*/
        getActivity().invalidateOptionsMenu();
    } catch (NullPointerException e) {
        e.printStackTrace();
    }
    databaseManager.setRead(position + 1, true);
    lastComicNumber = position + 1;
    if (prefHelper.subtitleEnabled() && ((MainActivity) getActivity()).getCurrentFragment() == R.id.nav_browser)
        ((MainActivity) getActivity()).getToolbar().setSubtitle(String.valueOf(lastComicNumber));

    animateToolbar();
}

From source file:com.starwood.anglerslong.LicenseActivity.java

/******************************************************************************
 * Reads in all of the items in that should be populated.
 ******************************************************************************/
private void populateTabs(boolean isRestart) {
    try {/*  w w  w. java  2  s.c  o m*/
        JsonStorage jsonStorage = new JsonStorage(getApplicationContext());
        String wholeString = jsonStorage.loadTabs();
        if (!wholeString.equals(""))
            isLicensePopulated = true;
        populateLicense(wholeString, isRestart);
        if (numItems == 0) {
            isCreateTextViewSet = false;
            createTextView();
        } else {
            try {
                TextView tv = (TextView) findViewById(0);
                if (tv.getVisibility() == View.VISIBLE || numItems > 0) {
                    tv.setVisibility(View.GONE);
                    isCreateTextViewSet = false;
                }
            } catch (NullPointerException e) {
                Log.d("KENNY", "The text view was null.");
            }
        }

    } catch (IOException | JSONException e) {
        if (!isLicensePopulated)
            isArrayEmpty = true;
        createTextView();
        e.printStackTrace();
    }
}