*/
package org.opendaylight.controller.config.persist.storage.file.xml.model;
-import com.google.common.base.Charsets;
import com.google.common.base.Optional;
import com.google.common.collect.Iterables;
import com.google.common.collect.Lists;
import com.google.common.io.Files;
import java.io.File;
import java.io.IOException;
+import java.nio.charset.StandardCharsets;
import java.util.List;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
xif.setProperty(XMLInputFactory.IS_SUPPORTING_EXTERNAL_ENTITIES, false);
xif.setProperty(XMLInputFactory.SUPPORT_DTD, false);
XMLStreamReader xsr = xif.createXMLStreamReader(new StreamSource(from));
- return ((Config) um.unmarshal(xsr));
+ return (Config) um.unmarshal(xsr);
} catch (JAXBException | XMLStreamException e) {
throw new PersistException("Unable to restore configuration", e);
}
private static boolean isBlank(File from) {
try {
- return StringUtils.isBlank(Files.toString(from, Charsets.UTF_8));
+ return StringUtils.isBlank(Files.toString(from, StandardCharsets.UTF_8));
} catch (IOException e) {
throw new IllegalStateException("Unexpected error reading file" + from, e);
}
}
public void addConfigSnapshot(ConfigSnapshot snap, int numberOfStoredBackups) {
- if(shouldReplaceLast(numberOfStoredBackups) && snapshots.isEmpty() == false) {
+ if (shouldReplaceLast(numberOfStoredBackups) && !snapshots.isEmpty()) {
snapshots.remove(0);
}
snapshots.add(snap);