File tree Expand file tree Collapse file tree 1 file changed +4
-12
lines changed
app/src/main/java/com/samsung/microbit/utils Expand file tree Collapse file tree 1 file changed +4
-12
lines changed Original file line number Diff line number Diff line change @@ -226,12 +226,8 @@ public static byte[] readBytesFromFile( File file) {
226
226
byte [] bytes = null ;
227
227
try {
228
228
long size = file .length ();
229
- if ( size > Integer .MAX_VALUE ) {
230
- Log .e ( TAG , "readBytesFromFile too big" );
231
- return null ;
232
- }
233
- if ( size <= 0 ) {
234
- Log .e ( TAG , "readBytesFromFile size unknown" );
229
+ if ( size <= 0 || size > Integer .MAX_VALUE ) {
230
+ Log .e ( TAG , "readBytesFromFile error - size" );
235
231
return null ;
236
232
}
237
233
FileInputStream is = new FileInputStream ( file );
@@ -249,12 +245,8 @@ public static byte[] readBytesFromUri( Uri uri, Context ctx) {
249
245
byte [] bytes = null ;
250
246
try {
251
247
long size = fileSizeFromUri ( uri , ctx );
252
- if ( size > Integer .MAX_VALUE ) {
253
- Log .e ( TAG , "readBytesFromUri too big" );
254
- return null ;
255
- }
256
- if ( size <= 0 ) {
257
- Log .e ( TAG , "readBytesFromUri size unknown" );
248
+ if ( size <= 0 || size > Integer .MAX_VALUE ) {
249
+ Log .e ( TAG , "readBytesFromUri error - size" );
258
250
return null ;
259
251
}
260
252
InputStream is = ctx .getContentResolver ().openInputStream ( uri );
You can’t perform that action at this time.
0 commit comments