From e2d72d7a190724245b8aae05416a9c14e2ed84dd Mon Sep 17 00:00:00 2001 From: bananeweizen Date: Tue, 10 Jan 2006 18:14:38 +0000 Subject: [PATCH 1/1] avoid exception during creation of identifier list --- .../phpeclipse/builder/IdentifierIndexManager.java | 32 +++++++++++-------- 1 files changed, 18 insertions(+), 14 deletions(-) diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/builder/IdentifierIndexManager.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/builder/IdentifierIndexManager.java index 277a54f..1a38bc6 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/builder/IdentifierIndexManager.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpeclipse/builder/IdentifierIndexManager.java @@ -32,7 +32,7 @@ import org.eclipse.core.runtime.IStatus; /** * Manages the identifer index information for a specific project - * + * */ public class IdentifierIndexManager { public class LineCreator implements ITerminalSymbols { @@ -46,7 +46,7 @@ public class IdentifierIndexManager { /** * Add the information of the current identifier to the line - * + * * @param typeOfIdentifier * the type of the identifier ('c'lass, 'd'efine, 'f'unction, 'm'ethod(class), 'v'ariable(class) 'g'lobal variable) * @param identifier @@ -64,7 +64,7 @@ public class IdentifierIndexManager { /** * Add the information of the current identifier to the line - * + * * @param typeOfIdentifier * the type of the identifier ('c'lass, 'd'efine, 'f'unction, 'm'ethod(class), 'v'ariable(class) 'g'lobal variable) * @param identifier @@ -415,7 +415,7 @@ public class IdentifierIndexManager { /** * Check if 2 char arrays are equal - * + * * @param a * @param b * @return @@ -438,7 +438,7 @@ public class IdentifierIndexManager { /** * Add the information for a given IFile resource - * + * */ public void addFile(IFile fileToParse) { // InputStream iStream; @@ -481,7 +481,7 @@ public class IdentifierIndexManager { /** * Adds a line of the index file for function, class, class-method and class-variable names - * + * * @param line */ private void addLine(String line) { @@ -551,7 +551,7 @@ public class IdentifierIndexManager { /** * Adds a line of the index file for function, class, class-method and class-variable names - * + * * @param line */ public void addLine(TreeMap treeMap, HashMap fileMap, String line, List allClassNames) { @@ -702,7 +702,7 @@ public class IdentifierIndexManager { /** * Change the information for a given IFile resource - * + * */ public void changeFile(IFile fileToParse) { removeFile(fileToParse); @@ -711,17 +711,21 @@ public class IdentifierIndexManager { /** * Get a list of all PHPIdentifierLocation object's associated with an identifier - * + * * @param identifier * @return */ public List getLocations(String identifier) { - return (List) fIndentifierMap.get(identifier); + List list=(List) fIndentifierMap.get(identifier); + if (list!=null) { + return list; + } + return new ArrayList(); } /** * Initialize (i.e. clear) the current index information - * + * */ public void initialize() { fIndentifierMap = new TreeMap(new StringComparator()); @@ -752,7 +756,7 @@ public class IdentifierIndexManager { /** * Remove the information for a given IFile resource - * + * */ public void removeFile(IFile fileToParse) { // String line = (String) @@ -765,7 +769,7 @@ public class IdentifierIndexManager { /** * Removes a line of the index file for function, class, class-method and class-variable names - * + * * @param line */ private void removeLine(String line) { @@ -875,7 +879,7 @@ public class IdentifierIndexManager { /** * Save the current index information in the projects index file - * + * */ public void writeFile() { FileWriter fileWriter; -- 1.7.1