in src/main/java/org/apache/tomcat/jakartaee/Migration.java [232:261]
public void execute() throws IOException {
if (state == State.RUNNING) {
throw new IllegalStateException(sm.getString("migration.alreadyRunning"));
}
state = State.RUNNING;
converted = false;
logger.log(Level.INFO, sm.getString("migration.execute", source.getAbsolutePath(),
destination.getAbsolutePath(), profile.toString()));
long t1 = System.nanoTime();
if (source.isDirectory()) {
if ((destination.exists() && destination.isDirectory()) || destination.mkdirs()) {
migrateDirectory(source, destination);
} else {
throw new IOException(sm.getString("migration.mkdirError", destination.getAbsolutePath()));
}
} else {
// Single file`
File parentDestination = destination.getAbsoluteFile().getParentFile();
if (parentDestination.exists() || parentDestination.mkdirs()) {
migrateFile(source, destination);
} else {
throw new IOException(sm.getString("migration.mkdirError", parentDestination.getAbsolutePath()));
}
}
state = State.COMPLETE;
logger.log(Level.INFO, sm.getString("migration.done",
Long.valueOf(TimeUnit.MILLISECONDS.convert(System.nanoTime() - t1, TimeUnit.NANOSECONDS))));
}