Java 8 Exception - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 Exception class.

This code example shows how to use the following methods:getMessage
            throws AxisFault { 
        try { 
            return stub.configureServiceGroupMTOM(mtomState, serviceGroupName);
        } catch (java.lang.Exception e) {
            String msg = "Cannot change MOM state of Axis service group" + serviceGroupName
                         + " .  Error is "+ e.getMessage();
            handleException(msg, e);
        } 
 
        return null; 
    } 
 
    /** 
     * @param serviceGroupName 
     * @return 
     * @throws AxisFault 
     */ 
    public ServiceGroupMetaData listServiceGroup(String serviceGroupName) throws AxisFault {
        try { 
            return stub.listServiceGroup(serviceGroupName);

6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:sleep
            echo(">>> START the CounterMonitor"); 
            counterMonitor.start();
 
            // Wait for granularity period (multiplied by 2 for sure) 
            // 
            Thread.sleep(granularityperiod * 2);
 
            // Check if notification was received 
            // 
            if (messageReceived) {
                echo("\tOK: CounterMonitor got RUNTIME_ERROR notification!"); 
            } else { 
                echo("\tKO: CounterMonitor did not get " + 
                     "RUNTIME_ERROR notification!"); 
                return 1; 
            } 
        } finally { 
            messageReceived = false;
            if (counterMonitor != null)
                counterMonitor.stop();

5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
            null);	 
    } 
 
	@Override 
	public synchronized Object invoke(String name, Object[] args, String[] sig) throws MBeanException, ReflectionException {
		throw new ReflectionException(new NoSuchMethodException(name));	
	} 
 
	@Override 
	public synchronized void setAttribute(Attribute attr) throws AttributeNotFoundException, InvalidAttributeValueException, MBeanException, ReflectionException {
		String name = attr.getName();
		if(name != null)
			_propMap.put(name, attr.getValue());
	} 
 
	@Override 
	public synchronized AttributeList setAttributes(AttributeList list) {
		Attribute[] attrs = (Attribute[]) list.toArray(new Attribute[0]);
		AttributeList retList = new AttributeList();
        for (Attribute attr : attrs) {
5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getMessage
            throw new MetricNotFoundException(msg, e);
        } catch (InstanceNotFoundException e) {
            String msg = "MBean '" + objName + "' not found";
            throw new MetricNotFoundException(msg, e);
        } catch (ReflectionException e) {
            String msg = "ReflectionException: " + e.getMessage();
            throw new PluginException(msg, e);
        } catch (ConnectorException e) {
            String msg = "ConnectorException: " + e.getMessage();
            throw new PluginException(msg, e);
        } 
    } 
 
    //XXX cache 
    public static AdminClient getMBeanServer(Properties cfg)
            throws MetricUnreachableException { 
 
        Properties props = getAdminProperties(cfg);
 
        if (log.isDebugEnabled()) {
3
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
            return null; 
        } else if (actionName.equals("reload") && (params == null || params.length == 0)) {
            manager.reload();
            return null; 
        } 
        throw new ReflectionException(new NoSuchMethodException(actionName));
    } 
 
    @Delegate 
    public MBeanInfo getMBeanInfo() {
        List<MBeanAttributeInfo> attributesInfo = new ArrayList<MBeanAttributeInfo>();
        Set<String> propertyNames = manager.propertyNames();
        for (String name : propertyNames)
            attributesInfo.add(new MBeanAttributeInfo(name, "java.lang.String", name, true, true, false));
 
        MBeanAttributeInfo[] attributes = attributesInfo.toArray(new MBeanAttributeInfo[propertyNames.size()]);
 
        MBeanParameterInfo key = new MBeanParameterInfo("key", "java.lang.String", "Key of the property");
        MBeanParameterInfo value = new MBeanParameterInfo("value", "java.lang.String", "Value of the property");
 
5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
        } 
        catch (Error err) {
            throw new RuntimeErrorException(err, "Error occured while invoking " + toSimpleName(method));
        } 
        catch (Exception e) {
            throw new ReflectionException(e, "Exception occured while invoking " + toSimpleName(method));
        } 
    } 
 
    private static String toSimpleName(Method method)
    { 
        return method.getName() + "()";
    } 
 
    public static boolean isGetter(Method method)
    { 
        String methodName = method.getName();
        return (methodName.startsWith("get") || methodName.startsWith("is")) && isValidGetter(method);
    } 
 
4
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
This code example shows how to use the following methods:
      { 
         throw new ReflectionException(x);
      } 
      catch (IllegalAccessException x)
      { 
         throw new ReflectionException(x);
      } 
      catch (IllegalArgumentException x)
      { 
         throw new InvalidAttributeValueException(x.toString());
      } 
      catch (InvocationTargetException x)
      { 
         Throwable t = x.getTargetException();
         if (t instanceof RuntimeException)
            throw new RuntimeMBeanException((RuntimeException)t);
         else if (t instanceof Exception) throw new MBeanException((Exception)t);
         throw new RuntimeErrorException((Error)t);
      } 
   } 
4
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
    // Check for a recognized operation name and call the corresponding operation 
 
    if(operationName.equals("addLoggerMBean")) {
      return addLoggerMBean((String)params[0]);
    } else { 
      throw new ReflectionException(
	    new NoSuchMethodException(operationName),
	    "Cannot find the operation " + operationName + " in " + dClassName);
    } 
 
  } 
 
 
  public 
  Object getAttribute(String attributeName) throws AttributeNotFoundException,
                                                    MBeanException,
                                                    ReflectionException {
 
    // Check attributeName is not null to avoid NullPointerException later on 
    if (attributeName == null) {
4
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
        } 
        catch (Error err) {
            throw new RuntimeErrorException(err, "Error occurred while invoking " + toSimpleName(method));
        } 
        catch (Exception e) {
            throw new ReflectionException(e, "Exception occurred while invoking " + toSimpleName(method));
        } 
    } 
 
    private static String toSimpleName(Method method)
    { 
        return new Signature(method).toString();
    } 
 
    public static boolean isGetter(Method method)
    { 
        String methodName = method.getName();
        return (methodName.startsWith("get") || methodName.startsWith("is")) && isValidGetter(method);
    } 
 
4
CodeRank
Experience pair programming with AI  Get Codota for Java

Related Java 8 Exception Questions & Answers:

Other Java 8 Exception Examples

14:	      builder.append(line);
15:	    }
16:	  } catch (Exception e) {
17:	    e.printStackTrace();
18:	  } finally {

Read More

10:				// start playing
11:				videoPreview.start();
12:			} catch (Exception e) {
13:				e.printStackTrace();
14:			}

Read More

18:	            }
19:	        }
20:	        catch(Exception ex){}
21:	    }
22:	}

Read More

18:	        }
19:	        catch(Exception ex){}
20:	    }
21:	}
22:

Read More

See Code Examples for Java 8 Exception Methods: