Example usage for java.lang SecurityException printStackTrace

List of usage examples for java.lang SecurityException printStackTrace

Introduction

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

Prototype

public void printStackTrace() 

Source Link

Document

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

Usage

From source file:com.github.michalbednarski.intentslab.browser.RegisteredReceiverFetcher.java

@Override
Object getEntries(Context context) {
    try {/*w  ww.  j  a v a  2  s  .com*/
        final Categorizer<RegisteredReceiverInfo> categorizer = new ProcessCategorizer();
        (new RegisteredReceiversParser(mExcludeProtected) {
            @Override
            protected void onReceiverFound(RegisteredReceiverInfo receiverInfo) {
                categorizer.add(receiverInfo);
            }
        }).parse(context);
        return categorizer.getResult();
    } catch (SecurityException e) {
        // Create message about error
        SpannableStringBuilder ssb = new SpannableStringBuilder(
                context.getString(R.string.registered_receivers_denied));
        ssb.append("\n");
        int commandStart = ssb.length();
        if (ComponentFetcher.DEVELOPMENT_PERMISSIONS_SUPPORTED) {
            ssb.append("pm grant ").append(context.getPackageName()).append(" android.permission.DUMP");
        } else {
            ssb.append(RemoteEntryPoint.getScriptFile(context).getAbsolutePath());
        }
        int commandEnd = ssb.length();
        ssb.setSpan(new StyleSpan(Typeface.BOLD), commandStart, commandEnd, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
        return new CustomError(ssb);
    } catch (Throwable e) {
        e.printStackTrace();
        return new CustomError(Utils.describeException(e));
    }
}

From source file:com.canappi.connector.yp.yhere.HomeView.java

public void viewDidLoad() {

    Bundle extras = getIntent().getExtras();
    if (extras != null) {
        Set<String> keys = extras.keySet();
        for (Iterator<String> iter = keys.iterator(); iter.hasNext();) {
            String key = iter.next();
            Class c = SearchView.class;
            try {
                Field f = c.getDeclaredField(key);
                Object extra = extras.get(key);
                String value = extra.toString();
                f.set(this, extras.getString(value));
            } catch (SecurityException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            } catch (NoSuchFieldException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();//from  w ww  . jav  a  2 s. c  o  m
            } catch (IllegalArgumentException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            } catch (IllegalAccessException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
        }
    } else {

    }

    homeViewIds = new HashMap();
    homeViewValues = new HashMap();

    isUserDefault = false;

    String restaurantButtonText = "";
    String restaurantButtonPressedText = "";

    restaurantButton = (Button) findViewById(R.id.restaurantButton);
    restaurantButton.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            // Perform action on click
            goToRestaurantView(v);
        }
    });

    String groceryButtonText = "";
    String groceryButtonPressedText = "";

    groceryButton = (Button) findViewById(R.id.groceryButton);
    groceryButton.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            // Perform action on click
            goToGroceryView(v);
        }
    });

    String gasButtonText = "";
    String gasButtonPressedText = "";

    gasButton = (Button) findViewById(R.id.gasButton);
    gasButton.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            // Perform action on click
            goToGasView(v);
        }
    });

    String teatherButtonText = "";
    String teatherButtonPressedText = "";

    teatherButton = (Button) findViewById(R.id.teatherButton);
    teatherButton.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            // Perform action on click
            goToTeatherView(v);
        }
    });

    String couponButtonText = "";
    String couponButtonPressedText = "";

    couponButton = (Button) findViewById(R.id.couponButton);
    couponButton.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            // Perform action on click
            goToCouponView(v);
        }
    });

    String lubeButtonText = "";
    String lubeButtonPressedText = "";

    lubeButton = (Button) findViewById(R.id.lubeButton);
    lubeButton.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            // Perform action on click
            goToLubeView(v);
        }
    });

    String gameButtonText = "";
    String gameButtonPressedText = "";

    gameButton = (Button) findViewById(R.id.gameButton);
    gameButton.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            // Perform action on click
            goGameView(v);
        }
    });

    String bakeryButtonText = "";
    String bakeryButtonPressedText = "";

    bakeryButton = (Button) findViewById(R.id.bakeryButton);
    bakeryButton.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            // Perform action on click
            goToBakeryView(v);
        }
    });

    String repairButtonText = "";
    String repairButtonPressedText = "";

    repairButton = (Button) findViewById(R.id.repairButton);
    repairButton.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            // Perform action on click
            goToRepairView(v);
        }
    });

    if (isUserDefault) {
        termEditText.setText(retrieveFromUserDefaultsFor("term"), TextView.BufferType.EDITABLE);
    }

    String findButtonText = "Search";
    String findButtonPressedText = "";

    findButton = (Button) findViewById(R.id.findButton);
    findButton.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            // Perform action on click
            goToSearchView(v);
        }
    });
    didSelectViewController();

}

From source file:arc.noaa.weather.activities.MainActivity.java

void getCityByLocation() {
    locationManager = (LocationManager) getSystemService(LOCATION_SERVICE);

    if (ContextCompat.checkSelfPermission(this,
            Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
        if (ActivityCompat.shouldShowRequestPermissionRationale(this,
                Manifest.permission.ACCESS_FINE_LOCATION)) {
            // Explanation not needed, since user requests this himself

        } else {// ww w . j a v a2  s. co m
            ActivityCompat.requestPermissions(this, new String[] { Manifest.permission.ACCESS_FINE_LOCATION },
                    MY_PERMISSIONS_ACCESS_FINE_LOCATION);
        }

    } else if (locationManager.isProviderEnabled(LocationManager.NETWORK_PROVIDER)
            || locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER)) {
        progressDialog = new ProgressDialog(this);
        progressDialog.setMessage(getString(R.string.getting_location));
        progressDialog.setCancelable(false);
        progressDialog.setButton(DialogInterface.BUTTON_NEGATIVE, getString(R.string.dialog_cancel),
                new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialogInterface, int i) {
                        try {
                            locationManager.removeUpdates(MainActivity.this);
                        } catch (SecurityException e) {
                            e.printStackTrace();
                        }
                    }
                });
        progressDialog.show();
        if (locationManager.isProviderEnabled(LocationManager.NETWORK_PROVIDER)) {
            locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0, 0, this);
        }
        if (locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER)) {
            locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, this);
        }
    } else {
        showLocationSettingsDialog();
    }
}

From source file:de.clusteval.framework.ClustevalBackendServer.java

@Override
public Options getOptionsForDataSetGenerator(String generatorName) {
    try {//from w  w w.j a v  a2s.c o m

        DataSetGenerator generator = DataSetGenerator.parseFromString(repository, generatorName);
        return generator.getAllOptions();
    } catch (SecurityException e) {
        e.printStackTrace();
    } catch (IllegalArgumentException e) {
        e.printStackTrace();
    } catch (UnknownDataSetGeneratorException e) {
        e.printStackTrace();
    }
    return null;
}

From source file:de.clusteval.framework.ClustevalBackendServer.java

@Override
public Options getOptionsForDataRandomizer(String randomizerName) {
    try {/*from ww w . java2s  .co m*/

        DataRandomizer randomizer = DataRandomizer.parseFromString(repository, randomizerName);
        return randomizer.getAllOptions();
    } catch (SecurityException e) {
        e.printStackTrace();
    } catch (IllegalArgumentException e) {
        e.printStackTrace();
    } catch (UnknownDataRandomizerException e) {
        e.printStackTrace();
    }
    return null;
}

From source file:com.gmail.boiledorange73.ut.map.MapActivityBase.java

/**
 * Calls invalidateOptionsMenu() if it is possible (in other words, Android
 * 3.0 or higher).// w  ww  .j  av a2 s  .c  om
 */
private void invalidateOptionsMenuIfPossible() {
    try {
        Class<? extends MapActivityBase> clazz = this.getClass();
        if (clazz != null) {
            Method method = clazz.getMethod("invalidateOptionsMenu", (Class[]) null);
            if (method != null) {
                method.invoke(this);
            }
        }
    } catch (SecurityException e) {
        e.printStackTrace();
    } catch (NoSuchMethodException e) {
        e.printStackTrace();
    } catch (IllegalArgumentException e) {
        e.printStackTrace();
    } catch (IllegalAccessException e) {
        e.printStackTrace();
    } catch (InvocationTargetException e) {
        e.printStackTrace();
    }

}

From source file:com.almarsoft.GroundhogReader.MessageListActivity.java

@SuppressWarnings("unchecked")
private void getNewMessagesFromServer(boolean getlatest) {
    Vector<String> groupVector = new Vector<String>(1);
    groupVector.add(mGroup);/*w w w .  j  av a2s . c o m*/
    Class[] noargs = new Class[0];
    Method callback;
    try {
        callback = this.getClass().getMethod("threadMessagesFromDB", noargs);

        mServerManager.setFetchLatest(getlatest);
        mDownloader = new GroupMessagesDownloadDialog(mServerManager, this);
        mDownloader.synchronize(mOfflineMode, groupVector, callback, callback, this);

    } catch (SecurityException e) {
        e.printStackTrace();
    } catch (NoSuchMethodException e) {
        e.printStackTrace();
    }
}

From source file:de.lazyzero.kkMulticopterFlashTool.KKMulticopterFlashTool.java

private void initLogger() {
    try {/* w  w w  .  j a v  a  2  s.  c  o  m*/
        logFile = new FileHandler(LOG_FILE.getAbsolutePath(), false);
        logFile.setFormatter(new SimpleFormatter());
        logFile.setLevel(Level.INFO);
        logger.addHandler(logFile);

    } catch (SecurityException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    logger.setLevel(Level.INFO);
}

From source file:com.hihsoft.baseclass.web.controller.javahihBaseController.java

/**
 * ?//  ww  w . ja v a  2s .c om
 * @param request
 * @param datas
 * @param source
 * @param fieldName
 * @author Xiaojf
 * @since 2011-8-15
 */
public <T> void convertList(List<?> datas, Map<String, T> source, String sourceField, String... fieldNames) {
    if (source == null || fieldNames == null || fieldNames.length == 0)
        return;
    for (String fieldName : fieldNames) {
        String mname = StringHelpers.fistCapital(fieldName);
        Method setter = null;
        Method getter = null;
        for (Object o : datas) {
            try {
                if (setter == null) {
                    try {
                        setter = o.getClass().getDeclaredMethod("set" + mname, String.class);
                    } catch (SecurityException e) {
                        e.printStackTrace();
                    } catch (NoSuchMethodException e) {
                        e.printStackTrace();
                    }
                }
                if (getter == null) {
                    try {
                        getter = o.getClass().getDeclaredMethod("get" + mname);
                    } catch (SecurityException e) {
                        e.printStackTrace();
                    } catch (NoSuchMethodException e) {
                        e.printStackTrace();
                    }
                }
                if (setter != null && getter != null) {
                    T t = null;
                    try {
                        t = (T) source.get(getter.invoke(o));
                    } catch (IllegalArgumentException e) {
                        e.printStackTrace();
                    } catch (IllegalAccessException e) {
                        e.printStackTrace();
                    } catch (InvocationTargetException e) {
                        e.printStackTrace();
                    }
                    String m = StringHelpers.fistCapital(sourceField);
                    if (t != null) {
                        Method gt = null;
                        try {
                            gt = t.getClass().getDeclaredMethod("get" + m);
                        } catch (SecurityException e) {
                            e.printStackTrace();
                        } catch (NoSuchMethodException e) {
                            e.printStackTrace();
                        }
                        if (gt != null)
                            try {
                                setter.invoke(o, gt.invoke(t));
                            } catch (IllegalArgumentException e) {
                                e.printStackTrace();
                            } catch (IllegalAccessException e) {
                                e.printStackTrace();
                            } catch (InvocationTargetException e) {
                                e.printStackTrace();
                            }
                    }
                }
            } catch (ControllerException e) {
            }
        }
    }
}

From source file:com.canappi.connector.yp.yhere.CouponView.java

public void viewDidLoad() {

    Bundle extras = getIntent().getExtras();
    if (extras != null) {
        Set<String> keys = extras.keySet();
        for (Iterator<String> iter = keys.iterator(); iter.hasNext();) {
            String key = iter.next();
            Class c = SearchView.class;
            try {
                Field f = c.getDeclaredField(key);
                Object extra = extras.get(key);
                String value = extra.toString();
                f.set(this, extras.getString(value));
            } catch (SecurityException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            } catch (NoSuchFieldException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();//from   w ww  .  j  a va 2s  .c  om
            } catch (IllegalArgumentException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            } catch (IllegalAccessException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
        }
    } else {

    }

    couponViewIds = new HashMap();
    couponViewValues = new HashMap();

    isUserDefault = false;

    resultsListView = (ListView) findViewById(R.id.resultsTable);
    resultsAdapter = new ResultsEfficientAdapter(this);

    businessNameArray = new ArrayList<String>();

    couponDescriptionArray = new ArrayList<String>();

    couponIdArray = new ArrayList<String>();

    phoneNumberArray = new ArrayList<String>();

    callArray = new ArrayList<String>();

    streetArray = new ArrayList<String>();

    cityArray = new ArrayList<String>();
    resultsListView.setAdapter(resultsAdapter);
    didSelectViewController();

}