Copilot commented on code in PR #11940: URL: https://github.com/apache/gravitino/pull/11940#discussion_r3542084868
########## common/src/main/java/org/apache/gravitino/utils/DirectoryUtils.java: ########## @@ -0,0 +1,47 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.gravitino.utils; + +import java.io.File; +import java.io.IOException; +import java.nio.file.FileAlreadyExistsException; +import java.nio.file.Files; + +/** Utilities for working with local directories. */ +public class DirectoryUtils { + + private DirectoryUtils() {} + + /** + * Ensures that the given directory exists, creating it and any missing parent directories if + * necessary. + * + * <p>Unlike {@code File#exists()} followed by {@code File#mkdirs()}, this method is safe against + * concurrent creation of the same directory: it succeeds if the directory already exists or is + * created concurrently by another thread or process. + * + * @param dir the directory to create + * @throws FileAlreadyExistsException if the path exists but is not a directory + * @throws IOException if the directory cannot be created + */ Review Comment: `DirectoryUtils` imports `java.nio.file.FileAlreadyExistsException` but never uses it in code (only in Javadoc). Unused imports fail compilation/checkstyle; either remove the import or reference the class with a fully qualified name in the Javadoc. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
