Examples of InjectionException


Examples of org.jboss.wsf.common.injection.InjectionException

   {
      for (Class<?> type : method.getParameterTypes())
      {
         if (type.isPrimitive())
         {
            throw new InjectionException("Method " + getAnnotationMessage(annotation) + "can't declare primitive parameters: " + method);
         }
      }
   }
View Full Code Here

Examples of org.qi4j.bootstrap.InjectionException

            }
            method.invoke( instance, params );
        }
        catch( IllegalAccessException e )
        {
            throw new InjectionException( e );
        }
        catch( InvocationTargetException e )
        {
            throw new InjectionException( e.getTargetException() );
        }
    }
View Full Code Here

Examples of org.qi4j.bootstrap.InjectionException

        {
            injectedField.set( instance, value );
        }
        catch( IllegalAccessException e )
        {
            throw new InjectionException( e );
        }
        catch( IllegalArgumentException e )
        {
            String fieldClassName = injectedField.getType().getName();
            String valueClassName = value.getClass().getName();
            String message = "Cannot inject field of type " + fieldClassName + " with value '" + value +
                             "' of type " + valueClassName;
            throw new InjectionException( message, e );
        }
    }
View Full Code Here

Examples of org.qi4j.bootstrap.InjectionException

            }
            method.invoke( instance, params );
        }
        catch( IllegalAccessException e )
        {
            throw new InjectionException( e );
        }
        catch( InvocationTargetException e )
        {
            throw new InjectionException( e.getTargetException() );
        }
    }
View Full Code Here

Examples of org.qi4j.bootstrap.InjectionException

        {
            injectedField.set( instance, value );
        }
        catch( IllegalAccessException e )
        {
            throw new InjectionException( e );
        }
        catch( IllegalArgumentException e )
        {
            String valueClassName;
            if( Proxy.isProxyClass( value.getClass() ) )
            {
                InvocationHandler invocationHandler = Proxy.getInvocationHandler( value );
                if( invocationHandler instanceof TransientInstance )
                {
                    TransientInstance handler = (TransientInstance) invocationHandler;
                    valueClassName = Classes.toString( handler.descriptor().types() )
                                     + " in [" + handler.module().name() + "] of [" + handler.module()
                        .layerInstance()
                        .name() + "]";
                }
                else
                {
                    valueClassName = invocationHandler.toString();
                }
            }
            else
            {
                valueClassName = value.getClass().getName();
            }
            StringBuilder annotBuilder = new StringBuilder();
            for( Annotation annot : injectedField.getAnnotations() )
            {
                String s = annot.toString();
                annotBuilder.append( "@" ).append( s.substring( s.lastIndexOf( '.' ) + 1, s.length() - 2 ) );
                annotBuilder.append( " " );
            }
            String annots = annotBuilder.toString();
            String message = "Can not inject the field\n    "
                             + injectedField.getDeclaringClass()
                             + "\n    {\n        " + annots + "\n        "
                             + injectedField.getType().getSimpleName() + " " + injectedField.getName()
                             + "\n    }\nwith value \n    " + value + "\nof type\n    "
                             + valueClassName;
            throw new InjectionException( message, e );
        }
    }
View Full Code Here

Examples of org.shiftone.jrat.inject.InjectionException

    Assert.assertNotNull("transformer", transformer);
    long lastModified;

        if (!source.exists()) {
      throw new InjectionException("source file does not exist : " + source);
    }
        LOG.debug("source exists");
        if (source.isDirectory()) {
      throw new InjectionException("source file is a directory : " + source);
    }
        LOG.debug("source is real file (not dir)");
        if (source.canRead() == false) {
      throw new InjectionException("source file can not be read (check permissions): " + source);
    }

        LOG.debug("source can be read");
        lastModified = source.lastModified();

        if (target.exists()) {

            LOG.debug("target exists " + target.getAbsolutePath());

            if (forceOverwrite == false) {
        throw new InjectionException("target exists and forceOverwrite is disabled : " + source);
      }
      if (target.isDirectory()) {
        throw new InjectionException("target is directory : " + target);
      }
      if (target.canWrite() == false) {
        throw new InjectionException("unable to write to target (check permissions) : " + target);
      }
      // newer is bigger

            if (target.lastModified() > source.lastModified()) {
        // target is newer than source
        if (!overwriteNewer) {
          throw new InjectionException("target is newer than source and overwriteNewer is disabled : "
              + source);
        }
      }

            processUsingSwapFile(transformer, options, source, target);
View Full Code Here

Examples of sg.edu.nus.comp.simTL.engine.exceptions.InjectionException

 
  protected String loadAttribute(EObject tElement, String eAttribute) throws InjectionException{
    try{
      return (String)tElement.eGet(tElement.eClass().getEStructuralFeature(eAttribute));
    } catch(Exception e){
      throw new InjectionException("Couldn't find attribute " + eAttribute + " in " + tElement.eClass().getName());
    }
  }
View Full Code Here

Examples of sg.edu.nus.comp.simTL.engine.exceptions.InjectionException

      log.error("BUG: Cannot cast the returned object of " + eReference + " to a list");
      Vector<EObject> returnList = new Vector<EObject>();
      returnList.add(loadReferencedEObject(eReference));
      return returnList;
    } catch(Exception e){
      throw new InjectionException("Couldn't find reference " + eReference + " in " + tElement);
    }
  }
View Full Code Here

Examples of sg.edu.nus.comp.simTL.engine.exceptions.InjectionException

      //template manipulates only OL-elements under an TElement!
      return (EObject)tElement.eGet(tElement.eClass().getEStructuralFeature(eReference));
    } catch(ClassCastException e){
      log.error("BUG: Cannot cast the returned object of " + eReference + " to an eObject");
    } catch(Exception e){
      throw new InjectionException("Couldn't find reference " + eReference + " in " + tElement);
    }
    return null;
  }
View Full Code Here

Examples of sg.edu.nus.comp.simTL.engine.exceptions.InjectionException

  }
 
  private EAnnotation findTemplateAnnotation() throws SimTLException{
    //find superclass XFrame
    EClass templateClass = findTemplateClass(getTElement().eClass());
    if(templateClass==null) throw new InjectionException("There is no "+CLASS_TEMPLATE+" super class?!");
   
    EAnnotation ann = templateClass.getEAnnotation(ANNOTATION_TEMPLATE_CLASS);
    if(ann==null){
      throw new InjectionException("No \"" + ANNOTATION_TEMPLATE_CLASS + "\" annotation on XFrame Root");
    }
    return ann;
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.