Anonymous | Login
News | My View | View Issues | Roadmap | Summary

View Issue DetailsJump to Notes ] Issue History ] Print ]
TypeCategorySeverityReproducibilityDate SubmittedLast Update
defect[Openbravo ERP] A. Platformminorsometimes2023-05-10 23:202023-05-29 10:13
ReporterjlopezView Statuspublic 
Assigned Tofrank_gonzalez 
PrioritynormalResolutionopenFixed in Version
StatusacknowledgedFix in branchFixed in SCM revision
ProjectionnoneETAnoneTarget Version
OSAnyDatabaseAnyJava version
OS VersionDatabase versionAnt version
Product VersionSCM revision 
Review Assigned To
Web browser
Regression level
Regression date
Regression introduced in release
Regression introduced by commit
Triggers an Emergency PackNo

0052415: Error importing text files: Input length = 1

DescriptionIt 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:


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/
- src/org/openbravo/retail/discounts/actionhandler/
- src/org/openbravo/pos2/process/
- src/org/openbravo/pos2/process/
- src/org/openbravo/reporting/tools/task/
- src/org/openbravo/reporting/tools/task/

So perhaps it would be necessary to check if it is necessary to apply any correction.
Steps To Reproduce*
Proposed SolutionReplace this:


For this:

new BufferedReader(new InputStreamReader(new FileInputStream(file.getAbsolutePath())))
TagsNo tags attached.
Attached Files

- Relationships Relation Graph ] Dependency Graph ]
related to defect 0052368 closedjlopez Modules [OPECOM] Cannot import prices : error Input lenght = 1 

-  Notes
hgbot (developer)
2023-05-29 10:12

Merge Request created: [^]
hgbot (developer)
2023-05-29 10:13

Merge Request created: [^]
hgbot (developer)
2023-05-29 10:13

Merge Request created: [^]

- 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

Copyright © 2000 - 2009 MantisBT Group
Powered by Mantis Bugtracker