Wrap dart:convert to track utf8 decode failures#26650
Merged
Merged
Conversation
Contributor
Author
|
cc @Hixie |
zanderso
reviewed
Jan 25, 2019
| runCommand(device.adbCommandForDevice(args)).then<void>((Process process) { | ||
| _process = process; | ||
| const Utf8Decoder decoder = Utf8Decoder(allowMalformed: true); | ||
| // Previously this line specified allowMalformed: true. |
Member
There was a problem hiding this comment.
Avoid "history of the code" comments. Maybe explain why reportErrors is true, instead.
| process.stdin.write('n\n'); | ||
| final Future<void> output = process.stdout | ||
| .transform<String>(const Utf8Decoder(allowMalformed: true)) | ||
| // Previously this line specified allowMalformed: true. |
| @@ -0,0 +1,47 @@ | |||
| // Copyright 2018 The Chromium Authors. All rights reserved. | |||
| // Use of this source code is governed by a BSD-style license that can be | ||
| // found in the LICENSE file. | ||
|
|
||
| import 'dart:convert' hide utf8; |
Member
There was a problem hiding this comment.
Neat! Maybe add a comment here explaining what this does.
zanderso
approved these changes
Jan 25, 2019
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Creates a tools specific implementation of Utf8Decoder that allows malformed utf8 and then checks for \u{FFFD}. If that is encountered, an error is thrown with more context.
Adds an unauthorized imports test to cover the flutter_tools lib directory.
#15646