1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-01 06:05:24 +02:00

Fixes a NPE, bug 215768.

This commit is contained in:
Markus Schorn 2008-01-18 12:58:55 +00:00
parent 61806eb27f
commit d41fb1782b

View file

@ -1,12 +1,13 @@
/*******************************************************************************
* Copyright (c) 2002, 2005 IBM Corporation and others.
* Copyright (c) 2002, 2008 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Rational Software - Initial API and implementation
* IBM Rational Software - Initial API and implementation
* Markus Schorn (Wind River Systems)
*******************************************************************************/
package org.eclipse.cdt.core.parser;
@ -49,7 +50,7 @@ public class ParserUtil
return scannerLogService;
}
public static char [] findWorkingCopyBuffer( String path, Iterator workingCopies )
public static char [] findWorkingCopyBuffer( String path, Iterator<IWorkingCopy> workingCopies )
{
IResource resultingResource = getResourceForFilename(path);
@ -63,7 +64,7 @@ public class ParserUtil
return null;
}
public static CodeReader createReader( String finalPath, Iterator workingCopies )
public static CodeReader createReader( String finalPath, Iterator<IWorkingCopy> workingCopies )
{
// check to see if the file which this path points to points to an
// IResource in the workspace
@ -153,15 +154,13 @@ public class ParserUtil
* @param workingCopies
* @return
*/
protected static char[] findWorkingCopy(IResource resultingResource, Iterator workingCopies) {
protected static char[] findWorkingCopy(IResource resultingResource, Iterator<IWorkingCopy> workingCopies) {
if( parserLogService.isTracing() )
parserLogService.traceLog( "Attempting to find the working copy for " + resultingResource.getName() ); //$NON-NLS-1$
while( workingCopies.hasNext() )
{
Object next = workingCopies.next();
if( !( next instanceof IWorkingCopy)) continue;
IWorkingCopy copy = (IWorkingCopy) next;
if( copy.getResource().equals(resultingResource ))
IWorkingCopy copy = workingCopies.next();
if (resultingResource.equals(copy.getResource()))
{
if( parserLogService.isTracing() )
parserLogService.traceLog( "Working copy found!!" ); //$NON-NLS-1$