voyent
Target unreachable in rowSelection value expression  XML
Forum Index -> General Help
Author Message
aperezymadrid

Joined: 15/Nov/2008 00:00:00
Messages: 27
Offline


I have push enabled application with datatables. When another user updates something, the table must be server pushed rerendered. If I use a "checked" field in the row object to store the row selection status, the checked info is lost when the table is updated. So I designed a way to do that and it's a class that implements a Map interface. It stores the database table key of the selected row. So, when the table is reloaded, the record key of the selected row is not erased. The Map interface was selected to be used for all the rows in this way:
Code:
<ice:column id="cnt13">
 		<ice:rowSelector id="cnt9" multiple="false"
 		selectionListener="#{Proveedores.rowSelectionListener}"
 		value="#{Proveedores.dataModel.checkedHelper[currentRow]}" />
 ...

The problem is sometimes this warning is thrown after clicking the row and before calling the selectionListener:
Code:
WARNING: javax.faces.el.PropertyNotFoundException: javax.el.PropertyNotFoundException: Target Unreachable, 'BracketSuffix' returned null
 	at com.sun.faces.application.ValueBindingValueExpressionAdapter.setValue(ValueBindingValueExpressionAdapter.java:154)
 	at com.icesoft.faces.component.ext.RowSelector.setValue(RowSelector.java:112)
 	at com.icesoft.faces.component.ext.RowSelector.processDecodes(RowSelector.java:426)
 ...


I've also tested it using a field in the currentRow object:
Code:
<ice:rowSelector id="cnt9" multiple="false"
 		selectionListener="#{Proveedores.rowSelectionListener}"
 		value="#{currentRow.checked}" />

and sometimes happens something similar: javax.el.PropertyNotFoundException: Target Unreachable, identifier 'currentRow' resolved to null.

The usual recipe
Code:
<ice:rowSelector id="cnt9" multiple="false"
 		selectionListener="#{Proveedores.rowSelectionListener}"
 		value="#{currentRow['checked']}" />

does not fail.

I think it should work and it seems a race condition.

Any ideas?
Thanks


aperezymadrid

Joined: 15/Nov/2008 00:00:00
Messages: 27
Offline


If I do the same in Java, it works

Code:
selectionListener="#{Proveedores.rowSelectionListener}"
  		value="#{Proveedores.rowSelStatus}"
 

and in Java
Code:
 public Boolean getRowSelStatus(){
    return dataModel.getCheckedHelper().get(getBean("currentRow"));
 }
 public void setRowSelStatus(Boolean b){
    dataModel.getCheckedHelper().put(getBean("currentRow"),b);
 }
 


So, there is a bug in EL jar or EL doesn't like complex expressions or there is a race condition;

Aniceto
Knuckle

Joined: 22/Nov/2008 00:00:00
Messages: 93
Offline


Hi

I have a similar problem when using the datatable and its rowselector to re-fresh itself with data based upon the id of the selected row. However, when the exception is thrown there is no loss in functionally of the app.

javax.faces.el.PropertyNotFoundException: javax.el.PropertyNotFoundException: Target Unreachable, identifier 'myTableVar' resolved to null

The exception is thrown consistently on certain returned datasets but not on others, the JPA call is the same apart from the unique id of the selected object.

I have been unsuccessful in catching the exception within my code and suspect that it is a JSF issue.

If anyone is able to shed some light on why this exception may be occurring, it would be greatly appreciated.

Cheers
Wayne
aperezymadrid

Joined: 15/Nov/2008 00:00:00
Messages: 27
Offline


Hi

I've got that kind of error from time to time if expressions are complex. If you put all complex code as a JSF bean property and do all exception handling there, those errors disappear.

I suppose rowselector events are handled in a different way; in fact datatables need special handling. Probably sometimes the rowSelector value property is changed before the currentRow bean is created and it does not check if it's available. Probably it's called again later and the application works right, but the log says something is not completely OK.

My advise is to keep EL expressions simple.

Regards
drewh

Joined: 01/Jul/2009 00:00:00
Messages: 54
Offline


Could anybody elaborate more on this. This is happening to me. Doesn't seem to affect anything but it's still there.
bgosse

Joined: 08/Sep/2010 09:37:48
Messages: 12
Offline


I find that I always get this exception when I have a datatable that only contains one row as a result of a search and then I click that row.
nateshkurup

Joined: 10/Mar/2010 00:00:00
Messages: 9
Offline


Hi,

Iam using icefaces 1.8.2 and a similar error used to occur in my application.

In my application i have a datatable and the source comes from an arraylist in the managed bean.

Code:
 <ice:dataTable id="kmTopicDetailsDataTable" width="100%"
 			rows="#{topicDetailsManagedBean.noOfRowsPerPage}"
 			rendered="#{topicDetailsManagedBean.tableRendered}"
 			value="#{topicDetailsManagedBean.articleDetailsList}"
 			var="topicDetailsList"
 			sortColumn="#{topicDetailsManagedBean.sortColumnName}"
 			sortAscending="#{topicDetailsManagedBean.ascending}"
 			styleClass="topic-details-datatable">
 
 </ice:dataTable>
 


My datatable displays 10 records at a time. I select the 10th row. Then i apply a filter so that when the screen refreshes only 2 reocrds are displayed. Now when i select the 2nd row the application displays the stack trace on the console though it does stop the application.

Investigating the code, found the error to occur in com.icesoft.faces.component.ext.RowSelector.java I found the problem occurs because when a new and different row has been selected the class tries to reset the selected attribute of the previous selected row. But in my case after applying the filter there are 2 rows in the arraylist compared to the initial 10 rows, when it tries to reset the 10th row it throws up an error. I included a condition for checking the length of the arraylist before resetting the selected attribute of the previous record. please find the original code

Code:
 
 if (rowClicked) {
                 // Toggle the row selection if multiple
                 boolean b = rowSelector.getValue().booleanValue();
                 if (isEnhancedMultiple()) {
                     if ((!isCtrlKey && !isShiftKey) || isShiftKey) {
                         b = true; // always select
                         _queueEvent(rowSelector, rowIndex, b,
 clickActionEvent);
                         return;
                     }
                     if (isCtrlKey && !isShiftKey) {
                         b = !b;
                         _queueEvent(rowSelector, rowIndex, b,
 clickActionEvent);
                         return;
                     }
                 }
                 else {
                     b = !b;
                     _queueEvent(rowSelector, rowIndex, b, clickActionEvent);
                     // ICE-3440
                     if (!getMultiple().booleanValue()) {
                         if (oldRow != null && oldRow.intValue() >= 0 &&
 oldRow.intValue() != rowIndex) {
                            [color=yellow] dataTable.setRowIndex(oldRow.intValue());
                             setValue(Boolean.FALSE);[/color]
 
                             dataTable.setRowIndex(rowIndex);
                             setValue(Boolean.valueOf(b));
                         }
 
                     }
                 }
             }
 
 


The modified code is below

Code:
 if (rowClicked) {
                 // Toggle the row selection if multiple
                 boolean b = rowSelector.getValue().booleanValue();
                 if (isEnhancedMultiple()) {
                     if ((!isCtrlKey && !isShiftKey) || isShiftKey) {
                         b = true; // always select
                         _queueEvent(rowSelector, rowIndex, b,
 clickActionEvent);
                         return;
                     }
                     if (isCtrlKey && !isShiftKey) {
                         b = !b;
                         _queueEvent(rowSelector, rowIndex, b,
 clickActionEvent);
                         return;
                     }
                 }
                 else {
                     b = !b;
                     _queueEvent(rowSelector, rowIndex, b, clickActionEvent);
                     // ICE-3440
                     if (!getMultiple().booleanValue()) {
                         if (oldRow != null && oldRow.intValue() >= 0 &&
 oldRow.intValue() != rowIndex) {
                             dataTable.setRowIndex(oldRow.intValue());
                             //Before we reset the old Row we need to ensure the
 list still contains the record at the previous position
 [color=yellow] 
                             if (oldRow.intValue()<= dataTable.getRowCount()) {
 [/color]
                                 // if the record is found then reset the
 selection of the previous record.
                                 setValue(Boolean.FALSE);
                             }
                             dataTable.setRowIndex(rowIndex);
                             setValue(Boolean.valueOf(b));
                         }
 
                     }
                 }
             }
 
 


Hope this helps
Knuckle

Joined: 22/Nov/2008 00:00:00
Messages: 93
Offline


Dear nateshkurup

You are a legend !

It has reduced but not eliminated the occurance of the exception.

Thanks heaps.

Cheers
Wayne
Knuckle

Joined: 22/Nov/2008 00:00:00
Messages: 93
Offline


Just to add....

Catching the exception here, appears to have eliminated the log trace.

Code:
 
     public void setValue(Boolean value) {
         ValueBinding vb = getValueBinding("value");
         if (vb != null) {
           try{
             vb.setValue(getFacesContext(), value);
           }catch(javax.faces.el.PropertyNotFoundException e){}
         } else {
             this.value = value;
         }
     }
 
 


Cheers
Wayne
 
Forum Index -> General Help
Go to:   
Powered by JForum 2.1.7ice © JForum Team