Lines 17-22
Link Here
|
17 |
import java.io.InputStreamReader; |
17 |
import java.io.InputStreamReader; |
18 |
import java.io.OutputStreamWriter; |
18 |
import java.io.OutputStreamWriter; |
19 |
import java.io.UnsupportedEncodingException; |
19 |
import java.io.UnsupportedEncodingException; |
|
|
20 |
import java.nio.charset.Charset; |
20 |
import java.util.ArrayList; |
21 |
import java.util.ArrayList; |
21 |
import java.util.HashMap; |
22 |
import java.util.HashMap; |
22 |
import java.util.HashSet; |
23 |
import java.util.HashSet; |
Lines 912-918
Link Here
|
912 |
if (manifest == null) |
913 |
if (manifest == null) |
913 |
return null; |
914 |
return null; |
914 |
// non-null implies regular file |
915 |
// non-null implies regular file |
915 |
reader = new BufferedReader(new InputStreamReader(zip.getInputStream(manifest))); |
916 |
reader = new BufferedReader(new InputStreamReader(zip.getInputStream(manifest), Charset.forName(org.eclipse.jdt.internal.compiler.util.Util.UTF_8))); |
916 |
ManifestAnalyzer analyzer = new ManifestAnalyzer(); |
917 |
ManifestAnalyzer analyzer = new ManifestAnalyzer(); |
917 |
boolean success = analyzer.analyzeManifestContents(reader); |
918 |
boolean success = analyzer.analyzeManifestContents(reader); |
918 |
calledFileNames = analyzer.getCalledFileNames(); |
919 |
calledFileNames = analyzer.getCalledFileNames(); |
Lines 1462-1468
Link Here
|
1462 |
* <li> The project output location path cannot be null, must be absolute and located inside the project. |
1463 |
* <li> The project output location path cannot be null, must be absolute and located inside the project. |
1463 |
* <li> Specific output locations (specified on source entries) can be null, if not they must be located inside the project, |
1464 |
* <li> Specific output locations (specified on source entries) can be null, if not they must be located inside the project, |
1464 |
* <li> A project entry cannot refer to itself directly (that is, a project cannot prerequisite itself). |
1465 |
* <li> A project entry cannot refer to itself directly (that is, a project cannot prerequisite itself). |
1465 |
* <li> Classpath entries or output locations cannot coincidate or be nested in each other, except for the following scenarii listed below: |
1466 |
* <li> Classpath entries or output locations cannot coincidate or be nested in each other, except for the following scenarii listed below: |
1466 |
* <ul><li> A source folder can coincidate with its own output location, in which case this output can then contain library archives. |
1467 |
* <ul><li> A source folder can coincidate with its own output location, in which case this output can then contain library archives. |
1467 |
* However, a specific output location cannot coincidate with any library or a distinct source folder than the one referring to it. </li> |
1468 |
* However, a specific output location cannot coincidate with any library or a distinct source folder than the one referring to it. </li> |
1468 |
* <li> A source/library folder can be nested in any source folder as long as the nested folder is excluded from the enclosing one. </li> |
1469 |
* <li> A source/library folder can be nested in any source folder as long as the nested folder is excluded from the enclosing one. </li> |
Lines 1581-1588
Link Here
|
1581 |
} |
1582 |
} |
1582 |
// check nesting across output locations |
1583 |
// check nesting across output locations |
1583 |
for (int i = 1 /*no check for default output*/ ; i < outputCount; i++) { |
1584 |
for (int i = 1 /*no check for default output*/ ; i < outputCount; i++) { |
1584 |
IPath customOutput = outputLocations[i]; |
1585 |
IPath customOutput = outputLocations[i]; |
1585 |
int index; |
1586 |
int index; |
1586 |
// check nesting |
1587 |
// check nesting |
1587 |
if ((index = Util.indexOfEnclosingPath(customOutput, outputLocations, outputCount)) != -1 && index != i) { |
1588 |
if ((index = Util.indexOfEnclosingPath(customOutput, outputLocations, outputCount)) != -1 && index != i) { |
1588 |
if (index == 0) { |
1589 |
if (index == 0) { |
Lines 1681-1706
Link Here
|
1681 |
} |
1682 |
} |
1682 |
|
1683 |
|
1683 |
// prevent nesting output location inside entry unless enclosing is a source entry which explicitly exclude the output location |
1684 |
// prevent nesting output location inside entry unless enclosing is a source entry which explicitly exclude the output location |
1684 |
char[][] inclusionPatterns = ((ClasspathEntry)entry).fullInclusionPatternChars(); |
1685 |
char[][] inclusionPatterns = ((ClasspathEntry)entry).fullInclusionPatternChars(); |
1685 |
char[][] exclusionPatterns = ((ClasspathEntry)entry).fullExclusionPatternChars(); |
1686 |
char[][] exclusionPatterns = ((ClasspathEntry)entry).fullExclusionPatternChars(); |
1686 |
for (int j = 0; j < outputCount; j++){ |
1687 |
for (int j = 0; j < outputCount; j++){ |
1687 |
IPath currentOutput = outputLocations[j]; |
1688 |
IPath currentOutput = outputLocations[j]; |
1688 |
if (entryPath.equals(currentOutput)) continue; |
1689 |
if (entryPath.equals(currentOutput)) continue; |
1689 |
if (entryPath.isPrefixOf(currentOutput)) { |
1690 |
if (entryPath.isPrefixOf(currentOutput)) { |
1690 |
if (kind != IClasspathEntry.CPE_SOURCE || !Util.isExcluded(currentOutput, inclusionPatterns, exclusionPatterns, true)) { |
1691 |
if (kind != IClasspathEntry.CPE_SOURCE || !Util.isExcluded(currentOutput, inclusionPatterns, exclusionPatterns, true)) { |
1691 |
return new JavaModelStatus(IJavaModelStatusConstants.INVALID_CLASSPATH, Messages.bind(Messages.classpath_cannotNestOutputInEntry, new String[] {currentOutput.makeRelative().toString(), entryPath.makeRelative().toString()})); |
1692 |
return new JavaModelStatus(IJavaModelStatusConstants.INVALID_CLASSPATH, Messages.bind(Messages.classpath_cannotNestOutputInEntry, new String[] {currentOutput.makeRelative().toString(), entryPath.makeRelative().toString()})); |
1692 |
} |
1693 |
} |
1693 |
} |
1694 |
} |
1694 |
} |
1695 |
} |
1695 |
|
1696 |
|
1696 |
// prevent nesting entry inside output location - when distinct from project or a source folder |
1697 |
// prevent nesting entry inside output location - when distinct from project or a source folder |
1697 |
for (int j = 0; j < outputCount; j++){ |
1698 |
for (int j = 0; j < outputCount; j++){ |
1698 |
if (allowNestingInOutputLocations[j]) continue; |
1699 |
if (allowNestingInOutputLocations[j]) continue; |
1699 |
IPath currentOutput = outputLocations[j]; |
1700 |
IPath currentOutput = outputLocations[j]; |
1700 |
if (currentOutput.isPrefixOf(entryPath)) { |
1701 |
if (currentOutput.isPrefixOf(entryPath)) { |
1701 |
return new JavaModelStatus(IJavaModelStatusConstants.INVALID_CLASSPATH, Messages.bind(Messages.classpath_cannotNestEntryInOutput, new String[] {entryPath.makeRelative().toString(), currentOutput.makeRelative().toString()})); |
1702 |
return new JavaModelStatus(IJavaModelStatusConstants.INVALID_CLASSPATH, Messages.bind(Messages.classpath_cannotNestEntryInOutput, new String[] {entryPath.makeRelative().toString(), currentOutput.makeRelative().toString()})); |
1702 |
} |
1703 |
} |
1703 |
} |
1704 |
} |
1704 |
} |
1705 |
} |
1705 |
// ensure that no specific output is coincidating with another source folder (only allowed if matching current source folder) |
1706 |
// ensure that no specific output is coincidating with another source folder (only allowed if matching current source folder) |
1706 |
// 36465 - for 2.0 backward compatibility, only check specific output locations (the default can still coincidate) |
1707 |
// 36465 - for 2.0 backward compatibility, only check specific output locations (the default can still coincidate) |
Lines 1921-1927
Link Here
|
1921 |
// project source folder |
1922 |
// project source folder |
1922 |
case IClasspathEntry.CPE_SOURCE : |
1923 |
case IClasspathEntry.CPE_SOURCE : |
1923 |
if (((entry.getInclusionPatterns() != null && entry.getInclusionPatterns().length > 0) |
1924 |
if (((entry.getInclusionPatterns() != null && entry.getInclusionPatterns().length > 0) |
1924 |
|| (entry.getExclusionPatterns() != null && entry.getExclusionPatterns().length > 0)) |
1925 |
|| (entry.getExclusionPatterns() != null && entry.getExclusionPatterns().length > 0)) |
1925 |
&& JavaCore.DISABLED.equals(project.getOption(JavaCore.CORE_ENABLE_CLASSPATH_EXCLUSION_PATTERNS, true))) { |
1926 |
&& JavaCore.DISABLED.equals(project.getOption(JavaCore.CORE_ENABLE_CLASSPATH_EXCLUSION_PATTERNS, true))) { |
1926 |
return new JavaModelStatus(IJavaModelStatusConstants.DISABLED_CP_EXCLUSION_PATTERNS, project, path); |
1927 |
return new JavaModelStatus(IJavaModelStatusConstants.DISABLED_CP_EXCLUSION_PATTERNS, project, path); |
1927 |
} |
1928 |
} |
Lines 2014-2034
Link Here
|
2014 |
} |
2015 |
} |
2015 |
} else if (target instanceof File){ |
2016 |
} else if (target instanceof File){ |
2016 |
File file = JavaModel.getFile(target); |
2017 |
File file = JavaModel.getFile(target); |
2017 |
if (file == null) { |
2018 |
if (file == null) { |
2018 |
if (container != null) { |
2019 |
if (container != null) { |
2019 |
return new JavaModelStatus(IJavaModelStatusConstants.INVALID_CLASSPATH, Messages.bind(Messages.classpath_illegalExternalFolderInContainer, new String[] {path.toOSString(), container})); |
2020 |
return new JavaModelStatus(IJavaModelStatusConstants.INVALID_CLASSPATH, Messages.bind(Messages.classpath_illegalExternalFolderInContainer, new String[] {path.toOSString(), container})); |
2020 |
} else { |
2021 |
} else { |
2021 |
return new JavaModelStatus(IJavaModelStatusConstants.INVALID_CLASSPATH, Messages.bind(Messages.classpath_illegalExternalFolder, new String[] {path.toOSString(), project.getElementName()})); |
2022 |
return new JavaModelStatus(IJavaModelStatusConstants.INVALID_CLASSPATH, Messages.bind(Messages.classpath_illegalExternalFolder, new String[] {path.toOSString(), project.getElementName()})); |
2022 |
} |
2023 |
} |
2023 |
} else if (sourceAttachment != null |
2024 |
} else if (sourceAttachment != null |
2024 |
&& !sourceAttachment.isEmpty() |
2025 |
&& !sourceAttachment.isEmpty() |
2025 |
&& JavaModel.getTarget(sourceAttachment, true) == null){ |
2026 |
&& JavaModel.getTarget(sourceAttachment, true) == null){ |
2026 |
if (container != null) { |
2027 |
if (container != null) { |
2027 |
return new JavaModelStatus(IJavaModelStatusConstants.INVALID_CLASSPATH, Messages.bind(Messages.classpath_unboundSourceAttachmentInContainedLibrary, new String [] {sourceAttachment.toString(), path.toOSString(), container})); |
2028 |
return new JavaModelStatus(IJavaModelStatusConstants.INVALID_CLASSPATH, Messages.bind(Messages.classpath_unboundSourceAttachmentInContainedLibrary, new String [] {sourceAttachment.toString(), path.toOSString(), container})); |
2028 |
} else { |
2029 |
} else { |
2029 |
return new JavaModelStatus(IJavaModelStatusConstants.INVALID_CLASSPATH, Messages.bind(Messages.classpath_unboundSourceAttachment, new String [] {sourceAttachment.toString(), path.toOSString(), project.getElementName()})); |
2030 |
return new JavaModelStatus(IJavaModelStatusConstants.INVALID_CLASSPATH, Messages.bind(Messages.classpath_unboundSourceAttachment, new String [] {sourceAttachment.toString(), path.toOSString(), project.getElementName()})); |
2030 |
} |
2031 |
} |
2031 |
} |
2032 |
} |
2032 |
} else { |
2033 |
} else { |
2033 |
boolean isExternal = path.getDevice() != null || !ResourcesPlugin.getWorkspace().getRoot().getProject(path.segment(0)).exists(); |
2034 |
boolean isExternal = path.getDevice() != null || !ResourcesPlugin.getWorkspace().getRoot().getProject(path.segment(0)).exists(); |
2034 |
if (isExternal) { |
2035 |
if (isExternal) { |