|
Lines 11-25
Link Here
|
| 11 |
package org.eclipse.jdt.internal.core; |
11 |
package org.eclipse.jdt.internal.core; |
| 12 |
|
12 |
|
| 13 |
import java.io.*; |
13 |
import java.io.*; |
| 14 |
import java.io.BufferedInputStream; |
|
|
| 15 |
import java.io.ByteArrayInputStream; |
| 16 |
import java.io.ByteArrayOutputStream; |
| 17 |
import java.io.File; |
| 18 |
import java.io.FileInputStream; |
| 19 |
import java.io.IOException; |
| 20 |
import java.io.InputStream; |
| 21 |
import java.io.OutputStreamWriter; |
| 22 |
import java.io.StringReader; |
| 23 |
import java.util.ArrayList; |
14 |
import java.util.ArrayList; |
| 24 |
import java.util.HashMap; |
15 |
import java.util.HashMap; |
| 25 |
import java.util.HashSet; |
16 |
import java.util.HashSet; |
|
Lines 2121-2126
Link Here
|
| 2121 |
// fallback to default |
2112 |
// fallback to default |
| 2122 |
property = new String(bytes); |
2113 |
property = new String(bytes); |
| 2123 |
} |
2114 |
} |
|
|
2115 |
} else { |
| 2116 |
// when a project is imported, we get a first delta for the addition of the .project, but the .classpath is not accessible |
| 2117 |
// so default to using java.io.File |
| 2118 |
// see https://bugs.eclipse.org/bugs/show_bug.cgi?id=96258 |
| 2119 |
File file = rscFile.getLocation().toFile(); |
| 2120 |
if (file.exists()) { |
| 2121 |
byte[] bytes; |
| 2122 |
try { |
| 2123 |
bytes = org.eclipse.jdt.internal.compiler.util.Util.getFileByteContent(file); |
| 2124 |
} catch (IOException e) { |
| 2125 |
return null; |
| 2126 |
} |
| 2127 |
try { |
| 2128 |
property = new String(bytes, "UTF-8"); //$NON-NLS-1$ // .classpath always encoded with UTF-8 |
| 2129 |
} catch (UnsupportedEncodingException e) { |
| 2130 |
Util.log(e, "Could not read .classpath with UTF-8 encoding"); //$NON-NLS-1$ |
| 2131 |
// fallback to default |
| 2132 |
property = new String(bytes); |
| 2133 |
} |
| 2134 |
} |
| 2124 |
} |
2135 |
} |
| 2125 |
return property; |
2136 |
return property; |
| 2126 |
} |
2137 |
} |