Openbravo Issue Tracking System - Openbravo ERP | |||||||||||||
View Issue Details | |||||||||||||
ID | Project | Category | View Status | Date Submitted | Last Update | ||||||||
0052415 | Openbravo ERP | A. Platform | public | 2023-05-10 23:20 | 2024-02-02 13:35 | ||||||||
Reporter | jlopez | ||||||||||||
Assigned To | frank_gonzalez | ||||||||||||
Priority | normal | Severity | minor | Reproducibility | sometimes | ||||||||
Status | closed | Resolution | fixed | ||||||||||
Platform | OS | 5 | OS Version | ||||||||||
Product Version | |||||||||||||
Target Version | Fixed in Version | ||||||||||||
Merge Request Status | |||||||||||||
Review Assigned To | |||||||||||||
OBNetwork customer | |||||||||||||
Web browser | |||||||||||||
Modules | Core | ||||||||||||
Support ticket | |||||||||||||
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()))) | ||||||||||||
Additional Information | |||||||||||||
Tags | No tags attached. | ||||||||||||
Relationships |
| ||||||||||||
Attached Files | |||||||||||||
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 |
Notes | |||||
|
|||||
|
|
||||
|
|||||
|
|
||||
|
|||||
|
|
||||
|
|||||
|
|
||||
|
|||||
|
|
||||
|
|||||
|
|
||||
|
|||||
|
|
||||
|
|||||
|
|
||||
|
|||||
|
|