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
70e70ebb
Unverified
Commit
70e70ebb
authored
Dec 01, 2020
by
Jonah Williams
Committed by
GitHub
Dec 01, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[flutter_tools] Catch all exception subtypes when unzipping a file (#70967)
parent
2f567c39
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
21 deletions
+6
-21
cache.dart
packages/flutter_tools/lib/src/cache.dart
+2
-10
artifact_updater_test.dart
...utter_tools/test/general.shard/artifact_updater_test.dart
+4
-11
No files found.
packages/flutter_tools/lib/src/cache.dart
View file @
70e70ebb
...
...
@@ -4,7 +4,6 @@
import
'dart:async'
;
import
'package:archive/archive.dart'
;
import
'package:crypto/crypto.dart'
;
import
'package:file/memory.dart'
;
import
'package:meta/meta.dart'
;
...
...
@@ -15,7 +14,7 @@ import 'android/gradle_utils.dart';
import
'base/common.dart'
;
import
'base/error_handling_io.dart'
;
import
'base/file_system.dart'
;
import
'base/io.dart'
show
HttpClient
,
HttpClientRequest
,
HttpClientResponse
,
HttpHeaders
,
HttpStatus
,
ProcessException
,
SocketException
;
import
'base/io.dart'
show
HttpClient
,
HttpClientRequest
,
HttpClientResponse
,
HttpHeaders
,
HttpStatus
,
SocketException
;
import
'base/logger.dart'
;
import
'base/net.dart'
;
import
'base/os.dart'
show
OperatingSystemUtils
;
...
...
@@ -1792,14 +1791,7 @@ class ArtifactUpdater {
try
{
extractor
(
tempFile
,
location
);
}
on
ProcessException
{
retries
-=
1
;
if
(
retries
==
0
)
{
rethrow
;
}
_deleteIgnoringErrors
(
tempFile
);
continue
;
}
on
ArchiveException
{
}
on
Exception
{
retries
-=
1
;
if
(
retries
==
0
)
{
rethrow
;
...
...
packages/flutter_tools/test/general.shard/artifact_updater_test.dart
View file @
70e70ebb
...
...
@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import
'package:archive/archive.dart'
;
import
'package:file/memory.dart'
;
import
'package:file/src/interface/file.dart'
;
import
'package:file_testing/file_testing.dart'
;
...
...
@@ -314,7 +313,7 @@ void main() {
'test message'
,
Uri
.
parse
(
'http:///test.zip'
),
fileSystem
.
currentDirectory
.
childDirectory
(
'out'
),
),
throwsA
(
isA
<
Process
Exception
>()));
),
throwsA
(
isA
<
Exception
>()));
expect
(
fileSystem
.
file
(
'te,[/test'
),
isNot
(
exists
));
expect
(
fileSystem
.
file
(
'out/test'
),
isNot
(
exists
));
});
...
...
@@ -338,7 +337,7 @@ void main() {
'test message'
,
Uri
.
parse
(
'http:///test.zip'
),
fileSystem
.
currentDirectory
.
childDirectory
(
'out'
),
),
throwsA
(
isA
<
Archive
Exception
>()));
),
throwsA
(
isA
<
Exception
>()));
expect
(
fileSystem
.
file
(
'te,[/test'
),
isNot
(
exists
));
expect
(
fileSystem
.
file
(
'out/test'
),
isNot
(
exists
));
});
...
...
@@ -401,10 +400,7 @@ class MockOperatingSystemUtils extends Mock implements OperatingSystemUtils {
void
unzip
(
File
file
,
Directory
targetDirectory
)
{
if
(
failures
>
0
)
{
failures
-=
1
;
if
(
windows
)
{
throw
ArchiveException
(
'zip'
);
}
throw
const
ProcessException
(
'zip'
,
<
String
>[],
'Failed to unzip'
);
throw
Exception
();
}
targetDirectory
.
childFile
(
file
.
fileSystem
.
path
.
basenameWithoutExtension
(
file
.
path
))
.
createSync
();
...
...
@@ -414,10 +410,7 @@ class MockOperatingSystemUtils extends Mock implements OperatingSystemUtils {
void
unpack
(
File
gzippedTarFile
,
Directory
targetDirectory
)
{
if
(
failures
>
0
)
{
failures
-=
1
;
if
(
windows
)
{
throw
ArchiveException
(
'zip'
);
}
throw
const
ProcessException
(
'zip'
,
<
String
>[],
'Failed to unzip'
);
throw
Exception
();
}
targetDirectory
.
childFile
(
gzippedTarFile
.
fileSystem
.
path
.
basenameWithoutExtension
(
gzippedTarFile
.
path
))
.
createSync
();
...
...
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