e.printStackTrace(); throw new BuildException( "Unable to compile source code for device [" + device.getIdentifier() + "]: " + e.getMessage() );
System.out.println("If an error occured in the J2ME Polish packages, please try a clean rebuild - e.g. [ant clean] and then [ant]."); System.out.println("Alternatively you might need to define where to find the device-APIs. Following classpath has been used: [" + classPath + "]."); throw new BuildException( "Unable to compile source code for device [" + device.getIdentifier() + "]: " + e.getMessage(), e );
	private void compile( Device device ) {		Javac javac = new Javac();		javac.setProject( this.project );		javac.setTaskName(getTaskName() + "-javac-" + device.getIdentifier() );		//javac.target=1.1 is needed for the preverification:		javac.setTarget("1.1");				System.out.println("now compiling for device [" +  device.getIdentifier() + "]." );		String targetDirName = device.getBaseDir() + File.separatorChar + "classes";		device.setClassesDir( targetDirName );		File targetDir = new File( targetDirName );		if (!targetDir.exists()) {			targetDir.mkdirs();		}		javac.setDestdir( targetDir );		javac.setSrcdir(new Path( this.project,  device.getSourceDir() ) );		if (device.isMidp1()) {			javac.setBootclasspath(this.midp1BootClassPath);		} else {			javac.setBootclasspath(this.midp2BootClassPath);		}				// check for each supported api, if the appropriate path-property		// has been set: mmapi = ${polish.api.mmapi}		// when this has not been defined, just look in the import-dir		String apisStr = device.getSupportedApisAsString();		if(apisStr == null) {			apisStr = "";		}  		// check if the class path has been resolved before:		String classPath = (String) this.apiPaths.get( apisStr );		if (classPath == null) {			String[] apis = device.getSupportedApis();			if (apis == null) {				apis = new String[0];			}			StringBuffer classPathBuffer = new StringBuffer();			Hashtable properties = this.project.getProperties(); 			for (int i = 0; i < apis.length; i++) {				String api = apis[i];				String path = (String) this.apiPaths.get( api );				if (path != null) {					classPathBuffer.append( ':' )							 .append( path );				} else {					path = (String) properties.get( "polish.api." + api );					if (path == null) {						path = this.apiDir.getAbsolutePath() + File.separatorChar + api + ".jar" 							 + File.pathSeparatorChar 							 + this.apiDir.getAbsolutePath() + File.separatorChar + api + ".zip";					}  					classPathBuffer.append( File.pathSeparatorChar )							 .append( path );					this.apiPaths.put( api, path );				}			} // for each api			if (apis.length > 0) {				classPath = classPathBuffer.toString().substring(1);				this.apiPaths.put(apisStr, classPath );			}		}		if (classPath != null) {			javac.setClasspath( new Path(this.project, classPath ) );			device.setClassPath(classPath);			//System.out.println( "using classpath [" + classPath.toString().substring(1) + "]." );		}				// start compile:		try {			javac.execute();		} catch (BuildException e) {			e.printStackTrace();			throw new BuildException( "Unable to compile source code for device [" + device.getIdentifier() + "]: " + e.getMessage() );		}			}