You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucenenet.apache.org by sy...@apache.org on 2014/06/01 05:15:14 UTC
git commit: We can't remove the IOException catch blocks completely
Repository: lucenenet
Updated Branches:
refs/heads/master ac8c9fa80 -> 41ebbc2de
We can't remove the IOException catch blocks completely
Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/41ebbc2d
Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/41ebbc2d
Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/41ebbc2d
Branch: refs/heads/master
Commit: 41ebbc2de5227b14a225d6d1576beaba2811f40b
Parents: ac8c9fa
Author: Itamar Syn-Hershko <it...@code972.com>
Authored: Sun Jun 1 06:15:12 2014 +0300
Committer: Itamar Syn-Hershko <it...@code972.com>
Committed: Sun Jun 1 06:15:12 2014 +0300
----------------------------------------------------------------------
src/core/QueryParser/QueryParserTokenManager.cs | 241 ++++++++++++-------
1 file changed, 150 insertions(+), 91 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/41ebbc2d/src/core/QueryParser/QueryParserTokenManager.cs
----------------------------------------------------------------------
diff --git a/src/core/QueryParser/QueryParserTokenManager.cs b/src/core/QueryParser/QueryParserTokenManager.cs
index 17583d2..ec09c8e 100644
--- a/src/core/QueryParser/QueryParserTokenManager.cs
+++ b/src/core/QueryParser/QueryParserTokenManager.cs
@@ -18,6 +18,7 @@
/* Generated By:JavaCC: Do not edit this line. QueryParserTokenManager.java */
using System;
+using System.IO;
namespace Lucene.Net.QueryParsers
{
@@ -102,14 +103,19 @@ namespace Lucene.Net.QueryParsers
jjmatchedKind = kind;
jjmatchedPos = pos;
- var nextCharacter = input_stream.ReadChar();
-
- if (nextCharacter == Char.MinValue)
- {
- return pos + 1;
- }
-
- curChar = nextCharacter;
+ try
+ {
+ var nextCharacter = input_stream.ReadChar();
+ if (nextCharacter == Char.MinValue)
+ {
+ return pos + 1;
+ }
+ curChar = nextCharacter;
+ }
+ catch (IOException)
+ {
+ return pos + 1;
+ }
return JjMoveNfa_3(state, pos + 1);
}
@@ -604,14 +610,19 @@ namespace Lucene.Net.QueryParsers
if ((i = jjnewStateCnt) == (startsAt = 36 - (jjnewStateCnt = startsAt)))
return curPos;
- var nextCharacter = input_stream.ReadChar();
-
- if (nextCharacter == Char.MinValue)
- {
- return curPos;
- }
-
- curChar = nextCharacter;
+ try
+ {
+ var nextCharacter = input_stream.ReadChar();
+ if (nextCharacter == Char.MinValue)
+ {
+ return curPos;
+ }
+ curChar = nextCharacter;
+ }
+ catch (IOException)
+ {
+ return curPos;
+ }
}
}
private int JjStopStringLiteralDfa_1(int pos, long active0)
@@ -654,15 +665,21 @@ namespace Lucene.Net.QueryParsers
}
private int JjMoveStringLiteralDfa1_1(long active0)
{
- var nextCharacter = input_stream.ReadChar();
-
- if (nextCharacter == Char.MinValue)
- {
- JjStopStringLiteralDfa_1(0, active0);
+ try
+ {
+ var nextCharacter = input_stream.ReadChar();
+ if (nextCharacter == Char.MinValue)
+ {
+ JjStopStringLiteralDfa_1(0, active0);
+ return 1;
+ }
+ curChar = nextCharacter;
+ }
+ catch (IOException)
+ {
+ JjStopStringLiteralDfa_1(0, active0);
return 1;
- }
-
- curChar = nextCharacter;
+ }
switch (curChar)
{
@@ -683,14 +700,20 @@ namespace Lucene.Net.QueryParsers
jjmatchedKind = kind;
jjmatchedPos = pos;
- var nextCharacter = input_stream.ReadChar();
-
- if (nextCharacter == Char.MinValue)
- {
- return pos + 1;
- }
+ try
+ {
+ var nextCharacter = input_stream.ReadChar();
+ if (nextCharacter == Char.MinValue)
+ {
+ return pos + 1;
+ }
+ curChar = nextCharacter;
+ }
+ catch (IOException)
+ {
+ return pos + 1;
+ }
- curChar = nextCharacter;
return JjMoveNfa_1(state, pos + 1);
}
@@ -850,14 +873,19 @@ namespace Lucene.Net.QueryParsers
if ((i = jjnewStateCnt) == (startsAt = 7 - (jjnewStateCnt = startsAt)))
return curPos;
- var nextCharacter = input_stream.ReadChar();
-
- if (nextCharacter == Char.MinValue)
- {
- return curPos;
- }
-
- curChar = nextCharacter;
+ try
+ {
+ var nextCharacter = input_stream.ReadChar();
+ if (nextCharacter == Char.MinValue)
+ {
+ return curPos;
+ }
+ curChar = nextCharacter;
+ }
+ catch (IOException)
+ {
+ return curPos;
+ }
}
}
private int JjMoveStringLiteralDfa0_0()
@@ -952,14 +980,19 @@ namespace Lucene.Net.QueryParsers
if ((i = jjnewStateCnt) == (startsAt = 3 - (jjnewStateCnt = startsAt)))
return curPos;
- var nextCharacter = input_stream.ReadChar();
-
- if (nextCharacter != Char.MinValue)
- {
- return curPos;
- }
-
- curChar = nextCharacter;
+ try
+ {
+ var nextCharacter = input_stream.ReadChar();
+ if (nextCharacter != Char.MinValue)
+ {
+ return curPos;
+ }
+ curChar = nextCharacter;
+ }
+ catch (IOException)
+ {
+ return curPos;
+ }
}
}
private int JjStopStringLiteralDfa_2(int pos, long active0)
@@ -1002,15 +1035,21 @@ namespace Lucene.Net.QueryParsers
}
private int JjMoveStringLiteralDfa1_2(long active0)
{
- var nextCharacter = input_stream.ReadChar();
-
- if (nextCharacter == Char.MinValue)
- {
- JjStopStringLiteralDfa_2(0, active0);
- return 1;
- }
-
- curChar = nextCharacter;
+ try
+ {
+ var nextCharacter = input_stream.ReadChar();
+ if (nextCharacter == Char.MinValue)
+ {
+ JjStopStringLiteralDfa_2(0, active0);
+ return 1;
+ }
+ curChar = nextCharacter;
+ }
+ catch (IOException)
+ {
+ JjStopStringLiteralDfa_2(0, active0);
+ return 1;
+ }
switch (curChar)
{
@@ -1031,14 +1070,19 @@ namespace Lucene.Net.QueryParsers
jjmatchedKind = kind;
jjmatchedPos = pos;
- var nextCharacter = input_stream.ReadChar();
-
- if (nextCharacter == Char.MinValue)
- {
- return pos + 1;
- }
-
- curChar = nextCharacter;
+ try
+ {
+ var nextCharacter = input_stream.ReadChar();
+ if (nextCharacter == Char.MinValue)
+ {
+ return pos + 1;
+ }
+ curChar = nextCharacter;
+ }
+ catch (IOException)
+ {
+ return pos + 1;
+ }
return JjMoveNfa_2(state, pos + 1);
}
@@ -1198,14 +1242,19 @@ namespace Lucene.Net.QueryParsers
if ((i = jjnewStateCnt) == (startsAt = 7 - (jjnewStateCnt = startsAt)))
return curPos;
- var nextCharacter = input_stream.ReadChar();
-
- if (nextCharacter == Char.MinValue)
- {
- return curPos;
- }
-
- curChar = nextCharacter;
+ try
+ {
+ var nextCharacter = input_stream.ReadChar();
+ if (nextCharacter == Char.MinValue)
+ {
+ return curPos;
+ }
+ curChar = nextCharacter;
+ }
+ catch (IOException)
+ {
+ return curPos;
+ }
}
}
internal static readonly int[] jjnextStates = new int[]{15, 16, 18, 29, 32, 23, 33, 30, 20, 21, 32, 23, 33, 31, 34, 27, 2, 4, 5, 0, 1};
@@ -1416,26 +1465,36 @@ namespace Lucene.Net.QueryParsers
System.String error_after = null;
bool EOFSeen = false;
- var nextCharacter2 = input_stream.ReadChar();
-
- if (nextCharacter2 == Char.MinValue)
- {
- EOFSeen = true;
- error_after = curPos <= 1 ? "" : input_stream.Image;
- if (curChar == '\n' || curChar == '\r')
- {
- error_line++;
- error_column = 0;
- }
- else
- error_column++;
- }
- else
- {
- input_stream.Backup(1);
- }
+ bool read = false;
+ try
+ {
+ var nextChar = input_stream.ReadChar();
+ if (nextChar != Char.MinValue)
+ {
+ input_stream.Backup(1);
+ }
+ else
+ {
+ EOFSeen = true;
+ }
+ }
+ catch (IOException)
+ {
+ EOFSeen = true;
+ }
- if (!EOFSeen)
+ if (EOFSeen)
+ {
+ error_after = curPos <= 1 ? "" : input_stream.Image;
+ if (curChar == '\n' || curChar == '\r')
+ {
+ error_line++;
+ error_column = 0;
+ }
+ else
+ error_column++;
+ }
+ else
{
input_stream.Backup(1);
error_after = curPos <= 1?"":input_stream.Image;