Package org.springframework.core

Examples of org.springframework.core.NestedIOException


               
                if (this.logger.isDebugEnabled()) {
                    this.logger.debug("Parsed configuration file: '" + this.configLocation + "'");
                }
            } catch (Exception ex) {
                throw new NestedIOException("Failed to parse config resource: " + this.configLocation, ex);
            } finally {
                ErrorContext.instance().reset();
            }
        }

        if (this.transactionFactory == null) {
            this.transactionFactory = new SpringManagedTransactionFactory(this.dataSource);
        }

        Environment environment = new Environment(this.environment, this.transactionFactory, this.dataSource);
        configuration.setEnvironment(environment);
       
        if (!ObjectUtils.isEmpty(this.mapperLocations)) {
            for (Resource mapperLocation : this.mapperLocations) {
                if (mapperLocation == null) {
                    continue;
                }

                // this block is a workaround for issue http://code.google.com/p/mybatis/issues/detail?id=235
                // when running MyBatis 3.0.4. But not always works.
                // Not needed in 3.0.5 and above.
                String path;
                if (mapperLocation instanceof ClassPathResource) {
                    path = ((ClassPathResource) mapperLocation).getPath();
                } else {
                    path = mapperLocation.toString();
                }

                try {
                    XMLMapperBuilder xmlMapperBuilder = new XMLMapperBuilder(mapperLocation.getInputStream(),
                            configuration, path, configuration.getSqlFragments());
                    xmlMapperBuilder.parse();
                } catch (Exception e) {
                    throw new NestedIOException("Failed to parse mapping resource: '" + mapperLocation + "'", e);
                } finally {
                    ErrorContext.instance().reset();
                }

                if (this.logger.isDebugEnabled()) {
View Full Code Here


        if (LOGGER.isDebugEnabled()) {
          LOGGER.debug("Parsed configuration file: '" + this.configLocation + "'");
        }
      } catch (Exception ex) {
        throw new NestedIOException("Failed to parse config resource: " + this.configLocation, ex);
      } finally {
        ErrorContext.instance().reset();
      }
    }

    if (this.transactionFactory == null) {
      this.transactionFactory = new SpringManagedTransactionFactory();
    }

    configuration.setEnvironment(new Environment(this.environment, this.transactionFactory, this.dataSource));

    if (this.databaseIdProvider != null) {
      try {
        configuration.setDatabaseId(this.databaseIdProvider.getDatabaseId(this.dataSource));
      } catch (SQLException e) {
        throw new NestedIOException("Failed getting a databaseId", e);
      }
    }

    if (!isEmpty(this.mapperLocations)) {
      for (Resource mapperLocation : this.mapperLocations) {
        if (mapperLocation == null) {
          continue;
        }

        try {
          XMLMapperBuilder xmlMapperBuilder = new XMLMapperBuilder(mapperLocation.getInputStream(),
              configuration, mapperLocation.toString(), configuration.getSqlFragments());
          xmlMapperBuilder.parse();
        } catch (Exception e) {
          throw new NestedIOException("Failed to parse mapping resource: '" + mapperLocation + "'", e);
        } finally {
          ErrorContext.instance().reset();
        }

        if (LOGGER.isDebugEnabled()) {
View Full Code Here

    URL url = getURL();
    try {
      return ResourceUtils.toURI(url);
    }
    catch (URISyntaxException ex) {
      throw new NestedIOException("Invalid URI [" + url + "]", ex);
    }
  }
View Full Code Here

    URL url = getURL();
    try {
      return ResourceUtils.toURI(url);
    }
    catch (URISyntaxException ex) {
      throw new NestedIOException("Invalid URI [" + url + "]", ex);
    }
  }
View Full Code Here

    ObjectInputStream objectInputStream = new ObjectInputStream(inputStream);
    try {
      return objectInputStream.readObject();
    }
    catch (ClassNotFoundException ex) {
      throw new NestedIOException("Failed to deserialize object type", ex);
    }
  }
View Full Code Here

  public URL getURL() throws IOException {
    try {
      return VfsUtils.getURL(this.resource);
    }
    catch (Exception ex) {
      throw new NestedIOException("Failed to obtain URL for file " + this.resource, ex);
    }
  }
View Full Code Here

  public URI getURI() throws IOException {
    try {
      return VfsUtils.getURI(this.resource);
    }
    catch (Exception ex) {
      throw new NestedIOException("Failed to obtain URI for " + this.resource, ex);
    }
  }
View Full Code Here

    URL url = getURL();
    try {
      return ResourceUtils.toURI(url);
    }
    catch (URISyntaxException ex) {
      throw new NestedIOException("Invalid URI [" + url + "]", ex);
    }
  }
View Full Code Here

      }
      try {
        return new File((URI) invokeVfsMethod(VFS_UTILS_METHOD_GET_COMPATIBLE_URI, null, vfsResource));
      }
      catch (Exception ex) {
        throw new NestedIOException("Failed to obtain File reference for " + vfsResource, ex);
      }
    }
    else {
      return (File) invokeVfsMethod(GET_PHYSICAL_FILE, vfsResource);
    }
View Full Code Here

      InputStream is = configLocation.getInputStream();
      try {
        client = configParser.parse(is, properties);
      }
      catch (RuntimeException ex) {
        throw new NestedIOException("Failed to parse config resource: " + configLocation, ex.getCause());
      }
    }

    if (mappingLocations != null) {
      SqlMapParser mapParser = SqlMapParserFactory.createSqlMapParser(configParser);
      for (Resource mappingLocation : mappingLocations) {
        try {
          mapParser.parse(mappingLocation.getInputStream());
        }
        catch (NodeletException ex) {
          throw new NestedIOException("Failed to parse mapping resource: " + mappingLocation, ex);
        }
      }
    }

    return client;
View Full Code Here

TOP

Related Classes of org.springframework.core.NestedIOException

Copyright © 2018 www.massapicom. 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.