This is an automated email from the ASF dual-hosted git repository.

lzljs3620320 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-paimon.git


The following commit(s) were added to refs/heads/master by this push:
     new 7df96bbc5 [Minor] Remove duplicate code from 
FileFormat#fromIdentifier. (#2712)
7df96bbc5 is described below

commit 7df96bbc50974b2040ec072700b48dc702bc2606
Author: Yujiang Zhong <[email protected]>
AuthorDate: Tue Jan 16 21:29:53 2024 +0800

    [Minor] Remove duplicate code from FileFormat#fromIdentifier. (#2712)
---
 .../java/org/apache/paimon/format/FileFormat.java     | 19 +++++++------------
 1 file changed, 7 insertions(+), 12 deletions(-)

diff --git 
a/paimon-common/src/main/java/org/apache/paimon/format/FileFormat.java 
b/paimon-common/src/main/java/org/apache/paimon/format/FileFormat.java
index cb7a62453..d0cd53f8a 100644
--- a/paimon-common/src/main/java/org/apache/paimon/format/FileFormat.java
+++ b/paimon-common/src/main/java/org/apache/paimon/format/FileFormat.java
@@ -81,18 +81,13 @@ public abstract class FileFormat {
 
     /** Create a {@link FileFormat} from format identifier and format options. 
*/
     public static FileFormat fromIdentifier(String identifier, FormatContext 
context) {
-        Optional<FileFormat> format =
-                fromIdentifier(identifier, context, 
FileFormat.class.getClassLoader());
-        return format.orElseGet(
-                () ->
-                        fromIdentifier(identifier, context, 
FileFormat.class.getClassLoader())
-                                .orElseThrow(
-                                        () ->
-                                                new RuntimeException(
-                                                        String.format(
-                                                                "Could not 
find any factories that implement '%s' in the classpath.",
-                                                                
FileFormatFactory.class
-                                                                        
.getName()))));
+        return fromIdentifier(identifier, context, 
FileFormat.class.getClassLoader())
+                .orElseThrow(
+                        () ->
+                                new RuntimeException(
+                                        String.format(
+                                                "Could not find a 
FileFormatFactory implementation class for %s format",
+                                                identifier)));
     }
 
     private static Optional<FileFormat> fromIdentifier(

Reply via email to