Skip to content

Commit

Permalink
Reduce technical debt, compile with -Xlint
Browse files Browse the repository at this point in the history
  • Loading branch information
Olivier Chédru committed Mar 18, 2016
1 parent b8d1140 commit d5fa0c6
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 5 deletions.
10 changes: 10 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,16 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.5.1</version>
<configuration>
<compilerArgs>
<arg>-Xlint</arg>
</compilerArgs>
</configuration>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
Expand Down
5 changes: 2 additions & 3 deletions src/main/java/org/dhatim/fastexcel/TimestampUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.time.chrono.ChronoZonedDateTime;
import java.time.temporal.ChronoUnit;
import java.util.Date;
Expand All @@ -45,7 +44,7 @@ private TimestampUtil() {
* carry any timezone information; this method uses the system timezone to
* convert the timestamp to a serial number. If you need a specific
* timezone, prefer using
* {@link #convertZonedDateTime(java.time.ChronoZonedDateTime)}.
* {@link #convertZonedDateTime(java.time.chrono.ChronoZonedDateTime)}.
*
* @param date Date value.
* @return Serial number value.
Expand All @@ -65,7 +64,7 @@ public static Double convertDate(LocalDate date) {
}

/**
* Convert a {@link ZonedDateTime} to a serial number.
* Convert a {@link ChronoZonedDateTime} to a serial number.
*
* @param zdt Date and timezone values.
* @return Serial number value.
Expand Down
8 changes: 6 additions & 2 deletions src/test/java/org/dhatim/fastexcel/Correctness.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import java.util.concurrent.ExecutionException;
import java.util.function.Consumer;
import org.apache.commons.io.output.NullOutputStream;
import org.apache.poi.xssf.usermodel.XSSFRow;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.junit.Test;
Expand Down Expand Up @@ -148,7 +149,9 @@ public void singleWorksheet() throws Exception {
assertThat(xwb.getActiveSheetIndex()).isEqualTo(0);
assertThat(xwb.getNumberOfSheets()).isEqualTo(1);
XSSFSheet xws = xwb.getSheet(sheetName);
assertThat((Iterable) xws.getRow(0)).isNull();
@SuppressWarnings("unchecked")
Comparable<XSSFRow> row = (Comparable) xws.getRow(0);
assertThat(row).isNull();
int i = 1;
assertThat(xws.getRow(i).getCell(i++).getStringCellValue()).isEqualTo(stringValue);
assertThat(xws.getRow(i).getCell(i++).getDateCellValue()).isEqualTo(dateValue);
Expand All @@ -168,6 +171,7 @@ public void multipleWorksheets() throws Exception {
int numRows = 5000;
int numCols = 6;
byte[] data = writeWorkbook(wb -> {
@SuppressWarnings("unchecked")
CompletableFuture<Void>[] cfs = new CompletableFuture[numWs];
for (int i = 0; i < cfs.length; ++i) {
Worksheet ws = wb.newWorksheet("Sheet " + i);
Expand Down Expand Up @@ -209,7 +213,7 @@ public void multipleWorksheets() throws Exception {
ws.style(numRows + 1, 4).format("yyyy-MM-dd HH:mm:ss").set();
ws.formula(numRows + 1, 5, "=AVERAGE(" + ws.range(1, 5, numRows, 5).toString() + ")");
ws.style(numRows + 1, 5).format("yyyy-MM-dd").horizontalAlignment("center").verticalAlignment("top").wrapText(true).set();
ws.range(1, 0, numRows, numCols).style().borderColor(Color.RED).borderStyle("thick").shadeAlternateRows(Color.RED).set();
ws.range(1, 0, numRows, numCols - 1).style().borderColor(Color.RED).borderStyle("thick").shadeAlternateRows(Color.RED).set();
});
cfs[i] = cf;
}
Expand Down

0 comments on commit d5fa0c6

Please sign in to comment.