wro4j-extensions/src/main/java/ro/isdc/wro/extensions/model/factory/SmartWroModelFactory.java
@Override
  public WroModel create() {
    if (factoryList == null) {
      factoryList = newWroModelFactoryFactoryList();
    }
    if (factoryList != null) {
      // Holds the details about model creation which are logged only when no model can be created
      final StringBuffer logMessageBuffer = new StringBuffer();
      for (final WroModelFactory factory : factoryList) {
        try {
          // use injector for aggregated modelFactories
          injector.inject(factory);
          final Class<? extends WroModelFactory> factoryClass = factory.getClass().asSubclass(WroModelFactory.class);
          logMessageBuffer.append(" Using " + getClassName(factoryClass) + " for model creation..\n");
          return factory.create();
        } catch (final WroRuntimeException e) {
          LOG.debug("[FAIL] creating model... will try another factory: {}", e.getCause());
          logMessageBuffer.append("[FAIL] Model creation using " + getClassName(factory.getClass())
              + " failed. Trying another ...\n");
          logMessageBuffer.append("[FAIL] Exception occured while building the model using: "
              + getClassName(factory.getClass()) + " " + e.getMessage());
          // stop trying with other factories if the reason is IOException
          if (!autoDetectWroFile && e.getCause() instanceof IOException) {
            throw e;
          }
        }
      }
      LOG.error(logMessageBuffer.toString());
    }
    throw new WroRuntimeException("Cannot create model using any of provided factories");
  }
@Override
  public WroModel create() {
    if (factoryList == null) {
      factoryList = newWroModelFactoryFactoryList();
    }
    if (factoryList != null) {
      // Holds the details about model creation which are logged only when no model can be created
      final StringBuffer logMessageBuffer = new StringBuffer();
      for (final WroModelFactory factory : factoryList) {
        try {
          // use injector for aggregated modelFactories
          injector.inject(factory);
          final Class<? extends WroModelFactory> factoryClass = factory.getClass().asSubclass(WroModelFactory.class);
          logMessageBuffer.append(" Using " + getClassName(factoryClass) + " for model creation..\n");
          return factory.create();
        } catch (final WroRuntimeException e) {
          LOG.debug("[FAIL] creating model... will try another factory: {}", e.getCause());
          logMessageBuffer.append("[FAIL] Model creation using " + getClassName(factory.getClass())
              + " failed. Trying another ...\n");
          logMessageBuffer.append("[FAIL] Exception occured while building the model using: "
              + getClassName(factory.getClass()) + " " + e.getMessage());
          // stop trying with other factories if the reason is IOException
          if (!autoDetectWroFile && e.getCause() instanceof IOException) {
            throw e;
          }
        }
      }
      LOG.error(logMessageBuffer.toString());
    }
    throw new WroRuntimeException("Cannot create model using any of provided factories");
  }
@ Override public WroModel create ( ) { if ( factoryList == null ) { factoryList = newWroModelFactoryFactoryList ( ) ; } if ( factoryList != null ) { // Holds the details about model creation which are logged only when no model can be created
 final StringBuffer logMessageBuffer = new StringBuffer ( ) ; for ( final WroModelFactory factory : factoryList ) { try { // use injector for aggregated modelFactories
 injector . inject ( factory ) ; final Class < ? extends WroModelFactory > factoryClass = factory . getClass ( ) . asSubclass ( WroModelFactory . class ) ; logMessageBuffer . append ( " Using " + getClassName ( factoryClass ) + " for model creation..\n" ) ; return factory . create ( ) ; } catch ( final WroRuntimeException e ) { LOG . debug ( "[FAIL] creating model... will try another factory: {}" , e . getCause ( ) ) ; logMessageBuffer . append ( "[FAIL] Model creation using " + getClassName ( factory . getClass ( ) ) + " failed. Trying another ...\n" ) ; logMessageBuffer . append ( "[FAIL] Exception occured while building the model using: " + getClassName ( factory . getClass ( ) ) + " " + e . getMessage ( ) ) ; // stop trying with other factories if the reason is IOException
 if ( ! autoDetectWroFile && e . getCause ( ) instanceof IOException ) { throw e ; } } } LOG . error ( logMessageBuffer . toString ( ) ) ; } throw new WroRuntimeException ( "Cannot create model using any of provided factories" ) ; }
{@inheritDoc}
{