sourceCode.setCurrent( debugExit + line );
int closePos = line.indexOf('}'); if (closePos != -1 ) {   sourceCode.setCurrent( line.substring(0, closePos) + debugExit + line.substring( closePos ) ); } else { if (!sourceCode.next()) { throw new BuildException("Unable to process MIDlet [" + className + "]: destroyApp method is not opened with '{': line [" + (++lineIndex) + "]."); } line  = sourceCode.getCurrent(); sourceCode.setCurrent( debugExit + line ); }
	protected void insertExitSetting( String className, StringList sourceCode ) {		if (!this.environment.hasSymbol("polish.debugEnabled")) {			return;		}		// at first try to find the startApp method:		while (sourceCode.next()) {			String line = sourceCode.getCurrent();			Matcher matcher = DESTROY_APP_PATTERN.matcher(line);			if (matcher.find()) {				int lineIndex = sourceCode.getCurrentIndex();				while ((line.indexOf('{') == -1) && (sourceCode.next()) ) {					line = sourceCode.getCurrent();				}				if (!sourceCode.next()) {					throw new BuildException("Unable to process MIDlet [" + className + "]: destroyApp method is not opened with '{': line [" + (++lineIndex) + "].");				}				line  = sourceCode.getCurrent();				String debugExit;				if (this.useDefaultPackage) {					debugExit = "Debug.exit();";				} else {					debugExit = "de.enough.polish.util.Debug.exit();";				}				sourceCode.setCurrent( debugExit + line );				return;			}		}		System.out.println(DESTROY_APP_PATTERN.pattern());		throw new BuildException("Unable to find destroyApp method in MIDlet [" + className + "].");	}