Skip to content
This repository has been archived by the owner on Dec 3, 2021. It is now read-only.

Commit

Permalink
Revert "fix: instantiate the right inputStream instead of relying on …
Browse files Browse the repository at this point in the history
…the registry"

This reverts commit 3c57598.
  • Loading branch information
Marc authored and phiz71 committed Nov 3, 2021
1 parent 86a4c1b commit fc54c19
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 16 deletions.
Expand Up @@ -16,7 +16,6 @@
package io.gravitee.rest.api.portal.rest.resource;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.twelvemonkeys.imageio.stream.ByteArrayImageInputStream;
import io.gravitee.rest.api.idp.api.authentication.UserDetails;
import io.gravitee.rest.api.model.InlinePictureEntity;
import io.gravitee.rest.api.model.MediaEntity;
Expand Down Expand Up @@ -154,13 +153,7 @@ String checkAndScaleImage(final String encodedPicture) {
}

try {
/*
* For an unknown reason, when running APIM from jar/zip instead of sourcecode, com.twelvemonkeys.imageio.stream.ByteArrayImageInputStreamSpi
* is not registered in the IIORegistry used by ImageIO to manage stream.
* So basically the hack is to directly instantiate a ByteArrayImageInputStream
*/
//ImageInputStream imageInputStream = ImageIO.createImageInputStream(decodedPicture);
ImageInputStream imageInputStream = new ByteArrayImageInputStream(decodedPicture);
ImageInputStream imageInputStream = ImageIO.createImageInputStream(decodedPicture);
Iterator<ImageReader> imageReaders = ImageIO.getImageReaders(imageInputStream);

while (imageReaders.hasNext()) {
Expand Down
Expand Up @@ -15,7 +15,6 @@
*/
package io.gravitee.rest.api.security.utils;

import com.twelvemonkeys.imageio.stream.ByteArrayImageInputStream;
import io.gravitee.rest.api.exception.InvalidImageException;
import java.awt.*;
import java.awt.image.BufferedImage;
Expand Down Expand Up @@ -115,13 +114,7 @@ private static Image decodePicture(String picture) throws InvalidImageException

private static Image rescale(Image image, int width, int height) throws InvalidImageException {
try {
/*
* For an unknown reason, when running APIM from jar/zip instead of sourcecode, com.twelvemonkeys.imageio.stream.ByteArrayImageInputStreamSpi
* is not registered in the IIORegistry used by ImageIO to manage stream.
* So basically the hack is to directly instantiate a ByteArrayImageInputStream
*/
//ImageInputStream imageInputStream = ImageIO.createImageInputStream(image.getData());
ImageInputStream imageInputStream = new ByteArrayImageInputStream(image.getData());
ImageInputStream imageInputStream = ImageIO.createImageInputStream(image.getData());
Iterator<ImageReader> imageReaders = ImageIO.getImageReaders(imageInputStream);

while (imageReaders.hasNext()) {
Expand Down

0 comments on commit fc54c19

Please sign in to comment.