taylor      2004/06/25 15:23:21

  Modified:    applications/demo/src/java/org/apache/jetspeed/demo/simple
                        PickANumberServlet.java
  Log:
  don't allow 0 as a valid guess number
  
  CVS: ----------------------------------------------------------------------
  CVS: PR:
  CVS:   If this change addresses a PR in the problem report tracking
  CVS:   database, then enter the PR number(s) here.
  CVS: Obtained from:
  CVS:   If this change has been taken from another system, such as NCSA,
  CVS:   then name the system in this line, otherwise delete it.
  CVS: Submitted by:
  CVS:   If this code has been contributed to Apache by someone else; i.e.,
  CVS:   they sent us a patch or a new module, then include their name/email
  CVS:   address here. If this is your work then delete this line.
  CVS: Reviewed by:
  CVS:   If we are doing pre-commit code reviews and someone else has
  CVS:   reviewed your changes, include their name(s) here.
  CVS:   If you have not had it reviewed then delete this line.
  
  Revision  Changes    Path
  1.6       +7 -2      
jakarta-jetspeed-2/applications/demo/src/java/org/apache/jetspeed/demo/simple/PickANumberServlet.java
  
  Index: PickANumberServlet.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jetspeed-2/applications/demo/src/java/org/apache/jetspeed/demo/simple/PickANumberServlet.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- PickANumberServlet.java   25 Jun 2004 07:20:58 -0000      1.5
  +++ PickANumberServlet.java   25 Jun 2004 22:23:20 -0000      1.6
  @@ -196,7 +196,12 @@
           }
           if (targetValue == null)
           {
  -            targetValue = new Long(Math.round(Math.random() * 
getHighRange(request)));
  +            long random = (Math.round(Math.random() * getHighRange(request)));
  +            if (random == 0)
  +            {
  +                random = 1; // don;t allow 0
  +            }
  +            targetValue = new Long(random);
               System.out.println("cheater: target value = " + targetValue);
               guessCount = new Long(0);
               session.setAttribute( TARGET_VALUE_NAME, targetValue, 
PortletSession.APPLICATION_SCOPE);
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to