Skip to content

Commit

Permalink
replaced Class#newInstance with Constructor#newInstance
Browse files Browse the repository at this point in the history
  • Loading branch information
ghacupha committed Nov 6, 2017
1 parent 940bb43 commit 8055200
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/main/java/com/poiji/bind/mapping/PoijiHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import com.poiji.exception.IllegalCastException;
import com.poiji.option.PoijiOptions;
import com.poiji.util.Casting;
import java.lang.reflect.InvocationTargetException;
import org.apache.poi.ss.util.CellAddress;
import org.apache.poi.xssf.usermodel.XSSFComment;

Expand Down Expand Up @@ -40,8 +41,8 @@ List<T> getDataset() {
private <T> T newInstanceOf(Class<T> type) {
T newInstance;
try {
newInstance = type.newInstance();
} catch (IllegalAccessException | InstantiationException e) {
newInstance = type.getDeclaredConstructor().newInstance();
} catch (NoSuchMethodException| InvocationTargetException | IllegalAccessException | InstantiationException e) {
throw new IllegalCastException("Cannot create a new instance of " + type.getName());
}

Expand All @@ -65,7 +66,6 @@ private void setValue(String content, Class<? super T> type, int column) {

if (column == index.value()) {

if (!field.isAccessible())
field.setAccessible(true);

Object o = Casting.castValue(fieldType, content, options);
Expand Down

0 comments on commit 8055200

Please sign in to comment.