You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by bu...@apache.org on 2014/12/11 20:55:11 UTC

[Bug 57342] New: Excel is getting corrupt : Apache poi version poi-3.9

https://issues.apache.org/bugzilla/show_bug.cgi?id=57342

            Bug ID: 57342
           Summary: Excel is getting corrupt : Apache poi version poi-3.9
           Product: POI
           Version: 3.9-FINAL
          Hardware: PC
            Status: NEW
          Severity: normal
          Priority: P2
         Component: HSSF
          Assignee: dev@poi.apache.org
          Reporter: pal.ratikanta@gmail.com

Created attachment 32284
  --> https://issues.apache.org/bugzilla/attachment.cgi?id=32284&action=edit
Attached! source

Hi,
After 7 lakh records file are getting corroupted,when i am writing 1 million
recors with 60 columns its working fine but when i am writing 7.5 lakh records
with 100 columns file are getting corrupted.

I have attached snipnet of code . Kindly suggest i if doing something wrong

package com.rati.Dec;

import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;

import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.xssf.streaming.SXSSFSheet;
import org.apache.poi.xssf.streaming.SXSSFWorkbook;

public class MillionTest1 {

    public static void main(String[] args) {
        // TODO Auto-generated method stub
        SXSSFWorkbook workbook = new SXSSFWorkbook(100);
        workbook.setCompressTempFiles(true);
        SXSSFSheet sheet = null;
        Row row = null;
        Cell cell = null;
        sheet = (SXSSFSheet) workbook.createSheet("Test");
        FileOutputStream fileOut = null;
        try {
            System.out.println("Started!");
            for (int i = 0; i < 777384; i++) {
                row = sheet.createRow(i);
                for (int j = 0; j < 100; j++) {
                    cell = row.createCell(j);
                    cell.setCellValue("Rati : row : "+i +" Col: "+ j);
                }
            }

            fileOut = new FileOutputStream(
                    new File("Z:\\output\\Version\\Version11.xlsx"));
            workbook.write(fileOut);

        } catch (Exception exception) {
            exception.printStackTrace();
        } finally {
            workbook.dispose();
            try {
                fileOut.flush();
                fileOut.close();
            } catch (IOException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
            System.out.println("Completed!");
        }
    }

}

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 57342] Excel is getting corrupt : Apache poi version poi-3.9

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=57342

maggie1 <gr...@dougandgretchen.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |gretchen@dougandgretchen.co
                   |                            |m

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 57342] Excel is getting corrupt : Apache poi version poi-3.9

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=57342

--- Comment #2 from RatiKanata Pal <pa...@gmail.com> ---
sir.i have tried all version and compatible dependency jars.still file is
getting corrupted.

u can also try running this or attached code!

:(

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 57342] Writing very large file via SXXSF leads to corrupt file

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=57342

RatiKanata Pal <pa...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 OS|                            |All

--- Comment #10 from RatiKanata Pal <pa...@gmail.com> ---
It also been tested multiple system but issue remains the same.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 57342] Writing very large file via SXXSF leads to corrupt file

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=57342

RatiKanata Pal <pa...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEEDINFO                    |NEW

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 57342] Excel is getting corrupt : Apache poi version poi-3.9

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=57342

RatiKanata Pal <pa...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEEDINFO                    |NEW
           Severity|normal                      |blocker

--- Comment #3 from RatiKanata Pal <pa...@gmail.com> ---
(In reply to Nick Burch from comment #1)
> How is the file getting corrupt?
> 
> How do the files differ between 3.9 and 3.10?
> 
> Did you try with 3.11 beta 3?
> 
> Did you try generating a simple file with the same number of rows+columns
> using SSPerformanceTest (see http://poi.apache.org/faq.html#faq-N10109)? Did
> that file work fine when generated at the same row+column size?

No Sir,
i have tried using SSPerformanceTest 

args = new String[4];
args[0] = "SXSSF";
args[1] = "1000000";->Rows
args[2] = "100";--->Cols
args[3] = "1";


but still file is getting corrupt.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 57342] Excel is getting corrupt : Apache poi version poi-3.9

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=57342

RatiKanata Pal <pa...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P2                          |P1

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 57342] Writing very large file via SXXSF leads to corrupt file

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=57342

--- Comment #7 from Dominik Stadler <do...@gmx.at> ---
I tried with java version "1.6.0_26" and could not reproduce the problem there.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 57342] Writing very large file via SXXSF leads to corrupt file

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=57342

RatiKanata Pal <pa...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 OS|All                         |Windows 7

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 57342] Writing very large file via SXXSF leads to corrupt file

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=57342

RatiKanata Pal <pa...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pal.ratikanta@gmail.com

--- Comment #9 from RatiKanata Pal <pa...@gmail.com> ---
Created attachment 32356
  --> https://issues.apache.org/bugzilla/attachment.cgi?id=32356&action=edit
Jars Used

HI,
Run the test using Jdk 1.8 and latest poi jars.

here the code I used 


package com.rati.Dec;

import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;

import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.xssf.streaming.SXSSFSheet;
import org.apache.poi.xssf.streaming.SXSSFWorkbook;

public class MillionTest1 {

    @SuppressWarnings("resource")
    public static void main(String[] args) {
        // TODO Auto-generated method stub
        SXSSFWorkbook workbook = new SXSSFWorkbook(100);
        workbook.setCompressTempFiles(true);
        SXSSFSheet sheet = null;
        Row row = null;
        Cell cell = null;
        sheet = (SXSSFSheet) workbook.createSheet("Test");
        FileOutputStream fileOut = null;
        try {
            System.out.println("Started!");
            for (int i = 0; i < 777384; i++) {
                row = sheet.createRow(i);
                for (int j = 0; j < 100; j++) {
                    cell = row.createCell(j);
                    cell.setCellValue("Rati : row : "+i +" Col: "+ j);
                }
            }

            fileOut = new FileOutputStream(
                    new File("Z:\\Version11.xlsx"));
            workbook.write(fileOut);

        } catch (Exception exception) {
            exception.printStackTrace();
        } finally {
            workbook.dispose();
            try {
                fileOut.flush();
                fileOut.close();
            } catch (IOException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
            System.out.println("Completed!");
        }
    }

}


Same error Is popping up.

I have also attached the screen shots in the attachment section.

Please check once.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 57342] Writing very large file via SXXSF leads to corrupt file

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=57342

Dominik Stadler <do...@gmx.at> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |NEEDINFO
            Summary|Excel is getting corrupt :  |Writing very large file via
                   |Apache poi version poi-3.9  |SXXSF leads to corrupt file

--- Comment #5 from Dominik Stadler <do...@gmx.at> ---
I think this the problem may happen around the 2G/4G size border, so it may be
related to the trouble in some JDK versions with handling zip-files larger than
2G/4G, can you state which exact Java version you are using?

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 57342] Excel is getting corrupt : Apache poi version poi-3.9

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=57342

Nick Burch <ap...@gagravarr.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |NEEDINFO
                 OS|                            |All

--- Comment #1 from Nick Burch <ap...@gagravarr.org> ---
How is the file getting corrupt?

How do the files differ between 3.9 and 3.10?

Did you try with 3.11 beta 3?

Did you try generating a simple file with the same number of rows+columns using
SSPerformanceTest (see http://poi.apache.org/faq.html#faq-N10109)? Did that
file work fine when generated at the same row+column size?

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 57342] Writing very large file via SXXSF leads to corrupt file

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=57342

--- Comment #6 from Dominik Stadler <do...@gmx.at> ---
I tried to look up details of support of large zip files in Java, but the
bug-database is not very definite about what is supported.

However https://en.wikipedia.org/wiki/Zip_(file_format)#ZIP64 states that only
Java 7 fully supports files larger than 4G, can you try running your test with
the latest patchlevel of this version to verify this?

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 57342] Writing very large file via SXXSF leads to corrupt file

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=57342

--- Comment #8 from RatiKanata Pal <pa...@gmail.com> ---
Created attachment 32355
  --> https://issues.apache.org/bugzilla/attachment.cgi?id=32355&action=edit
Error Shown from Excel

Error and compiler version

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 57342] Writing very large file via SXXSF leads to corrupt file

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=57342

Nick Burch <ap...@gagravarr.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |NEEDINFO

--- Comment #11 from Nick Burch <ap...@gagravarr.org> ---
I've just run your test program on this jvm:

java version "1.6.0_33"
OpenJDK Runtime Environment (IcedTea6 1.13.5) (6b33-1.13.5-1ubuntu0.12.04)

The generated file (268mb!) is processed just fine with Apache Tika

The generated file takes an absolute epic age to load in Excel 
then Excel gives a warning about unreadable content, after repairing it
reports:
"System error: - 2134163449. Line 437452, column 5899". However, it does still
show 777384 rows, all with 100 columns

The only thing I can suggest is finding the exact point when the file files to
load (eg 777384 fails, 777383 works), then unzip both files and compare the XML
to see how they differ. (We now have a tool to help with this -
OOXMLPrettyPrint)

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 57342] Excel is getting corrupt : Apache poi version poi-3.9

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=57342

--- Comment #4 from maggie1 <gr...@dougandgretchen.com> ---
We are also using 3.9 and experiencing the same corruption. Ran the performance
test with the same results as reporting user.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 57342] Excel is getting corrupt : Apache poi version poi-3.9

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=57342

RatiKanata Pal <pa...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|HSSF                        |SXSSF

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org