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:com.sammyun.entity.Member.java

/**
 * /*from   www  .  j a  va  2  s.c om*/
 */
@Transient
public void removeAttributeValue() {
    setGender(null);
    setBirth(null);
    setArea(null);
    setAddress(null);
    setZipCode(null);
    setPhone(null);
    setMobile(null);
    for (int i = 0; i < ATTRIBUTE_VALUE_PROPERTY_COUNT; i++) {
        String propertyName = ATTRIBUTE_VALUE_PROPERTY_NAME_PREFIX + i;
        try {
            PropertyUtils.setProperty(this, propertyName, null);
        } catch (IllegalAccessException e) {
            e.printStackTrace();
        } catch (InvocationTargetException e) {
            e.printStackTrace();
        } catch (NoSuchMethodException e) {
            e.printStackTrace();
        }
    }
}

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

/**
 * /*  ww  w . jav  a  2  s  .  c om*/
 */
@Transient
public void removeAttributeValue() {
    setBirth(null);
    setArea(null);
    setAddress(null);
    setZipCode(null);
    setPhone(null);
    setMobile(null);
    for (int i = 0; i < ATTRIBUTE_VALUE_PROPERTY_COUNT; i++) {
        String propertyName = ATTRIBUTE_VALUE_PROPERTY_NAME_PREFIX + i;
        try {
            PropertyUtils.setProperty(this, propertyName, null);
        } catch (IllegalAccessException e) {
            e.printStackTrace();
        } catch (InvocationTargetException e) {
            e.printStackTrace();
        } catch (NoSuchMethodException e) {
            e.printStackTrace();
        }
    }
}

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

/**
 *
 *//*w  w  w .  j  av  a2s .  c  o m*/
private void initializeCustomBottomScreenAfterSelectionOfAKeyCardType(String typeName) {
    KeyCardTypeEnum type = KeyCardTypeEnum.getValueByTitle(typeName);
    if (this.componentHolder == null) {
        this.componentHolder = new CustomComponentHolder(this);
    }
    KeyCardEditActivity.this.componentHolder.removeAllViews();
    KeyCardEditActivity.this.componentHolder.clear();
    try {
        switch (type) {
        case site:
            componentHolder.addValues(new Site());
            break;
        case bank_account:
            componentHolder.addValues(new BankAccount());
            break;
        case clothing:
            componentHolder.addValues(new Clothing());
            break;
        case credit_card:
            componentHolder.addValues(new CreditCardNew());
            break;
        case database:
            componentHolder.addValues(new Database());
            break;
        case drivers_license:
            componentHolder.addValues(new DrivingLicense());
            break;
        case email:
            componentHolder.addValues(new EmailAccount());
            break;
        case form_fill:
            componentHolder.addValues(new FormFill());
            break;
        case instant_messenger:
            componentHolder.addValues(new InstantMessenger());
            break;
        case insurance:
            componentHolder.addValues(new Insurance());
            break;
        case membership:
            componentHolder.addValues(new Membership());
            break;
        case note:
            componentHolder.addValues(new Note());
            break;
        case passport:
            componentHolder.addValues(new Passport());
            break;
        case prescription:
            componentHolder.addValues(new Prescription());
            break;
        case reward_program:
            componentHolder.addValues(new RewardsProgram());
            break;
        case wifi:
            componentHolder.addValues(new WiFi());
            break;
        case vehicle:
            componentHolder.addValues(new Vehicle());
            break;
        case software_licence:
            componentHolder.addValues(new SoftwareLicense());
            break;
        case social_security:
            componentHolder.addValues(new SocialSecurity());
            break;
        case server:
            componentHolder.addValues(new Server());
            break;
        default:
            break;
        }
    } catch (IllegalAccessException e1) {
        e1.printStackTrace();
    }
    bottom.removeAllViews();
    bottom.addView(componentHolder);
    bottom.invalidate();
    bottom.requestLayout();
}

From source file:au.org.theark.lims.web.component.barcodelabel.form.DetailForm.java

@Override
protected void onSave(Form<BarcodeLabel> containerForm, AjaxRequestTarget target) {
    if (barcodePrinterName == null) {
        this.error("Barcode Printer is required");
    } else {//from  w  w w.  ja v a 2 s.c o  m
        containerForm.getModelObject().setBarcodePrinterName(barcodePrinterName.toString());
        if (isNew()) {
            if (barcodeLabelTemplateDdc.getModelObject() != null) {
                List<BarcodeLabelData> cloneBarcodeLabelDataList = iLimsAdminService
                        .getBarcodeLabelDataByBarcodeLabel(barcodeLabelTemplateDdc.getModelObject());
                List<BarcodeLabelData> barcodeLabelDataList = new ArrayList<BarcodeLabelData>(0);
                for (Iterator<BarcodeLabelData> iterator = cloneBarcodeLabelDataList.iterator(); iterator
                        .hasNext();) {
                    BarcodeLabelData clonebarcodeLabelData = (BarcodeLabelData) iterator.next();
                    BarcodeLabelData barcodeLabelData = new BarcodeLabelData();
                    // Copy parent details to new barcodeLabelData
                    try {
                        PropertyUtils.copyProperties(barcodeLabelData, clonebarcodeLabelData);
                    } catch (IllegalAccessException e) {
                        log.error(e.getMessage());
                    } catch (InvocationTargetException e) {
                        log.error(e.getMessage());
                    } catch (NoSuchMethodException e) {
                        log.error(e.getMessage());
                    }
                    barcodeLabelData.setId(null);
                    barcodeLabelDataList.add(barcodeLabelData);
                }
                containerForm.getModelObject().setBarcodeLabelData(barcodeLabelDataList);
            }

            try {
                iLimsAdminService.createBarcodeLabel(containerForm.getModelObject());
                this.info("Barcode label: " + containerForm.getModelObject().getName()
                        + " was created successfully.");
            } catch (ConstraintViolationException e) {
                e.printStackTrace();
                this.error("A Barcode Label named \"" + containerForm.getModelObject().getName()
                        + "\" already exists for this study.");
            }
        } else {
            iLimsAdminService.updateBarcodeLabel(containerForm.getModelObject());
            this.info("Barcode label: " + containerForm.getModelObject().getName()
                    + " was updated successfully.");
        }
    }
    target.add(feedBackPanel);
    onSavePostProcess(target);
}

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

/**
 * ?/*w  ww.  j  a v a 2s.  c  o  m*/
 * 
 * @param memberAttribute 
 * @return 
 */
@Transient
public Object getAttributeValue(MemberAttribute memberAttribute) {
    if (memberAttribute != null) {
        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.height) {
            return getMobile();
        } else if (memberAttribute.getType() == Type.weight) {
            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.Shop.java

/**
 * ?//from w  ww.j  a va2 s. c om
 * 
 * @param storeAttribute
 *            
 * @return 
 */
@Transient
public Object getAttributeValue(ShopAttribute storeAttribute) {
    if (storeAttribute != null) {
        if (storeAttribute.getType() == Type.name) {
            return getShopName();
        } else if (storeAttribute.getType() == Type.area) {
            return getArea();
        } else if (storeAttribute.getType() == Type.address) {
            return getAddress();
        } else if (storeAttribute.getType() == Type.zipCode) {
            return getZipCode();
        } else if (storeAttribute.getType() == Type.phone) {
            return getPhone();
        } else if (storeAttribute.getType() == Type.mobile) {
            return getMobile();
        } else if (storeAttribute.getType() == Type.checkbox) {
            if (storeAttribute.getPropertyIndex() != null) {
                try {
                    String propertyName = ATTRIBUTE_VALUE_PROPERTY_NAME_PREFIX
                            + storeAttribute.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 (storeAttribute.getPropertyIndex() != null) {
                try {
                    String propertyName = ATTRIBUTE_VALUE_PROPERTY_NAME_PREFIX
                            + storeAttribute.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.sammyun.entity.Member.java

/**
 * /*from   w  ww . j a v  a  2s  .co  m*/
 * 
 * @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;
        } 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:de.static_interface.sinksql.SqlDatabase.java

@Override
public <T extends Row> T insert(AbstractTable<T> abstractTable, T row) {
    Validate.notNull(row);//from   w w w.j  a  v  a 2 s .  co  m
    String columns = "";
    char bt = getBacktick();
    int i = 0;
    List<Field> fields = ReflectionUtil.getAllFields(abstractTable.getRowClass());
    Map<Field, String> autoIncrements = new HashMap<>();
    for (Field f : fields) {
        Column column = FieldCache.getAnnotation(f, Column.class);
        if (column == null) {
            continue;
        }

        String name = StringUtil.isEmptyOrNull(column.name()) ? f.getName() : column.name();

        if (column.autoIncrement()) {
            autoIncrements.put(f, name);
        }

        name = bt + name + bt;
        if (i == 0) {
            columns = name;
            i++;
            continue;
        }
        columns += ", " + name;
        i++;
    }

    if (i == 0) {
        throw new IllegalStateException(
                abstractTable.getRowClass().getName() + " doesn't have any public fields!");
    }

    String valuesPlaceholders = "";
    for (int k = 0; k < i; k++) {
        if (k == 0) {
            valuesPlaceholders = "?";
            continue;
        }
        valuesPlaceholders += ",?";
    }

    String sql = "INSERT INTO `{TABLE}` (" + columns + ") " + "VALUES(" + valuesPlaceholders + ")";
    List<Object> values = new ArrayList<>();
    for (Field f : fields) {
        try {
            values.add(f.get(row));
        } catch (IllegalAccessException e) {
            throw new RuntimeException(e);
        }
    }

    PreparedStatement ps = abstractTable.createPreparedStatement(sql, Statement.RETURN_GENERATED_KEYS,
            values.toArray(new Object[values.size()]));
    try {
        ps.executeUpdate();
    } catch (SQLException e) {
        throw new RuntimeException(e);
    }

    ResultSet rs;
    try {
        rs = ps.getGeneratedKeys();
    } catch (SQLException e) {
        throw new RuntimeException(e);
    }

    try {
        rs.next();
    } catch (SQLException e) {
        e.printStackTrace();
    }

    for (Field f : autoIncrements.keySet()) {
        abstractTable.setFieldFromResultSet(row, rs, f, autoIncrements.get(f));
    }

    try {
        rs.close();
    } catch (SQLException e) {
        e.printStackTrace();
    }

    return row;
}

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

/**
 * // w  ww.ja  v  a  2s. co m
 */
@Transient
public void removeAttributeValue() {
    setName(null);
    setGender(null);
    setBirth(null);
    setArea(null);
    setAddress(null);
    setZipCode(null);
    setPhone(null);
    setMobile(null);
    for (int i = 0; i < ATTRIBUTE_VALUE_PROPERTY_COUNT; i++) {
        String propertyName = ATTRIBUTE_VALUE_PROPERTY_NAME_PREFIX + i;
        try {
            PropertyUtils.setProperty(this, propertyName, null);
        } catch (IllegalAccessException e) {
            e.printStackTrace();
        } catch (InvocationTargetException e) {
            e.printStackTrace();
        } catch (NoSuchMethodException e) {
            e.printStackTrace();
        }
    }
}

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

/**
 * // w  w  w  .ja  va  2 s  .  c  o m
 * 
 * @param storeAttribute
 *            
 * @param attributeValue
 *            
 */
@Transient
public void setAttributeValue(ShopAttribute storeAttribute, Object attributeValue) {
    if (storeAttribute != null) {
        if (attributeValue instanceof String && StringUtils.isEmpty((String) attributeValue)) {
            attributeValue = null;
        }
        if (storeAttribute.getType() == Type.name
                && (attributeValue instanceof String || attributeValue == null)) {
            setShopName((String) attributeValue);
        } else if (storeAttribute.getType() == Type.birth
                && (attributeValue instanceof Date || attributeValue == null)) {
            setBirth((Date) attributeValue);
        } else if (storeAttribute.getType() == Type.area
                && (attributeValue instanceof Area || attributeValue == null)) {
            setArea((Area) attributeValue);
        } else if (storeAttribute.getType() == Type.address
                && (attributeValue instanceof String || attributeValue == null)) {
            setAddress((String) attributeValue);
        } else if (storeAttribute.getType() == Type.zipCode
                && (attributeValue instanceof String || attributeValue == null)) {
            setZipCode((String) attributeValue);
        } else if (storeAttribute.getType() == Type.phone
                && (attributeValue instanceof String || attributeValue == null)) {
            setPhone((String) attributeValue);
        } else if (storeAttribute.getType() == Type.mobile
                && (attributeValue instanceof String || attributeValue == null)) {
            setMobile((String) attributeValue);
        } else if (storeAttribute.getType() == Type.checkbox
                && (attributeValue instanceof List || attributeValue == null)) {
            if (storeAttribute.getPropertyIndex() != null) {
                if (attributeValue == null || (storeAttribute.getOptions() != null
                        && storeAttribute.getOptions().containsAll((List<?>) attributeValue))) {
                    try {
                        String propertyName = ATTRIBUTE_VALUE_PROPERTY_NAME_PREFIX
                                + storeAttribute.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 (storeAttribute.getPropertyIndex() != null) {
                try {
                    String propertyName = ATTRIBUTE_VALUE_PROPERTY_NAME_PREFIX
                            + storeAttribute.getPropertyIndex();
                    PropertyUtils.setProperty(this, propertyName, attributeValue);
                } catch (IllegalAccessException e) {
                    e.printStackTrace();
                } catch (InvocationTargetException e) {
                    e.printStackTrace();
                } catch (NoSuchMethodException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}