lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From synhers...@apache.org
Subject [58/59] git commit: Fixing demo app, closes #8 on github
Date Tue, 22 Apr 2014 02:53:30 GMT
Fixing demo app, closes #8 on github


Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/4d414070
Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/4d414070
Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/4d414070

Branch: refs/heads/master
Commit: 4d4140707f581e04e05160cb3c876f55550370a1
Parents: 6953376
Author: synhershko <itamar@code972.com>
Authored: Tue Apr 22 04:23:39 2014 +0300
Committer: synhershko <itamar@code972.com>
Committed: Tue Apr 22 04:23:39 2014 +0300

----------------------------------------------------------------------
 src/demo/SearchFiles/SearchFiles.cs | 19 ++++++++++++++-----
 1 file changed, 14 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/4d414070/src/demo/SearchFiles/SearchFiles.cs
----------------------------------------------------------------------
diff --git a/src/demo/SearchFiles/SearchFiles.cs b/src/demo/SearchFiles/SearchFiles.cs
index a1b806b..80b62f8 100644
--- a/src/demo/SearchFiles/SearchFiles.cs
+++ b/src/demo/SearchFiles/SearchFiles.cs
@@ -348,15 +348,24 @@ namespace Lucene.Net.Demo
                         }
                         else
                         {
-                            int page = Int32.Parse(line);
-                            if ((page - 1) * hitsPerPage < numTotalHits)
+                            int page;
+                            if (Int32.TryParse(line, out page))
                             {
-                                start = (page - 1) * hitsPerPage;
-                                break;
+                                if ((page - 1)*hitsPerPage < numTotalHits)
+                                {
+                                    start = (page - 1)*hitsPerPage;
+                                    break;
+                                }
+                                else
+                                {
+                                    Console.Out.WriteLine("No such page");
+                                }
                             }
                             else
                             {
-                                Console.Out.WriteLine("No such page");
+                                Console.Out.WriteLine("Unrecognized page number. Quitting.");
+                                quit = true;
+                                break;
                             }
                         }
                     }


Mime
View raw message