FeatureResponse throws ClassCastException when trying to cast a non-blocking FeatureSource

Description

When performing a GetFeature request, FeatureResponse class obtains the propper FeatureSource but directly cast it to a FeatureLocking without checking if the returning FeatureSource actually implements it.

This affects ArcSDE datastore, wich currently does not implements write access nor locking, and will affect any other non-blocking DataStore.

The cast is done at line 282 in FeatureResponse.java:

source = (FeatureLocking) meta.getFeatureSource();

As it seems to take care of currently locked features, I don't have the courage of putting my hands on although it seems pretty trivial. So it is for you, Jody <img class="emoticon" src="https://jira.codehaus.org/images/icons/emoticons/smile.gif" height="16" width="16" align="absmiddle" alt="" border="0"/>

Environment

None

Activity

Show:
codehaus
April 10, 2015, 4:35 PM

CodeHaus Comment From: jgarnett - Time: Sun, 25 Jan 2004 21:44:45 -0600
---------------------
<p>Thanks for the bug report, I hunted down a similar problem in LockResponse. Nicely done!</p>

<p>Code was fixed by:</p>

<p>FeatureSource source = meta.getFeatureSource();

...snip...

if( !(source instanceof FeatureLocking))</p>
{
continue; // Locking is not supproted
}

<p>If you read my comments for those methods, I was not sure about the "safe" way for performing lock functionality. There are lots of comments about me being unsure as to where/when abort is called (in case we have errors in the middle of the locking proccess.</p>

<p>This code has been in place since 1.1 (as you reported), it would be nice to have a second developer review this work (please).</p>

codehaus
April 10, 2015, 4:35 PM

CodeHaus Comment From: jgarnett - Time: Sun, 25 Jan 2004 22:50:07 -0600
---------------------
<p>EXTERNAL MESSAGE:

SUBJECT: Re: <span class="error">&#91;jira&#93;</span> Resolved: (<a href="https://jira.codehaus.org/browse/GEOS-67" title="FeatureResponse throws ClassCastException when trying to cast a non-blocking FeatureSource" class="issue-link" data-issue-key="GEOS-67"><del>GEOS-67</del></a>) FeatureResponse throws ClassCastException

when trying to cast a non-blocking FeatureSource

jira@codehaus.org wrote:</p>

<p>Just going to try replying to a Jira bug <img class="emoticon" src="https://jira.codehaus.org/images/icons/emoticons/smile.gif" height="16" width="16" align="absmiddle" alt="" border="0"/></p>

<p>It could be that I should perform this check in the middle of the reader

access, so I can report in painful detail each and every FeatureId that

could not be locked. As it stands the locking process will simply report

that no locks were obtained, not all the locks that could not be obtained.</p>

<p>Second opionion needed, this bug may need to be reopened.

Jody</p>

codehaus
April 10, 2015, 4:35 PM

CodeHaus Comment From: jgarnett - Time: Sun, 25 Jan 2004 22:57:23 -0600
---------------------
<p>Changed to report all the fids that could not be locked. This is a much more friendly response. The wfs spec does not demand that we say why a lock could not be obtained, we are just supposed to sort them into two piles: those that were locked and those that were not. This change will mean that the Lock response contains all the Fids that would be present in a request.</p>

<p>We may be allowed to outright fail when a user trys to lock on a data source that does not support such. We will have to look at the spec.</p>

Assignee

Unassigned

Reporter

codehaus

Triage

None

Fix versions

Affects versions

Components

Priority

Medium
Configure