sysperfana/analyzetoolext/com.nokia.s60tools.analyzetool/src/com/nokia/s60tools/analyzetool/engine/UseAtool.java
changeset 15 0367d2db2c06
parent 6 f65f740e69f9
equal deleted inserted replaced
14:bb339882c6e9 15:0367d2db2c06
    17 
    17 
    18 package com.nokia.s60tools.analyzetool.engine;
    18 package com.nokia.s60tools.analyzetool.engine;
    19 
    19 
    20 import java.io.BufferedReader;
    20 import java.io.BufferedReader;
    21 import java.io.File;
    21 import java.io.File;
       
    22 import java.io.FileInputStream;
    22 import java.io.FileNotFoundException;
    23 import java.io.FileNotFoundException;
    23 import java.io.FileInputStream;
       
    24 import java.io.IOException;
    24 import java.io.IOException;
    25 import java.io.InputStreamReader;
    25 import java.io.InputStreamReader;
       
    26 import java.text.MessageFormat;
    26 import java.util.AbstractList;
    27 import java.util.AbstractList;
    27 import java.util.ArrayList;
    28 import java.util.ArrayList;
    28 
    29 
    29 import org.eclipse.core.resources.IProject;
    30 import org.eclipse.core.resources.IProject;
    30 import org.eclipse.core.runtime.CoreException;
    31 import org.eclipse.core.runtime.CoreException;
    31 import org.eclipse.core.runtime.IProgressMonitor;
    32 import org.eclipse.core.runtime.IProgressMonitor;
    32 import org.eclipse.core.runtime.Path;
    33 import org.eclipse.core.runtime.Path;
    33 import org.eclipse.core.runtime.QualifiedName;
    34 import org.eclipse.core.runtime.QualifiedName;
       
    35 import org.eclipse.swt.SWT;
    34 
    36 
    35 import com.nokia.carbide.cdt.builder.CarbideBuilderPlugin;
    37 import com.nokia.carbide.cdt.builder.CarbideBuilderPlugin;
    36 import com.nokia.carbide.cdt.builder.builder.CarbideCPPBuilder;
    38 import com.nokia.carbide.cdt.builder.builder.CarbideCPPBuilder;
    37 import com.nokia.carbide.cdt.builder.builder.CarbideCommandLauncher;
    39 import com.nokia.carbide.cdt.builder.builder.CarbideCommandLauncher;
    38 import com.nokia.carbide.cdt.builder.project.ICarbideBuildConfiguration;
    40 import com.nokia.carbide.cdt.builder.project.ICarbideBuildConfiguration;
    41 import com.nokia.s60tools.analyzetool.global.Util;
    43 import com.nokia.s60tools.analyzetool.global.Util;
    42 
    44 
    43 /**
    45 /**
    44  * Class to use atool.exe. Atool.exe is usually used in command prompt so that's
    46  * Class to use atool.exe. Atool.exe is usually used in command prompt so that's
    45  * why we executes atool commands with using CarbideCommandLauncher class.
    47  * why we executes atool commands with using CarbideCommandLauncher class.
    46  *
    48  * 
    47  * @author kihe
    49  * @author kihe
    48  *
    50  * 
    49  */
    51  */
    50 public class UseAtool {
    52 public class UseAtool {
    51 
    53 
    52 	/** Used data file name and path */
    54 	/** XML file path */
    53 	private String dataFileName = "";
    55 	private String xmlFilePath = null;
    54 	
    56 
    55 	/**
    57 	/** Clean .dat file path */
    56 	 * Returns used data file name and path
    58 	private String cleanDatFilePath = null;
    57 	 * @return Data file name and path
    59 
    58 	 */
    60 	private static String deviceAtoolVersion = "";
    59 	public String getDataFileName() {
    61 
    60 		return dataFileName;
    62 	/**
       
    63 	 * Sets XML file path
       
    64 	 * 
       
    65 	 * @param xmlFilePath
       
    66 	 *            XML file path
       
    67 	 */
       
    68 	private void setXmlFilePath(String xmlFilePath) {
       
    69 		this.xmlFilePath = xmlFilePath;
       
    70 	}
       
    71 
       
    72 	/**
       
    73 	 * Returns XML file path.
       
    74 	 * 
       
    75 	 * @return XML file path
       
    76 	 */
       
    77 	public String getXmlFilePath() {
       
    78 		return xmlFilePath;
       
    79 	}
       
    80 
       
    81 	/**
       
    82 	 * Sets clean .dat file path
       
    83 	 * 
       
    84 	 * @param cleanDatFilePath
       
    85 	 *            clean .dat file path
       
    86 	 */
       
    87 	private void setCleanDatFilePath(String cleanDatFilePath) {
       
    88 		this.cleanDatFilePath = cleanDatFilePath;
       
    89 	}
       
    90 
       
    91 	/**
       
    92 	 * Returns clean .dat file path.
       
    93 	 * 
       
    94 	 * @return clean .dat file path
       
    95 	 */
       
    96 	public String getCleanDatFilePath() {
       
    97 		return cleanDatFilePath;
    61 	}
    98 	}
    62 
    99 
    63 	/**
   100 	/**
    64 	 * Check data file type. Gets first line of file and compares that to
   101 	 * Check data file type. Gets first line of file and compares that to
    65 	 * predefined constants.
   102 	 * predefined constants.
    66 	 *
   103 	 * 
    67 	 * @param path
   104 	 * @param path
    68 	 *            Data file path
   105 	 *            data file path
    69 	 * @return Type of data file
   106 	 * @return type of data file
    70 	 */
   107 	 */
    71 	public static int checkFileType(final String path) {
   108 	public static int checkFileType(final String path) {
    72 		// return value
   109 		// return value
    73 		int retValue = Constants.DATAFILE_INVALID;
   110 		int retValue = Constants.DATAFILE_INVALID;
    74 
   111 
    75 		// check that file exists
   112 		// check that file exists
    76 		if (path == null || ("").equals(path)) {
   113 		if (path == null || ("").equals(path)) {
    77 			return retValue;
   114 			return retValue;
    78 		}
   115 		}
    79 		java.io.File file = new java.io.File(path);
   116 		File file = new File(path);
    80 		if (!file.exists()) {
   117 		if (!file.exists()) {
    81 			return retValue;
   118 			return retValue;
    82 		}
   119 		}
    83 
   120 
    84 		if( Util.isFileXML(path) ) {
   121 		if (Util.isFileXML(path)) {
    85 			return Constants.DATAFILE_XML;
   122 			return Constants.DATAFILE_XML;
    86 		}
   123 		}
    87 
   124 
    88 		// input
   125 		// input
    89 		BufferedReader input = null;
   126 		BufferedReader input = null;
    90 		FileInputStream fileInputStream = null;
   127 		FileInputStream fileInputStream = null;
    91 		InputStreamReader inputReader = null;
   128 		InputStreamReader inputReader = null;
       
   129 
    92 		try {
   130 		try {
    93 
       
    94 			// get input
   131 			// get input
    95 			fileInputStream = new FileInputStream(path);
   132 			fileInputStream = new FileInputStream(path);
    96 			if( fileInputStream.available() == 0 ) {
   133 			if (fileInputStream.available() == 0) {
    97 				fileInputStream.close();
   134 				fileInputStream.close();
    98 				return Constants.DATAFILE_EMPTY;
   135 				return Constants.DATAFILE_EMPTY;
    99 			}
   136 			}
   100 
   137 
   101 			// file not empty read file contents
   138 			// file not empty read file contents
   102 			inputReader = new InputStreamReader(fileInputStream, "UTF-8");
   139 			inputReader = new InputStreamReader(fileInputStream, "UTF-8");
   103 			input = new BufferedReader(inputReader);
   140 			input = new BufferedReader(inputReader);
   104 
   141 
   105 			// get first line of data file
   142 			boolean firstLineProcessed = false;
   106 			String line = input.readLine();
   143 			String line;
   107 
   144 
   108 			// line contains data file version specification => data file type
   145 			while ((line = input.readLine()) != null) {
   109 			// is log
   146 
   110 			if (line != null && line.contains(Constants.DATAFILE_VERSION)) {
   147 				if (!firstLineProcessed) {
   111 				// update return value
   148 					firstLineProcessed = true;
   112 				retValue = Constants.DATAFILE_LOG;
   149 
   113 			} else {
   150 					if (line.contains(Constants.DATAFILE_VERSION)) {
   114 				// go thru file
   151 						return Constants.DATAFILE_LOG;
   115 				while ((line = input.readLine()) != null) {
       
   116 
       
   117 					// line contains prefix specification => data file type is
       
   118 					// trace
       
   119 					if (line.contains(Constants.PREFIX)) {
       
   120 						// update return value
       
   121 						retValue = Constants.DATAFILE_TRACE;
       
   122 						return retValue;
       
   123 					}
   152 					}
   124 
   153 					if (line.contains(Constants.BINARY_FILE_VERSION)) {
       
   154 						return Constants.DATAFILE_BINARY;
       
   155 					}
       
   156 				}
       
   157 
       
   158 				if (line.contains(Constants.PREFIX_OLD)) {
       
   159 					return Constants.DATAFILE_OLD_FORMAT;
       
   160 				}
       
   161 
       
   162 				if (line.contains(Constants.PREFIX)) {
       
   163 					int index = line.indexOf(Constants.PREFIX);
       
   164 					String usedString = line.substring(index, line.length());
       
   165 					String[] lineFragments = usedString.split(" ");
       
   166 
       
   167 					if (lineFragments.length > 8) {
       
   168 						if (lineFragments[2].equals(Constants.PCS)) {
       
   169 
       
   170 							deviceAtoolVersion = lineFragments[8];
       
   171 
       
   172 							int traceFormatVersion = 0;
       
   173 							try {
       
   174 								traceFormatVersion = Integer.parseInt(
       
   175 										lineFragments[7], 16);
       
   176 							} catch (NumberFormatException nfe) {
       
   177 								nfe.printStackTrace();
       
   178 								return Constants.DATAFILE_INVALID;
       
   179 							}
       
   180 
       
   181 							if (traceFormatVersion == 3) {
       
   182 								return Constants.DATAFILE_TRACE;
       
   183 							} else {
       
   184 								return Constants.DATAFILE_UNSUPPORTED_TRACE_FORMAT;
       
   185 							}
       
   186 						}
       
   187 					}
   125 				}
   188 				}
   126 			}
   189 			}
   127 			input.close();
   190 			input.close();
   128 			inputReader.close();
   191 			inputReader.close();
   129 			fileInputStream.close();
   192 			fileInputStream.close();
   159 		return retValue;
   222 		return retValue;
   160 	}
   223 	}
   161 
   224 
   162 	/**
   225 	/**
   163 	 * Creates atool_temp folder to current mmp folder location.
   226 	 * Creates atool_temp folder to current mmp folder location.
   164 	 *
   227 	 * 
   165 	 * @param folderLocation
   228 	 * @param folderLocation
   166 	 *            Current mmp folder location
   229 	 *            Current mmp folder location
   167 	 * @return True if given location contains atool_temp folder otherwise false
   230 	 * @return True if given location contains atool_temp folder otherwise false
   168 	 *
   231 	 * 
   169 	 */
   232 	 */
   170 	public static boolean createAToolFolderIfNeeded(final String folderLocation) {
   233 	public static boolean createAToolFolderIfNeeded(final String folderLocation) {
   171 
   234 
   172 		boolean returnValue = false;
   235 		boolean returnValue = false;
   173 
   236 
   175 		if (folderLocation.indexOf(Constants.ATOOL_TEMP) != -1) {
   238 		if (folderLocation.indexOf(Constants.ATOOL_TEMP) != -1) {
   176 			returnValue = true;
   239 			returnValue = true;
   177 		}
   240 		}
   178 
   241 
   179 		// create atool_temp folder
   242 		// create atool_temp folder
   180 		if( !returnValue ) {
   243 		if (!returnValue) {
   181 			File file = new File(folderLocation + "\\" + Constants.ATOOL_TEMP);
   244 			File file = new File(folderLocation + "\\" + Constants.ATOOL_TEMP);
   182 			if (!file.exists()) {
   245 			if (!file.exists()) {
   183 				returnValue = file.mkdir();
   246 				returnValue = file.mkdir();
   184 			}
   247 			}
   185 		}
   248 		}
   194 		// and ($ignoreExplicitConstructorInvocation = 'true' or
   257 		// and ($ignoreExplicitConstructorInvocation = 'true' or
   195 		// not(ExplicitConstructorInvocation)) and @containsComment = 'false']
   258 		// not(ExplicitConstructorInvocation)) and @containsComment = 'false']
   196 	}
   259 	}
   197 
   260 
   198 	/**
   261 	/**
   199 	 * Creates xml file to project bld.inf folder.
   262 	 * Creates XML file to project bld.inf folder.
   200 	 *
   263 	 * 
   201 	 * @param monitor
   264 	 * @param monitor
   202 	 *            IProgressMonitor reference
   265 	 *            IProgressMonitor reference
   203 	 * @param project
   266 	 * @param project
   204 	 *            Project reference
   267 	 *            Project reference
   205 	 * @param dataFilePath
   268 	 * @param dataFilePath
   207 	 * @param command
   270 	 * @param command
   208 	 *            Command which is used to execute atool.exe
   271 	 *            Command which is used to execute atool.exe
   209 	 * @return XML file name and path if file was successfully created otherwise
   272 	 * @return XML file name and path if file was successfully created otherwise
   210 	 *         null
   273 	 *         null
   211 	 */
   274 	 */
   212 	public final Constants.COMMAND_LINE_ERROR_CODE createXMLFileToCarbide(final IProgressMonitor monitor,
   275 	public final Constants.COMMAND_LINE_ERROR_CODE createXmlAndCleanDatFilesToCarbide(
   213 			final IProject project, final String dataFilePath, final String command) {
   276 			final IProgressMonitor monitor, final IProject project,
   214 		// check file type
   277 			final String dataFilePath, final String command) {
   215 		// possible file types: S60 data file, trace data file or xml file
   278 
   216 		int fileType = 0;
   279 		int fileType = 0;
   217 
   280 
   218 		// get file type
   281 		// get file type
   219 		fileType = checkFileType(dataFilePath);
   282 		fileType = checkFileType(dataFilePath);
   220 
   283 
   221 		if (fileType == Constants.DATAFILE_INVALID) {
   284 		if (fileType == Constants.DATAFILE_INVALID) {
   222 			return Constants.COMMAND_LINE_ERROR_CODE.DATA_FILE_INVALID;
   285 			return Constants.COMMAND_LINE_ERROR_CODE.DATA_FILE_INVALID;
   223 		} else if( fileType == Constants.DATAFILE_EMPTY ) {
   286 		} else if (fileType == Constants.DATAFILE_EMPTY) {
   224 			return Constants.COMMAND_LINE_ERROR_CODE.DATA_FILE_EMPTY;
   287 			return Constants.COMMAND_LINE_ERROR_CODE.DATA_FILE_EMPTY;
   225 		}
   288 		} else if (fileType == Constants.DATAFILE_OLD_FORMAT) {
   226 		
   289 			return Constants.COMMAND_LINE_ERROR_CODE.DATA_FILE_OLD_FORMAT;
   227 		//check that command line engine can be executed
   290 		} else if (fileType == Constants.DATAFILE_UNSUPPORTED_TRACE_FORMAT) {
   228 		if( !Util.isAtoolAvailable() ) {
   291 			return Constants.COMMAND_LINE_ERROR_CODE.DATA_FILE_UNSUPPORTED_TRACE_FORMAT;
       
   292 		}
       
   293 
       
   294 		// check that command line engine can be executed
       
   295 		if (!Util.isAtoolAvailable()) {
   229 			return Constants.COMMAND_LINE_ERROR_CODE.EXECUTE_ERROR;
   296 			return Constants.COMMAND_LINE_ERROR_CODE.EXECUTE_ERROR;
   230 		}
   297 		}
   231 		ICarbideProjectInfo cpi = CarbideBuilderPlugin.getBuildManager()
   298 		ICarbideProjectInfo cpi = CarbideBuilderPlugin.getBuildManager()
   232 				.getProjectInfo(project);
   299 				.getProjectInfo(project);
   233 
   300 
   234 		// if ICarbideProjectInfo not found return null
   301 		// if ICarbideProjectInfo not found return null
   235 		if( cpi == null ) {
   302 		if (cpi == null) {
   236 			return Constants.COMMAND_LINE_ERROR_CODE.UNKNOWN_ERROR;
   303 			return Constants.COMMAND_LINE_ERROR_CODE.UNKNOWN_ERROR;
   237 		}
   304 		}
   238 		String absolutePath = cpi.getAbsoluteBldInfPath().toOSString();
   305 		String absolutePath = cpi.getAbsoluteBldInfPath().toOSString();
   239 		String bldInfFolder = null;
   306 		String bldInfFolder = null;
   240 		int index = Util.getLastSlashIndex(absolutePath);
   307 		int index = Util.getLastSlashIndex(absolutePath);
   241 		if (index != -1) {
   308 		if (index != -1) {
   242 			bldInfFolder = absolutePath.substring(0, index);
   309 			bldInfFolder = absolutePath.substring(0, index);
   243 		}
   310 		}
   244 		if( bldInfFolder != null ) {
   311 		if (bldInfFolder != null) {
   245 			createAToolFolderIfNeeded(bldInfFolder);
   312 			createAToolFolderIfNeeded(bldInfFolder);
   246 		}
   313 		}
   247 
   314 
   248 		AbstractList<String> usedArguments = new ArrayList<String>();
   315 		AbstractList<String> usedArguments = new ArrayList<String>();
   249 		usedArguments.add(command);
   316 		usedArguments.add(command);
   250 		usedArguments.add(dataFilePath);
   317 		usedArguments.add(dataFilePath);
   251 		
   318 
   252 		//try to load user defined symbol files
   319 		// try to load user defined symbol files
   253 		try {
   320 		try {
   254 			//property store names
   321 			// property store names
   255 			QualifiedName useRom = new QualifiedName(Constants.USE_ROM_SYMBOL, Constants.USE_ROM );
   322 			QualifiedName useRom = new QualifiedName(Constants.USE_ROM_SYMBOL,
   256 			QualifiedName name = new QualifiedName(Constants.USE_ROM_SYMBOL_LOCATION, Constants.ROM_LOC );
   323 					Constants.USE_ROM);
   257 			
   324 			QualifiedName name = new QualifiedName(
   258 			//get value
   325 					Constants.USE_ROM_SYMBOL_LOCATION, Constants.ROM_LOC);
       
   326 
       
   327 			// get value
   259 			String useRomText = project.getPersistentProperty(useRom);
   328 			String useRomText = project.getPersistentProperty(useRom);
   260 			if( useRomText != null ) {
   329 			if (useRomText != null) {
   261 				boolean useRomSymbol = useRomText.equalsIgnoreCase("true") ? true : false;
   330 				boolean useRomSymbol = useRomText.equalsIgnoreCase("true") ? true
   262 				//is symbol files activated for project
   331 						: false;
   263 				if(useRomSymbol) {
   332 				// is symbol files activated for project
   264 					String symbolFileLocation = project.getPersistentProperty(name);
   333 				if (useRomSymbol) {
   265 					if( symbolFileLocation != null && !("").equals(symbolFileLocation) ) {
   334 					String symbolFileLocation = project
       
   335 							.getPersistentProperty(name);
       
   336 					if (symbolFileLocation != null
       
   337 							&& !("").equals(symbolFileLocation)) {
   266 						String[] split = symbolFileLocation.split(";");
   338 						String[] split = symbolFileLocation.split(";");
   267 						if( split != null ) {
   339 						if (split != null) {
   268 							for( int i=0; i<split.length; i++ ) {
   340 							for (int i = 0; i < split.length; i++) {
   269 								//check that file exists
   341 								// check that file exists
   270 								java.io.File symFile = new java.io.File(split[i]);
   342 								java.io.File symFile = new java.io.File(
   271 								if(symFile.exists()) {
   343 										split[i]);
       
   344 								if (symFile.exists()) {
   272 									usedArguments.add("-s");
   345 									usedArguments.add("-s");
   273 									usedArguments.add(split[i]);
   346 									usedArguments.add(split[i]);
   274 								}
   347 								}
   275 							}
   348 							}
   276 						}
   349 						}
   277 					}
   350 					}
   278 				}
   351 				}
   279 			}
   352 			}
   280 		}catch(CoreException ce) {
   353 		} catch (CoreException ce) {
   281 			ce.printStackTrace();
   354 			ce.printStackTrace();
   282 		}
   355 		}
   283 		
   356 
   284 		
       
   285 		usedArguments.add(bldInfFolder + "\\" + Constants.ATOOL_TEMP + "\\"
   357 		usedArguments.add(bldInfFolder + "\\" + Constants.ATOOL_TEMP + "\\"
   286 				+ Constants.FILENAME_CARBIDE);
   358 				+ Constants.FILENAME_CARBIDE);
   287 		if (Util.verboseAtoolOutput()) {
   359 		if (Util.verboseAtoolOutput()) {
   288 			usedArguments.add(Constants.ATOOL_SHOW_DEBUG);
   360 			usedArguments.add(Constants.ATOOL_SHOW_DEBUG);
   289 		}
   361 		}
   290 
   362 
   291 	    String[] arguments = new String[usedArguments.size()];
   363 		String[] arguments = new String[usedArguments.size()];
   292         usedArguments.toArray(arguments);
   364 		usedArguments.toArray(arguments);
   293 
   365 
   294 		int returnValue = executeCommand(arguments, bldInfFolder,
   366 		if (fileType != Constants.DATAFILE_BINARY) {
   295 				monitor, project);
   367 			String carbideAtoolVersion = Util.getAtoolVersionNumber(Util
       
   368 					.getAtoolInstallFolder());
       
   369 			if (!carbideAtoolVersion.equals(deviceAtoolVersion)) {
       
   370 				Util.showMessageDialog(Constants.CLE_VERSION_MISMATCH,
       
   371 						MessageFormat.format(
       
   372 								Constants.AT_BINARIES_VERSION_MISMATCH,
       
   373 								deviceAtoolVersion, carbideAtoolVersion),
       
   374 						SWT.ICON_WARNING);
       
   375 			}
       
   376 		}
       
   377 
       
   378 		int returnValue = executeCommand(arguments, bldInfFolder, monitor,
       
   379 				project);
   296 
   380 
   297 		// if some error happens
   381 		// if some error happens
   298 		if (returnValue == Constants.DATAFILE_INVALID || returnValue != Constants.COMMAND_LINE_ERROR_CODE.OK.getCode() ) {
   382 		if (returnValue == Constants.DATAFILE_INVALID
   299 			Constants.COMMAND_LINE_ERROR_CODE error = Util.getErrorCode(returnValue);
   383 				|| returnValue != Constants.COMMAND_LINE_ERROR_CODE.OK
   300 			setDataFileName(null);
   384 						.getCode()) {
       
   385 			Constants.COMMAND_LINE_ERROR_CODE error = Util
       
   386 					.getErrorCode(returnValue);
       
   387 			setXmlFilePath(null);
       
   388 			setCleanDatFilePath(null);
   301 			return error;
   389 			return error;
   302 		}
   390 		}
   303 		
   391 
   304 		setDataFileName(bldInfFolder + "\\" + Constants.ATOOL_TEMP + "\\"
   392 		setXmlFilePath(bldInfFolder + "\\" + Constants.ATOOL_TEMP + "\\"
   305 		+ Constants.FILENAME_CARBIDE); 
   393 				+ Constants.FILENAME_CARBIDE);
   306 		return Constants.COMMAND_LINE_ERROR_CODE.OK; 
   394 
   307 	}
   395 		String cleanDatFileName = null;
   308 
   396 		int lastSlashIndex = Util.getLastSlashIndex(dataFilePath);
   309 	/**
   397 		if (lastSlashIndex != -1) {
   310 	 * Sets data file name and path
   398 			cleanDatFileName = dataFilePath.substring(lastSlashIndex + 1,
   311 	 * @param newDataFileName Data file name and path
   399 					dataFilePath.length());
   312 	 */
   400 		}
   313 	private void setDataFileName(String newDataFileName) {
   401 		setCleanDatFilePath(bldInfFolder + "\\" + Constants.ATOOL_TEMP + "\\"
   314 		dataFileName = newDataFileName;
   402 				+ cleanDatFileName + ".cleaned");
       
   403 
       
   404 		return Constants.COMMAND_LINE_ERROR_CODE.OK;
   315 	}
   405 	}
   316 
   406 
   317 	/**
   407 	/**
   318 	 * Executes given command, uses CarbideCommandLauncher class for execution.
   408 	 * Executes given command, uses CarbideCommandLauncher class for execution.
   319 	 *
   409 	 * 
   320 	 * @param args
   410 	 * @param args
   321 	 *            Command argument list
   411 	 *            Command argument list
   322 	 * @param path
   412 	 * @param path
   323 	 *            Where to run command
   413 	 *            Where to run command
   324 	 * @param monitor
   414 	 * @param monitor
   364 		} catch (OutOfMemoryError oome) {
   454 		} catch (OutOfMemoryError oome) {
   365 			oome.printStackTrace();
   455 			oome.printStackTrace();
   366 		}
   456 		}
   367 		return error;
   457 		return error;
   368 	}
   458 	}
   369 
       
   370 }
   459 }