Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle two continuous START TEXT TAG by throwing Error #96

Merged
merged 5 commits into from
Jun 20, 2017

Conversation

rtgdk
Copy link
Contributor

@rtgdk rtgdk commented Jun 16, 2017

  • HandBuiltParser is also not giving error when two START_TEXT are encountered one after the other without the END_TEXT.
  • It ignores the second START_TEXT and take the END_TEXT for the first START_TEXT

Signed-off-by: rtgdk rohit.lodhartg@gmail.com

	* HandBuiltParser is also not giving error when two START_TEXT
		are encountered one after the other without the END_TEXT.
	* It ignores the second START_TEXT and take the END_TEXT
		for the first START_TEXT

Signed-off-by: rtgdk <rohit.lodhartg@gmail.com>
@rtgdk
Copy link
Contributor Author

rtgdk commented Jun 16, 2017

This PR will be for identifying the line no. of the error tag/value document.
The changes made will handle the case when two <text> tags are present simultaneously without any </text> in between. This will result in proper error line no.
Previously, it used to skip the second <text> tag and take </text> for the first <text> tag.

@rtgdk
Copy link
Contributor Author

rtgdk commented Jun 16, 2017

From this, we can get the correct line and character position where the START_TEXT is starting which can be passed in the error itself. I'll commit that code soon.

@goneall
Copy link
Member

goneall commented Jun 16, 2017

If we break the loop, we will get an exception unterminated text block. I think it may be better to just throw an exception with a message " found within a block" - this would make the error clearer

rtgdk added 2 commits June 18, 2017 23:31
…TEXT correctly

	* DataInputStream is no longer useful. Change Handbuilterparser type
	* If END_TEXT and START_TEXT are in the same line, NOCommentInpurStream was not able to identify it.

Signed-off-by: rtgdk <rohit.lodhartg@gmail.com>
	* Add a new String ArrayList to store the lines of the file.
	* Add a method to return the index of a line.
	* Add a InputStream Constructor for HandBuiltParser to handle Test Java files.

Signed-off-by: rtgdk <rohit.lodhartg@gmail.com>
@rtgdk
Copy link
Contributor Author

rtgdk commented Jun 18, 2017

I have added a method to retrieve the line no. of the error by storing every line of the file in an ArrayList.
As an alternative, we could also pass the original file to HandBuiltParser for searching only when error occurs.
Also, I had to add the InputStream constructor for HandBuilParser as some tests were failing.( TestBuildDocument )

rtgdk added 2 commits June 19, 2017 00:36
Signed-off-by: rtgdk <rohit.lodhartg@gmail.com>
Signed-off-by: rtgdk <rohit.lodhartg@gmail.com>
@goneall goneall merged commit 5f16b25 into spdx:master Jun 20, 2017
@goneall
Copy link
Member

goneall commented Jun 20, 2017

I fixed the unit test failure. The failure was due to an invalid type cast. Changing the type cast to instantiating a new NoCommentInputStream with the previous input stream as a constructor parameter fixed the problem. @rtgdk in the future, please run the unit tests before creating the pull requests

@rtgdk
Copy link
Contributor Author

rtgdk commented Jun 20, 2017

Thanks. Will keep that in mind. 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants