Skip to content

Commit

Permalink
clean file to remove non-UTF-8 xters as best as system can
Browse files Browse the repository at this point in the history
  • Loading branch information
hplahar committed Jun 30, 2021
1 parent 2828845 commit 569a82d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/main/java/org/jbei/ice/lib/bulkupload/BulkCSVUpload.java
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ private HashMap<Integer, HeaderValue> processColumnHeaders(String[] headerArray)
HashMap<Integer, HeaderValue> headers = new HashMap<>();

for (int i = 0; i < headerArray.length; i += 1) {
String fieldStr = headerArray[i].trim();
String fieldStr = headerArray[i].replaceAll("[^\\x20-\\x7e]", " ").trim();

// account for asterisk that indicates a header is required
fieldStr = fieldStr.replace(FileBulkUpload.ASTERISK_SYMBOL, "");
Expand Down Expand Up @@ -196,7 +196,7 @@ List<PartWithSample> getBulkUploadDataFromFile(InputStream inputStream) throws I
// for each column
for (int i = 0; i < nextLine.length; i += 1) {
HeaderValue headerForColumn = headers.get(i);
String value = nextLine[i];
String value = nextLine[i].replaceAll("[^\\x20-\\x7e]", " ");

// process sample information
if (headerForColumn.isSampleField()) {
Expand Down

0 comments on commit 569a82d

Please sign in to comment.