Error uploading file by stream

Hi everyone.
I’m using Backendless.Files.uploadFromStream function and often get error BackendlessException{ code: ‘500’, message: ‘null’ }.
Her is inner response from connection.getErrorStream() in com.backendless.Files class
response = "Internal server error with id 2304D8B2-1484-B90F-FF06-01E71C02B700 "
Here is my upload code:

public class CompressedImageFileOutputStreamRouter extends IOutputStreamRouter {
 private final File mFile;
 private final int mMaxSize;
 private final Bitmap.CompressFormat mCompressFormat;
 private final int mQuality;
 public CompressedImageFileOutputStreamRouter(final File file, final int maxSize, final Bitmap.CompressFormat compressFormat, final int quality) {
 mFile = file;
 mMaxSize = maxSize;
 mCompressFormat = compressFormat;
 mQuality = quality;
 public void writeStream(final int i) throws IOException {
 final BitmapFactory.Options options = new BitmapFactory.Options();
 options.inSampleSize = createSampleSizeForImageSizes(mFile.getAbsolutePath(), mMaxSize, options);
 boolean doCompressWork;
 Bitmap bitmap = null;
 do {
 //noinspection ErrorNotRethrown
 try {
 bitmap = BitmapFactory.decodeFile(mFile.getAbsolutePath(), options);
 doCompressWork = false;
 } catch (final OutOfMemoryError ignored) {
 options.inSampleSize *= 2;
 doCompressWork = true;
 } while (doCompressWork);
 if (null == bitmap) {
 throw new IOException("can't create image from file! ignore!");
 if (bitmap.getWidth() > mMaxSize || bitmap.getHeight() > mMaxSize) {
 bitmap = generateScaledBitmap(bitmap, mMaxSize);
 final BufferedOutputStream bufferedOutputStream = new BufferedOutputStream(getOutputStream(), i);
 bitmap.compress(mCompressFormat, mQuality, bufferedOutputStream);
 bitmap.compress(mCompressFormat, mQuality, getOutputStream());
 private static Bitmap generateScaledBitmap(final Bitmap bitmap, final int maxSize) {
 final float scale = Math.min(1f * maxSize / bitmap.getWidth(), 1f * maxSize / bitmap.getHeight());
 try {
 return Bitmap.createScaledBitmap(bitmap, Math.round(bitmap.getWidth() * scale), Math.round(bitmap.getHeight() * scale), true);
 } finally {
 private static int createSampleSizeForImageSizes(final String filePath, final int maxSize, final BitmapFactory.Options options) {
 options.inJustDecodeBounds = true;
 BitmapFactory.decodeFile(filePath, options);
 final float sampleSize = Math.max(1f * options.outWidth / maxSize, 1f * options.outHeight / maxSize);
 options.inJustDecodeBounds = false;
 return Math.round(sampleSize);

final String fileName = // todo;
final BackendlessFile backendlessFile =
 .uploadFromStream(new CompressedImageFileOutputStreamRouter(file, IMAGE_MAX_SIZE, Bitmap.CompressFormat.JPEG, 80), fileName,
 filePath, true);
return backendlessFile.getFileURL();

I was not able to locate the internal error you referenced. Could you please try running it again and let me know if you get an error (post the error ID).


Thanks for reply.
All this days I was trying to reproduce this issue, but with no success.

This issue reproduced very often on May 11-13. Any way now this is gone. I will reopen it if I will be able to reproduce it again.