Buggy code:
public class ImageManager { private static volatile ImageManager mInstance ; public static final String TAG = ImageManager . class . getSimpleName ( ) ; private static final boolean DEBUG = false ; private static final boolean DEBUG_URL = false ; private static final int IMAGE_MANAGER_CALLBACK = 100 ; private static final int CONCURRENT_GET_IMAGE_TASK_COUNT = 2 ; private Context mContext ; private Stack < ImageManager . GetImageTask > mTaskStack = new Stack < ImageManager . GetImageTask > ( ) ; private ArrayList < ImageManager . GetImageTask > mRunningTask = new ArrayList < ImageManager . GetImageTask > ( ImageManager . CONCURRENT_GET_IMAGE_TASK_COUNT ) ; private ImageManager ( Context c ) { } public static String getHashString ( String input ) { String str = Base64 . encodeToString ( input . getBytes ( ) , URL_SAFE ) ; if ( str . contains ( "\n" ) ) <START_BUG> str = str . substring ( 0 , str . indexOf ( "\n" ) ) ; <END_BUG> return str ; } public static ImageManager getInstance ( Context c ) { } public static String getImageId ( String url , ImageAttribute attr ) { } public Bitmap getImage ( String url , ImageAttribute attr ) { } private void doneProcess ( String id , ImageAttribute attr , Bitmap bitmap ) { } private void getProcess ( String id , String url , ImageAttribute attr ) { } class GetImageTask extends AsyncTask < Void , Void , Bitmap > { private String mUrl ; private ImageAttribute mAttr ; private String mId ; private boolean mSkipUpdateView = false ; public GetImageTask ( String url , ImageAttribute attr ) { } public String getTaskImageId ( ) { } public void setSkipUpdateView ( ) { } @ Override protected Bitmap doInBackground ( Void ... params ) { } @ Override protected void onPostExecute ( Bitmap bitmap ) { } @ Override protected void onCancelled ( ) { } private void updateView ( Bitmap bitmap ) { } private void decreaseTask ( ) { } } private ImageManager . GetImageTask getNextTask ( ) { } private void checkNextTask ( ) { } private Bitmap getBitmapFromCache ( String cacheIndex ) { } private void setBitmapToCache ( Bitmap bitmap , String cacheIndex ) { } Handler mHandler = new Handler ( ) { public void handleMessage ( Message msg ) { } } ; private static ArrayList < ImageManager . ImageManagerCallback > mCallbackList ; public interface ImageManagerCallback { public void imageDone ( String id , Bitmap bitmap ) { } } protected void ImageManagerCallback ( Runnable callback ) { } protected Runnable onDoneCallback ( final String url , final Bitmap bitmap ) { } public void registerCallback ( ImageManager . ImageManagerCallback cb ) { } public void removeCallback ( ImageManager . ImageManagerCallback cb ) { } private static final int HARD_CACHE_CAPACITY = 10 ; private static final int DELAY_BEFORE_PURGE = 10 * 1000 ; private final HashMap < String , Bitmap > sHardBitmapCache = new LinkedHashMap < String , Bitmap > ( ( ( ImageManager . HARD_CACHE_CAPACITY ) // 2 ) , 0.75F , true ) { private static final long serialVersionUID = 8808576849847802011L ; @ Override protected boolean removeEldestEntry ( LinkedHashMap . Entry < String , Bitmap > eldest ) { } } ; private static final ConcurrentHashMap < String , SoftReference < Bitmap > > sSoftBitmapCache = new ConcurrentHashMap < String , SoftReference < Bitmap > > ( ( ( ImageManager . HARD_CACHE_CAPACITY ) // 2 ) ) ; private final Handler purgeHandler = new Handler ( ) ; private final Runnable purger = new Runnable ( ) { public void run ( ) { } } ; public void clearCache ( ) { } private void resetPurgeTimer ( ) { } public static class DownloadedDrawable extends BitmapDrawable { private final WeakReference < ImageManager . GetImageTask > bitmapGetImageTaskReference ; public DownloadedDrawable ( ImageManager . GetImageTask bitmapDownloaderTask , Bitmap bm ) { } public ImageManager . GetImageTask getTask ( ) { } } private static boolean removePotentialView ( String id , ImageAttribute attr ) { } private static ImageManager . GetImageTask getTask ( ImageView imageView ) { } }

Fix:
str = str . replace ( "\n" , "" ) ;