Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#550 decompress gzip files bigger than 10000 bytes #594

Merged

Conversation

svennissel
Copy link
Collaborator

The old implementation try to unzip the first 10,000 bytes of a gzip file. But if the file was bigger than 10,000 bytes a exception (Unexpected end of ZLIB input stream) was thrown while decompress file: pl/otros/logview/api/io/LoadingInfo.java:173

Solution:

  1. Read first 2 bytes to check if it is a gzip file
  2. Read direct from imputstream to decompress first 10,000 bytes
  3. Reset file to get new ImputStream

Stacktrace that not logged in default:
23:20:35.284 [AWT-EventQueue-0] ERROR p.o.l.g.a.TailLogActionListener - Cannot open tailing input stream for file:///C:/Users/sven/test.log.gz, Unexpected end of ZLIB input stream java.io.EOFException: Unexpected end of ZLIB input stream at java.util.zip.InflaterInputStream.fill(InflaterInputStream.java:240) ~[na:1.8.0_322] at java.util.zip.InflaterInputStream.read(InflaterInputStream.java:158) ~[na:1.8.0_322] at java.util.zip.GZIPInputStream.read(GZIPInputStream.java:117) ~[na:1.8.0_322] at java.io.FilterInputStream.read(FilterInputStream.java:107) ~[na:1.8.0_322] at org.apache.commons.io.IOUtils.copyLarge(IOUtils.java:1309) ~[commons-io-2.11.0.jar:2.11.0] at org.apache.commons.io.IOUtils.copy(IOUtils.java:978) ~[commons-io-2.11.0.jar:2.11.0] at org.apache.commons.io.IOUtils.copyLarge(IOUtils.java:1282) ~[commons-io-2.11.0.jar:2.11.0] at org.apache.commons.io.IOUtils.copy(IOUtils.java:953) ~[commons-io-2.11.0.jar:2.11.0] at pl.otros.logview.api.io.LoadingInfo.ungzip(LoadingInfo.java:173) ~[main/:na] at pl.otros.logview.api.io.LoadingInfo.<init>(LoadingInfo.java:63) ~[main/:na] at pl.otros.logview.api.io.LoadingInfo.<init>(LoadingInfo.java:51) ~[main/:na] at pl.otros.logview.gui.actions.TailLogActionListener.openFileObjectInTailMode(TailLogActionListener.java:77) [main/:na] at pl.otros.logview.gui.actions.TailLogActionListener.actionPerformedHook(TailLogActionListener.java:70) [main/:na] at pl.otros.logview.api.gui.OtrosAction.actionPerformed(OtrosAction.java:61) [main/:na] at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2022) [na:1.8.0_322] at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2348) [na:1.8.0_322] at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402) [na:1.8.0_322] at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259) [na:1.8.0_322] at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:252) [na:1.8.0_322] at org.pushingpixels.substance.internal.utils.RolloverButtonListener.mouseReleased(RolloverButtonListener.java:126) [substance-8.0.02.jar:na] at java.awt.Component.processMouseEvent(Component.java:6539) [na:1.8.0_322] at javax.swing.JComponent.processMouseEvent(JComponent.java:3324) [na:1.8.0_322] at java.awt.Component.processEvent(Component.java:6304) [na:1.8.0_322] at java.awt.Container.processEvent(Container.java:2239) [na:1.8.0_322] at java.awt.Component.dispatchEventImpl(Component.java:4889) [na:1.8.0_322] at java.awt.Container.dispatchEventImpl(Container.java:2297) [na:1.8.0_322] at java.awt.Component.dispatchEvent(Component.java:4711) [na:1.8.0_322] at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4904) [na:1.8.0_322] at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4535) [na:1.8.0_322] at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4476) [na:1.8.0_322] at java.awt.Container.dispatchEventImpl(Container.java:2283) [na:1.8.0_322] at java.awt.Window.dispatchEventImpl(Window.java:2746) [na:1.8.0_322] at java.awt.Component.dispatchEvent(Component.java:4711) [na:1.8.0_322] at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:760) [na:1.8.0_322] at java.awt.EventQueue.access$500(EventQueue.java:97) [na:1.8.0_322] at java.awt.EventQueue$3.run(EventQueue.java:709) [na:1.8.0_322] at java.awt.EventQueue$3.run(EventQueue.java:703) [na:1.8.0_322] at java.security.AccessController.doPrivileged(Native Method) [na:1.8.0_322] at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74) [na:1.8.0_322] at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:84) [na:1.8.0_322] at java.awt.EventQueue$4.run(EventQueue.java:733) [na:1.8.0_322] at java.awt.EventQueue$4.run(EventQueue.java:731) [na:1.8.0_322] at java.security.AccessController.doPrivileged(Native Method) [na:1.8.0_322] at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74) [na:1.8.0_322] at java.awt.EventQueue.dispatchEvent(EventQueue.java:730) [na:1.8.0_322] at pl.otros.logview.exceptionshandler.EventQueueProxy.dispatchEvent(EventQueueProxy.java:31) [main/:na] at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:205) [na:1.8.0_322] at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116) [na:1.8.0_322] at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105) [na:1.8.0_322] at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101) [na:1.8.0_322] at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93) [na:1.8.0_322] at java.awt.EventDispatchThread.run(EventDispatchThread.java:82) [na:1.8.0_322]

see also Issue #550

@otrebski otrebski merged commit f0e5a9f into otros-systems:master Apr 3, 2022
@svennissel svennissel deleted the 550_Unexpected_end_of_ZLIB_input branch April 18, 2022 19:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants