Skip to content

Commit e095af0

Browse files
committed
Changing runtime generic exceptions to persistence exceptions
1 parent b750800 commit e095af0

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

src/main/java/org/apache/ibatis/builder/xml/XMLMapperBuilder.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
import java.util.Properties;
2828

2929
import org.apache.ibatis.builder.BaseBuilder;
30+
import org.apache.ibatis.builder.BuilderException;
3031
import org.apache.ibatis.builder.CacheRefResolver;
3132
import org.apache.ibatis.builder.IncompleteElementException;
3233
import org.apache.ibatis.builder.MapperBuilderAssistant;
@@ -110,7 +111,7 @@ private void configurationElement(XNode context) {
110111
sqlElement(context.evalNodes("/mapper/sql"));
111112
buildStatementFromContext(context.evalNodes("select|insert|update|delete"));
112113
} catch (Exception e) {
113-
throw new RuntimeException("Error parsing Mapper XML. Cause: " + e, e);
114+
throw new BuilderException("Error parsing Mapper XML. Cause: " + e, e);
114115
}
115116
}
116117

src/main/java/org/apache/ibatis/reflection/wrapper/DefaultObjectWrapperFactory.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
package org.apache.ibatis.reflection.wrapper;
1717

1818
import org.apache.ibatis.reflection.MetaObject;
19+
import org.apache.ibatis.reflection.ReflectionException;
1920

2021
public class DefaultObjectWrapperFactory implements ObjectWrapperFactory {
2122

@@ -24,7 +25,7 @@ public boolean hasWrapperFor(Object object) {
2425
}
2526

2627
public ObjectWrapper getWrapperFor(MetaObject metaObject, Object object) {
27-
throw new RuntimeException("The DefaultObjectWrapperFactory should never be called to provide an ObjectWrapper.");
28+
throw new ReflectionException("The DefaultObjectWrapperFactory should never be called to provide an ObjectWrapper.");
2829
}
2930

3031
}

src/main/java/org/apache/ibatis/type/TypeHandlerRegistry.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -321,14 +321,14 @@ public <T> TypeHandler<T> getInstance(Class<?> javaTypeClass, Class<?> typeHandl
321321
} catch (NoSuchMethodException ignored) {
322322
// ignored
323323
} catch (Exception e) {
324-
throw new RuntimeException("Failed invoking constructor for handler " + typeHandlerClass, e);
324+
throw new TypeException("Failed invoking constructor for handler " + typeHandlerClass, e);
325325
}
326326
}
327327
try {
328328
Constructor<?> c = typeHandlerClass.getConstructor();
329329
return (TypeHandler<T>) c.newInstance();
330330
} catch (Exception e) {
331-
throw new RuntimeException("Unable to find a usable constructor for " + typeHandlerClass, e);
331+
throw new TypeException("Unable to find a usable constructor for " + typeHandlerClass, e);
332332
}
333333
}
334334

0 commit comments

Comments
 (0)