Buggy code:
public class ImageServlet extends HttpServlet implements Constants { private static final long serialVersionUID = - 4142816720756238591L ; private static final Logger LOGGER = LoggerFactory . getLogger ( ImageServlet . class ) ; private static final ObjectMapper MAPPER = new ObjectMapper ( ) ; private static final String RESOLVE_METADATA_QUERY = "?url_ver=Z39.88-2004&rft_id={}&svc_id=info:lanl-repo//svc//getMetadata" ; private static final String RESOLVE_IMAGE_QUERY = "?url_ver=Z39.88-2004&rft_id={}" + ( ( "&svc_id=info:lanl-repo//svc//getRegion" + "&svc_val_fmt=info:ofi//fmt:kev:mtx:jpeg2000" ) + "&svc.format={}&svc.level={}&svc.rotate={}&svc.region={}" ) ; private static final String RESOLVE_REGION_QUERY = "?url_ver=Z39.88-2004&rft_id={}" + ( ( "&svc_id=info:lanl-repo//svc//getRegion" + "&svc_val_fmt=info:ofi//fmt:kev:mtx:jpeg2000" ) + "&svc.format={}&svc.region={}&svc.scale={}&svc.rotate={}" ) ; private static final String XML_TEMPLATE = "//WEB-INF//metadata.xml" ; private static final int TILE_SIZE = 256 ; private static final int TILE_LOG2 = ImageServlet . log2 ( ImageServlet . TILE_SIZE ) ; private static PairtreeRoot tileCache = null ; private static String internalServer = null ; private static String contextPath = null ; private static String resolverPath = null ; private static Map < String , int [ ] > recentHWL = null ; private static final int HWL_CACHE_SIZE = 500 ; @ Override protected void doGet ( final HttpServletRequest aRequest , final HttpServletResponse aResponse ) throws IOException , ServletException { } private static int log2 ( int n ) { } @ Override public void init ( ) throws ServletException { } @ Override protected long getLastModified ( final HttpServletRequest aRequest ) { } private int [ ] getHeightWidthAndLevels ( final String id , final HttpServletRequest aRequest , final HttpServletResponse aResponse ) throws IOException , ServletException { } private void checkImageCache ( final String aID , final String aLevel , final String aRegion , final String aScale , final float aRotation , final HttpServletRequest aRequest , final HttpServletResponse aResponse ) throws IOException , ServletException { } private void serveNewImage ( final String aID , final String aLevel , final String aRegion , final String aScale , final float aRotation , final HttpServletRequest aRequest , final HttpServletResponse aResponse ) throws IOException , ServletException { final String safeID = URLEncode . pathSafetyEncode ( aID ) ; RequestDispatcher dispatcher ; String [ ] values ; String url ; <START_BUG> if ( aScale == null ) { <END_BUG> values = new String [ ] { safeID , DEFAULT_VIEW_FORMAT , aLevel , Integer . toString ( ( ( int ) ( aRotation ) ) ) , aRegion } ; url = ( ImageServlet . resolverPath ) + ( StringUtils . format ( ImageServlet . RESOLVE_IMAGE_QUERY , values ) ) ; } else { if ( ImageServlet . LOGGER . isDebugEnabled ( ) ) { ImageServlet . LOGGER . debug ( "Denied<seq2seq4repair_space>image<seq2seq4repair_space>requested<seq2seq4repair_space>with<seq2seq4repair_space>no<seq2seq4repair_space>level<seq2seq4repair_space>specified:<seq2seq4repair_space>id={}<seq2seq4repair_space>region={}" , aID , aRegion ) ; } aResponse . sendError ( SC_NOT_IMPLEMENTED , "level<seq2seq4repair_space>required" ) ; return ; } dispatcher = aRequest . getRequestDispatcher ( url ) ; if ( ImageServlet . LOGGER . isDebugEnabled ( ) ) { ImageServlet . LOGGER . debug ( "Image<seq2seq4repair_space>requested:<seq2seq4repair_space>{}<seq2seq4repair_space>-<seq2seq4repair_space>{}" , aID , url ) ; } dispatcher . forward ( aRequest , aResponse ) ; } private void cacheNewImage ( final HttpServletRequest aRequest , final String aKey , final File aDestFile ) { } private static String getServer ( final HttpServletRequest aRequest ) { } private class LruCache < K , V > extends LinkedHashMap < K , V > { private final int maxEntries ; public LruCache ( final int maxEntries ) { } @ Override protected boolean removeEldestEntry ( final Map . Entry < K , V > eldest ) { } } }

Fix:
if ( ( aLevel != null ) && ( aLevel != "" ) ) {