Skip to content

Commit

Permalink
#2863 use dirty hacks to reduce code duplication
Browse files Browse the repository at this point in the history
  • Loading branch information
c71n93 committed Mar 8, 2024
1 parent 153aeb9 commit 3be2745
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 18 deletions.
11 changes: 2 additions & 9 deletions eo-maven-plugin/src/main/java/org/eolang/maven/rust/Names.java
Expand Up @@ -189,20 +189,13 @@ private static ConcurrentHashMap<String, String> load(final Path src) throws IOE
final Object result = map.readObject();
if (result.getClass() != ConcurrentHashMap.class) {
throw new ClassCastException(
String.format(
"Object inside %s has wrong class %s",
src,
result.getClass()
)
String.format("Object inside %s has wrong class %s", src, result.getClass())
);
}
return (ConcurrentHashMap<String, String>) result;
} catch (final ClassNotFoundException exc) {
throw new IllegalArgumentException(
String.format(
"File %s contains invalid data",
src
),
String.format("File %s contains invalid data", src),
exc
);
}
Expand Down
11 changes: 2 additions & 9 deletions eo-runtime/src/main/java/EOorg/EOeolang/EOrust.java
Expand Up @@ -189,20 +189,13 @@ private static ConcurrentHashMap<String, String> load(final String src) throws I
final Object result = map.readObject();
if (result.getClass() != ConcurrentHashMap.class) {
throw new ClassCastException(
String.format(
"Object inside %s has wrong class %s",
src,
result.getClass()
)
String.format("Object inside %s has wrong class %s", src, result.getClass())
);
}
return (ConcurrentHashMap<String, String>) result;
} catch (final ClassNotFoundException exc) {
throw new IllegalArgumentException(
String.format(
"File %s contains invalid data",
src
),
String.format("File %s contains invalid data", src),
exc
);
}
Expand Down

0 comments on commit 3be2745

Please sign in to comment.