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

Reading Error response properly in AndroidClientHandler #180

Merged
merged 2 commits into from
Aug 26, 2016

Conversation

smstuebe
Copy link
Contributor

@smstuebe smstuebe commented Aug 20, 2016

  • Removed java flame comments.
  • try to read ErrorStream if error occurred

Response Handling
HttpURLConnection will follow up to five HTTP redirects. It will follow redirects from one origin server to another. This implementation doesn't follow redirects from HTTPS to HTTP or vice versa.
If the HTTP response indicates that an error occurred, getInputStream() will throw an IOException. Use getErrorStream() to read the error response.

https://developer.android.com/reference/java/net/HttpURLConnection.html#getErrorStream()

Sorry for not updating / writing test. Could not build the test project.

@monojenkins
Copy link

Hello! I'm the build bot for the Mono project.

I need approval from a Mono team member to build this pull request. A team member should reply with "approve" to approve a build of this pull request, "whitelist" to whitelist this and all future pull requests from this contributor, or "build" to explicitly request a build, even if one has already been done.

Contributors can ignore this message.

@dnfclas
Copy link

dnfclas commented Aug 20, 2016

Hi @smstuebe, I'm your friendly neighborhood .NET Foundation Pull Request Bot (You can call me DNFBOT). Thanks for your contribution!

This seems like a small (but important) contribution, so no Contribution License Agreement is required at this point. Real humans will now evaluate your PR.

TTYL, DNFBOT;

@jonpryor
Copy link
Member

@grendello?

// We should return the body of the response too but, alas, the Java client will throw
// a, wait for it, FileNotFound exception if we attempt to access the input stream. So
// no body, just a dummy. Java FTW!
ret.Content = new StringContent ("Unauthorized", Encoding.ASCII);
Copy link
Contributor

Choose a reason for hiding this comment

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

There's no reason to remove the entire section of the comment. If you think that wording here is indeed inflammatory, please rephrase as there's actual information here.

@grendello
Copy link
Contributor

Commented inline

@smstuebe
Copy link
Contributor Author

done. Better?

@jonpryor
Copy link
Member

build

1 similar comment
@jonpryor
Copy link
Member

build

@jonpryor jonpryor merged commit 5a4d965 into dotnet:master Aug 26, 2016
@martinwiboe
Copy link

This problem seems to still occur on the latest Stable release of Xamarin.Android (7.0.1.2). When we read the Content property, an empty StringContent is returned. Are the changes in this PR part of the latest stable release?

@roubachof
Copy link

@martinwiboe I can see the commit in the cycle 9 branch: https://github.com/xamarin/xamarin-android/blob/cycle9/src/Mono.Android/Xamarin.Android.Net/AndroidClientHandler.cs

It's not in the cycle8-sr0, but it could be in cycle8 SR1 or 2, but we can only speculate since there are no branches for these releases.

@djdmbrwsk
Copy link

I can confirm that this fix is in Xamarin.Android 7.1.0.30. Which is (at least currently) available in the Beta channel.

radical pushed a commit that referenced this pull request May 8, 2018
Windows machines do not include Java in their path by default, so it is
a better experience to not require it for the build.

Changes:

  - `JdkInfo.props` will export `$(JavaCPath)` and `$(JarPath)`
  - We can customize `$(JavaCPath)` and `$(JarPath)` as needed on Windows
  - `jdk.mk` generates these values as `javac` and `jar` for existing
    platforms

What will need to happen downstream in Xamarin.Android:

  - `Configuration.OperatingSystem.props` and `JdkInfo.props` will set
    `$(JavaCPath)` and `$(JarPath)` for Windows
  - Changes to `PrepareWindows.targets` will be needed
  - Cleaned up `JNIEnvGenPath` and places that hardcoded `Configuration`
jonpryor added a commit to jonpryor/xamarin-android that referenced this pull request Aug 24, 2022
Changes: TODO Java.Interop

Changes: dotnet/android-tools@9c641b3...7cfe683

  * dotnet/android-tools@7cfe683: [ci] Use Microsoft.SourceLink.GitHub (dotnet#192)
  * dotnet/android-tools@01a0dde: [Localization] Import translated resx files (dotnet#189)
  * dotnet/android-tools@cc715d9: [Xamarin.Android.Tools.AndroidSdk] Permit NDK r25 (dotnet#190)
  * dotnet/android-tools@3c55e9a: Avoid `Environment.SpecialFolder.ApplicationData` (dotnet#188)
  * dotnet/android-tools@0d55472: LEGO: Merge pull request 187
  * dotnet/android-tools@6946512: Juno: check in to juno/hb_befb220e-87ce-47e9-a9e6-10ea592b2337_20220729154833425. (dotnet#186)
  * dotnet/android-tools@6e3433a: Juno: check in to juno/hb_befb220e-87ce-47e9-a9e6-10ea592b2337_20220729025332507. (dotnet#185)
  * dotnet/android-tools@73c4388: [Xamarin.Android.Tools.AndroidSdk] Update SDK component for API-33 (dotnet#184)
  * dotnet/android-tools@da3653e: [Xamarin.Android.Tools.AndroidSdk] Add API-33 to KnownVersions
  * dotnet/android-tools@327d433: [ci] Run OneLocBuild on a schedule (dotnet#180)
  * dotnet/android-tools@8ab60e4: [ci] Use latest macOS and Windows images (dotnet#181)
  * dotnet/android-tools@4dd3292: LEGO: Merge pull request 182
  * dotnet/android-tools@56b61f1: [Localization] Add OneLocBuild job (dotnet#175)
  * dotnet/android-tools@14076a6: [Xamarin.Android.Tools.AndroidSdk] Add API-32 to KnownVersions
jonpryor pushed a commit that referenced this pull request Aug 26, 2022
…7309)

Changes: mono/mono.posix@e1269a5...d8994ca

  * mono/mono.posix@d8994ca: Remove Windows support completely for now

    Fixes an issue in which Mono.Unix would try to resolve `libc`
    P/Invokes by looking for the `msvcrt` library on Unix machines.

  * mono/mono.posix@74d504f: Fix yaml template path
  * mono/mono.posix@127cf9e: [build] Don't rebuild managed code on packaging time on Windows

Changes: dotnet/android-libzipsharp@2.0.4...2.0.7

  * dotnet/android-libzipsharp@98e9173: Bump version to 2.0.7
  * dotnet/android-libzipsharp@6e1e1b3: Localized file check-in by OneLocBuild Task: Build definition ID 11678: Build ID 6581869 (#119)
  * dotnet/android-libzipsharp@1c05430: LEGO: Merge pull request 118
  * dotnet/android-libzipsharp@06d44d8: Localized file check-in by OneLocBuild Task: Build definition ID 11678: Build ID 6570668 (#117)
  * dotnet/android-libzipsharp@37f3894: LEGO: Merge pull request 116
  * dotnet/android-libzipsharp@6c0edc5: Update libzip and zlib submodules (#115)
  * dotnet/android-libzipsharp@acd9a54: [Localization] Switch from xlf to resx files  (#112)
  * dotnet/android-libzipsharp@3cece80: LEGO: Merge pull request 114
  * dotnet/android-libzipsharp@fe336b4: LEGO: Merge pull request 113
  * dotnet/android-libzipsharp@9aee99a: [Localization] Add OneLocBuild job (#111)
  * dotnet/android-libzipsharp@bdfa9f8: Bump Mono.Unix to 7.1.0-final.1.21458.1 (#110)

Changes: xamarin/monodroid@210073e...100ccf9

  * xamarin/monodroid@100ccf969: Bump to xamarin/androidtools@81486ab, xamarin/android-sdk-installer@8cac7ea (#1264)

Changes: dotnet/android-tools@9c641b3...29f11f2

  * dotnet/android-tools@29f11f2 Bump to mono/mono.posix@d8994ca, dotnet/android-libzipsharp@98e9173 (#193)
  * dotnet/android-tools@7cfe683 [ci] Use Microsoft.SourceLink.GitHub (#192)
  * dotnet/android-tools@01a0dde [Localization] Import translated resx files (#189)
  * dotnet/android-tools@cc715d9 [Xamarin.Android.Tools.AndroidSdk] Permit NDK r25 (#190)
  * dotnet/android-tools@3c55e9a Avoid `Environment.SpecialFolder.ApplicationData` (#188)
  * dotnet/android-tools@0d55472 LEGO: Merge pull request 187
  * dotnet/android-tools@6946512 Juno: check in to juno/hb_befb220e-87ce-47e9-a9e6-10ea592b2337_20220729154833425. (#186)
  * dotnet/android-tools@6e3433a Juno: check in to juno/hb_befb220e-87ce-47e9-a9e6-10ea592b2337_20220729025332507. (#185)
  * dotnet/android-tools@73c4388 [Xamarin.Android.Tools.AndroidSdk] Update SDK component for API-33 (#184)
  * dotnet/android-tools@da3653e [Xamarin.Android.Tools.AndroidSdk] Add API-33 to KnownVersions
  * dotnet/android-tools@327d433 [ci] Run OneLocBuild on a schedule (#180)
  * dotnet/android-tools@8ab60e4 [ci] Use latest macOS and Windows images (#181)
  * dotnet/android-tools@4dd3292 LEGO: Merge pull request 182
  * dotnet/android-tools@56b61f1 [Localization] Add OneLocBuild job (#175)
  * dotnet/android-tools@14076a6 [Xamarin.Android.Tools.AndroidSdk] Add API-32 to KnownVersions
@github-actions github-actions bot locked and limited conversation to collaborators Feb 6, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants