|
1 | 1 | /*
|
2 | 2 | * java.util.Properties.java modified by Kevin Gaudin to allow usage of enums as keys.
|
3 |
| - * |
| 3 | + * |
4 | 4 | * Licensed to the Apache Software Foundation (ASF) under one or more
|
5 | 5 | * contributor license agreements. See the NOTICE file distributed with
|
6 | 6 | * this work for additional information regarding copyright ownership.
|
@@ -69,15 +69,7 @@ public CrashReportData load(String fileName) throws IOException {
|
69 | 69 |
|
70 | 70 | try {
|
71 | 71 | final BufferedInputStream bis = new BufferedInputStream(in, ACRAConstants.DEFAULT_BUFFER_SIZE_IN_BYTES);
|
72 |
| - bis.mark(Integer.MAX_VALUE); |
73 |
| - final boolean isEbcdic = isEbcdic(bis); |
74 |
| - bis.reset(); |
75 |
| - |
76 |
| - if (!isEbcdic) { |
77 |
| - return load(new InputStreamReader(bis, "ISO8859-1")); //$NON-NLS-1$ |
78 |
| - } else { |
79 |
| - return load(new InputStreamReader(bis)); //$NON-NLS-1$ |
80 |
| - } |
| 72 | + return load(new InputStreamReader(bis, "ISO8859-1")); //$NON-NLS-1$ |
81 | 73 | } finally {
|
82 | 74 | in.close();
|
83 | 75 | }
|
@@ -114,24 +106,6 @@ public void store(CrashReportData crashData, String fileName) throws IOException
|
114 | 106 | }
|
115 | 107 | }
|
116 | 108 |
|
117 |
| - private boolean isEbcdic(BufferedInputStream in) throws IOException { |
118 |
| - byte b; |
119 |
| - while ((b = (byte) in.read()) != -1) { |
120 |
| - if (b == 0x23 || b == 0x0a || b == 0x3d) {// ascii: newline/#/= |
121 |
| - return false; |
122 |
| - } |
123 |
| - if (b == 0x15) {// EBCDIC newline |
124 |
| - return true; |
125 |
| - } |
126 |
| - } |
127 |
| - // we found no ascii newline, '#', neither '=', relative safe to |
128 |
| - // consider it |
129 |
| - // as non-ascii, the only exception will be a single line with only |
130 |
| - // key(no value and '=') |
131 |
| - // in this case, it should be no harm to read it in default charset |
132 |
| - return false; |
133 |
| - } |
134 |
| - |
135 | 109 | /**
|
136 | 110 | * Loads properties from the specified InputStream. The properties are of
|
137 | 111 | * the form <code>key=value</code>, one property per line. It may be not
|
@@ -323,7 +297,7 @@ private synchronized CrashReportData load(Reader reader) throws IOException {
|
323 | 297 | }
|
324 | 298 | crashData.put(key, value);
|
325 | 299 | }
|
326 |
| - |
| 300 | + |
327 | 301 | CollectorUtil.safeClose(reader);
|
328 | 302 |
|
329 | 303 | return crashData;
|
|
0 commit comments