Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
cadb264d
Unverified
Commit
cadb264d
authored
Jul 13, 2022
by
Christopher Fujino
Committed by
GitHub
Jul 13, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[flutter_tools] Catch more general XmlException rather than XmlParserException (#107574)
parent
b26346f2
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
20 additions
and
10 deletions
+20
-10
application_package.dart
...es/flutter_tools/lib/src/android/application_package.dart
+1
-1
deferred_components_gen_snapshot_validator.dart
...c/android/deferred_components_gen_snapshot_validator.dart
+1
-1
deferred_components_prebuild_validator.dart
...b/src/android/deferred_components_prebuild_validator.dart
+1
-1
gradle.dart
packages/flutter_tools/lib/src/android/gradle.dart
+1
-1
multidex.dart
packages/flutter_tools/lib/src/android/multidex.dart
+1
-3
project.dart
packages/flutter_tools/lib/src/project.dart
+1
-1
project_test.dart
packages/flutter_tools/test/general.shard/project_test.dart
+14
-2
No files found.
packages/flutter_tools/lib/src/android/application_package.dart
View file @
cadb264d
...
...
@@ -139,7 +139,7 @@ class AndroidApk extends ApplicationPackage implements PrebuiltApplicationPackag
XmlDocument
document
;
try
{
document
=
XmlDocument
.
parse
(
manifestString
);
}
on
Xml
Parser
Exception
catch
(
exception
)
{
}
on
XmlException
catch
(
exception
)
{
String
manifestLocation
;
if
(
androidProject
.
isUsingGradle
)
{
manifestLocation
=
fileSystem
.
path
.
join
(
androidProject
.
hostAppGradleRoot
.
path
,
'app'
,
'src'
,
'main'
,
'AndroidManifest.xml'
);
...
...
packages/flutter_tools/lib/src/android/deferred_components_gen_snapshot_validator.dart
View file @
cadb264d
...
...
@@ -84,7 +84,7 @@ class DeferredComponentsGenSnapshotValidator extends DeferredComponentsValidator
XmlDocument
document
;
try
{
document
=
XmlDocument
.
parse
(
appManifestFile
.
readAsStringSync
());
}
on
Xml
Parser
Exception
{
}
on
XmlException
{
invalidFiles
[
appManifestFile
.
path
]
=
'Error parsing
$appManifestFile
'
'Please ensure that the android manifest is a valid XML document and '
'try again.'
;
...
...
packages/flutter_tools/lib/src/android/deferred_components_prebuild_validator.dart
View file @
cadb264d
...
...
@@ -136,7 +136,7 @@ class DeferredComponentsPrebuildValidator extends DeferredComponentsValidator {
XmlDocument
document
;
try
{
document
=
XmlDocument
.
parse
(
stringRes
.
readAsStringSync
());
}
on
Xml
Parser
Exception
{
}
on
XmlException
{
invalidFiles
[
stringRes
.
path
]
=
'Error parsing
$stringRes
'
'Please ensure that the strings.xml is a valid XML document and '
'try again.'
;
...
...
packages/flutter_tools/lib/src/android/gradle.dart
View file @
cadb264d
...
...
@@ -958,7 +958,7 @@ String _getLocalArtifactVersion(String pomPath, FileSystem fileSystem) {
XmlDocument document;
try {
document = XmlDocument.parse(pomFile.readAsStringSync());
} on Xml
Parser
Exception {
} on XmlException {
throwToolExit(
'
Error
parsing
$pomPath
.
Please
ensure
that
this
is
a
valid
XML
document
.
'
);
...
...
packages/flutter_tools/lib/src/android/multidex.dart
View file @
cadb264d
...
...
@@ -93,9 +93,7 @@ bool androidManifestHasNameVariable(final Directory projectDir) {
XmlDocument document;
try {
document = XmlDocument.parse(manifestFile.readAsStringSync());
} on XmlParserException {
return false;
} on XmlTagException {
} on XmlException {
return false;
} on FileSystemException {
return false;
...
...
packages/flutter_tools/lib/src/project.dart
View file @
cadb264d
...
...
@@ -647,7 +647,7 @@ The detected reason was:
XmlDocument
document
;
try
{
document
=
XmlDocument
.
parse
(
appManifestFile
.
readAsStringSync
());
}
on
Xml
Parser
Exception
{
}
on
XmlException
{
throwToolExit
(
'Error parsing
$appManifestFile
'
'Please ensure that the android manifest is a valid XML document and try again.'
);
}
on
FileSystemException
{
...
...
packages/flutter_tools/test/general.shard/project_test.dart
View file @
cadb264d
...
...
@@ -188,6 +188,16 @@ void main() {
await
project
.
regeneratePlatformSpecificTooling
();
expectExists
(
project
.
android
.
hostAppGradleRoot
.
childFile
(
'local.properties'
));
});
_testInMemory
(
'checkForDeprecation fails on invalid android app manifest file'
,
()
async
{
// This is not a valid Xml document
const
String
invalidManifest
=
'<manifest></application>'
;
final
FlutterProject
project
=
await
someProject
(
androidManifestOverride:
invalidManifest
);
expect
(
()
=>
project
.
checkForDeprecation
(
deprecationBehavior:
DeprecationBehavior
.
ignore
),
throwsToolExit
(
message:
'Please ensure that the android manifest is a valid XML document and try again.'
),
);
});
_testInMemory
(
'Android project not on v2 embedding shows a warning'
,
()
async
{
final
FlutterProject
project
=
await
someProject
();
// The default someProject with an empty <manifest> already indicates
...
...
@@ -769,7 +779,9 @@ apply plugin: 'kotlin-android'
});
}
Future
<
FlutterProject
>
someProject
()
async
{
Future
<
FlutterProject
>
someProject
({
String
androidManifestOverride
,
})
async
{
final
Directory
directory
=
globals
.
fs
.
directory
(
'some_project'
);
directory
.
childDirectory
(
'.dart_tool'
)
.
childFile
(
'package_config.json'
)
...
...
@@ -781,7 +793,7 @@ Future<FlutterProject> someProject() async {
..
createSync
(
recursive:
true
);
androidDirectory
.
childFile
(
'AndroidManifest.xml'
)
.
writeAsStringSync
(
'<manifest></manifest>'
);
.
writeAsStringSync
(
androidManifestOverride
??
'<manifest></manifest>'
);
return
FlutterProject
.
fromDirectory
(
directory
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment