Author: knopp
Date: Mon Jul  9 16:31:08 2007
New Revision: 554790

URL: http://svn.apache.org/viewvc?view=rev&rev=554790
Log:
Null check

Modified:
    
incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/pagestore/DiskPageStore.java

Modified: 
incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/pagestore/DiskPageStore.java
URL: 
http://svn.apache.org/viewvc/incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/pagestore/DiskPageStore.java?view=diff&rev=554790&r1=554789&r2=554790
==============================================================================
--- 
incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/pagestore/DiskPageStore.java
 (original)
+++ 
incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/pagestore/DiskPageStore.java
 Mon Jul  9 16:31:08 2007
@@ -115,29 +115,32 @@
                 */
                public synchronized void savePage(SerializedPage page)
                {
-                       PageMapEntry entry = 
getPageMapEntry(page.getPageMapName(), true);
-                       PageWindow window = 
entry.manager.savePage(page.getPageId(), page.getVersionNumber(),
-                                       page.getAjaxVersionNumber(), 
page.getData().length);
-                       pageMapEntryList.remove(entry);
-                       pageMapEntryList.add(entry);
-
-                       while (getTotalSize() > getMaxSizePerSession() && 
pageMapEntryList.size() > 1)
+                       if (page.getData() != null)
                        {
-                               
removePageMapEntry((PageMapEntry)pageMapEntryList.get(0));
-                       }
-
-                       FileChannel channel = 
fileChannelPool.getFileChannel(entry.fileName, true);
-                       try
-                       {
-                               channel.write(ByteBuffer.wrap(page.getData()), 
window.getFilePartOffset());
-                       }
-                       catch (IOException e)
-                       {
-                               log.error("Error writing to a channel " + 
channel, e);
-                       }
-                       finally
-                       {
-                               fileChannelPool.returnFileChannel(channel);
+                               PageMapEntry entry = 
getPageMapEntry(page.getPageMapName(), true);
+                               PageWindow window = 
entry.manager.savePage(page.getPageId(), page.getVersionNumber(),
+                                               page.getAjaxVersionNumber(), 
page.getData().length);
+                               pageMapEntryList.remove(entry);
+                               pageMapEntryList.add(entry);
+       
+                               while (getTotalSize() > getMaxSizePerSession() 
&& pageMapEntryList.size() > 1)
+                               {
+                                       
removePageMapEntry((PageMapEntry)pageMapEntryList.get(0));
+                               }
+       
+                               FileChannel channel = 
fileChannelPool.getFileChannel(entry.fileName, true);
+                               try
+                               {
+                                       
channel.write(ByteBuffer.wrap(page.getData()), window.getFilePartOffset());
+                               }
+                               catch (IOException e)
+                               {
+                                       log.error("Error writing to a channel " 
+ channel, e);
+                               }
+                               finally
+                               {
+                                       
fileChannelPool.returnFileChannel(channel);
+                               }
                        }
                }
 


Reply via email to