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:com.cranberrygame.cordova.plugin.game.Util.java

private void _showLeaderboard(String leaderboardId) {
    try {/*from w w w . jav  a 2 s.c  om*/
        //show a specific leaderboard
        this.cordova.getActivity().startActivityForResult(
                Games.Leaderboards.getLeaderboardIntent(getGameHelper().getApiClient(), leaderboardId), 0);
    } catch (SecurityException ex) {
        Log.d(LOG_TAG, String.format("%s", ex.getMessage()));
    }
}

From source file:com.cranberrygame.cordova.plugin.game.Util.java

private void _showLeaderboards() {
    try {/*from ww  w . j a  v  a 2 s . co  m*/
        //show all leaderboards
        this.cordova.getActivity().startActivityForResult(
                Games.Leaderboards.getAllLeaderboardsIntent(getGameHelper().getApiClient()), 0);
        //this.cordova.getActivity().startActivityFor(Games.Leaderboards.getAllLeaderboardsIntent(getGameHelper().getApiClient()));      
    } catch (SecurityException ex) {
        Log.d(LOG_TAG, String.format("%s", ex.getMessage()));
    }
}

From source file:com.klaasnotfound.locationassistant.LocationAssistant.java

private void requestLocationUpdates() {
    if (!googleApiClient.isConnected() || !permissionGranted || !locationRequested)
        return;//from w  w  w  .  ja v  a 2 s  .c  om
    try {
        LocationServices.FusedLocationApi.requestLocationUpdates(googleApiClient, locationRequest, this);
        updatesRequested = true;
    } catch (SecurityException e) {
        if (!quiet)
            Log.e(getClass().getSimpleName(), "Error while requesting location updates:\n " + e.toString());
        if (listener != null)
            listener.onError(ErrorType.RETRIEVAL, "Could not request location updates:\n" + e.getMessage());
    }
}

From source file:com.klaasnotfound.locationassistant.LocationAssistant.java

private boolean checkLocationAvailability() {
    if (!googleApiClient.isConnected() || !permissionGranted)
        return false;
    try {//from w  ww .  j  a  va 2  s .  c  om
        LocationAvailability la = LocationServices.FusedLocationApi.getLocationAvailability(googleApiClient);
        return (la != null && la.isLocationAvailable());
    } catch (SecurityException e) {
        if (!quiet)
            Log.e(getClass().getSimpleName(), "Error while checking location availability:\n " + e.toString());
        if (listener != null)
            listener.onError(ErrorType.RETRIEVAL, "Could not check location availability:\n" + e.getMessage());
        return false;
    }
}

From source file:com.landenlabs.all_devtool.GpsFragment.java

@Override
public void onGpsStatusChanged(int event) {
    if (getActivity() != null) {
        final LocationManager locMgr = (LocationManager) getActivity()
                .getSystemService(Context.LOCATION_SERVICE);

        try {//  w  w  w  .  j  ava2 s  .c o m
            gpsStatus = locMgr.getGpsStatus(gpsStatus);
            String msg = "";
            switch (event) {
            case GpsStatus.GPS_EVENT_STARTED:
                msg = "GPS event started";
                break;
            case GpsStatus.GPS_EVENT_STOPPED:
                msg = "GPS event stopped";
                break;
            case GpsStatus.GPS_EVENT_FIRST_FIX:
                msg = "GPS first fix";
                break;
            case GpsStatus.GPS_EVENT_SATELLITE_STATUS:
                msg = "GPS sat status";
                break;
            }

            if (TextUtils.isEmpty(msg)) {
                addMsgToDetailRow(s_colorGps, msg);
                GpsItem gpsItem = m_lastUpdates.get(STATUS_CB);
                if (gpsItem != null) {
                    gpsItem.set(System.currentTimeMillis(), msg);
                    listChanged();
                }
            }
            showProviders();
        } catch (SecurityException ex) {
            Log.e(TAG, ex.getMessage());
        }
    }
}

From source file:org.apache.directory.fortress.core.ReviewMgrConsole.java

/**
 * Description of the Method//from  w w w.j a v  a 2s  . com
 */
void searchPermissions() {
    Permission pe;
    /*
       *  This is the Fortress Logical Data Model for Perm:
       *  public class Perm
       *  implements java.io.Serializable
       *  {
       *  public void setInternalId()
       *  public void setInternalId(String internalId)
       *  public String getInternalId()
       *  public void setName(String name)
       *  public String getName()
       *  public void setDescription(String description)
       *  public String getDescription()
       *  public void addRole(String name)
       *  public List getRoles()
       *  public void addRoles(ArrayList roles)
       *  public void addUser(String user)
       *  public List getUsers()
       *  public void addUsers(ArrayList users)
       *  public void addGroup(String group)
       *  public List getGroups()
       *  public void addGroups(ArrayList groups)
       *  public void addProperty(String key, String value)
       *  public void addProperties(Properties props)
       *  public Properties getProperties()
       *  public String getProperty(String key)
       *  public void setOu(String ou)
       *  public String getOu()
       *  public void setType(String type)
       *  public String getType()
       *  public void setDn(String dn)
       *  public String getDn()
       *  public void addFinePerm(FinePerm fPerm)
       *  public HashMap getFinePerms()
       *  public void addFinePerms(HashMap fPerms)
       *  }
       *  public class FinePerm
       *  implements java.io.Serializable
       *  {
       *  public String getObjName()
       *  public void setObjName(String objName)
       *  public void addRole(String name)
       *  public List getRoles()
       *  public void addUser(String user)
       *  public List getUsers()
       *  public void addGroup(String group)
       *  public List getGroups()
       *  }
       */
    try {
        //ReaderUtil.clearScreen();
        //System.out.println("Enter operationid");

        System.out.println("Enter object name:");
        String name = ReaderUtil.readLn();
        System.out.println("Enter op name:");
        String opname = ReaderUtil.readLn();
        pe = new Permission();
        pe.setObjName(name);
        pe.setOpName(opname);
        List list = rm.findPermissions(pe);
        if (list != null) {
            for (int i = 0; i < list.size(); i++) {
                pe = (Permission) list.get(i);
                System.out.println("**perm:" + (i + 1) + "***");
                //System.out.println("perm operation [" + pe.operation + "]");
                System.out.println("object name [" + pe.getObjName() + "]");
                System.out.println("object id [" + pe.getObjId() + "]");
                System.out.println("operation name [" + pe.getOpName() + "]");
                System.out.println("abstract perm name [" + pe.getAbstractName() + "]");
                System.out.println("internalId [" + pe.getInternalId() + "]");
                if (pe.getUsers() != null && pe.getUsers().size() > 0) {
                    int ctr = 0;
                    for (String user : pe.getUsers()) {
                        System.out.println("user[" + ctr++ + "]=" + user);
                    }
                }
                if (pe.getRoles() != null && pe.getRoles().size() > 0) {
                    int ctr = 0;
                    for (String role : pe.getRoles()) {
                        System.out.println("name[" + ctr++ + "]=" + role);
                    }
                }
                if (pe.getProperties() != null && pe.getProperties().size() > 0) {
                    int ctr = 0;
                    for (Enumeration e = pe.getProperties().propertyNames(); e.hasMoreElements();) {
                        String key = (String) e.nextElement();
                        String val = pe.getProperty(key);
                        System.out.println("prop key[" + ctr + "]=" + key);
                        System.out.println("prop value[" + ctr++ + "]=" + val);
                    }
                }

                //prettyPrintFinePermissions(pe.getFinePerms());
                System.out.println("**");
            }
            System.out.println("search complete");
            System.out.println("ENTER to continue");
        }
    } catch (SecurityException e) {
        LOG.error("searchPermissions caught SecurityException rc=" + e.getErrorId() + ", msg=" + e.getMessage(),
                e);
    }
    ReaderUtil.readChar();
}

From source file:com.cranberrygame.cordova.plugin.game.Util.java

private void _submitScore(String leaderboardId, int score) {
    /*   //from w  w  w.  j  ava 2  s. c o m
          //https://developers.google.com/games/services/android/leaderboards
          Games.Leaderboards.submitScore(getGameHelper().getApiClient(), leaderboardId, score);         
    */
    ///*      
    //http://stackoverflow.com/questions/22896713/listener-for-leaderboard-in-google-game-services
    //https://developer.android.com/reference/gms-packages.html
    //https://developer.android.com/reference/com/google/android/gms/games/leaderboard/package-summary.html
    //https://developer.android.com/reference/com/google/android/gms/games/leaderboard/Leaderboards.html
    //https://developer.android.com/reference/com/google/android/gms/games/leaderboard/Leaderboards.html#submitScoreImmediate(com.google.android.gms.common.api.GoogleApiClient, java.lang.String, long)

    class ResultCallbackSubmitScoreResult implements ResultCallback<Leaderboards.SubmitScoreResult> {
        @Override
        public void onResult(Leaderboards.SubmitScoreResult result) {
            //https://developer.android.com/reference/com/google/android/gms/games/leaderboard/Leaderboards.SubmitScoreResult.html
            if (result.getStatus().getStatusCode() == GamesStatusCodes.STATUS_OK) {
                // data sent successfully to server.
                // display toast.

                PluginResult pr = new PluginResult(PluginResult.Status.OK);
                //pr.setKeepCallback(true);
                submitScoreCC.sendPluginResult(pr);
                //PluginResult pr = new PluginResult(PluginResult.Status.ERROR);
                //pr.setKeepCallback(true);
                //submitScoreCC.sendPluginResult(pr);
            } else {
                //PluginResult pr = new PluginResult(PluginResult.Status.OK);
                //pr.setKeepCallback(true);
                //submitScoreCC.sendPluginResult(pr);
                PluginResult pr = new PluginResult(PluginResult.Status.ERROR);
                //pr.setKeepCallback(true);
                submitScoreCC.sendPluginResult(pr);
            }
        }
    }
    //Games.Leaderboards.submitScoreImmediate(getGameHelper().getApiClient(), leaderboardId, score).setResultCallback(new ResultCallbackSubmitScoreResult());
    try {
        Games.Leaderboards.submitScoreImmediate(getGameHelper().getApiClient(), leaderboardId, score)
                .setResultCallback(new ResultCallbackSubmitScoreResult());
    } catch (SecurityException ex) {
        Log.d(LOG_TAG, String.format("%s", ex.getMessage()));
    }
    //*/
}

From source file:com.orange.oidc.tim.service.Service.java

public void connectSEService() {
    // check if not already connected
    if (SIMStorage.seService != null) {
        if (SIMStorage.seService.isConnected())
            return;
    }//w w  w . j  a  va 2 s  . co  m

    // instantiate SEService object
    try {
        Logd(TAG, "creating SEService object");
        SIMStorage.seService = new SEService(this, this);
    } catch (SecurityException e) {
        Log.e(TAG, "Binding not allowed, uses-permission org.simalliance.openmobileapi.SMARTCARD?");
    } catch (Exception e) {
        Log.e(TAG, "connectSEService exception: " + e.getMessage());
    }
}

From source file:org.csploit.android.services.UpdateService.java

@Override
protected void onHandleIntent(Intent intent) {
    mCurrentTask = (Update) intent.getSerializableExtra(UPDATE);
    boolean exitForError = true;

    if (mCurrentTask == null) {
        Logger.error("received null update");
        return;/*from w  w  w.  java  2 s. c  om*/
    }

    mRunning = true;

    try {
        setupNotification();

        mCurrentTask.errorOccurred = true;
        if (!haveLocalFile())
            downloadFile();

        if (mCurrentTask instanceof CoreUpdate)
            System.shutdownCoreDaemon();

        extract();

        if (mCurrentTask instanceof MsfUpdate)
            installGems();

        deleteTemporaryFiles();
        createVersionFile();

        mCurrentTask.errorOccurred = exitForError = false;

        sendDone();
    } catch (SecurityException e) {
        sendError(R.string.bad_permissions);
        Logger.warning(e.getClass().getName() + ": " + e.getMessage());
    } catch (KeyException e) {
        sendError(R.string.checksum_failed);
        Logger.warning(e.getClass().getName() + ": " + e.getMessage());
    } catch (CancellationException e) {
        sendError(R.string.update_cancelled);
        Logger.warning(e.getClass().getName() + ": " + e.getMessage());
    } catch (NoSuchAlgorithmException | RuntimeException | ChildManager.ChildDiedException
            | ChildManager.ChildNotStartedException | InterruptedException | IOException e) {
        sendError(R.string.error_occured);
        System.errorLogging(e);
    } finally {
        if (exitForError) {
            if (mCurrentTask instanceof MsfUpdate)
                clearGemsCache();
            if (!(mCurrentTask instanceof CoreUpdate))
                wipe();
        }
        stopSelf();
        mRunning = false;
    }
}

From source file:org.sakaiproject.assignment2.logic.impl.ExternalGradebookLogicImpl.java

public void saveGradeAndCommentForStudent(String contextId, Long gradebookItemId, String studentId,
        String grade, String comment) {
    if (contextId == null || gradebookItemId == null || studentId == null) {
        throw new IllegalArgumentException("Null contextId or gradebookItemId "
                + "or studentId passed to saveGradeAndCommentForStudent. contextId:" + contextId + " studentId:"
                + studentId + " gradebookItemId:" + gradebookItemId);
    }//from   w  ww  .  j  av a  2  s . c om

    try {
        gradebookService.saveGradeAndCommentForStudent(contextId, gradebookItemId, studentId, grade, comment);
        if (log.isDebugEnabled())
            log.debug("Grade and comment for student " + studentId + " for gbItem " + gradebookItemId
                    + "updated successfully");
    } catch (GradebookNotFoundException gnfe) {
        throw new NoGradebookDataExistsException("No gradebook exists in the given context " + contextId, gnfe);
    } catch (AssessmentNotFoundException anfe) {
        throw new GradebookItemNotFoundException(
                "No gradebook item exists with the given id " + gradebookItemId, anfe);
    } catch (InvalidGradeException ige) {
        throw new InvalidGradeForAssignmentException(
                "The grade: " + grade + " for gradebook " + contextId + " is invalid.", ige);
    } catch (SecurityException se) {
        throw new SecurityException("The current user attempted to saveGradeAndCommentForStudent "
                + "without authorization. Error: " + se.getMessage(), se);
    }
}