当前位置: 首页>>代码示例>>Java>>正文


Java ExceptionListener.exceptionThrown方法代码示例

本文整理汇总了Java中java.beans.ExceptionListener.exceptionThrown方法的典型用法代码示例。如果您正苦于以下问题:Java ExceptionListener.exceptionThrown方法的具体用法?Java ExceptionListener.exceptionThrown怎么用?Java ExceptionListener.exceptionThrown使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.beans.ExceptionListener的用法示例。


在下文中一共展示了ExceptionListener.exceptionThrown方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: start

import java.beans.ExceptionListener; //导入方法依赖的package包/类
/** Evaluates the attributes and creates a Context instance.
 * If the creation of the Context instance fails the ElementHandler
 * is marked as failed which may affect the parent handler other.
 *
 * @param attributes Attributes of the XML tag.
 */
public final void start(Attributes attributes,
                        ExceptionListener exceptionListener)
{
  try
    {
      // lets the subclass create the appropriate Context instance
      context = startElement(attributes, exceptionListener);
    }
  catch (AssemblyException pe)
    {
      Throwable t = pe.getCause();

      if (t instanceof Exception)
        exceptionListener.exceptionThrown((Exception) t);
      else
        throw new InternalError("Unexpected Throwable type in AssemblerException. Please file a bug report.");

      notifyContextFailed();

      return;
    }
}
 
开发者ID:vilie,项目名称:javify,代码行数:29,代码来源:AbstractElementHandler.java

示例2: startElement

import java.beans.ExceptionListener; //导入方法依赖的package包/类
protected final Context startElement(Attributes attributes, ExceptionListener exceptionListener)
  throws AssemblyException
{

  // note: simple elements should not have any attributes. We inform
  // the user of this syntactical but uncritical problem by sending
  // an IllegalArgumentException for each unneccessary attribute
  int size = attributes.getLength();
  for (int i = 0; i < size; i++) {
          String attributeName = attributes.getQName(i);
          Exception e =
                  new IllegalArgumentException(
                          "Unneccessary attribute '"
                                  + attributeName
                                  + "' discarded.");
          exceptionListener.exceptionThrown(e);
  }

  return context = new ObjectContext();
}
 
开发者ID:vilie,项目名称:javify,代码行数:21,代码来源:SimpleHandler.java

示例3: start

import java.beans.ExceptionListener; //导入方法依赖的package包/类
/** Evaluates the attributes and creates a Context instance.
  * If the creation of the Context instance fails the ElementHandler
  * is marked as failed which may affect the parent handler other.
  *
  * @param attributes Attributes of the XML tag.
  */
 public final void start(Attributes attributes,
                         ExceptionListener exceptionListener)
 {
   try
     {
// lets the subclass create the appropriate Context instance
context = startElement(attributes, exceptionListener);
     }
   catch (AssemblyException pe)
     {
Throwable t = pe.getCause();

if (t instanceof Exception)
  exceptionListener.exceptionThrown((Exception) t);
else
  throw new InternalError("Unexpected Throwable type in AssemblerException. Please file a bug report.");

notifyContextFailed();

return;
     }
 }
 
开发者ID:nmldiegues,项目名称:jvm-stm,代码行数:29,代码来源:AbstractElementHandler.java

示例4: startElement

import java.beans.ExceptionListener; //导入方法依赖的package包/类
protected final Context startElement(Attributes attributes, ExceptionListener exceptionListener)
  throws AssemblyException
{
	
  // note: simple elements should not have any attributes. We inform
  // the user of this syntactical but uncritical problem by sending
  // an IllegalArgumentException for each unneccessary attribute
  int size = attributes.getLength();
  for (int i = 0; i < size; i++) {
          String attributeName = attributes.getQName(i);
          Exception e =
                  new IllegalArgumentException(
                          "Unneccessary attribute '"
                                  + attributeName
                                  + "' discarded.");
          exceptionListener.exceptionThrown(e);
  }
  
  return context = new ObjectContext();
}
 
开发者ID:nmldiegues,项目名称:jvm-stm,代码行数:21,代码来源:SimpleHandler.java

示例5: getBlackList

import java.beans.ExceptionListener; //导入方法依赖的package包/类
/**
 * プラグインブラックリストの読み込み
 *
 * @param listener ExceptionListener
 * @return プラグインブラックリスト
 */
private Set<String> getBlackList(ExceptionListener listener) {
    Set<String> blackList = Collections.emptySet();

    InputStream in = Launcher.class.getClassLoader().getResourceAsStream("logbook/plugin-black-list"); //$NON-NLS-1$
    if (in != null) {
        try (BufferedReader r = new BufferedReader(new InputStreamReader(in, StandardCharsets.UTF_8))) {
            blackList = r.lines()
                    .filter(l -> l.length() >= 64)
                    .map(l -> l.substring(0, 64))
                    .collect(Collectors.toSet());
        } catch (IOException e) {
            listener.exceptionThrown(e);
        }
    }
    return blackList;
}
 
开发者ID:sanaehirotaka,项目名称:logbook-kai,代码行数:23,代码来源:Launcher.java

示例6: notifyStatement

import java.beans.ExceptionListener; //导入方法依赖的package包/类
/** Notifies the handler's Context that its child Context will not return
 * a value back. Some Context variants need this information to know when
 * a method or a constructor call can be made.
 *
 * This method is called by a child handler.
 */
public void notifyStatement(ExceptionListener exceptionListener)
{
  try
    {

      // propagates to parent handler first to generate objects
      // needed by this Context instance
      if(context.isStatement())
      {
              parent.notifyStatement(exceptionListener);
      }

      // Some Context instances do stuff which can fail now. If that
      // happens this handler is marked as failed.
      context.notifyStatement(parent.getContext());
    }
  catch (AssemblyException ae)
    {
      // notifies that an exception was thrown in this handler's Context
      Throwable t = ae.getCause();

      if (t instanceof Exception)
        exceptionListener.exceptionThrown((Exception) t);
      else
        throw (InternalError) new InternalError("Severe problem while decoding XML data.")
              .initCause(t);

      // marks the handler as failed
      notifyContextFailed();
    }
}
 
开发者ID:vilie,项目名称:javify,代码行数:38,代码来源:AbstractElementHandler.java

示例7: notifyStatement

import java.beans.ExceptionListener; //导入方法依赖的package包/类
/** Notifies the handler's Context that its child Context will not return
  * a value back. Some Context variants need this information to know when
  * a method or a constructor call can be made.
  *
  * This method is called by a child handler.
  */
 public void notifyStatement(ExceptionListener exceptionListener)
 {
   try
     {
     	
     	// propagates to parent handler first to generate objects
     	// needed by this Context instance
     	if(context.isStatement())
     	{
     		parent.notifyStatement(exceptionListener);
     	}
     	
// Some Context instances do stuff which can fail now. If that
// happens this handler is marked as failed.
context.notifyStatement(parent.getContext());
     }
   catch (AssemblyException ae)
     {
// notifies that an exception was thrown in this handler's Context 
Throwable t = ae.getCause();

if (t instanceof Exception)
  exceptionListener.exceptionThrown((Exception) t);
else
  throw (InternalError) new InternalError("Severe problem while decoding XML data.")
        .initCause(t);

// marks the handler as failed
notifyContextFailed();
     }
 }
 
开发者ID:nmldiegues,项目名称:jvm-stm,代码行数:38,代码来源:AbstractElementHandler.java

示例8: fireException

import java.beans.ExceptionListener; //导入方法依赖的package包/类
/**
 * Exception for model.
 * @param ex exception.
 */
public void fireException(Exception ex) {
    for (int i = listeners.size() - 1; i >= 0; i--) {
        ExceptionListener listener = listeners.get(i);
        listener.exceptionThrown(ex);
    }
}
 
开发者ID:miurahr,项目名称:tmpotter,代码行数:11,代码来源:SegmentationRulesModel.java

示例9: toJarBasedPlugin

import java.beans.ExceptionListener; //导入方法依赖的package包/类
public static JarBasedPlugin toJarBasedPlugin(Path p, ExceptionListener listener) {
    try {
        return new JarBasedPlugin(p);
    } catch (IOException e) {
        listener.exceptionThrown(e);
        return null;
    }
}
 
开发者ID:sanaehirotaka,项目名称:logbook-kai,代码行数:9,代码来源:JarBasedPlugin.java

示例10: end

import java.beans.ExceptionListener; //导入方法依赖的package包/类
/** Post-processes the Context.
 */
public final void end(ExceptionListener exceptionListener)
{
  // skips processing if the handler is marked as failed (because the Context
  // is then invalid or may not exist at all)
  if (!hasFailed)
    {
      try
        {
          // note: the order of operations is very important here
          // sends the stored character data to the Context
          endElement(buffer.toString());

          // reports to the parent handler if this handler's Context is a
          // statement (returning no value BACK to the parent's Context)
          if (context.isStatement())
            {
              // This may create a valid result in the parent's Context
              // or let it fail
              parent.notifyStatement(exceptionListener);

              // skips any further processing if the parent handler is now marked
              // as failed
              if (parent.hasFailed())
                return;
            }

          // processes the Context and stores the result
          putObject(context.getId(), context.endContext(parent.getContext()));

          // transfers the Context's results to the parent's Context
          // if it is an expression (rather than a statement)
          if (! context.isStatement())
            parent.getContext().addParameterObject(context.getResult());
        }
      catch (AssemblyException pe)
        {
          // notifies that an exception was thrown in this handler's Context
          Throwable t = pe.getCause();

          if (t instanceof Exception)
            exceptionListener.exceptionThrown((Exception) t);
          else
            throw (InternalError) new InternalError("Severe problem while decoding XML data.")
                  .initCause(t);

          // marks the handler as failed
          notifyContextFailed();
        }
    }
}
 
开发者ID:vilie,项目名称:javify,代码行数:53,代码来源:AbstractElementHandler.java

示例11: end

import java.beans.ExceptionListener; //导入方法依赖的package包/类
/** Post-processes the Context.
  */
 public final void end(ExceptionListener exceptionListener)
 {
   // skips processing if the handler is marked as failed (because the Context
   // is then invalid or may not exist at all)
   if (!hasFailed)
     {
try
  {
    // note: the order of operations is very important here
    // sends the stored character data to the Context
    endElement(buffer.toString());

    // reports to the parent handler if this handler's Context is a
    // statement (returning no value BACK to the parent's Context)
    if (context.isStatement())
      {
	// This may create a valid result in the parent's Context
	// or let it fail
	parent.notifyStatement(exceptionListener);

	// skips any further processing if the parent handler is now marked
	// as failed
	if (parent.hasFailed())
	  return;
      }

    // processes the Context and stores the result
    putObject(context.getId(), context.endContext(parent.getContext()));

    // transfers the Context's results to the parent's Context
    // if it is an expression (rather than a statement) 
    if (! context.isStatement())
      parent.getContext().addParameterObject(context.getResult());
  }
catch (AssemblyException pe)
  {
    // notifies that an exception was thrown in this handler's Context 
    Throwable t = pe.getCause();

    if (t instanceof Exception)
      exceptionListener.exceptionThrown((Exception) t);
    else
      throw (InternalError) new InternalError("Severe problem while decoding XML data.")
            .initCause(t);

    // marks the handler as failed
    notifyContextFailed();
  }
     }
 }
 
开发者ID:nmldiegues,项目名称:jvm-stm,代码行数:53,代码来源:AbstractElementHandler.java

示例12: checkThenCreateZooNode

import java.beans.ExceptionListener; //导入方法依赖的package包/类
/**
 * This method fixes the race condition faced by the client when checking if
 * a znode already exists before creating one. It basically handles the 
 * <b>NodeExistsException</b>, if an exception handler was given, or ignore
 * it, otherwise.
 * 
 * @param path
 *                the path for the node
 * @param data
 *                the initial data for the node
 * @param acl
 *                the acl for the node
 * @param createMode
 *                specifying whether the node to be created is ephemeral
 *                and/or sequential
 * @param zooClient 
 *                a ZooKeeper client object
 * @param exceptionHandler
 *                the object that will handle the NodeExistsExcpetion; if this
 *                is null, the exception is ignored and the execution continues
 *                without replacing the already existing znode
 * @return the actual path of the created node
 * @throws KeeperException if the server returns a non-zero error code
 * @throws KeeperException.InvalidACLException if the ACL is invalid, null, or empty
 * @throws InterruptedException if the transaction is interrupted
 * @throws IllegalArgumentException if an invalid path is specified
 */
public static String checkThenCreateZooNode(final String path, byte data[], List<ACL> acl, CreateMode createMode,
		ZooKeeper zooClient, ExceptionListener exceptionHandler) throws KeeperException, InterruptedException {

	String createReturn = null;
	try {
		createReturn = zooClient.create(path, data, acl, createMode);
	} catch (NodeExistsException e) {
		if (exceptionHandler != null){
			exceptionHandler.exceptionThrown(e);
		}
	}
	return createReturn;
}
 
开发者ID:sambenz,项目名称:URingPaxos,代码行数:41,代码来源:Util.java


注:本文中的java.beans.ExceptionListener.exceptionThrown方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。