[opencms-dev] error during user import (CSV)

Stephan Schrader zstephanz at gmail.com
Thu Jun 19 09:59:57 CEST 2014


Spooky, we faced the same issue 2 week ago. But hadn't have the time to
investigate.

The original problem is during export, the downloaded CSV is not complete.
To confirm, open the file with a texteditor and at the and you will see
that the data stops somewhere and not all columns are written.

The bug is in
"org.opencms.workplace.tools.accounts.CmsUsersCsvDownloadDialog" line: 194.
There the Content-Length header must not be count of characters, it must be
the count of bytes. For a quick fix:

1. Copy the class into a different packacke, eg.
"org.opencms.fix.workplace.tools.accounts"
2. Remove line 194 or replace with (which works for me):
        Charset defaultEncoding =
Charset.forName(OpenCms.getSystemInfo().getDefaultEncoding());

res.setContentLength(buffer.toString().getBytes(defaultEncoding).length);

3. Deploy and replace the original class with your version in:
/system/workplace/admin/accounts/imexport_user_data/csvdownload.jsp

Because of the wrong header, there might be some browser which ignores the
Content-Length and downloads the complete content. I only tested with
Chrome, maybe you can downlaod the full content without the fix in Firefox
or IE.

We have also seen another problem with the user import, during the import
all special character, like ä, ü, ... are not correct decoded.

As before copy the class:
org.opencms.workplace.tools.accounts.CmsUserDataImportList and replace in
line: 549, 550

            fileReader = new FileReader(m_uploadFile);
            bufferedReader = new BufferedReader(fileReader);

with
            FileInputStream fileInputStream = new
FileInputStream(m_uploadFile);
            Charset defaultEncoding =
Charset.forName(OpenCms.getSystemInfo().getDefaultEncoding());
            Reader reader = new InputStreamReader(fileInputStream,
defaultEncoding);
            bufferedReader = new BufferedReader(reader);

Replace the original version in:
/system/workplace/admin/accounts/imexport_user_data/import_csv_list.jsp


Hope this helps
Stephan


2014-06-17 13:05 GMT+02:00 Filip Kratochvil <filip.kratochvil at nelasoft.cz>:

> Hi Chris,
>
>
>
> it will be nice, if you can show us full Error message by *Details…*
> buttonJ As so as i had a similar problems with import because i had some
> whitespaces or invisible characters in CSV file. So you can try to check it.
>
>
>
> --
> Regards
> Filip Kratochvil
> ------------------------------------------------
> NELASOFT Technologies, s.r.o.
> E-mail: filip.kratochvil at nelasoft.cz
> Web: www.nelasoft.cz
>
>
>
> *From:* opencms-dev-bounces at opencms.org [mailto:
> opencms-dev-bounces at opencms.org] *On Behalf Of *Christoph Kukulies
> *Sent:* Tuesday, June 17, 2014 12:50 PM
> *To:* The OpenCms mailing list
> *Subject:* [opencms-dev] error during user import (CSV)
>
>
>
> I'm trying to copy users from one OpenCMS to another. When reading the CSV
> export into the other system I'm getting
>
>
>
>
> (Error while filling the list "Import Users". Reason: Index: 9, Size: 2)
>
> Any ideas?
>
> --
> Chris Christoph P. U. Kukulies kukulies (at) rwth-aachen.de
>
> _______________________________________________
> This mail is sent to you from the opencms-dev mailing list
> To change your list options, or to unsubscribe from the list, please visit
> http://lists.opencms.org/cgi-bin/mailman/listinfo/opencms-dev
>
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://webmail.opencms.org/pipermail/opencms-dev/attachments/20140619/99c1c106/attachment.htm>


More information about the opencms-dev mailing list