jackrabbit-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Stefan Guggisberg" <stefan.guggisb...@gmail.com>
Subject Re: svn commit: r523272 - /jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/util/DbNameIndex.java
Date Wed, 28 Mar 2007 12:31:00 GMT
> + * Due to a bug with oracle that treats empty strings a null values

erm2, ich bin nicht sicher ob oracle das als bug betrachtet ;)


On 3/28/07, tripod@apache.org <tripod@apache.org> wrote:
> Author: tripod
> Date: Wed Mar 28 03:49:28 2007
> New Revision: 523272
>
> URL: http://svn.apache.org/viewvc?view=rev&rev=523272
> Log:
> JCR-815 SQLException with OracleBundle PM in name index
>
> Modified:
>     jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/util/DbNameIndex.java
>
> Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/util/DbNameIndex.java
> URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/util/DbNameIndex.java?view=diff&rev=523272&r1=523271&r2=523272
> ==============================================================================
> --- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/util/DbNameIndex.java
(original)
> +++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/util/DbNameIndex.java
Wed Mar 28 03:49:28 2007
> @@ -27,9 +27,13 @@
>  /**
>   * Implements a {@link StringIndex} that stores and retrieves the names from a
>   * table in a database.
> - *
> + * <p/>
>   * Note that this class is not threadsafe by itself. it needs to be synchronized
>   * by the using application.
> + * <p/>
> + * Due to a bug with oracle that treats empty strings a null values
> + * (see JCR-815), all empty strings are replaced by a ' '. since names never
> + * start with a space, this it not problematic yet.
>   */
>  public class DbNameIndex implements StringIndex {
>
> @@ -88,9 +92,10 @@
>          // check cache
>          Integer index = (Integer) string2Index.get(string);
>          if (index == null) {
> -            int idx = getIndex(string);
> +            String dbString = string.length() == 0 ? " " : string;
> +            int idx = getIndex(dbString);
>              if (idx == -1) {
> -                idx = insertString(string);
> +                idx = insertString(dbString);
>              }
>              index = new Integer(idx);
>              string2Index.put(string, index);
> @@ -113,6 +118,9 @@
>              if (s == null) {
>                  throw new IllegalStateException("String empty???");
>              }
> +            if (s.equals(" ")) {
> +                s = "";
> +            }
>              index2String.put(index, s);
>              string2Index.put(s, index);
>          }
> @@ -172,11 +180,11 @@
>      }
>
>      /**
> -     * Retrieves the string from the database for the givein index.
> +     * Retrieves the string from the database for the given index.
>       * @param index the index to retrieve the string for.
>       * @return the string or <code>null</code> if not found.
>       */
> -    private String getString(int index) {
> +    protected String getString(int index) {
>          PreparedStatement stmt = nameSelect;
>          ResultSet rs = null;
>          try {
>
>
>

Mime
View raw message