Jad jad = new Jad();
Jad jad = new Jad( this.preprocessor.getVariables() );
	private void jad(Device device) {		HashMap infoProperties = new HashMap();		infoProperties.put( "polish.identifier", device.getIdentifier() );		infoProperties.put( "polish.name", device.getName() );		infoProperties.put( "polish.vendor", device.getVendorName() );		infoProperties.put( "polish.version", this.infoSetting.getVersion() );		String jarName = this.infoSetting.getJarName();		jarName = PropertyUtil.writeProperties(jarName, infoProperties);		infoProperties.put( "polish.jarName", jarName );				// now create the JAD file:		System.out.println("creating JAD for device [" + device.getIdentifier() + "].");		Jad jad = new Jad();		HashMap attributesByName = null;		boolean useAttributesFilter = this.buildSetting.hasJadAttributesFilter();		if (useAttributesFilter) {			attributesByName = new HashMap();		}		// add info attributes:		Attribute[] jadAttributes = this.infoSetting.getJadAttributes();		for (int i = 0; i < jadAttributes.length; i++) {			Attribute var  = jadAttributes[i];			if (useAttributesFilter) {				attributesByName.put( var.getName(), 					new Attribute(var.getName(), PropertyUtil.writeProperties( var.getValue(), infoProperties)) );			} else {				jad.addAttribute( var.getName() , PropertyUtil.writeProperties( var.getValue(), infoProperties) );			}		}				// add build properties - midlet infos:		String[] midletInfos = this.buildSetting.getMidletInfos( this.infoSetting.getIcon() );		for (int i = 0; i < midletInfos.length; i++) {			String info = midletInfos[i];			if (useAttributesFilter) {				attributesByName.put( InfoSetting.NMIDLET + (i+1), 						new Attribute(InfoSetting.NMIDLET + (i+1), info) );			} else {				jad.addAttribute( InfoSetting.NMIDLET + (i+1), info );			}		}				// add size of jar:		long size = device.getJarFile().length();		if (useAttributesFilter) {			attributesByName.put(InfoSetting.MIDLET_JAR_SIZE,					new Attribute( InfoSetting.MIDLET_JAR_SIZE, "" + size ) );		} else {			jad.addAttribute(  InfoSetting.MIDLET_JAR_SIZE, "" + size );		}				// add user-defined attributes:		Attribute[] attributes = this.buildSetting.getJadAttributes();		BooleanEvaluator evaluator = this.preprocessor.getBooleanEvaluator();		for (int i = 0; i < attributes.length; i++) {			Attribute attribute = attributes[i];			if (attribute.targetsJad() && attribute.isConditionFulfilled(evaluator, this.project)) {				if (useAttributesFilter) {					attributesByName.put(attribute.getName(),							new Attribute( attribute.getName(), PropertyUtil.writeProperties( attribute.getValue(), infoProperties) ) );									} else {					jad.addAttribute( attribute.getName(), PropertyUtil.writeProperties( attribute.getValue(), infoProperties) );				}			}		}				// sort and filter the JAD attributes if requested:		if (useAttributesFilter) {			Attribute[] filteredAttributes = this.buildSetting.filterJadAttributes(attributesByName);			jad.setAttributes( filteredAttributes );		}				String jadName = PropertyUtil.writeProperties( jarName.substring(0, jarName.lastIndexOf('.') ) + ".jad", infoProperties );		File jadFile = new File( this.buildSetting.getDestDir().getAbsolutePath() + File.separatorChar + jadName );		try {			FileUtil.writeTextFile(jadFile, jad.getContent() );		} catch (IOException e) {			throw new BuildException("Unable to create JAD file [" + jadFile.getAbsolutePath() +"] for device [" + device.getIdentifier() + "]: " + e.getMessage() );		}	}