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:org.apache.ranger.service.RangerServiceService.java

public List<XXTrxLog> getTransactionLog(RangerService vObj, XXService mObj, int action) {
    if (vObj == null || action == 0 || (action == OPERATION_UPDATE_CONTEXT && mObj == null)) {
        return null;
    }/*from   w ww .  j  a v  a2  s  .c  o m*/
    List<XXTrxLog> trxLogList = new ArrayList<XXTrxLog>();
    Field[] fields = vObj.getClass().getDeclaredFields();

    try {
        Field nameField = vObj.getClass().getDeclaredField("name");
        nameField.setAccessible(true);
        String objectName = "" + nameField.get(vObj);

        for (Field field : fields) {
            if (!trxLogAttrs.containsKey(field.getName())) {
                continue;
            }
            XXTrxLog xTrxLog = processFieldToCreateTrxLog(field, objectName, nameField, vObj, mObj, action);
            if (xTrxLog != null) {
                trxLogList.add(xTrxLog);
            }
        }
        Field[] superClassFields = vObj.getClass().getSuperclass().getDeclaredFields();
        for (Field field : superClassFields) {
            if (field.getName().equalsIgnoreCase("isEnabled")) {
                XXTrxLog xTrx = processFieldToCreateTrxLog(field, objectName, nameField, vObj, mObj, action);
                if (xTrx != null) {
                    trxLogList.add(xTrx);
                }
                break;
            }
        }
    } catch (IllegalAccessException e) {
        e.printStackTrace();
    } catch (NoSuchFieldException e) {
        e.printStackTrace();
    }
    return trxLogList;
}

From source file:net.navasoft.madcoin.backend.services.vo.request.SuccessRequestVOWrapper.java

/**
 * Gets the error processing values.//from  ww  w . j  av  a  2 s  .c o m
 * 
 * @return the error processing values
 * @since 27/07/2014, 06:49:08 PM
 */
@Override
public ControllerExceptionArgument[] getErrorProcessingValues() {
    ControllerExceptionArgument[] errors = (ControllerExceptionArgument[]) Array
            .newInstance(ControllerExceptionArgument.class, 0);
    for (Method accessor : helper.getDeclaredMethods()) {
        for (Annotation expected : accessor.getAnnotations()) {
            if (expected.annotationType() == ProcessingErrorValue.class) {
                try {
                    ProcessingErrorValue expectedReal = ((ProcessingErrorValue) expected);
                    Object requestValue = null;
                    switch (expectedReal.precedence()) {
                    case BASIC_OPTIONAL:

                        requestValue = accessor.invoke(hidden, ArrayUtils.EMPTY_OBJECT_ARRAY);

                        requestValue = (requestValue != null) ? requestValue : "No data provided";
                        errors = (ControllerExceptionArgument[]) ArrayUtils.add(errors,
                                new ControllerExceptionArgument(requestValue));
                        break;
                    case BASIC_REQUIRED:
                        requestValue = accessor.invoke(hidden, ArrayUtils.EMPTY_OBJECT_ARRAY);
                        errors = (ControllerExceptionArgument[]) ArrayUtils.add(errors,
                                new ControllerExceptionArgument(requestValue));
                        break;
                    case COMPLEX_OPTIONAL:
                        break;
                    case COMPLEX_REQUIRED:
                        break;
                    default:
                        break;
                    }
                } catch (IllegalAccessException e) {
                    e.printStackTrace();
                } catch (IllegalArgumentException e) {
                    e.printStackTrace();
                } catch (InvocationTargetException e) {
                    e.printStackTrace();
                }
            }
        }
    }
    return errors;
}

From source file:org.opensilk.video.tv.ui.playback.PlaybackActivity.java

@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
    Field[] fields = KeyEvent.class.getDeclaredFields();
    for (Field f : fields) {
        if (f.getName().startsWith("KEYCODE")) {
            try {
                int val = f.getInt(null);
                if (val == keyCode) {
                    Timber.d("onKeyDown(%s)", f.getName());
                }/*w  w  w .  j a  v a  2 s .c o  m*/
            } catch (IllegalAccessException e) {
                e.printStackTrace();
            }
        }
    }
    //        switch (keyCode) {
    //            case KeyEvent.KEYCODE_DPAD_RIGHT:
    //            case KeyEvent.KEYCODE_DPAD_LEFT: {
    //                boolean pos = keyCode == KeyEvent.KEYCODE_DPAD_RIGHT;
    //                getMediaController().getTransportControls().sendCustomAction(
    //                        PlaybackService.ACTION.SEEK_DELTA,
    //                        BundleHelper.b().putInt(pos ? 10000 : -10000).get());
    //                return true;
    //            }
    //        }
    //        if (keyCode == KeyEvent.KEYCODE_BUTTON_R1) {
    //            getMediaController().getTransportControls().skipToNext();
    //            return true;
    //        } else if (keyCode == KeyEvent.KEYCODE_BUTTON_L1) {
    //            getMediaController().getTransportControls().skipToPrevious();
    //            return true;
    //        }
    return super.onKeyDown(keyCode, event);
}

From source file:android.support.v7.internal.widget.ListViewCompat.java

protected void positionSelectorCompat(int position, View sel) {
    final Rect selectorRect = mSelectorRect;
    selectorRect.set(sel.getLeft(), sel.getTop(), sel.getRight(), sel.getBottom());

    // Adjust for selection padding.
    selectorRect.left -= mSelectionLeftPadding;
    selectorRect.top -= mSelectionTopPadding;
    selectorRect.right += mSelectionRightPadding;
    selectorRect.bottom += mSelectionBottomPadding;

    try {// w w w.jav a  2 s  .c o m
        // AbsListView.mIsChildViewEnabled controls the selector's state so we need to
        // modify it's value
        final boolean isChildViewEnabled = mIsChildViewEnabled.getBoolean(this);
        if (sel.isEnabled() != isChildViewEnabled) {
            mIsChildViewEnabled.set(this, !isChildViewEnabled);
            if (position != INVALID_POSITION) {
                refreshDrawableState();
            }
        }
    } catch (IllegalAccessException e) {
        e.printStackTrace();
    }
}

From source file:com.woodblockwithoutco.quickcontroldock.model.impl.actions.DataLollipopAction.java

@Override
protected void performActionOff() {
    new AsyncTask<Void, Void, Void>() {
        @Override//from www .j av a2 s .  com
        protected Void doInBackground(Void... args) {
            try {
                mToggleDataMethod.invoke(mTelephonyManager, false);
            } catch (IllegalAccessException e) {
                Log.e(TAG, "Inaccessible data toggle method");
            } catch (IllegalArgumentException e) {
                Log.e(TAG, "Invalid data toggle method signature");
            } catch (InvocationTargetException e) {
                e.printStackTrace();
                Log.e(TAG, "Invalid data toggle method invocation target: " + e.getCause().getMessage());
            }
            return null;
        }

        @Override
        protected void onPostExecute(Void result) {
            LocalBroadcastManager.getInstance(mContext).sendBroadcast(mBroadcastIntent);
        }

    }.execute();
}

From source file:com.woodblockwithoutco.quickcontroldock.model.impl.actions.DataLollipopAction.java

@Override
protected void performActionOn() {

    new AsyncTask<Void, Void, Void>() {
        @Override/*from www  .j ava2  s.c  o m*/
        protected Void doInBackground(Void... args) {
            try {
                mToggleDataMethod.invoke(mTelephonyManager, true);
            } catch (IllegalAccessException e) {
                Log.e(TAG, "Inaccessible data toggle method");
            } catch (IllegalArgumentException e) {
                Log.e(TAG, "Invalid data toggle method signature");
            } catch (InvocationTargetException e) {
                e.printStackTrace();
                Log.e(TAG, "Invalid data toggle method invocation target: " + e.getCause().getMessage());
            }
            return null;
        }

        @Override
        protected void onPostExecute(Void result) {
            LocalBroadcastManager.getInstance(mContext).sendBroadcast(mBroadcastIntent);
        }

    }.execute();
}

From source file:com.happyblueduck.lembas.datastore.LembasEntity.java

/**
 * copies values from  lembasEntity to this entity. skip objectKey from that.
 * @param that/* w  w  w .  j ava2  s .  c o  m*/
 */
public void copy(LembasEntity that) {

    ArrayList<Field> fields = Lists.newArrayList(that.getClass().getFields());
    for (Field f : fields) {
        try {

            int modifiers = f.getModifiers();
            if (Modifier.isPrivate(modifiers))
                continue;
            if (Modifier.isStatic(modifiers))
                continue;
            if (Modifier.isTransient(modifiers))
                continue;
            if (Modifier.isFinal(modifiers))
                continue;
            if (Modifier.isVolatile(modifiers))
                continue;

            if (f.getName().equalsIgnoreCase(LembasUtil.objectKey))
                continue;

            Object value = f.get(that);
            if (value != null)
                this.setField(f, value);

        } catch (IllegalAccessException exception) {
            exception.printStackTrace();
        }
    }
}

From source file:jerry.c2c.action.RegisterAction.java

public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request,
        HttpServletResponse response) throws IOException, ServletException {
    RegisterForm userForm = (RegisterForm) form;
    String target = "message";
    ActionMessages errors = this.getErrors(request);
    MessageResources msgs = this.getResources(request);
    String messageTitle = "error";
    String messageContent = "error";
    String title = "error";
    if (userService == null) {
        target = "message";
        errors.add("fatal", new ActionMessage("errors.fatal"));
    }//from w  w w .  ja  va2 s .  c  o  m
    User user = new User();
    try {
        BeanUtils.copyProperties(user, userForm);
        userService.save(user);
        HttpSession session = request.getSession();
        session.setAttribute("user", user);
        messageTitle = msgs.getMessage("messages.reg_success_title");
        Object[] args = new Object[2];
        args[0] = user.getName();
        args[1] = user.getId();
        messageContent = msgs.getMessage("messages.reg_success_content", args);
        title = msgs.getMessage("pagetitles.register.success");
    } catch (IllegalAccessException e) {
        errors.add("fatal", new ActionMessage("errors.fatal"));
        messageTitle = msgs.getMessage("errors.reg_fail_title");
        messageContent = msgs.getMessage("errors.reg_fail_content");
        title = msgs.getMessage("pagetitles.register.fail");
        e.printStackTrace();
    } catch (InvocationTargetException e) {
        title = msgs.getMessage("pagetitles.register.fail");
        messageTitle = msgs.getMessage("errors.reg_fail_title");
        messageContent = msgs.getMessage("errors.reg_fail_content");
        errors.add("fatal", new ActionMessage("errors.fatal"));
        e.printStackTrace();
    } catch (BusinessException e) {
        title = msgs.getMessage("pagetitles.register.fail");
        messageTitle = msgs.getMessage("errors.reg_fail_title");
        messageContent = msgs.getMessage("errors.reg_fail_content");
        errors.add("user_exists", new ActionMessage("errors.user_exists", user.getName()));
    } finally {
        request.setAttribute("title", title);
        request.setAttribute("message_title", messageTitle);
        request.setAttribute("message_content", messageContent);
    }
    return mapping.findForward(target);
}

From source file:org.rti.zcore.dar.servlet.DynasiteConfigServlet.java

/**
 * Iterates through the forms from the database and makes mods to XML files.
 * Once it is done, it loads these forms into DynaSiteObjects.
 *//*from   ww w  .j a v  a 2 s . c  o  m*/
public static void loadDynaSiteObjects() throws ServletException {
    org.rti.zcore.servlet.DynasiteConfigServlet.loadDynaSiteObjects();
    log.debug("Loading extras for DAR");
    Set formList = DynaSiteObjects.getForms().entrySet();
    for (Iterator iterator = formList.iterator(); iterator.hasNext();) {
        Map.Entry entry = (Map.Entry) iterator.next();
        Form form = (Form) entry.getValue();
        if (form.isEnabled() == true) {
            if (form.getRecordsPerEncounter() != null && form.getRecordsPerEncounter() > 0) {
                if (form.getResizedForPatientBridge() == null) {
                    try {
                        FormUtils.createBridgeTablePageItems(form);
                    } catch (IllegalAccessException e) {
                        log.debug(e);
                    } catch (InstantiationException e) {
                        log.debug(e);
                    } catch (InvocationTargetException e) {
                        log.debug(e);
                    } catch (NoSuchMethodException e) {
                        log.debug(e);
                    }
                }
            }
        }
    }
    Connection conn = null;
    try {
        conn = DatabaseUtils.getZEPRSConnection(Constants.DATABASE_ADMIN_USERNAME);
        try {
            HashMap<Long, StockReport> balanceMap = InventoryDAO.getBalanceMap(conn, null, null, null);
            DynaSiteObjects.getStatusMap().put("balanceMap", balanceMap);
            StockControlDAO.setExpiredStockItems(conn);
            StockControlDAO.setLowStockTasks(conn);
            StockControlDAO.setStockAlertList(conn, null);
        } catch (Exception e) {
            log.debug("Error loading DynaSiteObjects: " + e);
            e.printStackTrace();
        }
    } catch (ServletException e1) {
        // TODO Auto-generated catch block
        e1.printStackTrace();
    } finally {
        try {
            conn.close();
        } catch (SQLException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }

}

From source file:cern.c2mon.shared.common.datatag.address.impl.HardwareAddressImpl.java

/**
 * Returns an XML representation of the HardwareAddress object.
 *
 * @throws RuntimeException if Illegal access to fields
 *//*from  ww  w . j a va 2  s. com*/
public final synchronized String toConfigXML() {
    Class handlerClass = this.getClass();
    Field[] fields = handlerClass.getDeclaredFields();

    StringBuilder str = new StringBuilder();

    str.append("        <HardwareAddress class=\"");
    str.append(getClass().getName());
    str.append("\">\n");

    for (int i = 0; i < fields.length; i++) {
        if (Modifier.isProtected(fields[i].getModifiers()) && !Modifier.isFinal(fields[i].getModifiers())) {
            try {
                if (fields[i].get(this) != null) {
                    str.append("          <");
                    String fieldXMLName = encodeFieldName(fields[i].getName());

                    str.append(fieldXMLName);
                    str.append(">");
                    try {
                        str.append(fields[i].get(this));
                    } catch (IllegalAccessException iae) {
                        iae.printStackTrace();
                    }
                    str.append("</");
                    str.append(fieldXMLName);
                    str.append(">\n");
                }
            } catch (IllegalAccessException iae) {
                iae.printStackTrace();
                throw new RuntimeException("Exception caught while converting HardwareAddress to XML.", iae);
            }
        }
    }

    str.append("        </HardwareAddress>\n");
    return str.toString();
}