You are viewing a plain text version of this content. The canonical link for it is here.
Posted to xindice-dev@xml.apache.org by Natalia Shilenkova <ns...@gmail.com> on 2007/04/26 02:57:13 UTC

DocumentCache changes - missing return statement

Vadim,

Looks like there was a missing return statement in this patch (code
for stored instance of String):

             return null;
         } else if (v instanceof Document) {
             return (Document) v;
+        } else if (v instanceof String) {
+            try {
+                Document doc = DOMParser.toDocument((String) v);
+                ((DBDocument) doc).setSource(new NodeSource(col, key));
+            } catch (Exception e) {
+                if (log.isWarnEnabled()) {
+                    log.warn("ignored exception", e);
+                }
+            }
         } else if (v instanceof byte[]) {
             try {
                 SymbolTable s = col.getSymbols();

Regards,
Natalia

Re: DocumentCache changes - missing return statement

Posted by Vadim Gritsenko <va...@reverycodes.com>.
Natalia Shilenkova wrote:
> Vadim,
> 
> Looks like there was a missing return statement in this patch (code
> for stored instance of String):

Indeed! Thanks for spotting.

Vadim

>             return null;
>         } else if (v instanceof Document) {
>             return (Document) v;
> +        } else if (v instanceof String) {
> +            try {
> +                Document doc = DOMParser.toDocument((String) v);
> +                ((DBDocument) doc).setSource(new NodeSource(col, key));
> +            } catch (Exception e) {
> +                if (log.isWarnEnabled()) {
> +                    log.warn("ignored exception", e);
> +                }
> +            }
>         } else if (v instanceof byte[]) {
>             try {
>                 SymbolTable s = col.getSymbols();
> 
> Regards,
> Natalia
>