Example usage for java.lang SecurityException getMessage

List of usage examples for java.lang SecurityException getMessage

Introduction

In this page you can find the example usage for java.lang SecurityException getMessage.

Prototype

public String getMessage() 

Source Link

Document

Returns the detail message string of this throwable.

Usage

From source file:org.apache.ivy.util.url.HttpClientHandler.java

private HttpClientHelper getHttpClientHelper() {
    if (httpClientHelper == null) {
        // use commons httpclient 3.0 if available
        try {//from   w w  w  .  java2  s.co m
            HttpMethodBase.class.getMethod("getResponseContentLength", new Class[0]);
            httpClientHelper = new HttpClientHelper3x();
            Message.verbose("using commons httpclient 3.x helper");
        } catch (SecurityException e) {
            Message.verbose("unable to get access to getResponseContentLength of "
                    + "commons-httpclient HeadMethod. Please use commons-httpclient 3.0 or "
                    + "use ivy with sufficient security permissions.");
            Message.verbose("exception: " + e.getMessage());
            httpClientHelper = new HttpClientHelper2x();
            Message.verbose("using commons httpclient 2.x helper");
        } catch (NoSuchMethodException e) {
            httpClientHelper = new HttpClientHelper2x();
            Message.verbose("using commons httpclient 2.x helper");
        }
    }
    return httpClientHelper;
}

From source file:hudson.gridmaven.MavenBuilder.java

private void callSetListenerWithReflectOnInterceptorsQuietly(PluginManagerListener pluginManagerListener,
        ClassLoader cl) {//from  ww  w  . j av  a2  s .c  o m
    try {
        callSetListenerWithReflectOnInterceptors(pluginManagerListener, cl);
    } catch (SecurityException e) {
        throw new RuntimeException(e.getMessage(), e);
    } catch (IllegalArgumentException e) {
        throw new RuntimeException(e.getMessage(), e);
    } catch (ClassNotFoundException e) {
        throw new RuntimeException(e.getMessage(), e);
    } catch (NoSuchMethodException e) {
        throw new RuntimeException(e.getMessage(), e);
    } catch (IllegalAccessException e) {
        throw new RuntimeException(e.getMessage(), e);
    } catch (InvocationTargetException e) {
        throw new RuntimeException(e.getMessage(), e);
    }
}

From source file:us.socialgoodworking.mocklocation.MockLocationActivity.java

@Override
public void onCreate(Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    Logging.debug(TAG, TAG, "onCreate");

    getSupportActionBar().setDisplayShowTitleEnabled(true);
    getSupportActionBar().setDisplayUseLogoEnabled(true);
    Drawable d = getResources().getDrawable(R.drawable.socialgoodworking_ab_back1);
    getSupportActionBar().setBackgroundDrawable(d);

    btnStartStop = (Button) findViewById(R.id.btnStartStop);
    btnStartStop.setVisibility(View.GONE);

    btnStartStop.setOnClickListener(clickListener);
    btnStartStop.setTextColor(getResources().getColorStateList(R.color.button_colors));

    currentRouteLocationIndex = 0;//from w w  w  .j  av  a  2 s  .  c  o  m

    if (savedInstanceState != null) {
        Logging.debug(TAG, "onCreate", "savedInstanceState != null");
        double lat;
        double lng;

        currentMode = savedInstanceState.getInt("mode", TAP_MODE);
        bStarted = savedInstanceState.getBoolean("started", false);

        lat = savedInstanceState.getDouble("currentLat", defaultLatLng.latitude);
        lng = savedInstanceState.getDouble("currentLng", defaultLatLng.longitude);
        currentLatLng = new LatLng(lat, lng);

        lat = savedInstanceState.getDouble("previousLat", defaultLatLng.latitude);
        lng = savedInstanceState.getDouble("previousLng", defaultLatLng.longitude);
        previousLatLng = new LatLng(lat, lng);

        currentRoute = savedInstanceState.getString("currentRoute");
        currentRouteLocationIndex = savedInstanceState.getInt("index", 0);
    } else {
        Logging.debug(TAG, "onCreate", "savedInstanceState =!= null");
        currentMode = TAP_MODE;
        currentRoute = "";
    }

    try {
        mockLocation = new MockLocation.MockLocationBuilder(getApplicationContext(), providerName).build();
        mockLocation.removeProvider();
        mockLocation.setUpMockProvider();
        Logging.debug(TAG, "onCreate", "mockLocation instance created");
    }

    catch (SecurityException se) {
        Logging.debug(TAG, "onCreate", se.getMessage());
        mockPermissionEnabled = false;
        showSecurityErrorDlg();
    }

    setUpMapIfNeeded();

    handler = new Handler();
}

From source file:net.lightbody.bmp.proxy.jetty.http.handler.ResourceHandler.java

void handleDelete(HttpRequest request, HttpResponse response, String pathInContext, Resource resource)
        throws IOException {
    if (log.isDebugEnabled())
        log.debug("DELETE " + pathInContext + " from " + resource);

    if (!resource.exists() || !passConditionalHeaders(request, response, resource))
        return;//from w w  w .j a v  a2  s  .co m

    try {
        // delete the file
        if (resource.delete())
            response.setStatus(HttpResponse.__204_No_Content);
        else
            response.sendError(HttpResponse.__403_Forbidden);

        // Send response
        request.setHandled(true);
    } catch (SecurityException sex) {
        log.warn(LogSupport.EXCEPTION, sex);
        response.sendError(HttpResponse.__403_Forbidden, sex.getMessage());
    }
}

From source file:org.gots.ui.NewSeedActivity.java

private void monthFilter(DatePicker picker) {
    try {/*from  w w w . j  a v a 2 s  .  co m*/
        Field f[] = picker.getClass().getDeclaredFields();
        for (Field field : f) {
            if (field.getName().equals("mDaySpinner")) {
                field.setAccessible(true);
                Object dayPicker = new Object();
                dayPicker = field.get(picker);
                ((View) dayPicker).setVisibility(View.GONE);
            }
            if (field.getName().equals("mYearSpinner")) {
                field.setAccessible(true);
                Object dayPicker = new Object();
                dayPicker = field.get(picker);
                ((View) dayPicker).setVisibility(View.GONE);
            }
        }
    } catch (SecurityException e) {
        Log.d("ERROR", e.getMessage());
    } catch (IllegalArgumentException e) {
        Log.d("ERROR", e.getMessage());
    } catch (IllegalAccessException e) {
        Log.d("ERROR", e.getMessage());
    }
}

From source file:com.viettel.vfw5.base.dao.BaseFWDAOImpl.java

public String saveList(List<T> obj, String methodName, Session session) {

    try {/*from   w w w .  j ava2 s.c o  m*/
        for (T item : obj) {
            session.saveOrUpdate(item);
        }
    } catch (SecurityException ex) {
        return ex.getMessage();
    }
    return ParamUtils.SUCCESS;

}

From source file:com.snaplogic.snaps.firstdata.Create.java

private Object getObject(String path, Map<String, Object> map) {
    boolean isMethodInvokedAtOnce = false;
    Class<?> classType = getClassType(path);
    Object subClazInstance = getInstance(classType);
    String inputFieldName;//  w ww.  ja va 2s  .c o m
    String returnClazType;
    String returnClazName;
    for (Method method : findSetters(classType)) {
        inputFieldName = getFieldName(method.getName());
        if (!map.containsKey(inputFieldName)) {
            continue;
        }
        returnClazType = method.getParameterTypes()[0].getName();
        try {
            Object paramObj = null;
            if (returnClazType.startsWith(FD_PROXY_PKG_PREFIX) && !returnClazType.endsWith(TYPE)) {
                returnClazName = method.getParameterTypes()[0].getSimpleName();
                Object subMap = map.get(returnClazName);
                if (subMap == null) {
                    continue;
                }
                paramObj = getObject(returnClazType, Map.class.cast(subMap));
                paramObj = setArrayObj(paramObj, returnClazType, Map.class.cast(subMap));
            } else if (returnClazType.endsWith(TYPE)) {
                paramObj = getTypesInstance(returnClazType, (String) map.get(inputFieldName));
            } else if (returnClazType.endsWith(String.class.getSimpleName())) {
                paramObj = map.get(inputFieldName);
            }
            if (paramObj != null) {
                if (method.getParameterTypes()[0].isArray()) {
                    paramObj = paramObj.toString().getBytes();
                }
                method.invoke(subClazInstance, paramObj);
                isMethodInvokedAtOnce = true;
            }
        } catch (SecurityException e) {
            log.error(e.getMessage(), e);
            writeToErrorView(SECURITY_EXE, e.getMessage(), SECURITY_EXE_RES, e);
        } catch (IllegalArgumentException e) {
            log.error(e.getMessage(), e);
            writeToErrorView(String.format(ILLEGAL_ARGS_EXE, method.getName()), e.getMessage(),
                    ERROR_RESOLUTION, e);
        } catch (InvocationTargetException e) {
            log.error(e.getMessage(), e);
            writeToErrorView(e.getTargetException().getMessage(), e.getMessage(), ERROR_RESOLUTION, e);
        } catch (IllegalAccessException e) {
            log.error(e.getMessage(), e);
            writeToErrorView(String.format(ILLIGAL_ACCESS_EXE, method.getName()), e.getMessage(),
                    ILLIGAL_ACCESS_EXE_RES, e);
        } catch (Exception e) {
            log.error(e.getMessage(), e);
            writeToErrorView(ERRORMSG, e.getMessage(), ERROR_RESOLUTION, e);
        }
    }
    return (isMethodInvokedAtOnce) ? subClazInstance : null;
}

From source file:org.apache.ofbiz.pricat.AbstractPricatParser.java

protected void cleanupLogAndCommentedExcel() {
    try {/*from  ww w.  j av  a  2 s.  c o m*/
        report.print(UtilProperties.getMessage(resource, "CLEANUP_LOGANDEXCEL_BEGIN", locale),
                InterfaceReport.FORMAT_DEFAULT);
        List<GenericValue> historyValues = delegator.findByAnd("ExcelImportHistory",
                UtilMisc.toMap("userLoginId", userLoginId), UtilMisc.toList("sequenceNum DESC"), false);
        if (UtilValidate.isEmpty(historyValues) || historyValues.size() <= HISTORY_MAX_FILENUMBER) {
            report.print(
                    UtilProperties.getMessage(resource, "HistoryLessThan",
                            new Object[] { String.valueOf(HISTORY_MAX_FILENUMBER) }, locale),
                    InterfaceReport.FORMAT_NOTE);
            report.println(" ... " + UtilProperties.getMessage(resource, "skipped", locale),
                    InterfaceReport.FORMAT_NOTE);
        } else {
            report.print(
                    " ... " + UtilProperties.getMessage(resource, "HistoryEntryToRemove",
                            new Object[] { historyValues.size() - HISTORY_MAX_FILENUMBER }, locale),
                    InterfaceReport.FORMAT_NOTE);
            List<GenericValue> valuesToRemove = new ArrayList<GenericValue>();
            for (int i = HISTORY_MAX_FILENUMBER; i < historyValues.size(); i++) {
                GenericValue historyValue = historyValues.get(i);
                valuesToRemove.add(historyValue);
                File excelFile = FileUtil.getFile(
                        tempFilesFolder + userLoginId + "/" + historyValue.getLong("sequenceNum") + ".xlsx");
                if (excelFile.exists()) {
                    try {
                        excelFile.delete();
                    } catch (SecurityException e) {
                        Debug.logError(e.getMessage(), module);
                        report.print(e.getMessage(), InterfaceReport.FORMAT_ERROR);
                    }
                }
                File logFile = FileUtil.getFile(
                        tempFilesFolder + userLoginId + "/" + historyValue.getLong("sequenceNum") + ".log");
                if (logFile.exists()) {
                    try {
                        logFile.delete();
                    } catch (SecurityException e) {
                        Debug.logError(e.getMessage(), module);
                        report.print(e.getMessage(), InterfaceReport.FORMAT_ERROR);
                    }
                }
            }
            delegator.removeAll(valuesToRemove);
            report.println(" ... " + UtilProperties.getMessage(resource, "ok", locale),
                    InterfaceReport.FORMAT_OK);
        }
        report.println();
    } catch (GenericEntityException e) {
        Debug.logError(e.getMessage(), module);
    }
}

From source file:org.sakaiproject.kernel.rest.friends.RestFriendsProvider.java

/**
 * {@inheritDoc}//from   w w  w.j a va 2  s  . c  o m
 *
 * @see org.sakaiproject.kernel.api.rest.RestProvider#dispatch(java.lang.String[],
 *      javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
 */
public void dispatch(String[] elements, HttpServletRequest request, HttpServletResponse response) {
    try {
        FriendsParams params = new FriendsParams(elements, request, sessionManagerService,
                userEnvironmentResolverService);
        Map<String, Object> map = Maps.newHashMap();
        switch (params.major) {
        case connect:
            if (!"POST".equals(request.getMethod())) {
                throw new RestServiceFaultException(HttpServletResponse.SC_METHOD_NOT_ALLOWED);
            }
            switch (params.minor) {
            case request:
                map = doRequestConnect(params, request, response);
                break;
            case accept:
                map = doAcceptConnect(params, request, response);
                break;
            case cancel:
                map = doCancelConnect(params, request, response);
                break;
            case reject:
                map = doRejectConnect(params, request, response);
                break;
            case ignore:
                map = doIgnoreConnect(params, request, response);
                break;
            case remove:
                map = doRemoveConnect(params, request, response);
                break;
            default:
                doRequestError();
                break;
            }
            break;
        case status:
            if (!"GET".equals(request.getMethod())) {
                throw new RestServiceFaultException(HttpServletResponse.SC_METHOD_NOT_ALLOWED);
            }
            map = doStatus(params, request, response);
            break;
        default:
            doRequestError();
            break;
        }

        if (map != null) {
            String responseBody = beanConverter.convertToString(map);
            response.setContentType(RestProvider.CONTENT_TYPE);
            response.getOutputStream().print(responseBody);
        }
    } catch (SecurityException ex) {
        throw ex;
    } catch (RestServiceFaultException ex) {
        throw ex;
    } catch (Exception ex) {
        throw new RestServiceFaultException(ex.getMessage(), ex);
    }
}

From source file:com.viettel.vfw5.base.dao.BaseFWDAOImpl.java

@Transactional
public String saveList(List<T> obj, String methodName) {

    try {/*from   w  w  w  . j a  va2 s  . c  om*/
        session = getSession(); // tiepnv6 edit 27/07/15 16h:51
        for (T item : obj) {
            session.saveOrUpdate(item);
        }

        //            Class c = obj.get(0).getClass();
        //            Method method = c.getMethod("get" + StringUtils.upperFirstChar(methodName));
        //
        //            for (T item : obj) {
        //                String value;
        //                try {
        //                    value = String.valueOf(method.invoke(item));
        //
        //                } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
        //                    return ParamUtils.ERROR;
        //                }
        //
        //                if (value == "null") {
        //                    getSession().saveOrUpdate(item);
        //                } else {
        //                    getSession().update(item);
        //                }
        //            }
    } catch (SecurityException ex) {
        return ex.getMessage();
    }
    return ParamUtils.SUCCESS;

}