standardProps.setProperty(name, value);
}
}
// copy the archive in case anything goes wrong
ZipArchive archive = new ZipArchive(repositoryArchive);
// The standard properties path is guaranteed to be non-null if
// this code is being executed. If the path is null, an
// IOException is thrown by {@link createMergedProperties}
// (which is called by the constructor).
standardPropsOut = archive.getOutputTo(standardPropertiesPath);
try {
standardProps.store(standardPropsOut, null);
} catch (IOException e) {
throw new RepositoryException(e);
}
if (customProps.size() > 0) {
// The properties path will already be set if there were
// any custom properties in the repository. Otherwise,
// these are the first custom properties to be defined and
// written, so set the custom path to a suitable default.
if (customPropertiesPath == null) {
customPropertiesPath =
DeviceRepositoryConstants.CUSTOM_POLICIES_PROPERTIES_PREFIX +
DeviceRepositoryConstants.POLICIES_PROPERTIES_SUFFIX;
}
customPropsOut = archive.getOutputTo(customPropertiesPath);
try {
customProps.store(customPropsOut, null);
} catch (IOException e) {
throw new RepositoryException(e);
}