Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
J
jadx
Project
Project
Details
Activity
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
open-source
jadx
Commits
778b9bb8
Commit
778b9bb8
authored
Oct 24, 2018
by
Skylot
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: resolve lint errors in resource save methods
parent
57dd9e61
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
15 deletions
+15
-15
ResContainer.java
jadx-core/src/main/java/jadx/core/xmlgen/ResContainer.java
+5
-6
ResourcesSaver.java
jadx-core/src/main/java/jadx/core/xmlgen/ResourcesSaver.java
+10
-9
No files found.
jadx-core/src/main/java/jadx/core/xmlgen/ResContainer.java
View file @
778b9bb8
...
...
@@ -5,7 +5,6 @@ import java.awt.image.BufferedImage;
import
java.io.ByteArrayInputStream
;
import
java.io.ByteArrayOutputStream
;
import
java.io.File
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.util.ArrayList
;
import
java.util.Collections
;
...
...
@@ -66,14 +65,14 @@ public class ResContainer implements Comparable<ResContainer> {
}
return
resContainer
;
}
public
static
ResContainer
singleBinaryFile
(
String
name
,
InputStream
content
)
{
ResContainer
resContainer
=
new
ResContainer
(
name
,
Collections
.
emptyList
());
try
{
// TODO: don't store binary files in memory
resContainer
.
binary
=
new
ByteArrayInputStream
(
IOUtils
.
toByteArray
(
content
));
}
catch
(
IOException
e
)
{
LOG
.
warn
(
"Contents of the binary resource '{}' not saved, got exception {}"
,
name
,
e
);
}
catch
(
Exception
e
)
{
LOG
.
warn
(
"Contents of the binary resource '{}' not saved, got exception"
,
name
,
e
);
}
return
resContainer
;
}
...
...
@@ -94,7 +93,7 @@ public class ResContainer implements Comparable<ResContainer> {
public
CodeWriter
getContent
()
{
return
content
;
}
@Nullable
public
InputStream
getBinary
()
{
return
binary
;
...
...
jadx-core/src/main/java/jadx/core/xmlgen/ResourcesSaver.java
View file @
778b9bb8
...
...
@@ -15,6 +15,7 @@ import org.slf4j.LoggerFactory;
import
jadx.api.ResourceFile
;
import
jadx.core.codegen.CodeWriter
;
import
jadx.core.utils.files.FileUtils
;
import
jadx.core.utils.files.ZipSecurity
;
import
static
jadx
.
core
.
utils
.
files
.
FileUtils
.
prepareFile
;
...
...
@@ -89,16 +90,16 @@ public class ResourcesSaver implements Runnable {
return
;
}
InputStream
binary
=
rc
.
getBinary
();
if
(
binary
!=
null
)
{
if
(
binary
!=
null
)
{
try
{
outFile
.
getParentFile
().
mkdirs
(
);
FileOutputStream
binaryFileStream
=
new
FileOutputStream
(
outFile
);
IOUtils
.
copy
(
binary
,
binaryFileStream
);
binaryFileStream
.
close
();
binary
.
close
();
}
catch
(
IO
Exception
e
)
{
LOG
.
warn
(
"Resource '{}' not saved, got exception
{}
"
,
rc
.
getName
(),
e
);
FileUtils
.
makeDirsForFile
(
outFile
);
try
(
FileOutputStream
binaryFileStream
=
new
FileOutputStream
(
outFile
))
{
IOUtils
.
copy
(
binary
,
binaryFileStream
);
}
finally
{
binary
.
close
();
}
}
catch
(
Exception
e
)
{
LOG
.
warn
(
"Resource '{}' not saved, got exception"
,
rc
.
getName
(),
e
);
}
return
;
}
...
...
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