jad.addAttribute( InfoSetting.NMIDLET + (i+1), info );
if (useAttributesFilter) { attributesByName.put( InfoSetting.NMIDLET + (i+1), new Variable(InfoSetting.NMIDLET + (i+1), info) ); } else { jad.addAttribute( InfoSetting.NMIDLET + (i+1), info ); }
	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();		//add info attributes:		Variable[] jadAttributes = this.infoSetting.getJadAttributes();		for (int i = 0; i < jadAttributes.length; i++) {			Variable var =jadAttributes[i];			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];			jad.addAttribute( InfoSetting.NMIDLET + (i+1), info );		}				// add size of jar:		//TODO check if File.length changes after the file has been changed.		long size = device.getJarFile().length();		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];			String condition = attribute.getIf();			if (condition == null || evaluator.evaluate( condition, "build.xml", 0)) {				jad.addAttribute( attribute.getName(), PropertyUtil.writeProperties( attribute.getValue(), infoProperties) );			}		}				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() );		}	}