Project

General

Profile

« Previous | Next » 

Revision 4085

Added by daigle over 16 years ago

Backup properties should use addProperty, not setProperty

View differences:

src/edu/ucsb/nceas/metacat/service/PropertyService.java
215 215
	 * @param newValue
216 216
	 *            the new value for the property
217 217
	 */
218
	public static void setProperty(String propertyName, String newValue) throws IOException {
219
		mainProperties.setProperty(propertyName, newValue);
220
		mainProperties.store();
221

  
218
	public static void setProperty(String propertyName, String newValue) throws GeneralPropertyException {
219
			mainProperties.setProperty(propertyName, newValue);
220
			mainProperties.store();
222 221
	}
223 222

  
224 223
	/**
......
233 232
	 * @param newValue
234 233
	 *            the new value for the property
235 234
	 */
236
	public static void setPropertyNoPersist(String propertyName, String newValue) {
235
	public static void setPropertyNoPersist(String propertyName, String newValue) throws GeneralPropertyException {
237 236
		mainProperties.setPropertyNoPersist(propertyName, newValue);
238 237
	}
239 238

  
......
241 240
	 * Save the properties to a properties file. Note, the 
242 241
	 * order and comments will be preserved.
243 242
	 */
244
	public static void persistProperties() throws IOException {
243
	public static void persistProperties() throws GeneralPropertyException {
245 244
		mainProperties.store();
246 245
	}
247 246

  
......
306 305
			PropertiesMetaData mainMetadata = new PropertiesMetaData(propertiesMetaDataFilePath);
307 306
			Set<String> mainKeySet = mainMetadata.getKeys();
308 307
			for (String propertyKey : mainKeySet) {
309
				backupProperties.setProperty(propertyKey, getProperty(propertyKey));
308
				backupProperties.addProperty(propertyKey, getProperty(propertyKey));
310 309
			}
311 310
			
312 311
			// store the properties to file
......
347 346
				orgMetadata.getPropertiesInGroup(globalGroup.getIndex());
348 347
			for (MetaDataProperty property : globalPropertyMap.values()) {
349 348
				String orgPropertyName = property.getKey();
350
				backupProperties.setProperty(orgPropertyName, getProperty(orgPropertyName));
349
				backupProperties.addProperty(orgPropertyName, getProperty(orgPropertyName));
351 350
			}
352 351
			
353 352
			// We do the same thing here for organization specific properies
......
362 361
			for (String orgName : LDAPUtil.getOrganizations()) {
363 362
				for (MetaDataProperty property : orgPropertyMap.values()) {
364 363
					String orgPropertyName = property.getKey() + "." + orgName;
365
					backupProperties.setProperty(orgPropertyName, getProperty(orgPropertyName));
364
					backupProperties.addProperty(orgPropertyName, getProperty(orgPropertyName));
366 365
				}
367 366
			}
368 367
			

Also available in: Unified diff