Project:
View Issue Details[ Jump to Notes ] | [ Issue History ] [ Print ] | |||||||
ID | ||||||||
0052415 | ||||||||
Type | Category | Severity | Reproducibility | Date Submitted | Last Update | |||
defect | [Openbravo ERP] A. Platform | minor | sometimes | 2023-05-10 23:20 | 2024-02-02 13:35 | |||
Reporter | jlopez | View Status | public | |||||
Assigned To | frank_gonzalez | |||||||
Priority | normal | Resolution | fixed | Fixed in Version | ||||
Status | closed | Fix in branch | Fixed in SCM revision | |||||
Projection | none | ETA | none | Target Version | ||||
OS | Any | Database | Any | Java version | ||||
OS Version | Database version | Ant version | ||||||
Product Version | SCM revision | |||||||
Review Assigned To | ||||||||
Web browser | ||||||||
Modules | Core | |||||||
Regression level | ||||||||
Regression date | ||||||||
Regression introduced in release | ||||||||
Regression introduced by commit | ||||||||
Triggers an Emergency Pack | No | |||||||
Summary | 0052415: Error importing text files: Input length = 1 | |||||||
Description | It has been detected that when importing text files, depending on the operating system with which the file was generated, it can generate the following exception: java.nio.charset.MalformedInputException: Input length = 1 Specifically, for now the error has been located when importing text files that are then processed reading line by line, since depending on the operating system that generated the file, it could use a different line break character than the default for UNIX systems (LF). Creating BufferedReader from Files.newBufferedReader, when running the application it may throw the exception mentioned above. Example: Files.newBufferedReader(Paths.get("a.txt"), StandardCharsets.UTF_8); But if we replace the above with this, it works well: new BufferedReader(new InputStreamReader(new FileInputStream("a.txt"),"utf-8")); The different is that, the former uses CharsetDecoder default action (The default action for malformed-input and unmappable-character errors is to report them), while the latter uses the REPLACE action: cs.newDecoder().onMalformedInput(CodingErrorAction.REPLACE).onUnmappableCharacter(CodingErrorAction.REPLACE) Tests have been done in this regard and it has been verified that using the replacement avoids the error and imports the file correctly (at least for the specific case of line breaks). The use of the same case has been detected in the following files: - src/org/openbravo/retail/discounts/bytotal/actionhandler/ImportFreeProductInDiscount.java - src/org/openbravo/retail/discounts/actionhandler/ImportFreeProductInDiscount.java - src/org/openbravo/pos2/process/ImportCrossStoreWithPriority.java - src/org/openbravo/pos2/process/ImportStoreSet.java - src/org/openbravo/reporting/tools/task/ImportLabelsTask.java - src/org/openbravo/reporting/tools/task/GenerateJasperPropertyFileTask.java So perhaps it would be necessary to check if it is necessary to apply any correction. | |||||||
Steps To Reproduce | * | |||||||
Proposed Solution | Replace this: Files.newBufferedReader(Paths.get(file.getAbsolutePath())) For this: new BufferedReader(new InputStreamReader(new FileInputStream(file.getAbsolutePath()))) | |||||||
Tags | No tags attached. | |||||||
Attached Files | ||||||||
Relationships [ Relation Graph ] [ Dependency Graph ] | |||||||||
|
Notes | |
(0150367) hgbot (developer) 2023-05-29 10:12 |
Merge Request created: https://gitlab.com/openbravo/product/pmods/org.openbravo.pos2/-/merge_requests/1849 [^] |
(0150368) hgbot (developer) 2023-05-29 10:13 |
Merge Request created: https://gitlab.com/openbravo/product/pmods/org.openbravo.retail.discounts/-/merge_requests/105 [^] |
(0150369) hgbot (developer) 2023-05-29 10:13 |
Merge Request created: https://gitlab.com/openbravo/product/pmods/org.openbravo.reporting.tools/-/merge_requests/16 [^] |
(0160168) hgbot (developer) 2024-02-02 13:34 |
Directly closing issue as related merge request is already approved. Repository: https://gitlab.com/openbravo/product/pmods/org.openbravo.pos2 [^] Changeset: c36311c64f688048b540681d66b9cd2a37538fe5 Author: Frank González <frank.gonzalez@openbravo.com> Date: 02-02-2024 12:34:37 URL: https://gitlab.com/openbravo/product/pmods/org.openbravo.pos2/-/commit/c36311c64f688048b540681d66b9cd2a37538fe5 [^] Fixes ISSUE-52415: Error importing files with BufferedReader --- M src/org/openbravo/pos2/process/ImportCrossStoreWithPriority.java M src/org/openbravo/pos2/process/ImportStoreSet.java --- |
(0160169) hgbot (developer) 2024-02-02 13:34 |
Merge request merged: https://gitlab.com/openbravo/product/pmods/org.openbravo.pos2/-/merge_requests/1849 [^] |
(0160170) hgbot (developer) 2024-02-02 13:34 |
Merge request merged: https://gitlab.com/openbravo/product/pmods/org.openbravo.retail.discounts/-/merge_requests/105 [^] |
(0160171) hgbot (developer) 2024-02-02 13:34 |
Directly closing issue as related merge request is already approved. Repository: https://gitlab.com/openbravo/product/pmods/org.openbravo.retail.discounts [^] Changeset: 0629f1827f89162ac5bf96e2474180cdb289ad6c Author: Frank González <frank.gonzalez@openbravo.com> Date: 02-02-2024 12:34:57 URL: https://gitlab.com/openbravo/product/pmods/org.openbravo.retail.discounts/-/commit/0629f1827f89162ac5bf96e2474180cdb289ad6c [^] Fixes ISSUE-52415: Error importing files with BufferedReader --- M src/org/openbravo/retail/discounts/actionhandler/ImportFreeProductInDiscount.java --- |
(0160172) hgbot (developer) 2024-02-02 13:35 |
Directly closing issue as related merge request is already approved. Repository: https://gitlab.com/openbravo/product/pmods/org.openbravo.reporting.tools [^] Changeset: 26b1759b6722829d7ae5f5655d35607213019383 Author: Frank González <frank.gonzalez@openbravo.com> Date: 02-02-2024 12:35:09 URL: https://gitlab.com/openbravo/product/pmods/org.openbravo.reporting.tools/-/commit/26b1759b6722829d7ae5f5655d35607213019383 [^] Fixes ISSUE-52415: Error importing files with BufferedReader --- M src/org/openbravo/reporting/tools/task/GenerateJasperPropertyFileTask.java M src/org/openbravo/reporting/tools/task/ImportLabelsTask.java --- |
(0160173) hgbot (developer) 2024-02-02 13:35 |
Merge request merged: https://gitlab.com/openbravo/product/pmods/org.openbravo.reporting.tools/-/merge_requests/16 [^] |
Issue History | |||
Date Modified | Username | Field | Change |
2023-05-10 23:20 | jlopez | New Issue | |
2023-05-10 23:20 | jlopez | Assigned To | => Triage Platform Base |
2023-05-10 23:20 | jlopez | Modules | => Core |
2023-05-10 23:20 | jlopez | Triggers an Emergency Pack | => No |
2023-05-10 23:21 | jlopez | Relationship added | related to 0052368 |
2023-05-11 09:40 | aferraz | Assigned To | Triage Platform Base => Triage Omni OMS |
2023-05-25 10:54 | frank_gonzalez | Assigned To | Triage Omni OMS => frank_gonzalez |
2023-05-25 10:55 | frank_gonzalez | Status | new => acknowledged |
2023-05-29 10:12 | hgbot | Note Added: 0150367 | |
2023-05-29 10:13 | hgbot | Note Added: 0150368 | |
2023-05-29 10:13 | hgbot | Note Added: 0150369 | |
2024-02-02 13:34 | hgbot | Resolution | open => fixed |
2024-02-02 13:34 | hgbot | Status | acknowledged => closed |
2024-02-02 13:34 | hgbot | Fixed in Version | => 24Q2 |
2024-02-02 13:34 | hgbot | Note Added: 0160168 | |
2024-02-02 13:34 | hgbot | Note Added: 0160169 | |
2024-02-02 13:34 | hgbot | Note Added: 0160170 | |
2024-02-02 13:34 | hgbot | Fixed in Version | 24Q2 => RR24Q2 |
2024-02-02 13:34 | hgbot | Note Added: 0160171 | |
2024-02-02 13:35 | hgbot | Note Added: 0160172 | |
2024-02-02 13:35 | hgbot | Note Added: 0160173 |
Copyright © 2000 - 2009 MantisBT Group |