cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

BUG: IOException in Backoffice WidgetJarResourceReader in 1808.2

Former Member
0 Kudos
198

Unfortunately there is another nice little bug in 1808.2 backoffice: when opening the Inventory adapt stock popover the icons OK and X icons are not shown and a IOException is thown in com.hybris.cockpitng.core.persistence.packaging.impl.WidgetJarResourceReader.

The reason is that the ZipInputStream is closed when the underlying JarFile is closed ...

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

This little aspect fixes this:

 /**
  * Fixes a {@link java.io.IOException} when loading resources from jar files.
  */
 @Aspect
 public class BackofficeJarResourceClosedFixAspect
 {
     private static final Logger LOG = Logger.getLogger(BackofficeJarResourceClosedFixAspect.class);
 
     @Around("execution(* com.hybris.cockpitng.core.persistence.packaging.impl..*(..)) && args(java.util.jar.JarFile, String)")
     public Object method(ProceedingJoinPoint pjp) throws Throwable
     {
         if (LOG.isDebugEnabled())
         {
             LOG.debug("Wrapping JAR resource input stream so that is not being closed when the underlying JarFile is closed.");
         }
 
         // copy stream so that it will not be closed when the underlying jar file is closed
         final InputStream bufferedStream = IOUtils.toBufferedInputStream((InputStream) pjp.proceed());
 
         return bufferedStream;
     }
 }

Answers (1)

Answers (1)

former_member625836
Active Contributor
0 Kudos

,

I don't get the details, but if you are sure that there is a problem, please report it via SAP CS support, so that it may be taken care for others.

Cheers, Jacek