Add a general ResourceDataAccessException, RuntimeException class indicating problems while accessing the data from a target Resource.
Add ResourceReadException extending ResourceDataAccessException to indicate problems while reading from a target Resource. Add ResourceWriteException extending ResourceDataAccessException to indicate problems while writing to a target Resource. Resolves gh-92.
This commit is contained in:
@@ -0,0 +1,71 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2020 the original author or authors.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* https://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
|
||||||
|
* or implied. See the License for the specific language governing
|
||||||
|
* permissions and limitations under the License.
|
||||||
|
*/
|
||||||
|
package org.springframework.geode.core.io;
|
||||||
|
|
||||||
|
import org.springframework.core.io.Resource;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A Java {@link RuntimeException} indicating a problem accessing (e.g. reading/writing) the data
|
||||||
|
* of the target {@link Resource}.
|
||||||
|
*
|
||||||
|
* @author John Blum
|
||||||
|
* @see java.lang.RuntimeException
|
||||||
|
* @see org.springframework.core.io.Resource
|
||||||
|
* @since 1.3.1
|
||||||
|
*/
|
||||||
|
@SuppressWarnings("unused")
|
||||||
|
public class ResourceDataAccessException extends RuntimeException {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructs a new instance of {@link ResourceDataAccessException} with no {@link String message}
|
||||||
|
* or known {@link Throwable cause}.
|
||||||
|
*/
|
||||||
|
public ResourceDataAccessException() { }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructs a new instance of {@link ResourceDataAccessException} initialized with the given {@link String message}
|
||||||
|
* to describe the error.
|
||||||
|
*
|
||||||
|
* @param message {@link String} describing the {@link RuntimeException}.
|
||||||
|
*/
|
||||||
|
public ResourceDataAccessException(String message) {
|
||||||
|
super(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructs a new instance of {@link ResourceDataAccessException} initialized with the given {@link Throwable}
|
||||||
|
* signifying the underlying cause of this {@link RuntimeException}.
|
||||||
|
*
|
||||||
|
* @param cause {@link Throwable} signifying the underlying cause of this {@link RuntimeException}.
|
||||||
|
* @see java.lang.Throwable
|
||||||
|
*/
|
||||||
|
public ResourceDataAccessException(Throwable cause) {
|
||||||
|
super(cause);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructs a new instance of {@link ResourceDataAccessException} initialized with the given {@link String message}
|
||||||
|
* describing the error along with a {@link Throwable} signifying the underlying cause of this
|
||||||
|
* {@link RuntimeException}.
|
||||||
|
*
|
||||||
|
* @param message {@link String} describing the {@link RuntimeException}.
|
||||||
|
* @param cause {@link Throwable} signifying the underlying cause of this {@link RuntimeException}.
|
||||||
|
* @see java.lang.Throwable
|
||||||
|
*/
|
||||||
|
public ResourceDataAccessException(String message, Throwable cause) {
|
||||||
|
super(message, cause);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,72 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2020 the original author or authors.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* https://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
|
||||||
|
* or implied. See the License for the specific language governing
|
||||||
|
* permissions and limitations under the License.
|
||||||
|
*/
|
||||||
|
package org.springframework.geode.core.io;
|
||||||
|
|
||||||
|
import org.springframework.core.io.Resource;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A {@link ResourceDataAccessException} and Java {@link RuntimeException} indicating a problem
|
||||||
|
* while reading from the target {@link Resource}.
|
||||||
|
*
|
||||||
|
* @author John Blum
|
||||||
|
* @see java.lang.RuntimeException
|
||||||
|
* @see org.springframework.core.io.Resource
|
||||||
|
* @see org.springframework.geode.core.io.ResourceDataAccessException
|
||||||
|
* @since 1.3.1
|
||||||
|
*/
|
||||||
|
@SuppressWarnings("unused")
|
||||||
|
public class ResourceReadException extends ResourceDataAccessException {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructs a new instance of {@link ResourceReadException} with no {@link String message}
|
||||||
|
* or known {@link Throwable cause}.
|
||||||
|
*/
|
||||||
|
public ResourceReadException() { }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructs a new instance of {@link ResourceReadException} initialized with the given {@link String message}
|
||||||
|
* to describe the error.
|
||||||
|
*
|
||||||
|
* @param message {@link String} describing the {@link RuntimeException}.
|
||||||
|
*/
|
||||||
|
public ResourceReadException(String message) {
|
||||||
|
super(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructs a new instance of {@link ResourceReadException} initialized with the given {@link Throwable}
|
||||||
|
* signifying the underlying cause of this {@link RuntimeException}.
|
||||||
|
*
|
||||||
|
* @param cause {@link Throwable} signifying the underlying cause of this {@link RuntimeException}.
|
||||||
|
* @see java.lang.Throwable
|
||||||
|
*/
|
||||||
|
public ResourceReadException(Throwable cause) {
|
||||||
|
super(cause);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructs a new instance of {@link ResourceReadException} initialized with the given {@link String message}
|
||||||
|
* describing the error along with a {@link Throwable} signifying the underlying cause of this
|
||||||
|
* {@link RuntimeException}.
|
||||||
|
*
|
||||||
|
* @param message {@link String} describing the {@link RuntimeException}.
|
||||||
|
* @param cause {@link Throwable} signifying the underlying cause of this {@link RuntimeException}.
|
||||||
|
* @see java.lang.Throwable
|
||||||
|
*/
|
||||||
|
public ResourceReadException(String message, Throwable cause) {
|
||||||
|
super(message, cause);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,72 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2020 the original author or authors.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* https://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
|
||||||
|
* or implied. See the License for the specific language governing
|
||||||
|
* permissions and limitations under the License.
|
||||||
|
*/
|
||||||
|
package org.springframework.geode.core.io;
|
||||||
|
|
||||||
|
import org.springframework.core.io.Resource;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A {@link ResourceDataAccessException} and Java {@link RuntimeException} indicating a problem
|
||||||
|
* while writing to the target {@link Resource}.
|
||||||
|
*
|
||||||
|
* @author John Blum
|
||||||
|
* @see java.lang.RuntimeException
|
||||||
|
* @see org.springframework.core.io.Resource
|
||||||
|
* @see org.springframework.geode.core.io.ResourceDataAccessException
|
||||||
|
* @since 1.3.1
|
||||||
|
*/
|
||||||
|
@SuppressWarnings("unused")
|
||||||
|
public class ResourceWriteException extends ResourceDataAccessException {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructs a new instance of {@link ResourceWriteException} with no {@link String message}
|
||||||
|
* or known {@link Throwable cause}.
|
||||||
|
*/
|
||||||
|
public ResourceWriteException() { }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructs a new instance of {@link ResourceWriteException} initialized with the given {@link String message}
|
||||||
|
* to describe the error.
|
||||||
|
*
|
||||||
|
* @param message {@link String} describing the {@link RuntimeException}.
|
||||||
|
*/
|
||||||
|
public ResourceWriteException(String message) {
|
||||||
|
super(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructs a new instance of {@link ResourceWriteException} initialized with the given {@link Throwable}
|
||||||
|
* signifying the underlying cause of this {@link RuntimeException}.
|
||||||
|
*
|
||||||
|
* @param cause {@link Throwable} signifying the underlying cause of this {@link RuntimeException}.
|
||||||
|
* @see java.lang.Throwable
|
||||||
|
*/
|
||||||
|
public ResourceWriteException(Throwable cause) {
|
||||||
|
super(cause);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructs a new instance of {@link ResourceWriteException} initialized with the given {@link String message}
|
||||||
|
* describing the error along with a {@link Throwable} signifying the underlying cause of this
|
||||||
|
* {@link RuntimeException}.
|
||||||
|
*
|
||||||
|
* @param message {@link String} describing the {@link RuntimeException}.
|
||||||
|
* @param cause {@link Throwable} signifying the underlying cause of this {@link RuntimeException}.
|
||||||
|
* @see java.lang.Throwable
|
||||||
|
*/
|
||||||
|
public ResourceWriteException(String message, Throwable cause) {
|
||||||
|
super(message, cause);
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user