Example usage for java.lang Exception getClass

List of usage examples for java.lang Exception getClass

Introduction

In this page you can find the example usage for java.lang Exception getClass.

Prototype

@HotSpotIntrinsicCandidate
public final native Class<?> getClass();

Source Link

Document

Returns the runtime class of this Object .

Usage

From source file:com.martineve.mendroid.activity.ContactsActivity.java

/** Called when the activity is first created. */
@Override/*from   w  w w. ja  v  a  2s  .  co m*/
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.contacts);

    /*if (!OAuth.CONNECTOR.isConnected())
    {
       moveToLogin();
       return;
    }
            
    c_list.clear();*/

    JSONArray contacts;
    try {
        //new MendeleyAPITask(OAuth.CONNECTOR).execute(MendeleyURLs.getURL(MendeleyURLs.CONTACTS), ContactsActivity.this);
        //new MendeleyAPITask(OAuth.CONNECTOR).doFetch(new String[] {MendeleyURLs.getURL(MendeleyURLs.CONTACTS)}, ContactsActivity.this);

        /*contacts = m_conn.getCollections();
        for (int i=0; i< collections.length(); i++) {
            JSONObject collection = collections.getJSONObject(i);
                    
            HashMap<String,String> item = new HashMap<String,String>();
                    
            item.put("line1", collection.getString("name"));
            item.put("line2", collection.getString("size") + " documents");
                    
            m_list.add(item);
        }*/
    } catch (Exception e) {
        Toast.makeText(getApplicationContext(), "\nGot a " + e.getClass().getName() + ": " + e.getMessage(),
                Toast.LENGTH_LONG).show();
        return;
    }

}

From source file:com.clustercontrol.custom.factory.RunCustomBase.java

/**
 * ???????<br/>/*from w w  w . j  av  a 2s . co m*/
 * 
 * @param priority
 *            ????(PriorityConstant.INFO??)
 * @param monitor
 *            ??MonitorInfo
 * @param facilityId
 *            ???ID
 * @param facilityPath
 *            ID??
 * @param msg
 *            ???
 * @param msgOrig
 *            ???
 * @param pluginID
 *            PluginID
 * @throws HinemosUnknown
 *             ??????
 * @throws CustomInvalid
 *             ??????
 */
protected void notify(int priority, MonitorInfo monitor, String facilityId, String facilityPath, String subKey,
        String msg, String msgOrig, String pluginID) throws HinemosUnknown, CustomInvalid {
    // Local Variable
    OutputBasicInfo notifyInfo = null;

    notifyInfo = new OutputBasicInfo();
    notifyInfo.setMonitorId(monitor.getMonitorId());
    notifyInfo.setPluginId(pluginID);
    // ??????????
    notifyInfo.setSubKey(subKey == null ? "" : subKey);
    notifyInfo.setPriority(priority);
    notifyInfo.setApplication(monitor.getApplication());
    notifyInfo.setFacilityId(facilityId);
    notifyInfo.setScopeText(facilityPath);
    notifyInfo.setGenerationDate(result.getCollectDate());
    notifyInfo.setMessage(msg);
    notifyInfo.setMessageOrg(msgOrig);

    try {
        // ?
        new NotifyControllerBean().notify(notifyInfo, NotifyGroupIdGenerator.generate(monitor));
    } catch (Exception e) {
        m_log.warn("notify() : " + e.getClass().getSimpleName() + ", " + e.getMessage(), e);
        throw new HinemosUnknown("unexpected internal failure occurred. [" + result + "]", e);
    }
}

From source file:de.appsolve.padelcampus.controller.account.AccountController.java

@RequestMapping(method = POST, value = "/delete")
public ModelAndView postDelete(HttpServletRequest request, HttpServletResponse response) {
    ModelAndView mav = getDeleteView(request);
    try {/*ww  w  .j ava  2s .  co  m*/
        playerUtil.markAsDeleted(sessionUtil.getUser(request));
        loginUtil.deleteLoginCookie(request, response);
        sessionUtil.invalidate(request);
        return new ModelAndView("account/delete-success");
    } catch (Exception e) {
        mav.addObject("error",
                StringUtils.isEmpty(e.getMessage()) ? e.getClass().getSimpleName() : e.getMessage());
        return mav;
    }
}

From source file:org.openmrs.module.hl7query.web.controller.BaseHL7QueryController.java

@ExceptionHandler(Exception.class)
@ResponseBody//from   www.  j av a 2s . co m
private AuthenticationErrorObject handleException(Exception ex, HttpServletResponse response) throws Exception {
    ResponseStatus ann = ex.getClass().getAnnotation(ResponseStatus.class);
    if (ann != null) {
        errorCode = ann.value().value();
        if (StringUtils.isNotEmpty(ann.reason())) {
            errorDetail = ann.reason();
        }

    } else if (ExceptionUtil.hasCause(ex, APIAuthenticationException.class)) {
        return apiAuthenticationExceptionHandler(ex, response);
    } else if (ex.getClass() == HttpRequestMethodNotSupportedException.class) {
        errorCode = HttpServletResponse.SC_METHOD_NOT_ALLOWED;
    }
    response.setStatus(errorCode);
    return ExceptionUtil.wrapErrorResponse(ex, errorDetail);
}

From source file:org.sonatype.nexus.apachehttpclient.PoolingClientConnectionManagerMBeanInstaller.java

/**
 * Unregisters the connection manager from JMX.
 *//*  ww w  .ja v a  2 s.  c o  m*/
public synchronized void unregister() {
    if (jmxName != null) {
        try {
            final MBeanServer server = ManagementFactory.getPlatformMBeanServer();
            server.unregisterMBean(jmxName);
        } catch (final Exception e) {
            LOGGER.warn("Failed to unregister mbean {} due to {}:{}", jmxName, e.getClass(), e.getMessage());
        } finally {
            jmxName = null;
        }
    }
}

From source file:org.sonatype.nexus.internal.httpclient.PoolingClientConnectionManagerMBeanInstaller.java

/**
 * Unregisters the connection manager from JMX.
 *///from  ww w . ja v  a2 s  .  c om
synchronized void unregister() {
    if (jmxName != null) {
        try {
            final MBeanServer server = ManagementFactory.getPlatformMBeanServer();
            server.unregisterMBean(jmxName);
        } catch (final Exception e) {
            LOGGER.warn("Failed to unregister mbean {} due to {}:{}", jmxName, e.getClass(), e.getMessage());
        } finally {
            jmxName = null;
        }
    }
}

From source file:hu.petabyte.redflags.engine.boot.GearLoader.java

public AbstractGear loadGear(String gearName) {
    checkNotNull(gearName, "gearName should not be null.");
    checkArgument(!gearName.isEmpty(), "gearName should not be blank.");
    try {/*w  w  w.j  ava  2s  .  c o m*/
        // LOG.trace("Finding gear class: {}", gearName);
        // Class<? extends AbstractGear> c = (Class<? extends AbstractGear>)
        // Class.forName(gearName);

        LOG.trace("Requesting bean for gear: {}", gearName);
        // AbstractGear gear = ctx.getBean(c);
        AbstractGear gear = (AbstractGear) ctx.getBean(gearName);

        return gear;
    } catch (Exception e) {
        LOG.error("Failed to load gear: {} - {}: {}", gearName, e.getClass().getSimpleName(), e.getMessage());
    }
    return null;
}

From source file:org.sonatype.nexus.apachehttpclient.PoolingClientConnectionManagerMBeanInstaller.java

/**
 * Registers the connection manager to JMX.
 *///w  w  w .ja v a2s .c om
public synchronized void register(final PoolingHttpClientConnectionManager connectionManager) {
    if (jmxName == null) {
        try {
            jmxName = ObjectName.getInstance(JMX_DOMAIN, "name",
                    PoolingHttpClientConnectionManager.class.getSimpleName());

            final MBeanServer server = ManagementFactory.getPlatformMBeanServer();
            server.registerMBean(new PoolingClientConnectionManagerMBeanImpl(connectionManager), jmxName);
        } catch (final Exception e) {
            LOGGER.warn("Failed to register mbean {} due to {}:{}", jmxName, e.getClass(), e.getMessage());
            jmxName = null;
        }
    } else {
        LOGGER.warn("Already registered mbean {}", jmxName);
    }
}

From source file:org.sonatype.nexus.internal.httpclient.PoolingClientConnectionManagerMBeanInstaller.java

/**
 * Registers the connection manager to JMX.
 */// w ww . j av a2 s .  c  o m
synchronized void register(final PoolingHttpClientConnectionManager connectionManager) {
    if (jmxName == null) {
        try {
            jmxName = ObjectName.getInstance(JMX_DOMAIN, "name",
                    PoolingHttpClientConnectionManager.class.getSimpleName());

            final MBeanServer server = ManagementFactory.getPlatformMBeanServer();
            server.registerMBean(new PoolingClientConnectionManagerMBeanImpl(connectionManager), jmxName);
        } catch (final Exception e) {
            LOGGER.warn("Failed to register mbean {} due to {}:{}", jmxName, e.getClass(), e.getMessage());
            jmxName = null;
        }
    } else {
        LOGGER.warn("Already registered mbean {}", jmxName);
    }
}

From source file:com.bskyb.cg.environments.message.MessageFormatFactory.java

public MessageFormatFactory(DynamicProperties keysToClassNames) {
    this.keysToClassNames = keysToClassNames;
    try {/*from ww w .java  2  s.  c  o m*/
        initFromProperties();
    } catch (Exception ex) {
        ex.printStackTrace();
        throw new RuntimeException(ex.getClass().getName() + ": " + ex.getMessage());
    }
}