You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openjpa.apache.org by rm...@apache.org on 2020/09/30 10:24:27 UTC

[openjpa] branch master updated: OPENJPA-2820

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

rmannibucau pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/openjpa.git


The following commit(s) were added to refs/heads/master by this push:
     new bc63cd2  OPENJPA-2820
     new 049c2ef  Merge pull request #71 from eolivelli/fix/OPENJPA-2820-delim
bc63cd2 is described below

commit bc63cd2e45b386040ea5e402d8ab6abd4d98c833
Author: Enrico Olivelli <eo...@apache.org>
AuthorDate: Thu Jul 23 10:14:43 2020 +0200

    OPENJPA-2820
---
 .../java/org/apache/openjpa/jdbc/identifier/DBIdentifier.java    | 6 ++++--
 .../java/org/apache/openjpa/lib/identifier/IdentifierImpl.java   | 9 +++++++++
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/identifier/DBIdentifier.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/identifier/DBIdentifier.java
index aa1f888..255784a 100644
--- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/identifier/DBIdentifier.java
+++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/identifier/DBIdentifier.java
@@ -142,6 +142,7 @@ public class DBIdentifier extends IdentifierImpl implements Cloneable, Identifie
         if (DBIdentifierType.CONSTANT != getType() && DBIdentifierType.COLUMN_DEFINITION != getType()) {
             if (delimit) {
                 name = Normalizer.delimit(name, true);
+                setNameDelimited(true);
              } else {
                  name = Normalizer.normalizeString(name);
              }
@@ -325,6 +326,7 @@ public class DBIdentifier extends IdentifierImpl implements Cloneable, Identifie
         sName.setNameInternal(getNameInternal());
         sName.setType(getType());
         sName.setIgnoreCase(getIgnoreCase());
+        sName.setNameDelimited(isNameDelimited());
         return sName;
     }
 
@@ -859,7 +861,7 @@ public class DBIdentifier extends IdentifierImpl implements Cloneable, Identifie
      * @param name
      */
     public static DBIdentifier removeDelimiters(DBIdentifier name) {
-        if (DBIdentifier.isNull(name)) {
+        if (DBIdentifier.isNull(name) || !name.isDelimited()) {
             return name;
         }
         if (!name.isDelimited()) {
@@ -927,7 +929,7 @@ public class DBIdentifier extends IdentifierImpl implements Cloneable, Identifie
         if (DBIdentifier.isEmpty(this)) {
             return false;
         }
-        return Normalizer.isDelimited(getNameInternal());
+        return isNameDelimited() || Normalizer.isDelimited(getNameInternal());
     }
 
     /**
diff --git a/openjpa-lib/src/main/java/org/apache/openjpa/lib/identifier/IdentifierImpl.java b/openjpa-lib/src/main/java/org/apache/openjpa/lib/identifier/IdentifierImpl.java
index 3958cd3..99a636d 100644
--- a/openjpa-lib/src/main/java/org/apache/openjpa/lib/identifier/IdentifierImpl.java
+++ b/openjpa-lib/src/main/java/org/apache/openjpa/lib/identifier/IdentifierImpl.java
@@ -28,6 +28,7 @@ public class IdentifierImpl implements Identifier, Serializable {
     
     private static final long serialVersionUID = 1L;
     private String _name = null;
+    private boolean nameDelimited = false;
 
     protected IdentifierImpl() {}
 
@@ -45,6 +46,14 @@ public class IdentifierImpl implements Identifier, Serializable {
         return _name;
     }
 
+    public boolean isNameDelimited() {
+        return nameDelimited;
+    }
+
+    public void setNameDelimited(boolean nameDelimited) {
+        this.nameDelimited = nameDelimited;
+    }
+
     @Override
     public String toString() {
         return getName();