Author: toad
Date: 2006-11-10 19:17:11 +0000 (Fri, 10 Nov 2006)
New Revision: 10860

Modified:
   trunk/freenet/src/freenet/clients/http/WelcomeToadlet.java
Log:
trivial refactoring in FIN handler

Modified: trunk/freenet/src/freenet/clients/http/WelcomeToadlet.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/WelcomeToadlet.java  2006-11-10 
19:04:27 UTC (rev 10859)
+++ trunk/freenet/src/freenet/clients/http/WelcomeToadlet.java  2006-11-10 
19:17:11 UTC (rev 10860)
@@ -187,31 +187,32 @@
                        // innitialindex
                        // sender
                        // subject
-                               FrostBoard board = null;
-                               
if(request.isPartSet("boardprivatekey")&&request.isPartSet("boardpublickey")) 
// keyed board
-                               {
-                                       board = new FrostBoard(
-                                                       
request.getPartAsString("boardname",FrostBoard.MAX_NAME_LENGTH),
-                                                       
request.getPartAsString("boardprivatekey",78),
-                                                       
request.getPartAsString("boardpublickey",78));
+                       String boardName = 
request.getPartAsString("boardname",FrostBoard.MAX_NAME_LENGTH);
+                       String boardPrivateKey = 
request.getPartAsString("boardprivatekey",78);
+                       String boardPublicKey = 
request.getPartAsString("boardpublickey",78);
+                       String sender = request.getPartAsString("sender",64);
+                       String subject = request.getPartAsString("subject",128);
+                       String filename = 
request.getPartAsString("filename",1024);
+                       
+                       int innitialIndex = 0;
+                       if(request.isPartSet("innitialindex"))
+                       {
+                               try {
+                                       innitialIndex = 
Integer.parseInt(request.getPartAsString("innitialindex",3));
                                }
-                               else // unkeyed or public board
+                               catch(NumberFormatException e)
                                {
-                                       board = new 
FrostBoard(request.getPartAsString("boardname",FrostBoard.MAX_NAME_LENGTH));
+                                       innitialIndex = 0;
                                }
-                               FrostMessage fin = new FrostMessage("news", 
board, request.getPartAsString("sender",64), 
request.getPartAsString("subject",128), 
request.getPartAsString("filename",1024));
-                               
-                               int innitialIndex = 0;
-                               if(request.isPartSet("innitialindex"))
-                               {
-                                       try {
-                                               innitialIndex = 
Integer.parseInt(request.getPartAsString("innitialindex",3));
-                                       }
-                                       catch(NumberFormatException e)
-                                       {
-                                               innitialIndex = 0;
-                                       }
+                       }
+                       
+                               FrostBoard board = null;
+                               if(boardPrivateKey.length()>0 && 
boardPublicKey.length()>0) { // keyed board
+                                       board = new FrostBoard(boardName, 
boardPrivateKey, boardPublicKey);
+                               } else { // unkeyed or public board
+                                       board = new FrostBoard(boardName);
                                }
+                               FrostMessage fin = new FrostMessage("news", 
board, sender, subject, filename);

                                HTMLNode pageNode = 
ctx.getPageMaker().getPageNode("Insertion");
                                HTMLNode contentNode = 
ctx.getPageMaker().getContentNode(pageNode);


Reply via email to