mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-21 21:52:10 +02:00
Cleanup GCCToolChain
Fixed some possible null pointer uses, detected by a statical code analysis tool.
This commit is contained in:
parent
9e10c79017
commit
9dcaf509fa
1 changed files with 12 additions and 10 deletions
|
@ -280,11 +280,11 @@ public class GCCToolChain extends PlatformObject implements IToolChain {
|
||||||
}
|
}
|
||||||
|
|
||||||
List<String> commandLine = new ArrayList<>();
|
List<String> commandLine = new ArrayList<>();
|
||||||
if (command.isAbsolute()) {
|
Path commandPath = getCommandPath(command);
|
||||||
commandLine.add(command.toString());
|
if (commandPath == null) {
|
||||||
} else {
|
throw new NullPointerException("Cannot obtain full command path for command " + command); //$NON-NLS-1$
|
||||||
commandLine.add(getCommandPath(command).toString());
|
|
||||||
}
|
}
|
||||||
|
commandLine.add(commandPath.toString());
|
||||||
|
|
||||||
if (baseScannerInfo != null) {
|
if (baseScannerInfo != null) {
|
||||||
if (baseScannerInfo.getIncludePaths() != null) {
|
if (baseScannerInfo.getIncludePaths() != null) {
|
||||||
|
@ -415,11 +415,11 @@ public class GCCToolChain extends PlatformObject implements IToolChain {
|
||||||
// Pick the first one
|
// Pick the first one
|
||||||
Path command = Paths.get(commands[0]);
|
Path command = Paths.get(commands[0]);
|
||||||
List<String> commandLine = new ArrayList<>();
|
List<String> commandLine = new ArrayList<>();
|
||||||
if (command.isAbsolute()) {
|
Path commandPath = getCommandPath(command);
|
||||||
commandLine.add(command.toString());
|
if (commandPath == null) {
|
||||||
} else {
|
throw new NullPointerException("Cannot obtain full command path for command " + command); //$NON-NLS-1$
|
||||||
commandLine.add(getCommandPath(command).toString());
|
|
||||||
}
|
}
|
||||||
|
commandLine.add(commandPath.toString());
|
||||||
|
|
||||||
if (baseScannerInfo != null) {
|
if (baseScannerInfo != null) {
|
||||||
if (baseScannerInfo.getIncludePaths() != null) {
|
if (baseScannerInfo.getIncludePaths() != null) {
|
||||||
|
@ -535,7 +535,9 @@ public class GCCToolChain extends PlatformObject implements IToolChain {
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
Activator.log(e);
|
Activator.log(e);
|
||||||
}
|
}
|
||||||
Files.delete(tmpFile);
|
if (tmpFile != null) {
|
||||||
|
Files.delete(tmpFile);
|
||||||
|
}
|
||||||
|
|
||||||
return new ExtendedScannerInfo(symbols, includePath.toArray(new String[includePath.size()]));
|
return new ExtendedScannerInfo(symbols, includePath.toArray(new String[includePath.size()]));
|
||||||
}
|
}
|
||||||
|
@ -649,7 +651,7 @@ public class GCCToolChain extends PlatformObject implements IToolChain {
|
||||||
private Set<String> getResourcesFileExtensions() {
|
private Set<String> getResourcesFileExtensions() {
|
||||||
IContentTypeManager manager = Platform.getContentTypeManager();
|
IContentTypeManager manager = Platform.getContentTypeManager();
|
||||||
|
|
||||||
Set<String> fileExts = new TreeSet<String>(String.CASE_INSENSITIVE_ORDER);
|
Set<String> fileExts = new TreeSet<>(String.CASE_INSENSITIVE_ORDER);
|
||||||
|
|
||||||
IContentType contentTypeCpp = manager.getContentType(CCorePlugin.CONTENT_TYPE_CXXSOURCE);
|
IContentType contentTypeCpp = manager.getContentType(CCorePlugin.CONTENT_TYPE_CXXSOURCE);
|
||||||
fileExts.addAll(Arrays.asList(contentTypeCpp.getFileSpecs(IContentType.FILE_EXTENSION_SPEC)));
|
fileExts.addAll(Arrays.asList(contentTypeCpp.getFileSpecs(IContentType.FILE_EXTENSION_SPEC)));
|
||||||
|
|
Loading…
Add table
Reference in a new issue