Example usage for java.lang IllegalAccessException printStackTrace

List of usage examples for java.lang IllegalAccessException printStackTrace

Introduction

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

Prototype

public void printStackTrace() 

Source Link

Document

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

Usage

From source file:net.shopxx.entity.Merchant.java

/**
 * ?/*from ww  w . j  a  va  2  s.  com*/
 * 
 * @param merchantAttribute
 *            
 * @return 
 */
@Transient
public Object getAttributeValue(MerchantAttribute merchantAttribute) {
    if (merchantAttribute != null) {
        if (merchantAttribute.getType() == Type.name) {
            return getName();
        } else if (merchantAttribute.getType() == Type.gender) {
            return getGender();
        } else if (merchantAttribute.getType() == Type.birth) {
            return getBirth();
        } else if (merchantAttribute.getType() == Type.area) {
            return getArea();
        } else if (merchantAttribute.getType() == Type.address) {
            return getAddress();
        } else if (merchantAttribute.getType() == Type.zipCode) {
            return getZipCode();
        } else if (merchantAttribute.getType() == Type.phone) {
            return getPhone();
        } else if (merchantAttribute.getType() == Type.mobile) {
            return getMobile();
        } else if (merchantAttribute.getType() == Type.checkbox) {
            if (merchantAttribute.getPropertyIndex() != null) {
                try {
                    String propertyName = ATTRIBUTE_VALUE_PROPERTY_NAME_PREFIX
                            + merchantAttribute.getPropertyIndex();
                    String propertyValue = (String) PropertyUtils.getProperty(this, propertyName);
                    if (propertyValue != null) {
                        return JsonUtils.toObject(propertyValue, List.class);
                    }
                } catch (IllegalAccessException e) {
                    e.printStackTrace();
                } catch (InvocationTargetException e) {
                    e.printStackTrace();
                } catch (NoSuchMethodException e) {
                    e.printStackTrace();
                }
            }
        } else {
            if (merchantAttribute.getPropertyIndex() != null) {
                try {
                    String propertyName = ATTRIBUTE_VALUE_PROPERTY_NAME_PREFIX
                            + merchantAttribute.getPropertyIndex();
                    return (String) PropertyUtils.getProperty(this, propertyName);
                } catch (IllegalAccessException e) {
                    e.printStackTrace();
                } catch (InvocationTargetException e) {
                    e.printStackTrace();
                } catch (NoSuchMethodException e) {
                    e.printStackTrace();
                }
            }
        }
    }
    return null;
}

From source file:phex.common.Cfg.java

private boolean deserialiseSet(Field myField) {
    boolean isSet = false;
    try {/*from  w w  w. j  av  a2s  .co  m*/
        if (myField.getType().getName().equals("java.util.HashSet")) {
            myField.set(this, new HashSet()); // create an empty set
            Set mySet = (Set) myField.get(this);

            String prefix = new String(myField.getName() + LIST_PREFIX + "SET");
            for (Enumeration e = mSetting.propertyNames(); e.hasMoreElements();) {
                String foundName = (String) e.nextElement();
                if (foundName.startsWith(prefix)) {
                    if (mSetting.getProperty(foundName).length() > 0) {
                        mySet.add(mSetting.getProperty(foundName));
                    }
                }
            }
            isSet = true; // successfully processed the list
        }
    } catch (IllegalAccessException ex) {
        ex.printStackTrace();
        isSet = false;
    }
    return isSet;
}

From source file:net.shopxx.entity.Merchant.java

/**
 * //from  ww w.  j  av  a 2s .c o  m
 * 
 * @param merchantAttribute
 *            
 * @param attributeValue
 *            
 */
@Transient
public void setAttributeValue(MerchantAttribute merchantAttribute, Object attributeValue) {
    if (merchantAttribute != null) {
        if (attributeValue instanceof String && StringUtils.isEmpty((String) attributeValue)) {
            attributeValue = null;
        }
        if (merchantAttribute.getType() == Type.name
                && (attributeValue instanceof String || attributeValue == null)) {
            setName((String) attributeValue);
        } else if (merchantAttribute.getType() == Type.gender
                && (attributeValue instanceof Gender || attributeValue == null)) {
            setGender((Gender) attributeValue);
        } else if (merchantAttribute.getType() == Type.birth
                && (attributeValue instanceof Date || attributeValue == null)) {
            setBirth((Date) attributeValue);
        } else if (merchantAttribute.getType() == Type.area
                && (attributeValue instanceof Area || attributeValue == null)) {
            setArea((Area) attributeValue);
        } else if (merchantAttribute.getType() == Type.address
                && (attributeValue instanceof String || attributeValue == null)) {
            setAddress((String) attributeValue);
        } else if (merchantAttribute.getType() == Type.zipCode
                && (attributeValue instanceof String || attributeValue == null)) {
            setZipCode((String) attributeValue);
        } else if (merchantAttribute.getType() == Type.phone
                && (attributeValue instanceof String || attributeValue == null)) {
            setPhone((String) attributeValue);
        } else if (merchantAttribute.getType() == Type.mobile
                && (attributeValue instanceof String || attributeValue == null)) {
            setMobile((String) attributeValue);
        } else if (merchantAttribute.getType() == Type.checkbox
                && (attributeValue instanceof List || attributeValue == null)) {
            if (merchantAttribute.getPropertyIndex() != null) {
                if (attributeValue == null || (merchantAttribute.getOptions() != null
                        && merchantAttribute.getOptions().containsAll((List<?>) attributeValue))) {
                    try {
                        String propertyName = ATTRIBUTE_VALUE_PROPERTY_NAME_PREFIX
                                + merchantAttribute.getPropertyIndex();
                        PropertyUtils.setProperty(this, propertyName, JsonUtils.toJson(attributeValue));
                    } catch (IllegalAccessException e) {
                        e.printStackTrace();
                    } catch (InvocationTargetException e) {
                        e.printStackTrace();
                    } catch (NoSuchMethodException e) {
                        e.printStackTrace();
                    }
                }
            }
        } else {
            if (merchantAttribute.getPropertyIndex() != null) {
                try {
                    String propertyName = ATTRIBUTE_VALUE_PROPERTY_NAME_PREFIX
                            + merchantAttribute.getPropertyIndex();
                    PropertyUtils.setProperty(this, propertyName, attributeValue);
                } catch (IllegalAccessException e) {
                    e.printStackTrace();
                } catch (InvocationTargetException e) {
                    e.printStackTrace();
                } catch (NoSuchMethodException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}

From source file:phex.common.Cfg.java

private boolean deserialiseMap(Field myField) {
    boolean isMap = false;
    try {/*  w ww.j a va  2 s .  c om*/
        if (myField.getType().getName().equals("java.util.HashMap")) {
            myField.set(this, new HashMap()); // create an empty list
            Map myMap = (Map) myField.get(this);

            String key;
            String prefix = new String(myField.getName() + LIST_PREFIX);
            for (Enumeration e = mSetting.propertyNames(); e.hasMoreElements();) {
                String foundName = (String) e.nextElement();
                if (foundName.startsWith(prefix)) {
                    key = foundName.substring(prefix.length());
                    if (key.length() > 0 && mSetting.getProperty(foundName).length() > 0) {
                        myMap.put(key, mSetting.getProperty(foundName));
                    }

                }
            }
            isMap = true; // successfully processed the list
        }
    } catch (IllegalAccessException ex) {
        ex.printStackTrace();
        isMap = false;
    }
    return isMap;
}

From source file:com.arkami.myidkey.activity.KeyCardEditActivity.java

/**
 * Sets views and their listeners if its in edit mode
 *//* w ww . java 2  s. c  o m*/
private void setKeyCardActionbarEdit() {
    isInEditMode = true;
    actionBar = getSupportActionBar();
    actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM);
    actionBar.setCustomView(R.layout.actionbar_key_card_edit);
    if (keyCard.getId() != null) {

        typeArrows.setVisibility(View.INVISIBLE);
        deleteButton.setVisibility(View.VISIBLE);
    }
    Button save = (Button) actionBar.getCustomView().findViewById(R.id.actionbar_key_card_edit_save);
    save.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            String keyCardNameString = keyCardName.getText().toString().trim();
            if (keyCardNameString.length() < 1) {
                AlertDialog.Builder requiredAlert = new AlertDialog.Builder(KeyCardEditActivity.this)
                        .setMessage(R.string.message_reqired)
                        .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
                            @Override
                            public void onClick(DialogInterface dialog, int which) {

                            }
                        });
                requiredAlert.show();
                return;
            }
            keyCard.setName(keyCardNameString);

            // if is new key card(new key cards have no values)
            if (keyCard.getId() == null) {
                // cannot save two key cards with the same name
                if (keyCardDataSource.contains(KeyCard.NAME, keyCardNameString)) {
                    AlertDialog.Builder sameKeyCardNameAlert = new AlertDialog.Builder(KeyCardEditActivity.this)
                            .setMessage(R.string.same_key_card_name)
                            .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
                                @Override
                                public void onClick(DialogInterface dialog, int which) {

                                }
                            });
                    sameKeyCardNameAlert.show();
                    return;
                }
                long keyCardId = keyCardDataSource.insert(keyCard);
                if (keyCardId != -1) {
                    keyCard.setId(keyCardId);
                } else {
                    AlertDialog.Builder errorDatabaseAlert = new AlertDialog.Builder(KeyCardEditActivity.this)
                            .setMessage("Error. Could not save to database.")
                            .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
                                @Override
                                public void onClick(DialogInterface dialog, int which) {

                                }
                            });
                    errorDatabaseAlert.show();
                    return;
                }
                long[] valueIds = new long[componentHolder.getCustomComponents().size()];
                int i = 0;
                for (CustomViewComponent component : componentHolder.getCustomComponents()) {

                    component.getValue().setKeyCardId(keyCard.getId());
                    long id = valuesDataSource.insert(component.getValue());
                    valueIds[i++] = id;
                }
                keyCard.setValueIds(valueIds);
            }

            SavingTask savingTask = new SavingTask(KeyCardEditActivity.this);
            savingTask.execute(componentHolder.getValues());

            //
            KeyCardTypesDataSource keyCardTypesDataSource = new KeyCardTypesDataSource(
                    KeyCardEditActivity.this);
            keyCardTypesDataSource.open();
            try {
                long id = keyCardTypesDataSource.getByName((String) type.getText());
                if (id != -1) {
                    keyCard.setKeyCardTypeId(id);
                }
            } catch (IllegalAccessException e) {

                e.printStackTrace();
            }
            updateFiles();
            keyCardDataSource.update(keyCard);
            setKeyCardActionbarView();
        }
    });
    actionBarCameraButton = (ImageButton) actionBar.getCustomView()
            .findViewById(R.id.actionbar_key_card_edit_photo);
    actionBarCameraButton.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            final Dialog takePicturePopUp = new TakePicturePopUp(KeyCardEditActivity.this);
            // photoUri = getContentResolver().
            // insert(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, new
            // ContentValues());
            // if (photoUri == null) {
            // return;
            // }
            // ((TakePicturePopUp) takePicturePopUp).setPhotoUri(photoUri);
            // parent.getContentResolver().
            // insert(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, values);
            takePicturePopUp.show();
        }
    });

    recordAudio = (ImageButton) actionBar.getCustomView().findViewById(R.id.actionbar_key_card_edit_audio);

    recordAudio.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            //                final Dialog audioDialog = new RecordAudioDialog(
            //                        KeyCardEditActivity.this);
            // audioUri = getContentResolver().
            // insert(MediaStore.Audio.Media.EXTERNAL_CONTENT_URI, new
            // ContentValues());
            // ((RecordAudioDialog) audioDialog).setUri(audioUri);
            //                audioDialog.show();

            Dialog soundRecordingActivity = new SoundRecordingActivity(KeyCardEditActivity.this);
            soundRecordingActivity.show();
        }
    });
    favourite = (ToggleButton) actionBar.getCustomView().findViewById(R.id.actionbar_key_card_view_favorite);
    favourite.setChecked(keyCard.isFavourite());
    favourite.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            keyCard.setFavourite(isChecked);
        }
    });
    setEditable(true);
}

From source file:com.dp2345.entity.Member.java

/**
 * ?// ww w .ja v a  2 s  .co  m
 * 
 * @param memberAttribute
 *            
 * @return 
 */
@Transient
public Object getAttributeValue(MemberAttribute memberAttribute) {
    if (memberAttribute != null) {
        if (memberAttribute.getType() == Type.name) {
            return getName();
        } else if (memberAttribute.getType() == Type.gender) {
            return getGender();
        } else if (memberAttribute.getType() == Type.birth) {
            return getBirth();
        } else if (memberAttribute.getType() == Type.area) {
            return getArea();
        } else if (memberAttribute.getType() == Type.address) {
            return getAddress();
        } else if (memberAttribute.getType() == Type.zipCode) {
            return getZipCode();
        } else if (memberAttribute.getType() == Type.phone) {
            return getPhone();
        } else if (memberAttribute.getType() == Type.mobile) {
            return getMobile();
        } else if (memberAttribute.getType() == Type.checkbox) {
            if (memberAttribute.getPropertyIndex() != null) {
                try {
                    String propertyName = ATTRIBUTE_VALUE_PROPERTY_NAME_PREFIX
                            + memberAttribute.getPropertyIndex();
                    String propertyValue = (String) PropertyUtils.getProperty(this, propertyName);
                    if (propertyValue != null) {
                        return JsonUtils.toObject(propertyValue, List.class);
                    }
                } catch (IllegalAccessException e) {
                    e.printStackTrace();
                } catch (InvocationTargetException e) {
                    e.printStackTrace();
                } catch (NoSuchMethodException e) {
                    e.printStackTrace();
                }
            }
        } else {
            if (memberAttribute.getPropertyIndex() != null) {
                try {
                    String propertyName = ATTRIBUTE_VALUE_PROPERTY_NAME_PREFIX
                            + memberAttribute.getPropertyIndex();
                    return (String) PropertyUtils.getProperty(this, propertyName);
                } catch (IllegalAccessException e) {
                    e.printStackTrace();
                } catch (InvocationTargetException e) {
                    e.printStackTrace();
                } catch (NoSuchMethodException e) {
                    e.printStackTrace();
                }
            }
        }
    }
    return null;
}

From source file:com.dp2345.entity.Member.java

/**
 * /* www.j  a v  a  2 s .  c om*/
 * 
 * @param memberAttribute
 *            
 * @param attributeValue
 *            
 */
@Transient
public void setAttributeValue(MemberAttribute memberAttribute, Object attributeValue) {
    if (memberAttribute != null) {
        if (attributeValue instanceof String && StringUtils.isEmpty((String) attributeValue)) {
            attributeValue = null;
        }
        if (memberAttribute.getType() == Type.name
                && (attributeValue instanceof String || attributeValue == null)) {
            setName((String) attributeValue);
        } else if (memberAttribute.getType() == Type.gender
                && (attributeValue instanceof Gender || attributeValue == null)) {
            setGender((Gender) attributeValue);
        } else if (memberAttribute.getType() == Type.birth
                && (attributeValue instanceof Date || attributeValue == null)) {
            setBirth((Date) attributeValue);
        } else if (memberAttribute.getType() == Type.area
                && (attributeValue instanceof Area || attributeValue == null)) {
            setArea((Area) attributeValue);
        } else if (memberAttribute.getType() == Type.address
                && (attributeValue instanceof String || attributeValue == null)) {
            setAddress((String) attributeValue);
        } else if (memberAttribute.getType() == Type.zipCode
                && (attributeValue instanceof String || attributeValue == null)) {
            setZipCode((String) attributeValue);
        } else if (memberAttribute.getType() == Type.phone
                && (attributeValue instanceof String || attributeValue == null)) {
            setPhone((String) attributeValue);
        } else if (memberAttribute.getType() == Type.mobile
                && (attributeValue instanceof String || attributeValue == null)) {
            setMobile((String) attributeValue);
        } else if (memberAttribute.getType() == Type.checkbox
                && (attributeValue instanceof List || attributeValue == null)) {
            if (memberAttribute.getPropertyIndex() != null) {
                if (attributeValue == null || (memberAttribute.getOptions() != null
                        && memberAttribute.getOptions().containsAll((List<?>) attributeValue))) {
                    try {
                        String propertyName = ATTRIBUTE_VALUE_PROPERTY_NAME_PREFIX
                                + memberAttribute.getPropertyIndex();
                        PropertyUtils.setProperty(this, propertyName, JsonUtils.toJson(attributeValue));
                    } catch (IllegalAccessException e) {
                        e.printStackTrace();
                    } catch (InvocationTargetException e) {
                        e.printStackTrace();
                    } catch (NoSuchMethodException e) {
                        e.printStackTrace();
                    }
                }
            }
        } else {
            if (memberAttribute.getPropertyIndex() != null) {
                try {
                    String propertyName = ATTRIBUTE_VALUE_PROPERTY_NAME_PREFIX
                            + memberAttribute.getPropertyIndex();
                    PropertyUtils.setProperty(this, propertyName, attributeValue);
                } catch (IllegalAccessException e) {
                    e.printStackTrace();
                } catch (InvocationTargetException e) {
                    e.printStackTrace();
                } catch (NoSuchMethodException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}

From source file:com.arkami.myidkey.activity.KeyCardEditActivity.java

/**
 * Creates views for the keycard's values
 *///from  w w  w .  j av a 2s.co  m
private void initializeBottom() {
    // make some magic and show key cards' content
    try {
        if (keyCard.getValueIds() != null) {
            componentHolder.removeAllViews();
            for (long valueId : this.keyCard.getValueIds()) {
                Value value;
                value = valuesDataSource.get(valueId);
                componentHolder.addCustomComponent(new CustomViewComponent(this, value));
            }
        }
        bottom.removeAllViews();
        bottom.addView(this.componentHolder);
        bottom.invalidate();
        bottom.requestLayout();
    } catch (IllegalAccessException e) {
        initializeCustomBottomScreenAfterSelectionOfAKeyCardType(
                keyCardTypeDataSource.getTypeById(keyCard.getKeyCardTypeId()).getName());
        e.printStackTrace();
    }

}

From source file:org.imsglobal.lti.toolProvider.ToolProvider.java

private boolean doCallback(String method) {

    String callback = method;/*from  w w w .  j ava  2  s  .  c  o m*/
    Boolean retVal = null;
    if (callback == null) {
        callback = getMessageType();
    }
    Class<? extends ToolProvider> clazz = this.getClass();
    boolean methodExists = false;
    for (Method m : clazz.getDeclaredMethods()) {
        if (m.getName().equals(callback)) {
            methodExists = true;
            try {
                retVal = (Boolean) m.invoke(this);
            } catch (IllegalAccessException e) {
                e.printStackTrace();
            } catch (IllegalArgumentException e) {
                e.printStackTrace();
            } catch (InvocationTargetException e) {
                e.printStackTrace();
            } //returns a boolean
        }
    }
    if (!methodExists) { //didn"t find the method in declared methods
        if (StringUtils.isNotEmpty(method)) {
            reason = "Message type not supported: " + getMessageType();
            retVal = false;
        }
    }
    if (retVal && (getMessageType().equals("ToolProxyRegistrationRequest"))) {
        consumer.save();
    }

    return retVal;

}

From source file:com.alibaba.android.layoutmanager.ExposeLinearLayoutManagerEx.java

protected void ensureLayoutStateExpose() {
    if (mLayoutState == null) {
        mLayoutState = new LayoutState();
    }/*from w w w  . j  a va  2 s  .  c o  m*/

    if (mOrientationHelper == null) {
        mOrientationHelper = OrientationHelper.createOrientationHelper(this, getOrientation());
    }

    try {
        mEnsureLayoutStateMethod.invoke(this, emptyArgs);
    } catch (IllegalAccessException e) {
        e.printStackTrace();
    } catch (InvocationTargetException e) {
        e.printStackTrace();
    }
}