rename MetaData -> BaseMetaData and AbstractMDF -> AbstractMDContainerF

The difference between MetaData and AbstractMetaDataFile wasn't obvious, this should make it a bit more clear
This commit is contained in:
James Seibel
2023-02-18 18:02:44 -06:00
parent 070cdc13e2
commit be036fe67a
7 changed files with 100 additions and 87 deletions
@@ -8,7 +8,7 @@ import com.seibel.lod.core.dataObjects.fullData.sources.FullDataSource;
import com.seibel.lod.core.dataObjects.fullData.sources.SingleChunkFullDataSource;
import com.seibel.lod.core.dataObjects.fullData.sources.SparseFullDataSource;
import com.seibel.lod.core.file.FileUtil;
import com.seibel.lod.core.file.metaData.MetaData;
import com.seibel.lod.core.file.metaData.BaseMetaData;
import com.seibel.lod.core.level.IDhLevel;
import com.seibel.lod.core.pos.DhLodPos;
import com.seibel.lod.core.pos.DhSectionPos;
@@ -100,7 +100,7 @@ public class FullDataFileHandler implements IFullDataSourceProvider
{
// fileToUse = Collections.max(metaFiles, Comparator.comparingLong(a -> a.metaData.dataVersion.get()));
fileToUse = Collections.max(metaFiles, Comparator.comparingLong(fullDataMetaFile -> fullDataMetaFile.path.lastModified()));
fileToUse = Collections.max(metaFiles, Comparator.comparingLong(fullDataMetaFile -> fullDataMetaFile.file.lastModified()));
{
StringBuilder sb = new StringBuilder();
sb.append("Multiple files with the same pos: ");
@@ -109,11 +109,11 @@ public class FullDataFileHandler implements IFullDataSourceProvider
for (FullDataMetaFile metaFile : metaFiles)
{
sb.append("\t");
sb.append(metaFile.path);
sb.append(metaFile.file);
sb.append("\n");
}
sb.append("\tUsing: ");
sb.append(fileToUse.path);
sb.append(fileToUse.file);
sb.append("\n");
sb.append("(Other files will be renamed by appending \".old\" to their name.)");
LOGGER.warn(sb.toString());
@@ -125,17 +125,17 @@ public class FullDataFileHandler implements IFullDataSourceProvider
{
continue;
}
File oldFile = new File(metaFile.path + ".old");
File oldFile = new File(metaFile.file + ".old");
try
{
if (!metaFile.path.renameTo(oldFile))
if (!metaFile.file.renameTo(oldFile))
{
throw new RuntimeException("Renaming failed");
}
}
catch (Exception e)
{
LOGGER.error("Failed to rename file: " + metaFile.path + " to " + oldFile, e);
LOGGER.error("Failed to rename file: " + metaFile.file + " to " + oldFile, e);
}
}
}
@@ -405,7 +405,7 @@ public class FullDataFileHandler implements IFullDataSourceProvider
{
LOGGER.error("Error reading Data file ["+pos+"]", exception);
FileUtil.renameCorruptedFile(metaFile.path);
FileUtil.renameCorruptedFile(metaFile.file);
// remove the FullDataMetaFile since the old one was corrupted
this.files.remove(pos);
// create a new FullDataMetaFile to write new data to
@@ -413,7 +413,7 @@ public class FullDataFileHandler implements IFullDataSourceProvider
}
@Override
public IFullDataSource onDataFileLoaded(IFullDataSource source, MetaData metaData,
public IFullDataSource onDataFileLoaded(IFullDataSource source, BaseMetaData metaData,
Consumer<IFullDataSource> onUpdated, Function<IFullDataSource, Boolean> updater)
{
boolean changed = updater.apply(source);
@@ -436,7 +436,7 @@ public class FullDataFileHandler implements IFullDataSourceProvider
return source;
}
@Override
public CompletableFuture<IFullDataSource> onDataFileRefresh(IFullDataSource source, MetaData metaData, Function<IFullDataSource, Boolean> updater, Consumer<IFullDataSource> onUpdated)
public CompletableFuture<IFullDataSource> onDataFileRefresh(IFullDataSource source, BaseMetaData metaData, Function<IFullDataSource, Boolean> updater, Consumer<IFullDataSource> onUpdated)
{
return CompletableFuture.supplyAsync(() ->
{
@@ -12,9 +12,9 @@ import com.seibel.lod.core.dataObjects.fullData.IFullDataSource;
import com.seibel.lod.core.dataObjects.fullData.AbstractFullDataSourceLoader;
import com.seibel.lod.core.dataObjects.fullData.sources.ChunkSizedFullDataSource;
import com.seibel.lod.core.dependencyInjection.SingletonInjector;
import com.seibel.lod.core.file.metaData.MetaData;
import com.seibel.lod.core.file.metaData.BaseMetaData;
import com.seibel.lod.core.pos.DhLodPos;
import com.seibel.lod.core.file.metaData.AbstractMetaDataFile;
import com.seibel.lod.core.file.metaData.AbstractMetaDataContainerFile;
import com.seibel.lod.core.level.IDhLevel;
import com.seibel.lod.core.pos.DhSectionPos;
import com.seibel.lod.core.logging.DhLoggerBuilder;
@@ -26,7 +26,7 @@ import org.apache.logging.log4j.Logger;
/**
* Related to the stored Blockstate/Biome ID data.
*/
public class FullDataMetaFile extends AbstractMetaDataFile
public class FullDataMetaFile extends AbstractMetaDataContainerFile
{
private static final Logger LOGGER = DhLoggerBuilder.getLogger(FullDataMetaFile.class.getSimpleName());
private static final IMinecraftClientWrapper MC_CLIENT = SingletonInjector.INSTANCE.get(IMinecraftClientWrapper.class);
@@ -134,7 +134,7 @@ public class FullDataMetaFile extends AbstractMetaDataFile
// }
// else
// {
// MetaData getData = this.metaData;
// BaseMetaData getData = this.metaData;
// //NOTE: Do this instead of direct compare so values that wrapped around still work correctly.
// return (getData == null ? 0 : this.metaData.dataVersion.get()) - cacheVersion <= 0;
// }
@@ -195,7 +195,7 @@ public class FullDataMetaFile extends AbstractMetaDataFile
{
if (e != null)
{
LOGGER.error("Uncaught error on creation {}: ", this.path, e);
LOGGER.error("Uncaught error on creation {}: ", this.file, e);
future.complete(null);
this.data.set(null);
}
@@ -238,7 +238,7 @@ public class FullDataMetaFile extends AbstractMetaDataFile
}, this.handler.getIOExecutor())
.exceptionally((e) ->
{
LOGGER.error("Error loading file {}: ", this.path, e);
LOGGER.error("Error loading file {}: ", this.file, e);
this.data.set(null);
future.completeExceptionally(e);
@@ -257,9 +257,9 @@ public class FullDataMetaFile extends AbstractMetaDataFile
return future;
}
private static MetaData makeMetaData(IFullDataSource data) {
private static BaseMetaData makeMetaData(IFullDataSource data) {
AbstractFullDataSourceLoader loader = AbstractFullDataSourceLoader.getLoader(data.getClass(), data.getDataVersion());
return new MetaData(data.getSectionPos(), -1,
return new BaseMetaData(data.getSectionPos(), -1,
data.getDataDetail(), loader == null ? 0 : loader.datatypeId, data.getDataVersion());
}
@@ -337,9 +337,9 @@ public class FullDataMetaFile extends AbstractMetaDataFile
{
if (data.isEmpty())
{
if (path.exists() && !path.delete())
if (file.exists() && !file.delete())
{
LOGGER.warn("Failed to delete data file at {}", path);
LOGGER.warn("Failed to delete data file at {}", file);
}
doesFileExist = false;
}
@@ -361,7 +361,7 @@ public class FullDataMetaFile extends AbstractMetaDataFile
}
catch (IOException e)
{
LOGGER.error("Failed to save updated data file at {} for sect {}", path, pos, e);
LOGGER.error("Failed to save updated data file at {} for sect {}", file, pos, e);
}
}
}
@@ -389,7 +389,7 @@ public class FullDataMetaFile extends AbstractMetaDataFile
private FileInputStream getDataContent() throws IOException
{
FileInputStream fin = new FileInputStream(this.path);
FileInputStream fin = new FileInputStream(this.file);
int toSkip = METADATA_SIZE;
while (toSkip > 0)
{
@@ -2,7 +2,7 @@ package com.seibel.lod.core.file.fullDatafile;
import com.seibel.lod.core.dataObjects.fullData.IFullDataSource;
import com.seibel.lod.core.dataObjects.fullData.sources.ChunkSizedFullDataSource;
import com.seibel.lod.core.file.metaData.MetaData;
import com.seibel.lod.core.file.metaData.BaseMetaData;
import com.seibel.lod.core.pos.DhSectionPos;
import java.io.File;
@@ -12,7 +12,8 @@ import java.util.concurrent.Executor;
import java.util.function.Consumer;
import java.util.function.Function;
public interface IFullDataSourceProvider extends AutoCloseable {
public interface IFullDataSourceProvider extends AutoCloseable
{
void addScannedFile(Collection<File> detectedFiles);
CompletableFuture<IFullDataSource> read(DhSectionPos pos);
@@ -23,8 +24,8 @@ public interface IFullDataSourceProvider extends AutoCloseable {
//boolean isCacheVersionValid(DhSectionPos sectionPos, long cacheVersion);
CompletableFuture<IFullDataSource> onCreateDataFile(FullDataMetaFile file);
IFullDataSource onDataFileLoaded(IFullDataSource source, MetaData metaData, Consumer<IFullDataSource> onUpdated, Function<IFullDataSource, Boolean> updater);
CompletableFuture<IFullDataSource> onDataFileRefresh(IFullDataSource source, MetaData metaData, Function<IFullDataSource, Boolean> updater, Consumer<IFullDataSource> onUpdated);
IFullDataSource onDataFileLoaded(IFullDataSource source, BaseMetaData metaData, Consumer<IFullDataSource> onUpdated, Function<IFullDataSource, Boolean> updater);
CompletableFuture<IFullDataSource> onDataFileRefresh(IFullDataSource source, BaseMetaData metaData, Function<IFullDataSource, Boolean> updater, Consumer<IFullDataSource> onUpdated);
File computeDataFilePath(DhSectionPos pos);
Executor getIOExecutor();
@@ -18,13 +18,16 @@ import com.seibel.lod.core.util.LodUtil;
import org.apache.logging.log4j.Logger;
/**
* This represents the data appended to any file we write. <br>
* Contains a {@link BaseMetaData} which holds most of the necessary values written to the file. <br><br>
*
* Used size: 40 bytes <br>
* Remaining space: 24 bytes <br>
* Total size: 64 bytes <br> <br><br>
* Total size: 64 bytes <br><br><br>
*
*
* Metadata format: <br> <br>
*
* <Strong>Metadata format: </Strong><br><br>
* <code>
* 4 bytes: metadata identifier bytes: "DHv0" (in ascii: 0x44 48 76 30) this signals the file is in the metadata format <br>
* 4 bytes: section X position <br>
* 4 bytes: section Y position (Unused, for future proofing) <br>
@@ -39,8 +42,9 @@ import org.apache.logging.log4j.Logger;
* 8 bytes: datatype identifier <br> <br>
*
* 8 bytes: data version
* </code>
*/
public abstract class AbstractMetaDataFile
public abstract class AbstractMetaDataContainerFile
{
private static final Logger LOGGER = DhLoggerBuilder.getLogger();
@@ -56,11 +60,16 @@ public abstract class AbstractMetaDataFile
public static final boolean USE_ATOMIC_MOVE_REPLACE = false;
public volatile MetaData metaData = null;
/** also defined in {@link AbstractMetaDataFile#metaData} */
/**
* Will be null if no file exists for this object. <br>
* NOTE: Only use {@link BaseMetaData#pos} when initially setting up this object, afterwards the standalone {@link AbstractMetaDataContainerFile#pos} should be used.
*/
public volatile BaseMetaData metaData = null;
/** Should be used instead of the position inside {@link AbstractMetaDataContainerFile#metaData} */
public final DhSectionPos pos;
public File path;
public File file;
@@ -69,38 +78,38 @@ public abstract class AbstractMetaDataFile
//==============//
/** Create a metaFile in this path. If the path has a file, throws FileAlreadyExistsException */
protected AbstractMetaDataFile(File path, DhSectionPos pos) throws IOException
protected AbstractMetaDataContainerFile(File file, DhSectionPos pos) throws IOException
{
this.path = path;
this.file = file;
this.pos = pos;
if (path.exists())
if (file.exists())
{
throw new FileAlreadyExistsException(path.toString());
throw new FileAlreadyExistsException(file.toString());
}
}
/**
* Creates a {@link AbstractMetaDataFile} with the file at the given path.
* Creates a {@link AbstractMetaDataContainerFile} with the file at the given path.
* @throws IOException if the file was formatted incorrectly
* @throws FileNotFoundException if no file exists for the given path
*/
protected AbstractMetaDataFile(File path) throws IOException, FileNotFoundException
protected AbstractMetaDataContainerFile(File file) throws IOException, FileNotFoundException
{
this.path = path;
if (!path.exists())
this.file = file;
if (!file.exists())
{
throw new FileNotFoundException("File not found at [" + path + "]");
throw new FileNotFoundException("File not found at ["+ file +"]");
}
validateMetaDataFile(this.path);
this.metaData = readMetaDataFromFile(path);
validateMetaDataFile(this.file);
this.metaData = readMetaDataFromFile(file);
this.pos = this.metaData.pos;
}
/**
* Attempts to create a new {@link AbstractMetaDataFile} from the given file.
* Attempts to create a new {@link AbstractMetaDataContainerFile} from the given file.
* @throws IOException if the file was formatted incorrectly
*/
private static MetaData readMetaDataFromFile(File file) throws IOException
private static BaseMetaData readMetaDataFromFile(File file) throws IOException
{
try (FileChannel channel = FileChannel.open(file.toPath(), StandardOpenOption.READ))
{
@@ -112,7 +121,7 @@ public abstract class AbstractMetaDataFile
int idBytes = byteBuffer.getInt();
if (idBytes != METADATA_IDENTITY_BYTES)
{
throw new IOException("Invalid file format: Metadata Identity byte check failed. Expected: [" + METADATA_IDENTITY_BYTES + "], Actual: [" + idBytes + "].");
throw new IOException("Invalid file format: Metadata Identity byte check failed. Expected: ["+METADATA_IDENTITY_BYTES+"], Actual: ["+idBytes+"].");
}
int x = byteBuffer.getInt();
@@ -128,7 +137,7 @@ public abstract class AbstractMetaDataFile
LodUtil.assertTrue(byteBuffer.remaining() == METADATA_RESERVED_SIZE);
DhSectionPos dataPos = new DhSectionPos(detailLevel, x, z);
return new MetaData(dataPos, checksum, dataLevel, dataTypeId, loaderVersion);
return new BaseMetaData(dataPos, checksum, dataLevel, dataTypeId, loaderVersion);
}
}
@@ -147,14 +156,14 @@ public abstract class AbstractMetaDataFile
if (!file.canWrite()) throw new IOException("File not writable");
}
/** Sets this object's {@link AbstractMetaDataFile#metaData} using the set {@link AbstractMetaDataFile#path} */
/** Sets this object's {@link AbstractMetaDataContainerFile#metaData} using the set {@link AbstractMetaDataContainerFile#file} */
protected void loadMetaData() throws IOException
{
validateMetaDataFile(this.path);
this.metaData = readMetaDataFromFile(this.path);
validateMetaDataFile(this.file);
this.metaData = readMetaDataFromFile(this.file);
if (!this.metaData.pos.equals(this.pos))
{
LOGGER.warn("The file is from a different location than expected! Expected: [{}] but got [{}]. Ignoring file tag.", this.pos, this.metaData.pos);
LOGGER.warn("The file is from a different location than expected! Expected: ["+this.pos+"] but got ["+this.metaData.pos+"]. Ignoring file tag.");
this.metaData.pos = this.pos;
}
}
@@ -162,20 +171,20 @@ public abstract class AbstractMetaDataFile
protected void writeData(IMetaDataWriter<OutputStream> dataWriter) throws IOException
{
LodUtil.assertTrue(this.metaData != null);
if (this.path.exists())
if (this.file.exists())
{
validateMetaDataFile(this.path);
validateMetaDataFile(this.file);
}
File writerFile;
if (USE_ATOMIC_MOVE_REPLACE)
{
writerFile = new File(this.path.getPath() + ".tmp");
writerFile = new File(this.file.getPath() + ".tmp");
writerFile.deleteOnExit();
}
else
{
writerFile = this.path;
writerFile = this.file;
}
try (FileChannel file = FileChannel.open(writerFile.toPath(),
@@ -187,10 +196,12 @@ public abstract class AbstractMetaDataFile
try (OutputStream channelOut = new UnclosableOutputStream(Channels.newOutputStream(file)); // Prevent closing the channel
BufferedOutputStream bufferedOut = new BufferedOutputStream(channelOut); // TODO: Is default buffer size ok? Do we even need to buffer?
CheckedOutputStream checkedOut = new CheckedOutputStream(bufferedOut, new Adler32()))
{ // TODO: Is Adler32 ok?
{
// TODO: Is Adler32 ok?
dataWriter.writeBufferToFile(checkedOut);
checksum = (int) checkedOut.getChecksum().getValue();
}
file.position(0);
// Write metadata
ByteBuffer buff = ByteBuffer.allocate(METADATA_SIZE);
@@ -209,11 +220,12 @@ public abstract class AbstractMetaDataFile
buff.flip();
file.write(buff);
}
file.close();
if (USE_ATOMIC_MOVE_REPLACE)
{
// Atomic move / replace the actual file
Files.move(writerFile.toPath(), this.path.toPath(), StandardCopyOption.ATOMIC_MOVE);
Files.move(writerFile.toPath(), this.file.toPath(), StandardCopyOption.ATOMIC_MOVE);
}
}
finally
@@ -1,15 +1,15 @@
package com.seibel.lod.core.file.metaData;
import com.seibel.lod.core.dataObjects.fullData.IFullDataSource;
import com.seibel.lod.core.pos.DhSectionPos;
import com.seibel.lod.core.dataObjects.render.ColumnRenderSource;
import java.util.concurrent.atomic.AtomicLong;
/**
* Contains the MetaData used by DataSources. <br><br>
*
* See {@link AbstractMetaDataFile} for a byte map inorder to see the currently used bytes
/**
* Contains and represents the meta information ({@link DhSectionPos}, {@link BaseMetaData#dataLevel}, etc.)
* stored at the beginning of files that use the {@link AbstractMetaDataContainerFile}. <Br>
* Which, as of the time of writing, includes: {@link IFullDataSource} and {@link ColumnRenderSource} files.
*/
public class MetaData
public class BaseMetaData
{
public DhSectionPos pos;
public int checksum;
@@ -23,7 +23,7 @@ public class MetaData
public MetaData(DhSectionPos pos, int checksum, byte dataLevel, long dataTypeId, byte loaderVersion)
public BaseMetaData(DhSectionPos pos, int checksum, byte dataLevel, long dataTypeId, byte loaderVersion)
{
this.pos = pos;
this.checksum = checksum;
@@ -3,11 +3,11 @@ package com.seibel.lod.core.file.renderfile;
import com.seibel.lod.core.dataObjects.render.ColumnRenderLoader;
import com.seibel.lod.core.dataObjects.render.ColumnRenderSource;
import com.seibel.lod.core.dataObjects.fullData.sources.ChunkSizedFullDataSource;
import com.seibel.lod.core.file.metaData.MetaData;
import com.seibel.lod.core.file.metaData.BaseMetaData;
import com.seibel.lod.core.level.IDhClientLevel;
import com.seibel.lod.core.level.IDhLevel;
import com.seibel.lod.core.pos.DhLodPos;
import com.seibel.lod.core.file.metaData.AbstractMetaDataFile;
import com.seibel.lod.core.file.metaData.AbstractMetaDataContainerFile;
import com.seibel.lod.core.pos.DhSectionPos;
import com.seibel.lod.core.logging.DhLoggerBuilder;
import com.seibel.lod.core.util.LodUtil;
@@ -20,7 +20,7 @@ import java.lang.ref.SoftReference;
import java.util.concurrent.*;
import java.util.concurrent.atomic.AtomicReference;
public class RenderMetaDataFile extends AbstractMetaDataFile
public class RenderMetaDataFile extends AbstractMetaDataContainerFile
{
private static final Logger LOGGER = DhLoggerBuilder.getLogger();
@@ -52,7 +52,7 @@ public class RenderMetaDataFile extends AbstractMetaDataFile
super(fileHandler.computeRenderFilePath(pos), pos);
this.fileHandler = fileHandler;
LodUtil.assertTrue(this.metaData == null);
this.doesFileExist = this.path.exists();
this.doesFileExist = this.file.exists();
}
/**
@@ -69,7 +69,7 @@ public class RenderMetaDataFile extends AbstractMetaDataFile
this.fileHandler = fileHandler;
LodUtil.assertTrue(this.metaData != null);
this.doesFileExist = this.path.exists();
this.doesFileExist = this.file.exists();
}
@@ -92,7 +92,7 @@ public class RenderMetaDataFile extends AbstractMetaDataFile
public CompletableFuture<Void> flushAndSave(ExecutorService renderCacheThread)
{
if (!path.exists())
if (!file.exists())
{
return CompletableFuture.completedFuture(null); // No need to save if the file doesn't exist.
}
@@ -171,7 +171,7 @@ public class RenderMetaDataFile extends AbstractMetaDataFile
{
if (exception != null)
{
LOGGER.error("Uncaught error on creation {}: ", this.path, exception);
LOGGER.error("Uncaught error on creation {}: ", this.file, exception);
loadRenderSourceFuture.complete(null);
this.data.set(null);
}
@@ -210,7 +210,7 @@ public class RenderMetaDataFile extends AbstractMetaDataFile
{
if (e != null)
{
LOGGER.error("Error loading file {}: ", this.path, e);
LOGGER.error("Error loading file {}: ", this.file, e);
loadRenderSourceFuture.complete(null);
this.data.set(null);
}
@@ -224,15 +224,15 @@ public class RenderMetaDataFile extends AbstractMetaDataFile
return loadRenderSourceFuture;
}
private static MetaData makeMetaData(ColumnRenderSource renderSource)
private static BaseMetaData makeMetaData(ColumnRenderSource renderSource)
{
return new MetaData(renderSource.getSectionPos(), -1,
return new BaseMetaData(renderSource.getSectionPos(), -1,
renderSource.getDataDetail(), RenderSourceFileHandler.RENDER_SOURCE_TYPE_ID, renderSource.getRenderVersion());
}
private FileInputStream getDataContent() throws IOException
{
FileInputStream fin = new FileInputStream(this.path);
FileInputStream fin = new FileInputStream(this.file);
int toSkip = METADATA_SIZE;
while (toSkip > 0)
{
@@ -258,11 +258,11 @@ public class RenderMetaDataFile extends AbstractMetaDataFile
{
if (renderSource.isEmpty())
{
if (this.path.exists())
if (this.file.exists())
{
if (!this.path.delete())
if (!this.file.delete())
{
LOGGER.warn("Failed to delete render file at {}", this.path);
LOGGER.warn("Failed to delete render file at {}", this.file);
}
}
this.doesFileExist = false;
@@ -277,7 +277,7 @@ public class RenderMetaDataFile extends AbstractMetaDataFile
}
catch (IOException e)
{
LOGGER.error("Failed to save updated render file at {} for sect {}", this.path, this.pos, e);
LOGGER.error("Failed to save updated render file at {} for sect {}", this.file, this.pos, e);
}
}
}
@@ -109,7 +109,7 @@ public class RenderSourceFileHandler implements ILodRenderSourceProvider
// use the file's last modified date
fileToUse = Collections.max(metaFiles, Comparator.comparingLong(renderMetaDataFile ->
renderMetaDataFile.path.lastModified()));
renderMetaDataFile.file.lastModified()));
// fileToUse = Collections.max(metaFiles, Comparator.comparingLong(renderMetaDataFile ->
// renderMetaDataFile.metaData.dataVersion.get()));
@@ -121,11 +121,11 @@ public class RenderSourceFileHandler implements ILodRenderSourceProvider
for (RenderMetaDataFile metaFile : metaFiles)
{
sb.append("\t");
sb.append(metaFile.path);
sb.append(metaFile.file);
sb.append("\n");
}
sb.append("\tUsing: ");
sb.append(fileToUse.path);
sb.append(fileToUse.file);
sb.append("\n");
sb.append("(Other files will be renamed by appending \".old\" to their name.)");
LOGGER.warn(sb.toString());
@@ -138,15 +138,15 @@ public class RenderSourceFileHandler implements ILodRenderSourceProvider
continue;
}
File oldFile = new File(metaFile.path + ".old");
File oldFile = new File(metaFile.file + ".old");
try
{
if (!metaFile.path.renameTo(oldFile))
if (!metaFile.file.renameTo(oldFile))
throw new RuntimeException("Renaming failed");
}
catch (Exception e)
{
LOGGER.error("Failed to rename file: [" + metaFile.path + "] to [" + oldFile + "]", e);
LOGGER.error("Failed to rename file: [" + metaFile.file + "] to [" + oldFile + "]", e);
}
}
}