You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Benjamin Keil (JIRA)" <ji...@apache.org> on 2008/02/06 03:37:09 UTC

[jira] Created: (WICKET-1323) AbstractPageableView has transient cachedItemCount, but doesn't set it to -1 on deserialization.

AbstractPageableView has transient cachedItemCount, but doesn't set it to -1 on deserialization.
------------------------------------------------------------------------------------------------

                 Key: WICKET-1323
                 URL: https://issues.apache.org/jira/browse/WICKET-1323
             Project: Wicket
          Issue Type: Bug
          Components: wicket
    Affects Versions: 1.3.1
         Environment: Gentoo Linux / AMD64X2 / Java 6
            Reporter: Benjamin Keil


AbstractPageableView declares:

private transient int cachedItemCount;

When this is deserialized,  cachedItemCount gets set to 0.  This means that the method isItemCountCached() will return true on a deserialized AbstractPageableView.  This, in turn, causes getCurrentPage() to return 0, even when the user is not navigating the first page.

For me, this is causing huge problems with the paging navigator.

My current workaround is this is to add this method to my DataView implementation:

private Object readResolve() throws ObjectStreamException {
	final Class<?> myClass = getClass();
	final Class<?> dataView = myClass.getSuperclass();
	final Class<?> dataViewBase = dataView.getSuperclass();
	final Class<?> abstractPagableView = dataViewBase.getSuperclass();
	try {
		final Field field;
		field = abstractPagableView.getDeclaredField("cachedItemCount");
		field.setAccessible(true);
		field.setInt(this, -1);
	} catch (Exception e) {
		throw new RuntimeException(e);
	}
	return this;
}

Obviously it would be better if the AbstractPagingView could take care of this itself.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (WICKET-1323) AbstractPageableView has transient cachedItemCount, but doesn't set it to -1 on deserialization.

Posted by "Benjamin Keil (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-1323?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12566633#action_12566633 ] 

Benjamin Keil commented on WICKET-1323:
---------------------------------------

Awesome, thanks!

> AbstractPageableView has transient cachedItemCount, but doesn't set it to -1 on deserialization.
> ------------------------------------------------------------------------------------------------
>
>                 Key: WICKET-1323
>                 URL: https://issues.apache.org/jira/browse/WICKET-1323
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.3.1
>         Environment: Gentoo Linux / AMD64X2 / Java 6
>            Reporter: Benjamin Keil
>            Assignee: Johan Compagner
>             Fix For: 1.3.2
>
>
> AbstractPageableView declares:
> private transient int cachedItemCount;
> When this is deserialized,  cachedItemCount gets set to 0.  This means that the method isItemCountCached() will return true on a deserialized AbstractPageableView.  This, in turn, causes getCurrentPage() to return 0, even when the user is not navigating the first page.
> For me, this is causing huge problems with the paging navigator.
> My current workaround is this is to add this method to my DataView implementation:
> private Object readResolve() throws ObjectStreamException {
> 	final Class<?> myClass = getClass();
> 	final Class<?> dataView = myClass.getSuperclass();
> 	final Class<?> dataViewBase = dataView.getSuperclass();
> 	final Class<?> abstractPagableView = dataViewBase.getSuperclass();
> 	try {
> 		final Field field;
> 		field = abstractPagableView.getDeclaredField("cachedItemCount");
> 		field.setAccessible(true);
> 		field.setInt(this, -1);
> 	} catch (Exception e) {
> 		throw new RuntimeException(e);
> 	}
> 	return this;
> }
> Obviously it would be better if the AbstractPagingView could take care of this itself.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Closed: (WICKET-1323) AbstractPageableView has transient cachedItemCount, but doesn't set it to -1 on deserialization.

Posted by "Johan Compagner (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-1323?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Johan Compagner closed WICKET-1323.
-----------------------------------

       Resolution: Fixed
    Fix Version/s: 1.3.2
         Assignee: Johan Compagner

i added:
	private void readObject(java.io.ObjectInputStream s) throws java.io.IOException,
		ClassNotFoundException
	{
		// Read in all fields
		s.defaultReadObject();
		clearCachedItemCount();
	}

> AbstractPageableView has transient cachedItemCount, but doesn't set it to -1 on deserialization.
> ------------------------------------------------------------------------------------------------
>
>                 Key: WICKET-1323
>                 URL: https://issues.apache.org/jira/browse/WICKET-1323
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.3.1
>         Environment: Gentoo Linux / AMD64X2 / Java 6
>            Reporter: Benjamin Keil
>            Assignee: Johan Compagner
>             Fix For: 1.3.2
>
>
> AbstractPageableView declares:
> private transient int cachedItemCount;
> When this is deserialized,  cachedItemCount gets set to 0.  This means that the method isItemCountCached() will return true on a deserialized AbstractPageableView.  This, in turn, causes getCurrentPage() to return 0, even when the user is not navigating the first page.
> For me, this is causing huge problems with the paging navigator.
> My current workaround is this is to add this method to my DataView implementation:
> private Object readResolve() throws ObjectStreamException {
> 	final Class<?> myClass = getClass();
> 	final Class<?> dataView = myClass.getSuperclass();
> 	final Class<?> dataViewBase = dataView.getSuperclass();
> 	final Class<?> abstractPagableView = dataViewBase.getSuperclass();
> 	try {
> 		final Field field;
> 		field = abstractPagableView.getDeclaredField("cachedItemCount");
> 		field.setAccessible(true);
> 		field.setInt(this, -1);
> 	} catch (Exception e) {
> 		throw new RuntimeException(e);
> 	}
> 	return this;
> }
> Obviously it would be better if the AbstractPagingView could take care of this itself.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.