Re: strange NPE, really making me nervous

2012-10-15 Thread Thiago H de Paula Figueiredo
On Fri, 12 Oct 2012 01:01:36 -0300, Ken in Nashua wrote: Here is Home.JAVA snippet public class Home { /** * Component */ @Property private Class collectiontype; @Property private Integer itemsPerPage = new Integer("50"); Don't initialize fields in their dec

RE: strange NPE, really making me nervous

2012-10-12 Thread Ken in Nashua
Thanks Cezary... all good points to note. Sometimes I just like blabbin... Have a great weekend !

Re: strange NPE, really making me nervous

2012-10-12 Thread Cezary Biernacki
Java's garbage collector never sets any normal reference to null. It is a fundamental property of JVM. This sentence 'in this case the GC was a little late in erasing what was released across the request cycle' is not true. Your problem was not related to the garbage collector at all. 'colle

RE: strange NPE, really making me nervous

2012-10-12 Thread Ken in Nashua
yeah... the pointer to the collection wasnt null... it looked like a legitimate allocated collection with a hiberate entity in it. But as soon as i attempted to reference the collection in the event handler... boom... NPE a numega type bounds checker would flush something like this out by flood

RE: strange NPE, really making me nervous

2012-10-12 Thread bhorvat
hm...I am not sure what you are looking at with the debug, but the pointer to the collection should be null regardless of the objects actual state (whether or not it has been garbage collected). It is as everyone has described to you, once page is rendered everything is set to null and when you h

RE: strange NPE, really making me nervous

2012-10-12 Thread Ken in Nashua
Are you saying... that... I maintain a collection on a single initial rendering... I get away with it by loading my collection in setuprender... this works fine and I can see my hibernate entity on my display after the gallery is rendered. On a subsequent event (lastPage)... your claim is that

RE: strange NPE, really making me nervous

2012-10-12 Thread Lance Java
As Cezary said, there are two requests involved in this exception. 1. Request to draw the page initially 2. Request to fire the "lastPage" event Tapestry does NOT maintain state between Request 1 and Request 2 (unless you explicitly tell it to via @Persist). In this case, you should not use @Pers

RE: strange NPE, really making me nervous

2012-10-12 Thread Ken in Nashua
if it means anything here is the last stack trace... but it looks the same 127.0.0.1 - - [12/Oct/2012:15:17:56 +] "GET /tynamo/blob/adminlayout/1/header HTTP/1.1" 200 223753 "http://localhost:8080/Home"; "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:15.0) Gecko/20100101 Firefox/15.0.1" [INFO]

RE: strange NPE, really making me nervous

2012-10-12 Thread Ken in Nashua
Well i got rid of Integer usage with this variable itemsPerPage within the page and component as well as any initializations and modeled initialization in the setuprender Gallery.JAVA @SetupRender public void setupRender() { itemsPerPage = 50; try {

Re: strange NPE, really making me nervous

2012-10-12 Thread Cezary Biernacki
It does not matter that you it is loaded in setupRender(). Rending events happen only during page rendering. Your exception happens during a separate HTTP request for event handling (see request URL in your logs). Such events do not trigger page rendering in Tapestry 5. So setupRender() is not exec

RE: strange NPE, really making me nervous

2012-10-12 Thread Ken in Nashua
Guys, I appreciate the help... is it possible collection is getting clobbered in between somewhere the event ? I mean I walked thru debugger and logged a statement too and saw with my eyes that collection is loaded and allocated and established in @SetupRender public void setupRender()

Re: strange NPE, really making me nervous

2012-10-12 Thread Cezary Biernacki
On Fri, Oct 12, 2012 at 4:01 PM, Ken in Nashua wrote: > > Thanks Cezary, > > collection is an allocated collection housing a single hibernate entity. > my login page comes up > i get authenticated > it launches the Home.ml and Layout.tml > and my Gallery.tml gets rendered for the very first time

RE: strange NPE, really making me nervous

2012-10-12 Thread Lance Java
NB. When you fire an event on a component, the component rendering lifecycle is NOT fired. Anything configured in setupRender() and beginRender() etc will be null (unless using @Persist). Only your @Parameter values will be populated. You may need to have a common method that you call in setupRende

RE: strange NPE, really making me nervous

2012-10-12 Thread Ken in Nashua
Thanks Cezary, collection is an allocated collection housing a single hibernate entity. my login page comes up i get authenticated it launches the Home.ml and Layout.tml and my Gallery.tml gets rendered for the very first time I can see the hibernate entity on the screen... the photo is rendered

Re: strange NPE, really making me nervous

2012-10-12 Thread Cezary Biernacki
Ah, OK. Missed that. However by judging source code from other emails, it is clear that @Parameter for itemsPerPage was used in 'Galery' component, not on Home.java. But I guess it is to be confused by incomplete examples. Best regards, Cezary On Fri, Oct 12, 2012 at 2:42 PM, Robert Zeigler wrot

Re: strange NPE, really making me nervous

2012-10-12 Thread Robert Zeigler
On Oct 12, 2012, at 10/126:33 AM , Cezary Biernacki wrote: > On Fri, Oct 12, 2012 at 6:29 AM, Robert Zeigler > wrote: > >> Since itemsPerPage is a property of a page, the @Parameter bit won't work. >> > > That is not true. @Property just adds get and setter, and @Parameter can be > a property.

Re: strange NPE, really making me nervous

2012-10-12 Thread Cezary Biernacki
Hi, Have you really confirmed that collection is not null? E.g. by actually debugging that code or putting a logging statement? I strongly believe it is null, because you set it only on SetupRender event, and rendering events when page is not rendered. Cezary

Re: strange NPE, really making me nervous

2012-10-12 Thread Cezary Biernacki
On Fri, Oct 12, 2012 at 6:29 AM, Robert Zeigler wrote: > Since itemsPerPage is a property of a page, the @Parameter bit won't work. > That is not true. @Property just adds get and setter, and @Parameter can be a property. Tapestry standard components often have parameters that are also propertie

RE: strange NPE, really making me nervous

2012-10-11 Thread Ken in Nashua
i commented out the whole contents of the handler... and it ran ok... so it has to do with the variable itemsPerPage hoping it will thresh out tomorrow... or today have to get some sleep... ciao

RE: strange NPE, really making me nervous

2012-10-11 Thread Ken in Nashua
here is the latest... a component event exception is being triggered to the HOME.TML so for some reason HOME.TML or HOME.JAVA is not able to handle this somehow. An unexpected application exception has occurred.org.apache.tapestry5.ioc.internal.OperationExceptionlocationcontext:Home.tml, line

RE: strange NPE, really making me nervous

2012-10-11 Thread Ken in Nashua
Ok here is my actual GALLERY template and code... dont get too lost... its still in-play... and messy trust me I am a clean guy... and hopin this will be cleaned up soon http://www.w3.org/TR/html4/strict.dtd";> http://tapestry.apache.org/schema/tapestry_5_0_0.xsd"; xmlns:p="tapestry:parameter"

RE: strange NPE, really making me nervous

2012-10-11 Thread Ken in Nashua
Here is my HOME template and java http://tapestry.apache.org/schema/tapestry_5_0_0.xsd"; xmlns:p="tapestry:parameter"> ${message:org.hibernatesecurity.welcome}

RE: strange NPE, really making me nervous

2012-10-11 Thread Ken in Nashua
Thanks for tryin guys... the initialization attempts had no effect 127.0.0.1 - - [12/Oct/2012:04:45:35 +] "GET /assets/1.0-SNAPSHOT-1350017091525/tynamo-0.3.0/themes/tapestryskin/breadcrumbs.jpg HTTP/1.1" 200 349 "http://localhost:8080/assets/1.0-SNAPSHOT-1350017091525/tynamo-0.3.0/them

RE: strange NPE, really making me nervous

2012-10-11 Thread Ken in Nashua
Thanks Bob... i will try your solution... hold on

RE: strange NPE, really making me nervous

2012-10-11 Thread Ken in Nashua
yeah... it didnt work @Property @Parameter(value="50", required = false, cache = false) private Integer itemsPerPage; I kept the integer type because in theory I shouldn't have to change it. I can post the code in a bit... let me take another pass here... 127.0.0.1 - - [12/Oct/2

RE: strange NPE, really making me nervous

2012-10-11 Thread Ken in Nashua
thanks Cezary... I will try that right now... and if it fails code listings will be better submitted. be right back

Re: strange NPE, really making me nervous

2012-10-11 Thread Robert Zeigler
Since itemsPerPage is a property of a page, the @Parameter bit won't work. Instead, try: @Property private int itemsPerPage void setupRender() { itemsPerPage=50; } Robert On Oct 11, 2012, at 10/:25 PM , Cezary Biernacki wrote: > You are giving us incomplete examples, so we can only guess

Re: strange NPE, really making me nervous

2012-10-11 Thread Cezary Biernacki
You are giving us incomplete examples, so we can only guess. However my suspicion is that your declaration of default value itemsPerPage is bad. Tapestry 5 does not like initialisation of private fields in components and pages. Try: @Parameter(value="50", required = false, cache = false) p

RE: strange NPE, really making me nervous

2012-10-11 Thread Ken in Nashua
thanks czar yeah collestion is absolutely size = 1 and has a hibernate entity in it In my Gallery.JAVA I tried the following... removed @Property on itemsPerPage and added public Integer getItemsPerPage() { return itemsPerPage; } and invoked it directly instead of attempting

RE: strange NPE, really making me nervous

2012-10-11 Thread Ken in Nashua
Here is Home.JAVA snippet public class Home { /** * Component */ @Property private Class collectiontype; @Property private Integer itemsPerPage = new Integer("50"); I am trying to figure out why there is a NPE with this itemsPerPage its just a property in Home.*

Re: strange NPE, really making me nervous

2012-10-11 Thread Cezary Biernacki
Hi, are you sure that 'collection' is not null? Best regards, Cezary On Fri, Oct 12, 2012 at 5:27 AM, Ken in Nashua wrote: > > Folks, > > I am scratching my head about this code which generally was ok in T4... > things seem fine but when i enter this handler BOOM > > My usage of the Math.min(.