类org.springframework.core.NestedIOException源码实例Demo

下面列出了怎么用org.springframework.core.NestedIOException的API类实例代码及写法,或者点击链接到github查看源代码。

/**
 * Factory method to obtain a {@link SourceClass} from a class name.
 */
SourceClass asSourceClass(@Nullable String className) throws IOException {
	if (className == null || className.startsWith("java.lang.annotation.")) {
		return this.objectSourceClass;
	}
	if (className.startsWith("java")) {
		// Never use ASM for core java types
		try {
			return new SourceClass(ClassUtils.forName(className,
					this.resourceLoader.getClassLoader()));
		}
		catch (ClassNotFoundException ex) {
			throw new NestedIOException(
					"Failed to load class [" + className + "]", ex);
		}
	}
	return new SourceClass(
			this.metadataReaderFactory.getMetadataReader(className));
}
 
private SourceClass getRelated(String className) throws IOException {
	if (this.source instanceof Class) {
		try {
			Class<?> clazz = ClassUtils.forName(className, ((Class<?>) this.source).getClassLoader());
			return asSourceClass(clazz);
		}
		catch (ClassNotFoundException ex) {
			// Ignore -> fall back to ASM next, except for core java types.
			if (className.startsWith("java")) {
				throw new NestedIOException("Failed to load class [" + className + "]", ex);
			}
			return new SourceClass(metadataReaderFactory.getMetadataReader(className));
		}
	}
	return asSourceClass(className);
}
 
/**
 * Factory method to obtain a {@link SourceClass} from a class name.
 */
SourceClass asSourceClass(@Nullable String className) throws IOException {
	if (className == null) {
		return new SourceClass(Object.class);
	}
	if (className.startsWith("java")) {
		// Never use ASM for core java types
		try {
			return new SourceClass(ClassUtils.forName(className, this.resourceLoader.getClassLoader()));
		}
		catch (ClassNotFoundException ex) {
			throw new NestedIOException("Failed to load class [" + className + "]", ex);
		}
	}
	return new SourceClass(this.metadataReaderFactory.getMetadataReader(className));
}
 
private SourceClass getRelated(String className) throws IOException {
	if (this.source instanceof Class) {
		try {
			Class<?> clazz = ClassUtils.forName(className, ((Class<?>) this.source).getClassLoader());
			return asSourceClass(clazz);
		}
		catch (ClassNotFoundException ex) {
			// Ignore -> fall back to ASM next, except for core java types.
			if (className.startsWith("java")) {
				throw new NestedIOException("Failed to load class [" + className + "]", ex);
			}
			return new SourceClass(metadataReaderFactory.getMetadataReader(className));
		}
	}
	return asSourceClass(className);
}
 
源代码5 项目: lams   文件: ConfigurationClassParser.java
private SourceClass getRelated(String className) throws IOException {
	if (this.source instanceof Class) {
		try {
			Class<?> clazz = ((Class<?>) this.source).getClassLoader().loadClass(className);
			return asSourceClass(clazz);
		}
		catch (ClassNotFoundException ex) {
			// Ignore -> fall back to ASM next, except for core java types.
			if (className.startsWith("java")) {
				throw new NestedIOException("Failed to load class [" + className + "]", ex);
			}
			return new SourceClass(metadataReaderFactory.getMetadataReader(className));
		}
	}
	return asSourceClass(className);
}
 
private SourceClass getRelated(String className) throws IOException {
	if (this.source instanceof Class<?>) {
		try {
			Class<?> clazz = resourceLoader.getClassLoader().loadClass(className);
			return asSourceClass(clazz);
		}
		catch (ClassNotFoundException ex) {
			// Ignore -> fall back to ASM next, except for core java types.
			if (className.startsWith("java")) {
				throw new NestedIOException("Failed to load class [" + className + "]", ex);
			}
			return new SourceClass(metadataReaderFactory.getMetadataReader(className));
		}
	}
	return asSourceClass(className);
}
 
源代码7 项目: Shop-for-JavaWeb   文件: SqlSessionFactoryBean.java
/**
 * TODO 刷新
 * 
 * @param inputStream
 * @param resource
 * @param configuration
 * @throws NestedIOException
 */
public static void refresh(java.io.InputStream inputStream,
		String resource, Configuration configuration)
		throws NestedIOException {

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

}
 
/**
 * Read from the supplied {@code InputStream} and deserialize the contents
 * into an object.
 * @see ObjectInputStream#readObject()
 */
@Override
@SuppressWarnings("resource")
public Object deserialize(InputStream inputStream) throws IOException {
	ObjectInputStream objectInputStream = new ConfigurableObjectInputStream(inputStream, this.classLoader);
	try {
		return objectInputStream.readObject();
	}
	catch (ClassNotFoundException ex) {
		throw new NestedIOException("Failed to deserialize object type", ex);
	}
}
 
private static ClassReader getClassReader(Resource resource) throws IOException {
	try (InputStream is = new BufferedInputStream(resource.getInputStream())) {
		try {
			return new ClassReader(is);
		}
		catch (IllegalArgumentException ex) {
			throw new NestedIOException("ASM ClassReader failed to parse class file - " +
					"probably due to a new Java class file version that isn't supported yet: " + resource, ex);
		}
	}
}
 
源代码10 项目: spring-analysis-note   文件: AbstractResource.java
/**
 * This implementation builds a URI based on the URL returned
 * by {@link #getURL()}.
 */
@Override
public URI getURI() throws IOException {
	URL url = getURL();
	try {
		return ResourceUtils.toURI(url);
	}
	catch (URISyntaxException ex) {
		throw new NestedIOException("Invalid URI [" + url + "]", ex);
	}
}
 
源代码11 项目: spring-analysis-note   文件: VfsResource.java
@Override
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);
	}
}
 
源代码12 项目: spring-analysis-note   文件: VfsResource.java
@Override
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);
	}
}
 
/**
 * Read from the supplied {@code InputStream} and deserialize the contents
 * into an object.
 * @see ObjectInputStream#readObject()
 */
@Override
@SuppressWarnings("resource")
public Object deserialize(InputStream inputStream) throws IOException {
	ObjectInputStream objectInputStream = new ConfigurableObjectInputStream(inputStream, this.classLoader);
	try {
		return objectInputStream.readObject();
	}
	catch (ClassNotFoundException ex) {
		throw new NestedIOException("Failed to deserialize object type", ex);
	}
}
 
源代码14 项目: java-technology-stack   文件: AbstractResource.java
/**
 * This implementation builds a URI based on the URL returned
 * by {@link #getURL()}.
 */
@Override
public URI getURI() throws IOException {
	URL url = getURL();
	try {
		return ResourceUtils.toURI(url);
	}
	catch (URISyntaxException ex) {
		throw new NestedIOException("Invalid URI [" + url + "]", ex);
	}
}
 
源代码15 项目: java-technology-stack   文件: VfsResource.java
@Override
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);
	}
}
 
源代码16 项目: java-technology-stack   文件: VfsResource.java
@Override
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);
	}
}
 
源代码17 项目: radar   文件: BeanUtils.java
private static Object deserialize(InputStream inputStream) throws IOException {
	ObjectInputStream objectInputStream = new ConfigurableObjectInputStream(inputStream, BeanUtils.class.getClassLoader());
	try {
		return objectInputStream.readObject();
	}
	catch (ClassNotFoundException ex) {
		logger.error("Failed to deserialize object type", ex);
		throw new NestedIOException("Failed to deserialize object type", ex);
	}
}
 
源代码18 项目: lams   文件: ConfigurationClassParser.java
/**
 * Factory method to obtain a {@link SourceClass} from a class name.
 */
SourceClass asSourceClass(String className) throws IOException {
	if (className.startsWith("java")) {
		// Never use ASM for core java types
		try {
			return new SourceClass(this.resourceLoader.getClassLoader().loadClass(className));
		}
		catch (ClassNotFoundException ex) {
			throw new NestedIOException("Failed to load class [" + className + "]", ex);
		}
	}
	return new SourceClass(this.metadataReaderFactory.getMetadataReader(className));
}
 
源代码19 项目: lams   文件: DefaultDeserializer.java
/**
 * Read from the supplied {@code InputStream} and deserialize the contents
 * into an object.
 * @see ObjectInputStream#readObject()
 */
@Override
@SuppressWarnings("resource")
public Object deserialize(InputStream inputStream) throws IOException {
	ObjectInputStream objectInputStream = new ConfigurableObjectInputStream(inputStream, this.classLoader);
	try {
		return objectInputStream.readObject();
	}
	catch (ClassNotFoundException ex) {
		throw new NestedIOException("Failed to deserialize object type", ex);
	}
}
 
源代码20 项目: lams   文件: AbstractResource.java
/**
 * This implementation builds a URI based on the URL returned
 * by {@link #getURL()}.
 */
@Override
public URI getURI() throws IOException {
	URL url = getURL();
	try {
		return ResourceUtils.toURI(url);
	}
	catch (URISyntaxException ex) {
		throw new NestedIOException("Invalid URI [" + url + "]", ex);
	}
}
 
源代码21 项目: lams   文件: VfsResource.java
@Override
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);
	}
}
 
源代码22 项目: lams   文件: VfsResource.java
@Override
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);
	}
}
 
/**
 * Factory method to obtain a {@link SourceClass} from a class name.
 */
public SourceClass asSourceClass(String className) throws IOException {
	if (className.startsWith("java")) {
		// Never use ASM for core java types
		try {
			return new SourceClass(this.resourceLoader.getClassLoader().loadClass(className));
		}
		catch (ClassNotFoundException ex) {
			throw new NestedIOException("Failed to load class [" + className + "]", ex);
		}
	}
	return new SourceClass(this.metadataReaderFactory.getMetadataReader(className));
}
 
/**
 * Read from the supplied {@code InputStream} and deserialize the contents
 * into an object.
 * @see ObjectInputStream#readObject()
 */
@Override
@SuppressWarnings("resource")
public Object deserialize(InputStream inputStream) throws IOException {
	ObjectInputStream objectInputStream = new ConfigurableObjectInputStream(inputStream, this.classLoader);
	try {
		return objectInputStream.readObject();
	}
	catch (ClassNotFoundException ex) {
		throw new NestedIOException("Failed to deserialize object type", ex);
	}
}
 
源代码25 项目: spring4-understanding   文件: AbstractResource.java
/**
 * This implementation builds a URI based on the URL returned
 * by {@link #getURL()}.
 */
@Override
public URI getURI() throws IOException {
	URL url = getURL();
	try {
		return ResourceUtils.toURI(url);
	}
	catch (URISyntaxException ex) {
		throw new NestedIOException("Invalid URI [" + url + "]", ex);
	}
}
 
源代码26 项目: spring4-understanding   文件: VfsResource.java
@Override
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);
	}
}
 
源代码27 项目: spring4-understanding   文件: VfsResource.java
@Override
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);
	}
}
 
源代码28 项目: Shop-for-JavaWeb   文件: MapperLoader.java
public void reloadXML() throws Exception {
	SqlSessionFactory factory = context.getBean(SqlSessionFactory.class);
	Configuration configuration = factory.getConfiguration();
	// 移除加载项
	removeConfig(configuration);
	// 重新扫描加载
	for (String basePackage : basePackages) {
		Resource[] resources = getResource(basePackage, XML_RESOURCE_PATTERN);
		if (resources != null) {
			for (int i = 0; i < resources.length; i++) {
				if (resources[i] == null) {
					continue;
				}
				try {
					XMLMapperBuilder xmlMapperBuilder = new XMLMapperBuilder(resources[i].getInputStream(),
							configuration, resources[i].toString(), configuration.getSqlFragments());
					xmlMapperBuilder.parse();
				} catch (Exception e) {
					throw new NestedIOException("Failed to parse mapping resource: '" + resources[i] + "'", e);
				} finally {
					ErrorContext.instance().reset();
				}
			}
		}
	}

}
 
源代码29 项目: mongodb-orm   文件: MongoFactoryBean.java
public void init() throws Exception {
  MqlMapConfigParser configParser = new MqlMapConfigParser();
  for (Resource configLocation : configLocations) {
    InputStream is = configLocation.getInputStream();
    try {
      configParser.parse(is);
      logger.info("Mql configuration parse resource file. File name is " + configLocation.getFilename());
    } catch (RuntimeException ex) {
      throw new NestedIOException("Failed to parse config configuration. File name is " + configLocation.getFilename(), ex.getCause());
    }
  }
  configParser.validateMapping();
  this.configParser = configParser;
  logger.info("Mongodb orm framework has ready.");
}
 
源代码30 项目: mongodb-orm   文件: NodeletParser.java
/**
 * Begins parsing from the provided Reader.
 */
public void parse(Reader reader) throws NestedIOException {
  try {
    Document doc = createDocument(reader);
    parse(doc.getLastChild());
  } catch (Exception e) {
    throw new NestedIOException("Error parsing XML.  Cause: " + e, e);
  }
}
 
 类所在包
 同包方法