Skip to content

Commit c063ee1

Browse files
committed
Rethinking QuotingStrategy to remove dependency on the ORM model...
fixing handling of empty schemas, catalogs
1 parent 5aff3c5 commit c063ee1

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

cayenne/src/main/java/org/apache/cayenne/dba/QuotingStrategy.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,16 +50,17 @@ public interface QuotingStrategy {
5050
void appendEnd(Appendable out);
5151

5252
/**
53-
* Appends a fully-qualified name, joining non-null parts with {@code '.'} and wrapping each part
54-
* in start/end quotes. {@code null} parts are skipped.
53+
* Appends a fully-qualified name, joining non-empty parts with {@code '.'} and wrapping each part
54+
* in start/end quotes. {@code null} and empty parts are skipped (e.g. an absent catalog reported
55+
* as an empty string by JDBC metadata).
5556
*
5657
* @since 5.0
5758
*/
5859
default void appendFQN(Appendable out, String... parts) {
5960
try {
6061
boolean first = true;
6162
for (String part : parts) {
62-
if (part == null) {
63+
if (part == null || part.isEmpty()) {
6364
continue;
6465
}
6566
if (!first) {
@@ -89,8 +90,8 @@ default String quoted(String identifier) {
8990
}
9091

9192
/**
92-
* Returns a quoted fully-qualified name, joining non-null parts with {@code '.'} and wrapping
93-
* each part in start/end quotes. {@code null} parts are skipped.
93+
* Returns a quoted fully-qualified name, joining non-empty parts with {@code '.'} and wrapping
94+
* each part in start/end quotes. {@code null} and empty parts are skipped.
9495
*
9596
* @since 5.0
9697
*/

0 commit comments

Comments
 (0)