[Bug] Writing multiple sheets to CSV silently drops unflushed rows
I maintainer di solito rispondono entro 1 giorno
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 88/100
Direzione di ricerca
Iniziare da CsvWorkbook#createSheet alle righe 172-182 e 270-273, quindi esaminare CsvWorkbook#write e CsvSheet intorno alle righe 659-665. Riprodurre il problema tramite l’API pubblica ExcelWriter e aggiungere un test di regressione. Il lavoro è completo quando la creazione di un secondo foglio CSV logico genera un’eccezione a runtime prima che le righe memorizzate nel buffer possano andare perse.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Fesod version
Current main at 5a9a16b.
Description
Writing two distinct WriteSheet instances through one CSV ExcelWriter succeeds without an exception, but rows buffered by the earlier sheet are silently discarded.
Location
fesod-sheet/src/main/java/org/apache/fesod/sheet/metadata/csv/CsvWorkbook.java:172-182fesod-sheet/src/main/java/org/apache/fesod/sheet/metadata/csv/CsvWorkbook.java:270-273fesod-sheet/src/main/java/org/apache/fesod/sheet/metadata/csv/CsvSheet.java:659-665
CsvWorkbook#createSheet uses assert csvSheet == null to enforce the single-sheet CSV contract. Assertions are disabled in normal JVM runs, so a second sheet replaces the only csvSheet reference. CsvWorkbook#write then closes and flushes only the replacement sheet.
Reproduction
try (ExcelWriter writer = FesodSheet.write(file)
.excelType(ExcelTypeEnum.CSV)
.build()) {
writer.write(Collections.singletonList(Collections.singletonList("first-row")),
FesodSheet.writerSheet(0).build());
writer.write(Collections.singletonList(Collections.singletonList("second-row")),
FesodSheet.writerSheet(1).build());
}
The resulting CSV contains only second-row. With 101 rows in the first sheet, the first 100 rows are flushed, row 101 is lost, and the second sheet is appended. No exception is raised.
Expected behavior
CSV should reject creation of a second logical sheet with a normal runtime exception before any data can be lost.
Suggested fix
Replace the assert checks in both createSheet overloads with an explicit guard and add a regression test through the public writer API.
Related existing work
Issue #103 concerns parallel writing of multiple Excel sheets. It does not cover CSV silently discarding buffered rows.
Are you willing to submit a PR?
Yes.
- Lingua principale
- Java
- Stelle
- 6.3k
- Fork
- 545
- Merge medio
- 2g 22h
- PR unite (30g)
- 41
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di apache/fesod
-
[Enhancement] Allow static imports in test sources so AssertJ is usableForse già presa @qiaolezi001 l’ha presa oggi. Apertaenhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 69/100
apache/fesod#1267 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
[Task] mvnw.cmd always shows as modified after cloningForse già presa @yebuguntang l’ha presa 4 giorni fa. Apertadiscussion welcome help wanted
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 91/100
I maintainer di solito rispondono entro 1 giorno
-
discussion welcome security waiting for feedback
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
apache/fesod#1184 · 1 reazione ·
I maintainer di solito rispondono entro 1 giorno
-
[Bug] xlsx stream write leaves temp fileForse già presa @nkuprins l’ha presa 22 giorni fa. Apertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
apache/fesod#1137 · 1 commento · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
-
[Bug] A cell read into a ReadCellData field loses its row and column indexForse già presa @CodeMan-cmd l’ha presa 36 giorni fa. Apertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
apache/fesod#1131 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di apache/fesod
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 67/100
quarkiverse/quarkus-google-cloud-services#1188 ·
I maintainer di solito rispondono entro 1 giorno
-
Component: Frontend Component: Web Component Type: Maintenance
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
it-at-m/refarch-templates#1944 ·
I maintainer di solito rispondono entro 2 giorni
-
priority: p2 type: bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
googleapis/java-genai#1372 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 60/100