Skip to content

Commit 8423020

Browse files
author
tomas-sexenian
committed
Prettified code and reverted unnecessary changes
1 parent f16695f commit 8423020

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

java/src/main/java/com/genexus/GxImageUtil.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,21 @@ private static BufferedImage createBufferedImageFromURI(String filePathOrUrl) th
2525
{
2626
IHttpContext httpContext = com.genexus.ModelContext.getModelContext().getHttpContext();
2727
InputStream is = null;
28+
try{
29+
if (filePathOrUrl.toLowerCase().startsWith("http://") || filePathOrUrl.toLowerCase().startsWith("https://") ||
30+
(httpContext.isHttpContextWeb() && filePathOrUrl.startsWith(httpContext.getContextPath())))
31+
is = new URL(GXDbFile.pathToUrl( filePathOrUrl, httpContext)).openStream();
32+
else
33+
IHttpContext httpContext = com.genexus.ModelContext.getModelContext().getHttpContext();
34+
InputStream is = null;
2835
try{
2936
if (filePathOrUrl.toLowerCase().startsWith("http://") || filePathOrUrl.toLowerCase().startsWith("https://") ||
3037
(httpContext.isHttpContextWeb() && filePathOrUrl.startsWith(httpContext.getContextPath())))
3138
is = new URL(GXDbFile.pathToUrl( filePathOrUrl, httpContext)).openStream();
3239
else
3340
is = getGXFile(filePathOrUrl).getStream();
3441
return ImageIO.read(is);
42+
} catch (IOException e) {
3543
} catch (IOException e) {
3644
log.error("Failed to read image stream: " + filePathOrUrl);
3745
throw e;

0 commit comments

Comments
 (0)