Skip to content

Commit

Permalink
refactor code to increase coverage
Browse files Browse the repository at this point in the history
Signed-off-by: Hakan <ozler.hakan@gmail.com>
  • Loading branch information
ozlerhakan committed May 25, 2020
1 parent a8385b3 commit fd7693d
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 28 deletions.
4 changes: 0 additions & 4 deletions src/main/java/com/poiji/bind/mapping/PoijiNumberFormat.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,6 @@ public String getNumberFormatAt(short fmtId) {
return numberFormats.get(fmtId);
}

public int size() {
return numberFormats.size();
}

void overrideExcelNumberFormats(final StylesTable styles) {
for (Short fmtId : numberFormats.keySet()) {
String format = numberFormats.get(fmtId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,7 @@
/**
* Created by hakan on 24.05.2020
*/
public class PoijiPropertyHelper {

private PoijiPropertyHelper() {
}
public final class PoijiPropertyHelper {

public static HSSFPropertyFile createPoijiPropertyFile(File file, PoijiOptions options) {
return new HSSFPropertyFile(file, options);
Expand Down
5 changes: 1 addition & 4 deletions src/main/java/com/poiji/bind/mapping/XSSFUnmarshaller.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package com.poiji.bind.mapping;

import com.poiji.bind.Unmarshaller;
import com.poiji.exception.LimitCrossedException;
import com.poiji.exception.PoijiException;
import com.poiji.option.PoijiOptions;
import org.apache.poi.openxml4j.exceptions.OpenXML4JException;
Expand Down Expand Up @@ -116,10 +115,8 @@ private <T> void processSheet(StylesTable styles,
options);
reader.setContentHandler(contentHandler);
reader.parse(sheetSource);
} catch (LimitCrossedException e) {
IOUtils.closeQuietly(sheetInputStream);
// swallowing the exception for good :)
} catch (SAXException | IOException e) {
IOUtils.closeQuietly(sheetInputStream);
throw new PoijiException("Problem occurred while reading data", e);
}
}
Expand Down
9 changes: 0 additions & 9 deletions src/main/java/com/poiji/exception/LimitCrossedException.java

This file was deleted.

10 changes: 3 additions & 7 deletions src/main/java/com/poiji/parser/BigDecimalParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,9 @@ public class BigDecimalParser implements Parser<BigDecimal> {

private DecimalFormat getDecimalFormatInstance() {
NumberFormat numberFormat = NumberFormat.getInstance();
if (numberFormat instanceof DecimalFormat) {
DecimalFormat decimalFormat = (DecimalFormat) numberFormat;
decimalFormat.setParseBigDecimal(true);
return decimalFormat;
} else {
throw new IllegalStateException(numberFormat.getClass().getName());
}
DecimalFormat decimalFormat = (DecimalFormat) numberFormat;
decimalFormat.setParseBigDecimal(true);
return decimalFormat;
}

@Override
Expand Down

0 comments on commit fd7693d

Please sign in to comment.