• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Inappropriate OGNL expression !
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Inappropriate OGNL expression !


  • Subject: Re: Inappropriate OGNL expression !
  • From: Chuck Hill <email@hidden>
  • Date: Fri, 21 Sep 2012 09:59:17 -0700

Ah, missed this: "Exception invoking setValue on WOOgnlAssociation"

See
http://comments.gmane.org/gmane.comp.web.webobjects.wonder-disc/17475
http://www.digipedia.pl/usenet/thread/17625/10432/

One solution is to add a method

	public String dateFormatForOperationStartDate() {
		NSTimestampFormatter formatter = new NSTimestampFormatter("%Y-%m-%d %H:%M:%S");
		formatter.setDefaultParseTimeZone(NSTimeZone.defaultTimeZone());

		return formatter.format(anOperation.dateStart());
	}

And use that.  Which defeats the purpose of WOOgnl...

Also note that date formatters are somewhat expensive to create.  Just create an instance in the class and re-use that.


Chuck



On 2012-09-21, at 9:01 AM, Louis Demers wrote:

> Had some hope for a few seconds... Bot no
>
> Sep 21 11:59:23 ERROR ognl.webobjects.WOOgnlAssociation  - Exception invoking setValue on WOOgnlAssociation: 'dateFormat(anOperation.dateStart())'.
> InappropriateExpressionException: Inappropriate OGNL expression: dateFormat(anOperation.dateStart())
>  at ognl.SimpleNode.setValueBody(SimpleNode.java:257)
>  at ognl.SimpleNode.evaluateSetValueBody(SimpleNode.java:177)
>  at ognl.SimpleNode.setValue(SimpleNode.java:246)
>  at ognl.Ognl.setValue(Ognl.java:476)
>  at ognl.Ognl.setValue(Ognl.java:494)
>  at ognl.webobjects.WOOgnl.setValue(WOOgnl.java:275)
>  at ognl.webobjects.WOOgnlAssociation.setValue(WOOgnlAssociation.java:58)
>  at com.webobjects.appserver.WOComponent._doPushValuesUp(WOComponent.java:558)
>  at com.webobjects.appserver.WOComponent.pushValuesToParent(WOComponent.java:535)
>     ... skipped 22 stack elements
>  at er.extensions.appserver.ERXComponentRequestHandler._dispatchWithPreparedPage(ERXComponentRequestHandler.java:190)
>  at er.extensions.appserver.ERXComponentRequestHandler._dispatchWithPreparedSession(ERXComponentRequestHandler.java:235)
>  at er.extensions.appserver.ERXComponentRequestHandler._dispatchWithPreparedApplication(ERXComponentRequestHandler.java:268)
>  at er.extensions.appserver.ERXComponentRequestHandler._handleRequest(ERXComponentRequestHandler.java:302)
>  at er.extensions.appserver.ERXComponentRequestHandler.handleRequest(ERXComponentRequestHandler.java:374)
>  ... skipped 6 stack elements
>
>
>
> On 2012-09-21, at 11:12 , Chuck Hill <email@hidden> wrote:
>
>> Hi Louis,
>>
>> Does this work?
>> dateFormat(anOperation.dateStart())
>> Note the () after dateStart.
>>
>> Chuck
>>
>>
>> On 2012-09-21, at 7:19 AM, Louis Demers wrote:
>>
>>> Hi,
>>>
>>> 	from some of my pages, I get the exception listed below.
>>>
>>> Sep 21 09:47:26 ERROR ognl.webobjects.WOOgnlAssociation  - Exception invoking setValue on WOOgnlAssociation: 'dateFormat(anOperation.dateStart)'.
>>> InappropriateExpressionException: Inappropriate OGNL expression: dateFormat(anOperation.dateStart)
>>> at ognl.SimpleNode.setValueBody(SimpleNode.java:257)
>>> at ognl.SimpleNode.evaluateSetValueBody(SimpleNode.java:177)
>>> at ognl.SimpleNode.setValue(SimpleNode.java:246)
>>> at ognl.Ognl.setValue(Ognl.java:476)
>>> at ognl.Ognl.setValue(Ognl.java:494)
>>> at ognl.webobjects.WOOgnl.setValue(WOOgnl.java:275)
>>> at ognl.webobjects.WOOgnlAssociation.setValue(WOOgnlAssociation.java:58)
>>> at com.webobjects.appserver.WOComponent._doPushValuesUp(WOComponent.java:558)
>>> at com.webobjects.appserver.WOComponent.pushValuesToParent(WOComponent.java:535)
>>>    ... skipped 22 stack elements
>>> at er.extensions.appserver.ERXComponentRequestHandler._dispatchWithPreparedPage(ERXComponentRequestHandler.java:190)
>>> at er.extensions.appserver.ERXComponentRequestHandler._dispatchWithPreparedSession(ERXComponentRequestHandler.java:235)
>>> at er.extensions.appserver.ERXComponentRequestHandler._dispatchWithPreparedApplication(ERXComponentRequestHandler.java:268)
>>> at er.extensions.appserver.ERXComponentRequestHandler._handleRequest(ERXComponentRequestHandler.java:302)
>>> at er.extensions.appserver.ERXComponentRequestHandler.handleRequest(ERXComponentRequestHandler.java:374)
>>> ... skipped 6 stack elements
>>>
>>> The code in my page is
>>>
>>> <wo:PageHeader left = "$anOperation.part.ID" center = "$anOperation.title" right = "$~dateFormat(anOperation.dateStart)" />
>>>
>>> and the corresponding java is
>>>
>>> 	// __________________________________________________________________________________________________________________
>>> 	public String dateFormat(NSTimestamp d) {
>>> 		NSTimestampFormatter formatter = new NSTimestampFormatter("%Y-%m-%d %H:%M:%S");
>>> 		formatter.setDefaultParseTimeZone(NSTimeZone.defaultTimeZone());
>>>
>>> 		return formatter.format(d);
>>> 	}
>>>
>>> and the associated webobject is
>>>
>>> <div class = "PageHeader">
>>> <table>
>>>   <tr>
>>>     <td class = "left">
>>>       <span class = "Header"> <wo:str value = "$left" /> </span>
>>>     </td>
>>>     <td class = "center">
>>>       <span class = "Header"> <wo:str value = "$center" /> </span>
>>>     </td>
>>>     <td class = "right">
>>>       <span class = "Header"> <wo:str value = "$right" /> </span>
>>>     </td>
>>>   </tr>
>>> </table>
>>> </div>
>>>
>>> au cas ou ca serait une question d'ordre de framework j'ai mis un snapshot ...
>>>
>>> This happens in a lot of other similar places but not all ! Can't figure out what they have in common
>>>
>>>
>>>
>>>
>>> Louis Demers eng.
>>> Vice-President, Co-Founder
>>> Obzerv Technologies Inc.
>>> 400 Jean Lesage, suite 201
>>> Quebec, QC, Canada
>>> G1K 8W1
>>> T    418.524.3522
>>> F    418.524.6745
>>> www.obzerv.com
>>>
>>>
>>>
>>> <Screen Shot 2012-09-21 at 10.09.52 .PDF>
>>>
>>>
>>> Louis Demers eng.
>>> www.obzerv.com
>>>
>>>
>>> _______________________________________________
>>> Do not post admin requests to the list. They will be ignored.
>>> Webobjects-dev mailing list      (email@hidden)
>>> Help/Unsubscribe/Update your Subscription:
>>>
>>> This email sent to email@hidden
>>
>> --
>> Chuck Hill             Senior Consultant / VP Development
>>
>> Practical WebObjects - for developers who want to increase their overall knowledge of WebObjects or who are trying to solve specific problems.
>> http://www.global-village.net/gvc/practical_webobjects
>>
>>
>>
>>
>>
>>
>>
>>
>
> Louis Demers eng.
> Vice-President, Co-Founder
> Obzerv Technologies Inc.
> 400 Jean Lesage, suite 201
> Quebec, QC, Canada
> G1K 8W1
> T    418.524.3522
> F    418.524.6745
> www.obzerv.com
>
>
>
>

--
Chuck Hill             Senior Consultant / VP Development

Practical WebObjects - for developers who want to increase their overall knowledge of WebObjects or who are trying to solve specific problems.
http://www.global-village.net/gvc/practical_webobjects









 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Inappropriate OGNL expression !
      • From: Ramsey Gurley <email@hidden>
References: 
 >Re: Inappropriate OGNL expression ! (From: Chuck Hill <email@hidden>)

  • Prev by Date: Re: Inappropriate OGNL expression !
  • Next by Date: Re: Inappropriate OGNL expression !
  • Previous by thread: Re: Inappropriate OGNL expression !
  • Next by thread: Re: Inappropriate OGNL expression !
  • Index(es):
    • Date
    • Thread