Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
appinventor-sources
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
xpstem
appinventor-sources
Commits
ec35256e
Commit
ec35256e
authored
Jan 15, 2020
by
Evan W. Patton
Committed by
Jeffrey Schiller
Jan 16, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix potential resource leak in JsonUtil
Change-Id: I222d4df3a05ef7ab0f431d2b53ec65a0c008c38a
parent
cb5e005a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
2 deletions
+4
-2
appinventor/components/src/com/google/appinventor/components/runtime/util/JsonUtil.java
.../google/appinventor/components/runtime/util/JsonUtil.java
+4
-2
No files found.
appinventor/components/src/com/google/appinventor/components/runtime/util/JsonUtil.java
View file @
ec35256e
...
...
@@ -296,6 +296,7 @@ public class JsonUtil {
* @return the name of the created file
*/
private
static
String
writeFile
(
String
input
,
String
fileExtension
)
{
FileOutputStream
outStream
=
null
;
try
{
if
(
fileExtension
.
length
()
!=
3
&&
fileExtension
.
length
()
!=
4
)
{
throw
new
YailRuntimeError
(
"File Extension must be three or four characters"
,
"Write Error"
);
...
...
@@ -305,14 +306,15 @@ public class JsonUtil {
File
destDirectory
=
new
File
(
fullDirName
);
destDirectory
.
mkdirs
();
File
dest
=
File
.
createTempFile
(
"BinFile"
,
"."
+
fileExtension
,
destDirectory
);
FileOutputStream
outStream
=
new
FileOutputStream
(
dest
);
outStream
=
new
FileOutputStream
(
dest
);
outStream
.
write
(
content
);
outStream
.
close
();
String
retval
=
dest
.
toURI
().
toASCIIString
();
trimDirectory
(
20
,
destDirectory
);
return
retval
;
}
catch
(
Exception
e
)
{
throw
new
YailRuntimeError
(
e
.
getMessage
(),
"Write"
);
}
finally
{
IOUtils
.
closeQuietly
(
LOG_TAG
,
outStream
);
}
}
...
...
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