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:au.com.addstar.truehardcore.TrueHardcore.java

@Override
public void onEnable() {
    instance = this;

    // This block configure the logger with handler and formatter  
    try {/*from   w  w w  . j  a v  a  2s  . c o m*/
        debuglog.setUseParentHandlers(false);
        debugfh = new FileHandler("plugins/TrueHardcore/debug.log", true);
        Util.LogFormatter formatter = new Util.LogFormatter();
        debugfh.setFormatter(formatter);
        debuglog.addHandler(debugfh);
    } catch (SecurityException e) {
        e.printStackTrace();
    } catch (IOException e) {
        e.printStackTrace();
    }

    // Grab that plugin manager!
    pdfFile = this.getDescription();
    pm = this.getServer().getPluginManager();

    // Check if vault is loaded (required for economy)
    VaultEnabled = setupEconomy();
    if (VaultEnabled) {
        Log("Found Vault! Hooking for economy!");
    } else {
        Log("Vault was not detected! Economy rewards are not available.");
    }

    Plugin p = pm.getPlugin("LWC");
    if (p != null && p instanceof LWCPlugin) {
        LWCHooked = true;
        lwc = ((LWCPlugin) p).getLWC();
        Log("LWC Found, hooking into LWC.");
    } else {
        LWCHooked = false;
        Log("LWC not Found");
    }

    p = pm.getPlugin("Prism");
    if (p != null && p instanceof Prism) {
        LBHooked = true;
        prism = (Prism) p;
        Log("Prism found, hooking it.");
    } else {
        LBHooked = false;
        Log("Prism not found! This won't work very well...");
    }

    p = pm.getPlugin("WorldBorder");
    if (p != null && p instanceof WorldBorder) {
        WBHooked = true;
        wb = WorldBorder.plugin;
        Log("WorldBorder found, hooking it.");
    } else {
        WBHooked = false;
        Log("WorldBorder not found! Spawning will not be limited...");
    }

    p = pm.getPlugin("BungeeChatBukkit");
    if (p != null && p instanceof BungeeChat) {
        BCHooked = true;
        Log("BungeeChat found, hooking it.");
    } else {
        BCHooked = false;
        Log("BungeeChat not found! No cross server messages");
    }

    p = pm.getPlugin("VanishNoPacket");
    if (p != null && p instanceof VanishPlugin) {
        VNPHooked = true;
        vnp = ((VanishPlugin) p).getManager();
        Log("VanishNoPacket found, hooking it.");
    } else {
        WBHooked = false;
        Log("VanishNoPacket not found! Vanished players will not be unvanished...");
    }

    // Read (or initialise) plugin config file
    cfg.LoadConfig(getConfig());

    // Save the default config (if one doesn't exist)
    saveDefaultConfig();

    // Open/initialise the database
    dbcon = new Database(this);
    if (dbcon.IsConnected) {
        Log("Successfully connected to the database.");
        Log("Loading players from database...");
        LoadAllPlayers();
    } else {
        Log(pdfFile.getName() + " " + pdfFile.getVersion() + " could not be enabled!");
        this.setEnabled(false);
        return;
    }

    Log("Registering commands and events...");
    getCommand("truehardcore").setExecutor(new CommandTH(this));
    getCommand("th").setExecutor(new CommandTH(this));

    pm.registerEvents(new PlayerListener(this), this);

    // Set auto save timer
    if (AutoSaveEnabled) {
        Log("Launching auto-save timer (every 5 minutes)...");
        getServer().getScheduler().runTaskTimer(this, new Runnable() {
            @Override
            public void run() {
                SaveIngamePlayers();
            }
        }, 300 * 20L, 300 * 20L);
    }

    Log(pdfFile.getName() + " " + pdfFile.getVersion() + " has been enabled");
}

From source file:com.canappi.connector.yp.yhere.BakeryView.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  w  w .j  av a2s .co m*/
            } catch (IllegalArgumentException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            } catch (IllegalAccessException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
        }
    } else {

    }

    bakeryViewIds = new HashMap();
    bakeryViewValues = new HashMap();

    isUserDefault = false;

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

    businessNameArray = new ArrayList<String>();

    latitudeArray = new ArrayList<String>();

    longitudeArray = new ArrayList<String>();

    listingIdArray = new ArrayList<String>();

    phoneArray = new ArrayList<String>();

    callArray = new ArrayList<String>();

    streetArray = new ArrayList<String>();

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

}

From source file:com.canappi.connector.yp.yhere.GameView.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 www.j a va 2s.c  o  m
            } catch (IllegalArgumentException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            } catch (IllegalAccessException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
        }
    } else {

    }

    gameViewIds = new HashMap();
    gameViewValues = new HashMap();

    isUserDefault = false;

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

    businessNameArray = new ArrayList<String>();

    latitudeArray = new ArrayList<String>();

    longitudeArray = new ArrayList<String>();

    listingIdArray = new ArrayList<String>();

    phoneArray = new ArrayList<String>();

    callArray = new ArrayList<String>();

    streetArray = new ArrayList<String>();

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

}

From source file:com.canappi.connector.yp.yhere.GasStationView.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  w w .ja  v a 2  s.co  m*/
            } catch (IllegalArgumentException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            } catch (IllegalAccessException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
        }
    } else {

    }

    gasStationViewIds = new HashMap();
    gasStationViewValues = new HashMap();

    isUserDefault = false;

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

    businessNameArray = new ArrayList<String>();

    latitudeArray = new ArrayList<String>();

    longitudeArray = new ArrayList<String>();

    listingIdArray = new ArrayList<String>();

    phoneArray = new ArrayList<String>();

    callArray = new ArrayList<String>();

    streetArray = new ArrayList<String>();

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

}

From source file:com.canappi.connector.yp.yhere.GroceryView.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  w  w .  j a  v  a2 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 {

    }

    groceryViewIds = new HashMap();
    groceryViewValues = new HashMap();

    isUserDefault = false;

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

    businessNameArray = new ArrayList<String>();

    latitudeArray = new ArrayList<String>();

    longitudeArray = new ArrayList<String>();

    listingIdArray = new ArrayList<String>();

    phoneArray = new ArrayList<String>();

    callArray = new ArrayList<String>();

    streetArray = new ArrayList<String>();

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

}

From source file:com.canappi.connector.yp.yhere.LubeView.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();/*www .ja  v  a 2  s  .  com*/
            } catch (IllegalArgumentException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            } catch (IllegalAccessException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
        }
    } else {

    }

    lubeViewIds = new HashMap();
    lubeViewValues = new HashMap();

    isUserDefault = false;

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

    businessNameArray = new ArrayList<String>();

    latitudeArray = new ArrayList<String>();

    longitudeArray = new ArrayList<String>();

    listingIdArray = new ArrayList<String>();

    phoneArray = new ArrayList<String>();

    callArray = new ArrayList<String>();

    streetArray = new ArrayList<String>();

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

}

From source file:com.canappi.connector.yp.yhere.RepairView.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  www.  j av  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 {

    }

    repairViewIds = new HashMap();
    repairViewValues = new HashMap();

    isUserDefault = false;

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

    businessNameArray = new ArrayList<String>();

    latitudeArray = new ArrayList<String>();

    longitudeArray = new ArrayList<String>();

    listingIdArray = new ArrayList<String>();

    phoneArray = new ArrayList<String>();

    callArray = new ArrayList<String>();

    streetArray = new ArrayList<String>();

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

}

From source file:com.canappi.connector.yp.yhere.RestaurantView.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();/*w  w w .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 {

    }

    restaurantViewIds = new HashMap();
    restaurantViewValues = new HashMap();

    isUserDefault = false;

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

    businessNameArray = new ArrayList<String>();

    latitudeArray = new ArrayList<String>();

    longitudeArray = new ArrayList<String>();

    listingIdArray = new ArrayList<String>();

    phoneArray = new ArrayList<String>();

    callArray = new ArrayList<String>();

    streetArray = new ArrayList<String>();

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

}

From source file:com.canappi.connector.yp.yhere.TheaterView.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  av a2s . co m
            } catch (IllegalArgumentException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            } catch (IllegalAccessException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
        }
    } else {

    }

    theaterViewIds = new HashMap();
    theaterViewValues = new HashMap();

    isUserDefault = false;

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

    businessNameArray = new ArrayList<String>();

    latitudeArray = new ArrayList<String>();

    longitudeArray = new ArrayList<String>();

    listingIdArray = new ArrayList<String>();

    phoneArray = new ArrayList<String>();

    callArray = new ArrayList<String>();

    streetArray = new ArrayList<String>();

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

}

From source file:iddb.core.model.dao.DAOFactory.java

/**
 * @param key/*w ww.j a  v  a  2  s .  c  o  m*/
 * @param value
 * @return
 * @throws Exception
 * @throws ClassNotFoundException
 * @throws IllegalAccessException
 * @throws InstantiationException
 */
@SuppressWarnings({ "rawtypes", "unchecked" })
private Object createCachedInstance(String iface, Object impl) throws Exception {
    String[] ifacePart = StringUtils.split(iface, ".");
    String ifaceName = ifacePart[ifacePart.length - 1];
    log.debug("Getting cached instance for {} - {}", iface, ifaceName);
    ClassLoader loader = this.getClass().getClassLoader();

    try {
        Class clz = loader.loadClass("iddb.core.model.dao.cached." + ifaceName + "Cached");
        Constructor cons = clz.getConstructor(new Class[] { Class.forName(iface) });
        return cons.newInstance(impl);
    } catch (SecurityException e) {
        log.warn("No cached implementation found for {} - {}", ifaceName, e.getMessage());
        throw new Exception(e);
    } catch (IllegalArgumentException e) {
        log.warn("No cached implementation found for {} - {}", ifaceName, e.getMessage());
        throw new Exception(e);
    } catch (ClassNotFoundException e) {
        log.warn("No cached implementation found for {} - {}", ifaceName, e.getMessage());
        throw new Exception(e);
    } catch (NoSuchMethodException e) {
        log.warn("No cached implementation found for {} - {}", ifaceName, e.getMessage());
        throw new Exception(e);
    } catch (InstantiationException e) {
        log.warn("No cached implementation found for {} - {}", ifaceName, e.getMessage());
        throw new Exception(e);
    } catch (IllegalAccessException e) {
        log.warn("No cached implementation found for {} - {}", ifaceName, e.getMessage());
        throw new Exception(e);
    } catch (InvocationTargetException e) {
        e.printStackTrace();
        log.warn("No cached implementation found for {} - {}", ifaceName, e.getMessage());
        throw new Exception(e);
    }

}