Skip to content

Conversation

@jonpryor
Copy link
Contributor

@jonpryor jonpryor commented Aug 1, 2018

Fixes: #39

The release file contained within the
Microsoft OpenJDK Distribution Preview contains an entry which
broke the release parser within JdkInfo, an entry which doesn't
contain double quotes around the value:

BUILD_NUMBER=9

This causes an exception to be thrown when JdkInfo attempts to parse
the release file:

System.ArgumentOutOfRangeException : Length cannot be less than zero.
Parameter name: length
  at System.String.Substring (System.Int32 startIndex, System.Int32 length) [0x0004a] in <7e59c4ad7b424f9eab0db1b78ec1804f>:0
  at Xamarin.Android.Tools.JdkInfo.GetReleaseProperties () [0x0006b] in <3975ab851981476abded14492926b261>:0
  at Xamarin.Android.Tools.JdkInfo..ctor (System.String homePath) [0x00159] in <3975ab851981476abded14492926b261>:0

Update JdkInfo.GetReleaseProperties() so that the double-quotes
around values are optional and not required, so that this release
file may be processed without throwing an exception.

Copy link
Contributor

@bratsche bratsche left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

}
string key = line.Substring (0, delim);
string value = line.Substring (delim + PropertyDelim.Length, line.Length - delim - PropertyDelim.Length - 1);
string value = line.Substring (delim + PropertyDelim.Length);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should consider any other weirdness that could happen when parsing this text?

Maybe a call to Trim () for the original key and value? Such as:

KEY_A = 1234 
KEY_B = "Some text here"

Fixes: dotnet#39

The `release` file contained within the
[Microsoft OpenJDK Distribution Preview][0] contains an entry which
broke the `release` parser within `JdkInfo`, an entry which doesn't
contain double quotes around the value:

	BUILD_NUMBER=9

This causes an exception to be thrown when `JdkInfo` attempts to parse
the `release` file:

	System.ArgumentOutOfRangeException : Length cannot be less than zero.
	Parameter name: length
	  at System.String.Substring (System.Int32 startIndex, System.Int32 length) [0x0004a] in <7e59c4ad7b424f9eab0db1b78ec1804f>:0
	  at Xamarin.Android.Tools.JdkInfo.GetReleaseProperties () [0x0006b] in <3975ab851981476abded14492926b261>:0
	  at Xamarin.Android.Tools.JdkInfo..ctor (System.String homePath) [0x00159] in <3975ab851981476abded14492926b261>:0

Update `JdkInfo.GetReleaseProperties()` so that the double-quotes
around values are *optional* and not required, so that this `release`
file may be processed without throwing an exception.

[0]: https://dl.xamarin.com/OpenJDK/mac/microsoft-dist-openjdk-1.8.0.9.zip
@jonpryor jonpryor force-pushed the jonp-release-parsing branch from ee90ba2 to e13a92a Compare August 1, 2018 20:45
@jonpryor jonpryor merged commit 917d3b3 into dotnet:master Aug 1, 2018
jonpryor added a commit that referenced this pull request Aug 2, 2018
Fixes: #39

The `release` file contained within the
[Microsoft OpenJDK Distribution Preview][0] contains an entry which
broke the `release` parser within `JdkInfo`, an entry which doesn't
contain double quotes around the value:

	BUILD_NUMBER=9

This causes an exception to be thrown when `JdkInfo` attempts to parse
the `release` file:

	System.ArgumentOutOfRangeException : Length cannot be less than zero.
	Parameter name: length
	  at System.String.Substring (System.Int32 startIndex, System.Int32 length) [0x0004a] in <7e59c4ad7b424f9eab0db1b78ec1804f>:0
	  at Xamarin.Android.Tools.JdkInfo.GetReleaseProperties () [0x0006b] in <3975ab851981476abded14492926b261>:0
	  at Xamarin.Android.Tools.JdkInfo..ctor (System.String homePath) [0x00159] in <3975ab851981476abded14492926b261>:0

Update `JdkInfo.GetReleaseProperties()` so that the double-quotes
around values are *optional* and not required, so that this `release`
file may be processed without throwing an exception.

[0]: https://dl.xamarin.com/OpenJDK/mac/microsoft-dist-openjdk-1.8.0.9.zip
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.

3 participants