api_dev/src/main/java/com/google/appengine/api/images/dev/LocalBlobImageServlet.java [83:126]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException {
    try {
      OutputStream out = resp.getOutputStream();
      try {
        ParsedUrl parsedUrl = ParsedUrl.createParsedUrl(req.getRequestURI());
        // TODO: Revisit and possibly re-enable once b/7031367 is understood
        // Key key = KeyFactory.createKey(ImagesReservedKinds.BLOB_SERVING_URL_KIND,
        //     parsedUrl.getBlobKey());
        // try {
        //   datastoreService.get(key);
        // } catch (EntityNotFoundException ex) {
        //   // Not finding the key is only a warning at this stage to support
        //   // older apps.
        //   // TODO: Make this an error by returning SC_NOT_FOUND once
        //   // this code has been released for a few cycles.
        //   logger.log(Level.WARNING, "Missing serving URL key for blobKey " + key.toString() +
        //       ". Ensure that getServingUrl is called before serving a blob.");
        //   resp.sendError(HttpServletResponse.SC_NOT_FOUND);
        // }
        Image image = transformImage(parsedUrl);
        resp.setContentType(image.getMimeType());
        out.write(image.getImage());
      } finally {
        out.close();
      }
    } catch (ApiProxy.ApplicationException e) {
      ErrorCode code = ErrorCode.forNumber(e.getApplicationError());
      if (code == null) {
        code = ErrorCode.UNSPECIFIED_ERROR;
      }
      switch (code) {
        case NOT_IMAGE:
        case INVALID_BLOB_KEY:
          resp.sendError(HttpServletResponse.SC_NOT_FOUND, e.getMessage());
          break;
        default:
          resp.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, e.getMessage());
      }
    } catch(IllegalArgumentException e) {
      resp.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, e.getMessage());
    } catch (IOException e) {
      resp.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, e.getMessage());
    }
  }
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



api_dev/src/main/java/com/google/appengine/api/images/dev/ee10/LocalBlobImageServlet.java [84:127]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException {
    try {
      OutputStream out = resp.getOutputStream();
      try {
        ParsedUrl parsedUrl = ParsedUrl.createParsedUrl(req.getRequestURI());
        // TODO: Revisit and possibly re-enable once b/7031367 is understood
        // Key key = KeyFactory.createKey(ImagesReservedKinds.BLOB_SERVING_URL_KIND,
        //     parsedUrl.getBlobKey());
        // try {
        //   datastoreService.get(key);
        // } catch (EntityNotFoundException ex) {
        //   // Not finding the key is only a warning at this stage to support
        //   // older apps.
        //   // TODO: Make this an error by returning SC_NOT_FOUND once
        //   // this code has been released for a few cycles.
        //   logger.log(Level.WARNING, "Missing serving URL key for blobKey " + key.toString() +
        //       ". Ensure that getServingUrl is called before serving a blob.");
        //   resp.sendError(HttpServletResponse.SC_NOT_FOUND);
        // }
        Image image = transformImage(parsedUrl);
        resp.setContentType(image.getMimeType());
        out.write(image.getImage());
      } finally {
        out.close();
      }
    } catch (ApiProxy.ApplicationException e) {
      ErrorCode code = ErrorCode.forNumber(e.getApplicationError());
      if (code == null) {
        code = ErrorCode.UNSPECIFIED_ERROR;
      }
      switch (code) {
        case NOT_IMAGE:
        case INVALID_BLOB_KEY:
          resp.sendError(HttpServletResponse.SC_NOT_FOUND, e.getMessage());
          break;
        default:
          resp.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, e.getMessage());
      }
    } catch(IllegalArgumentException e) {
      resp.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, e.getMessage());
    } catch (IOException e) {
      resp.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, e.getMessage());
    }
  }
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



