/[projects]/android/TrainInfoService/src/dk/thoerup/traininfoservice/RequestPlotter.java
ViewVC logotype

Diff of /android/TrainInfoService/src/dk/thoerup/traininfoservice/RequestPlotter.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1312 by torben, Tue Apr 19 16:39:07 2011 UTC revision 1317 by torben, Tue Apr 19 17:21:43 2011 UTC
# Line 78  public class RequestPlotter extends Http Line 78  public class RequestPlotter extends Http
78                          return empty;                          return empty;
79                  }                  }
80                                    
81                  int from = logFiles.length - (count);                  int from = (count>logFiles.length) ? 0 : logFiles.length - (count);
82                  int to = logFiles.length;                  int to = logFiles.length;
83                                                                    
84                  return Arrays.copyOfRange(logFiles, from, to);                    return Arrays.copyOfRange(logFiles, from, to);  
# Line 368  public class RequestPlotter extends Http Line 368  public class RequestPlotter extends Http
368                  return (p != 0);                  return (p != 0);
369          }          }
370    
371            int getCount(String param) {
372                    if (param == null || param.equals("")) {
373                            return 1;
374                    }
375                                    
376                    return Integer.parseInt(param);
377            }
378    
379            
380          @Override          @Override
381          protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {          protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
382                                    
383                                    
384                  int count = Integer.parseInt( req.getParameter("count") );                  int count = getCount( req.getParameter("count") );
385                                    
386                  if (count > 30) //limit to 30 days                  if (count > 30) //limit to 30 days
387                          count = 30;                          count = 30;

Legend:
Removed from v.1312  
changed lines
  Added in v.1317

  ViewVC Help
Powered by ViewVC 1.1.20