Ошибка invalid distance too far back

I have a GWT application which uses Resteasy as backend api/service, the project works properly, but when I moved the project to a different machine and run it I get this error when doing a GWT run:

Caused by: java.util.zip.ZipException: invalid distance too far back
    at java.util.zip.InflaterInputStream.read(InflaterInputStream.java:164)
    at java.util.zip.ZipInputStream.read(ZipInputStream.java:193)
    at java.util.jar.JarInputStream.read(JarInputStream.java:207)
    at org.scannotation.archiveiterator.InputStreamWrapper.read(InputStreamWrapper.java:36)
    at java.io.BufferedInputStream.fill(BufferedInputStream.java:235)
    at java.io.BufferedInputStream.read(BufferedInputStream.java:254)
    at java.io.DataInputStream.readInt(DataInputStream.java:387)
    at javassist.bytecode.ClassFile.read(ClassFile.java:731)
    at javassist.bytecode.ClassFile.<init>(ClassFile.java:108)
    at org.scannotation.AnnotationDB.scanClass(AnnotationDB.java:343)
    at org.scannotation.AnnotationDB.scanArchives(AnnotationDB.java:326)
    at org.jboss.resteasy.plugins.server.servlet.ConfigurationBootstrap.createDeployment(ConfigurationBootstrap.java:163)
    ... 24 more

What could be the problem?

  • Is the the GWT jars or Resteasy? What does ZipException mean? Does it mean corrupted dependency?

asked May 16, 2013 at 17:57

quarks's user avatar

4

I am going to go out on a limb here and say you have a class compatibility error or corrupted Jars (look at the call stack, it’s trying to load classes from jar files).

Verify that you have the exact same Java version on both systems and then COPY the entire project from the working host to the non-working host. You may have a corrupted Jar.

Basically ensure everything is identical and try again

answered May 16, 2013 at 20:21

Christian Bongiorno's user avatar

1

Sometimes your firewall breaks the ftp connection, so try to keep an exception for java 7 on the firewall you are using. In Windows 7 it is:

netsh advfirewall set global statefulftp disable 

Do it by running command prompt as an administrator.

answered Dec 4, 2013 at 4:09

Ashim's user avatar

AshimAshim

4111 gold badge8 silver badges17 bronze badges

Basically my project is hosted in Bitbucket. So what I did is create a folder that will serve as the new workspace folder. Then, git clone the project there. Then issue mvn clean install and mvn gwt:run then everything works fine.

answered May 17, 2013 at 2:44

quarks's user avatar

quarksquarks

33.2k72 gold badges283 silver badges508 bronze badges

1

I don’t know if your problem is the same but, I’ve faced the same error and find out that it was related with Firefox version > 10.0. For some reason, Firefox converts any «!» character into something like «%21».

In my cenario, my application was triggering this error while rendering a image due to this fact. The same was NOT happening on Chrome.

That situation can be handled by implementing a Filter to treat the request.

If this case matchs your problem, take a look on this post:
javax.faces.FacesException: Error decode resource data while loading JSF page

Community's user avatar

answered Jan 31, 2017 at 12:49

Renato Camargos's user avatar

@kkat-zero Thank you for the extra information, the remoteagent.log does now point to the root cause:

[2021-10-13 08:50:56.961] [remoteagent] [error] [<unknown>][3e056802][ExtensionHostConnection] <1499> Error: invalid distance too far back
    at Zlib.zlibOnError [as onerror] (zlib.js:181:17)
[2021-10-13 08:50:57.114] [remoteagent] [info] [<unknown>][3e056802][ExtensionHostConnection] <1499><stderr> /home/foobar/.vscode-server/bin/ee8c7def80afc00dd6e593ef12f37756d8f504ea/out/vs/server/remoteExtensionHostProcess.js:3
 *--------------------------------------------------------*/(function(){var fe=["require","exports","vs/base/common/uri","vs/base/common/event","vs/platform/instantiation/common/instantiation","vs/workbench/api/common/extHost.protocol","vs/base/common/lifecycle","vs/workbench/api/common/extHostTypes","vs/base/common/path","vs/base/common/strings","vs/base/common/network","vs/base/common/platform","vs/base/common/types","vs/platform/log/common/log","vs/workbench/api/common/extHostRpcService","vs/workbench/api/common/extHostTypeConverters","vs/base/common/arrays","vs/base/common/async","vs/base/common/errors","vs/nls","vs/nls!vs/server/remoteExtensionHostProcess","vs/base/common/cancellation","vs/base/common/buffer","vs/base/common/resources","vs/base/common/map","vs/base/common/objects","vs/platform/extensions/common/extensions","vs/workbench/api/common/extHostInitDataService","vs/base/node/pfs","vs/base/common/extpath","vs/base/common/glob","vs/workbench/services/search/common/search","vs/base/common/uuid","vs/workbench/api/common/extHostTerminalService","vs/platform/registry/common/platform","vs/workbench/services/extensions/common/extensions","vs/workbench/api/common/extHostWorkspace","vs/workbench/api/common/extHostConfiguration","vs/base/common/process","child_process","vs/workbench/api/common/extHostCommands","vs/workbench/api/common/extHostExtensionService","vs/editor/common/core/range","vs/platform/files/common/files","vs/platform/workspace/common/workspace","vs/workbench/api/common/extHostDocumentsAndEditors","vs/base/common/stopwatch","vs/base/common/codicons","vs/base/common/hash","vs/base/common/severity","fs","vs/editor/common/core/position","vs/workbench/api/common/extHostFileSystemInfo","vs/workbench/api/common/extHostTunnelService","vs/workbench/services/extensions/common/proxyIdentifier","vs/workbench/api/common/extHostEditorTabs","vs/workbench/api/common/extHostDebugService","vs/base/common/assert","vs/base/common/collections","vs/base/common/decorators","vs/base/common/json","vs/base/common/marshalling","vs/base/common/errorMessage","vs/platform/contextkey/common/contextkey","vs/platform/theme/common/themeService","vs/workbench/api/common/extHostTestingPrivateApi","vs/workbench/api/common/extHostUriTransformerService","vs/workbench/api/common/extHostApiDeprecationService","vs/workbench/api/common/extHostOutput","vs/workbench/api/common/extHostStoragePaths","vs/workbench/api/common/extHostWebview","vs/workbench/services/search/common/searchExtTypes","vs/workbench/api/common/extHostTask","vs/base/common/performance","vs/workbench/api/common/extHostSearch","vs/base/common/functional","vs/base/common/idGenerator","vs/base/common/numbers","vs/base/common/normalization","vs/base/common/labels","os","vs/editor/common/modes/languageSelector","vs/platform/instantiation/common/extensions","vs/editor/common/modes","vs/platform/instantiation/common/serviceCollection","vs/platform/configuration/common/configurationRegistry","vs/platform/remote/common/remoteHosts","vs/workbench/api/common/cache","vs/workbench/api/common/shared/webview","vs/workbench/contrib/testing/common/testId","vs/workbench/api/common/exHostSecretState","vs/workbench/api/common/extHostFileSystemConsumer","vs/workbench/api/common/extHostStorage","vs/workbench/services/search/node/ripgrepSearchUtils","vs/base/common/iterator","vs/base/common/linkedList","vs/base/common/processes","vs/base/common/stream","vs/base/common/uint","vs/base/common/filters","vs/base/common/htmlContent","vs/base/common/comparers","vs/base/common/fuzzyScorer","vs/base/common/mime","vs/base/common/uriIpc","string_decoder","vs/base/node/extpath","vs/base/parts/ipc/common/ipc","vs/base/parts/ipc/common/ipc.net","vs/editor/common/core/characterClassifier","vs/editor/common/model","vs/editor/common/model/wordHelper","vs/editor/common/services/semanticTokensDto","vs/editor/common/viewModel/prefixSumComputer","vs/base/node/processes","vs/editor/common/config/editorOptions","vs/platform/instantiation/common/descriptors","vs/platform/log/node/spdlogLog","vs/platform/markers/common/markers","vs/platform/progress/common/progress","vs/platform/jsonschemas/common/jsonContributionRegistry","vs/platform/configuration/common/configuration","vs/platform/remote/common/remoteAuthorityResolver","vs/platform/remote/common/tunnel","vs/workbench/api/common/extHostTelemetry","vs/workbench/api/common/extHostDocumentData","vs/workbench/contrib/debug/common/abstractDebugAdapter","net","vs/workbench/contrib/notebook/common/notebookCommon","vs/workbench/contrib/testing/common/testCollection","vs/workbench/services/editor/common/editorGroupsService","vs/workbench/api/common/extHostNotebookEditor","vs/workbench/api/common/extHostTextEditor","vs/workbench/api/common/extHostDecorations","vs/workbench/api/common/extHostWindow","vs/workbench/services/search/common/textSearchManager","vs/workbench/services/search/node/textSearchManager","vs/workbench/services/search/node/ripgrepTextSearchEngine","vs/base/parts/ipc/node/ipc.net","vs/base/common/jsonFormatter","vs/base/common/jsonEdit","vs/base/common/lazy","vs/base/common/skipList","vs/base/common/iconLabels","vs/base/node/decoder","vs/editor/common/controller/wordCharacterClassifier","vs/editor/common/core/selection","vs/editor/common/model/textModelSearch","vs/editor/common/modes/languageConfiguration","vs/editor/common/modes/linkComputer","vs/editor/common/modes/tokenizationRegistry","vs/editor/common/model/mirrorTextModel","vs/nls!vs/base/common/date","vs/base/common/date","vs/nls!vs/base/common/errorMessage","vs/nls!vs/base/node/processes","vs/nls!vs/editor/common/config/editorOptions","vs/nls!vs/platform/configuration/common/configurationRegistry","vs/nls!vs/platform/extensionManagement/common/extensionManagement","vs/nls!vs/platform/extensions/common/extensionValidator","vs/nls!vs/platform/externalTerminal/node/externalTerminalService","vs/nls!vs/platform/files/common/files","vs/nls!vs/platform/markers/common/markers","vs/nls!vs/platform/theme/common/iconRegistry","vs/nls!vs/platform/workspaces/common/workspaces","vs/nls!vs/workbench/api/common/extHostDiagnostics","vs/nls!vs/workbench/api/common/extHostExtensionService","vs/nls!vs/workbench/api/common/extHostProgress","vs/nls!vs/workbench/api/common/extHostStatusBar","vs/nls!vs/workbench/api/common/extHostTerminalService","vs/nls!vs/workbench/api/common/extHostTreeViews","vs/nls!vs/workbench/api/common/extHostWorkspace","vs/nls!vs/workbench/api/node/extHostDebugService","vs/nls!vs/workbench/api/node/extHostTunnelService","vs/nls!vs/workbench/common/editor","vs/nls!vs/workbench/common/views","vs/nls!vs/workbench/contrib/debug/common/abstractDebugAdapter","vs/nls!vs/workbench/contrib/debug/node/debugAdapter","vs/nls!vs/workbench/contrib/search/common/queryBuilder","vs/nls!vs/workbench/contrib/tasks/common/taskService","vs/nls!vs/workbench/services/configurationResolver/common/variableResolver","vs/platform/editor/common/editor","vs/platform/extensions/common/extensionValidator","vs/platform/instantiation/common/graph","vs/editor/common/services/modelService","vs/editor/common/modes/languageFeatureRegistry","vs/platform/environment/common/environment","vs/platform/extensionManagement/common/extensionManagement","vs/platform/extensionManagement/common/extensionManagementUtil","vs/platform/externalTerminal/common/externalTerminal","vs/platform/externalTerminal/node/externalTerminalService","vs/platform/instantiation/common/instantiationService","vs/platform/notification/common/notification","vs/platform/opener/common/opener","vs/platform/product/common/product","vs/platform/configuration/common/configurationModels","vs/platform/sign/node/signService","vs/platform/terminal/common/terminalDataBuffering","vs/platform/theme/common/theme","vs/platform/theme/common/iconRegistry","vs/platform/workspaces/common/workspaces","vs/workbench/api/common/extHostMemento","vs/workbench/api/common/extHostNotebookDocuments","vs/workbench/api/common/extHostSecrets","vs/workbench/api/common/extHostNotebookConcatDocument","vs/workbench/api/common/extHostTheming","vs/workbench/api/common/extHostWebviewMessaging","vs/workbench/api/common/shared/treeDataTransfer","vs/workbench/api/common/extHostCodeInsets","vs/workbench/common/editor","vs/workbench/common/views","vs/workbench/contrib/debug/common/debugUtils","vs/workbench/contrib/debug/node/debugAdapter","vs/workbench/contrib/debug/node/terminals","vs/workbench/contrib/notebook/common/notebookExecutionService","vs/workbench/contrib/tasks/common/taskService","vs/workbench/contrib/terminal/common/environmentVariableShared","vs/workbench/services/configurationResolver/common/variableResolver","vs/workbench/services/editor/common/editorService","vs/workbench/api/common/extHostDocumentSaveParticipant","vs/workbench/api/common/extHostFileSystemEventService","vs/workbench/api/common/extHostNotebookDocument","vs/workbench/api/common/extHostProgress","vs/workbench/api/common/extHostTreeViews","vs/workbench/contrib/testing/common/ownedTestCollection","vs/workbench/services/environment/common/environmentService","vs/workbench/services/extensions/common/extensionDescriptionRegistry","vs/workbench/services/extensions/common/extensionHostProtocol","vs/workbench/api/common/extHostExtensionActivator","vs/workbench/api/node/extHostLogService","vs/workbench/services/extensions/common/lazyPromise","vs/workbench/api/common/extHostAuthentication","vs/workbench/api/common/extHostBulkEdits","vs/workbench/api/common/extHostClipboard","vs/workbench/api/common/extHostApiCommands","vs/workbench/api/common/extHostComments","vs/workbench/api/common/extHostDiagnostics","vs/workbench/api/common/extHostDialogs","vs/workbench/api/common/extHostDocumentContentProviders","vs/workbench/api/common/extHostDocuments","vs/workbench/api/common/extHostFileSystem","vs/workbench/api/common/extHostInteractive","vs/workbench/api/common/extHostLabelService","vs/workbench/api/common/extHostLanguageFeatures","vs/workbench/api/common/extHostLanguages","vs/workbench/api/common/extHostMessageService","vs/workbench/api/common/extHostNotebook","vs/workbench/api/common/extHostNotebookEditors","vs/workbench/api/common/extHostNotebookKernels","vs/workbench/api/common/extHostNotebookRenderers","vs/workbench/api/common/extHostQuickOpen","vs/workbench/api/common/extHostSCM","vs/workbench/api/common/extHostStatusBar","vs/workbench/api/common/extHostTesting","vs/workbench/api/common/extHostTextEditors","vs/workbench/api/common/extHostTimeline","vs/workbench/api/common/extHostUriOpener","vs/workbench/api/common/extHostUrls","vs/workbench/api/common/extHostCustomEditors","vs/workbench/api/common/extHostWebviewPanels","vs/workbench/api/common/extHostWebviewView","vs/workbench/api/node/extHostDownloadService","vs/workbench/api/node/extHostOutputService","vs/workbench/api/node/extHostStoragePaths","vs/workbench/api/node/extHostTerminalService","vs/workbench/api/node/extHostTunnelService","vs/workbench/services/extensions/common/rpcProtocol","vs/workbench/services/remote/common/remoteAgentService","vs/workbench/services/path/common/pathService","vs/workbench/contrib/search/common/queryBuilder","vs/workbench/api/common/shared/workspaceContains","vs/workbench/api/common/extHostRequireInterceptor","vs/workbench/api/node/extHostDebugService","vs/workbench/api/node/extHostTask","vs/workbench/services/extensions/common/extensionHostMain","vs/workbench/services/search/common/fileSearchManager","vs/workbench/api/common/extHost.api.impl","vs/workbench/api/common/extHost.common.services","vs/workbench/services/textfile/common/encoding","vs/workbench/services/extensions/node/proxyResolver","http","vs/workbench/services/search/node/ripgrepFileSearch","vscode-ripgrep","vs/workbench/services/search/node/fileSearch","vs/workbench/services/search/node/ripgrepSearchProvider","vs/workbench/services/search/node/textSearchAdapter","vs/workbench/services/search/node/rawSearchService","vs/workbench/api/node/extHostSearch","vs/workbench/api/node/extHostCLIServer","vs/workbench/api/node/extHostExtensionService","vs/workbench/api/node/extHost.node.services","vs/workbench/services/extensions/node/extensionHostProcessSetup","util","vs/base/common/marked/marked","path","https","tls","vscode-proxy-agent","events","vscode-regexpp","graceful-fs","crypto","zlib","minimist","vs/server/remoteExtensionHostProcess"],me=function(X){for(var e=[],f=0,F=X.length;f<F;f++)e[f]=fe[X[f]];return e};define(fe[57],me([0,1]),function(X,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.ok=void 0;function f(F,C){if(!F)throw new Error(C?`Assertion failed (${C})`:"Assertion Failed")}e.ok=f}),define(fe[58],me([0,1]),function(X,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.SetMap=e.diffMaps=e.diffSets=e.fromMap=e.groupBy=e.forEach=e.values=void 0;const f=Object.prototype.hasOwnProperty;function F(n){const k=[];for(let a in n)f.call(n,a)&&k.push(n[a]);return k}e.values=F;function C(n,k){for(let a in n)if(f.call(n,a)&&k({key:a,value:n[a]},function(){delete n[a]})===!1)return}e.forEach=C;function y(n,k){const a=Object.create(null);for(const m of n){const d=k(m);let v=a[d];v||(v=a[d]=[]),v.push(m)}return a}e.groupBy=y;function T(n){const k=Object.create(null);return n&&n.forEach((a,m)=>{k[m]=a}),k}e.fromMap=T;function _(n,k){const a=[],m=[];for(let d of n)k.has(d)||a.push(d);for(let d of k)n.has(d)||m.push(d);return{removed:a,added:m}}e.diffSets=_;function S(n,k){const a=[],m=[];for(let[d,v]of n)k.has(d)||a.push(v);for(let[d,v]of k)n.has(d)||m.push(v);return{removed:a,added:m}}e.diffMaps=S;class P{constructor(){this.map=new Map}add(k,a){let m=this.map.get(k);m||(m=new Set,this.map.set(k,m)),m.add(a)}delete(k,a){const m=this.map.get(k);!m||(m.delete(a),m.size===0&&this.map.delete(k))}forEach(k,a){const m=this.map.get(k);!m||m.forEach(a)}}e.SetMap=P}),define(fe[59],me([0,1]),function(X,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.throttle=e.debounce=e.memoize=e.createDecorator=void 0;function f(T){return(_,S,P)=>{let n=null,k=null;if(typeof P.value=="function"?(n="value",k=P.value):typeof P.get=="function"&&(n="get",k=P.get),!k)throw new Error("not supported");P[n]=T(k,S)}}e.createDecorator=f;function F(T,_,S){let P=null,n=null;if(typeof S.value=="function"?(P="value",n=S.value,n.length!==0&&console.warn("Memoize should only be used in functions with zero parameters")):typeof S.get=="function"&&(P="get",n=S.get),!n)throw new Error("not supported");const k=`$memoize$${_}`;S[P]=function(...a){return this.hasOwnProperty(k)||Object.defineProperty(this,k,{configurable:!1,enumerable:!1,writable:!1,value:n.apply(this,a)}),this[k]}}e.memoize=F;function C(T,_,S){return f((P,n)=>{const k=`$debounce$${n}`,a=`$debounce$result$${n}`;return function(...m){this[a]||(this[a]=S?S():void 0),clearTimeout(this[k]),_&&(this[a]=_(this[a],...m),m=[this[a]]),this[k]=setTimeout(()=>{P.apply(this,m),this[a]=S?S():void 0},T)}})}e.debounce=C;function y(T,_,S){return f((P,n)=>{const k=`$throttle$timer$${n}`,a=`$throttle$result$${n}`,m=`$throttle$lastRun$${n}`,d=`$throttle$pending$${n}`;return function(...v){if(this[a]||(this[a]=S?S():void 0),(this[m]===null||this[m]===void 0)&&(this[m]=-Number.MAX_VALUE),_&&(this[a]=_(this[a],...v)),this[d])return;const D=this[m]+T;D<=Date.now()?(this[m]=Date.now(),P.apply(this,[this[a]]),this[a]=S?S():void 0):(this[d]=!0,this[k]=setTimeout(()=>{this[d]=!1,this[m]=Date.now(),P.apply(this,[this[a]]),this[a]=S?S():void 0},D-Date.now()))}})}e.throttle=y}),define(fe[18],me([0,1]),function(X,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.createErrorWithActions=e.isErrorWithActions=e.ExpectedError=e.NotSupportedError=e.NotImplementedError=e.getErrorMessage=e.disposed=e.readonly=e.illegalState=e.illegalArgument=e.canceled=e.CancellationError=e.isPromiseCanceledError=e.transformErrorForSerialization=e.onUnexpectedExternalError=e.onUnexpectedError=e.setUnexpectedErrorHandler=e.errorHandler=e.ErrorHandler=void 0;class f{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(t){setTimeout(()=>{throw t.stack?new Error(t.message+`
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            

Error: invalid distance too far back

Error: invalid distance too far back
    at Zlib.zlibOnError [as onerror] (zlib.js:181:17)
    at Timeout._onTimeout (/home/foobar/.vscode-server/bin/ee8c7def80afc00dd6e593ef12f37756d8f504ea/out/vs/server/remoteExtensionHostProcess.js:3:16117)
    at listOnTimeout (internal/timers.js:554:17)
    at processTimers (internal/timers.js:497:7)

[2021-10-13 08:50:57.139] [remoteagent] [info] [<unknown>][3e056802][ExtensionHostConnection] <1499> Extension Host Process exited with code: 1, signal: null. 

It looks like there is a zlib stream decoding error in the extension host.

@kkat-zero I am very interested to manage to reproduce this. In the remote machine, we pass over sockets from one process to another, and I think that something might be misbehaving in this area. What is the remote Linux distribution/version that you are connecting to? Does this reproduce when connecting to any linux machine via SSH?

1, разум

Когда экспериментальное восстановление пешехозяйственного обнаружения, когда данные POS прочитаны, оно отображается.libpng error: IDAT: invalid distance too far backошибка,

Я запросил много информации в Интернете, я знаю причинуLibpng намеренно уничтожил обратную совместимость в прошлом, а также совместим с версией libpng.

2, решение

Используя PNGCRush Repair Image, PNGCRush можно загрузить непосредственно на конце команд, например, Mac — Brew install Pngcrous;

После установки,

1. Сначала скопируйте TXT с положительным именем файла образца в файл POS.

2, в папке POS создайте папку Trueimg,

3, затем введите папку POS, откройте окно команды в этой папке, введите

cat arg.txt|xargs -I {} pngcrush -fix {} trueimg/{}

Команда означает принести содержимое arg.txt в pngcroush — fix} trueimg / {},

⚠️: {} — это содержимое в файле arg.txt,

⚠️: PNGCRush — Fix — это фиксированное изображение.

Solution 1

I am going to go out on a limb here and say you have a class compatibility error or corrupted Jars (look at the call stack, it’s trying to load classes from jar files).

Verify that you have the exact same Java version on both systems and then COPY the entire project from the working host to the non-working host. You may have a corrupted Jar.

Basically ensure everything is identical and try again

Solution 2

Sometimes your firewall breaks the ftp connection, so try to keep an exception for java 7 on the firewall you are using. In Windows 7 it is:

netsh advfirewall set global statefulftp disable 

Do it by running command prompt as an administrator.

Solution 3

Basically my project is hosted in Bitbucket. So what I did is create a folder that will serve as the new workspace folder. Then, git clone the project there. Then issue mvn clean install and mvn gwt:run then everything works fine.

Comments

  • I have a GWT application which uses Resteasy as backend api/service, the project works properly, but when I moved the project to a different machine and run it I get this error when doing a GWT run:

    Caused by: java.util.zip.ZipException: invalid distance too far back
        at java.util.zip.InflaterInputStream.read(InflaterInputStream.java:164)
        at java.util.zip.ZipInputStream.read(ZipInputStream.java:193)
        at java.util.jar.JarInputStream.read(JarInputStream.java:207)
        at org.scannotation.archiveiterator.InputStreamWrapper.read(InputStreamWrapper.java:36)
        at java.io.BufferedInputStream.fill(BufferedInputStream.java:235)
        at java.io.BufferedInputStream.read(BufferedInputStream.java:254)
        at java.io.DataInputStream.readInt(DataInputStream.java:387)
        at javassist.bytecode.ClassFile.read(ClassFile.java:731)
        at javassist.bytecode.ClassFile.<init>(ClassFile.java:108)
        at org.scannotation.AnnotationDB.scanClass(AnnotationDB.java:343)
        at org.scannotation.AnnotationDB.scanArchives(AnnotationDB.java:326)
        at org.jboss.resteasy.plugins.server.servlet.ConfigurationBootstrap.createDeployment(ConfigurationBootstrap.java:163)
        ... 24 more
    

    What could be the problem?

    • Is the the GWT jars or Resteasy? What does ZipException mean? Does it mean corrupted dependency?
  • That doesn’t surprise me. Definitely sounded like you got a bad jar in a dependency sweep.

  • Where possible, use SHA256 hash to verify

Recents

#python #error-handling #unzip #zipfile #try-except

#python #обработка ошибок #распаковать #попробуйте-за исключением #python-zipfile

Вопрос:

Я работаю над скриптом python для распаковки папки с вложенными ZIP-файлами. В общем, кажется, что это работает, но когда дело доходит до одного из файлов, я всегда получаю эту ошибку:

 zlib.error: Error -3 while decompressing data: invalid distance too far back
 

Сначала я пытался использовать try и except , чтобы передать это, но это не сработало. Затем я попытался добавить в предложение except except zipfile.BadZipFile после прочтения различных сообщений об этом здесь, но я все еще получаю ту же ошибку. Вот как выглядит мой код:

 import os
import zipfile
folder_path = [MY FOLDER PATH HERE]

def extract_zip(filepath_in, filepath_out, password):
    if is_zip(filepath_in):
        print(filepath_in)
        with zipfile.ZipFile(filepath_in, 'r') as zip_file:
            zip_file.extractall(filepath_out, pwd = bytes(password, 'utf-8'))

error_list = []
zip_count = 1           
while zip_count > 0:   
    filelist = []

    for root, dirs, files in os.walk(folder_path):      
        for file in files:
            filelist.append(os.path.join(root,file)) 
       
    zip_count = 0   
    for name in filelist:
        if name[(len(name) - 4):(len(name))] == ".zip":      #if file name ends in .zip
            zip_count =  1
            try:    
                extract_zip(name, name[0:(len(name) - 4)] , password)
                os.remove(name)    
            except zipfile.BadZipFile as fail:
                error_list.append(name), fail
                pass

 

Я не уверен, как еще можно либо проигнорировать ошибку, либо есть какой-то другой способ извлечь файл.

Комментарии:

1. всегда помещайте полное сообщение об ошибке (начинающееся со слова «Traceback») в вопрос (не комментарий) в виде текста (не скриншота). Есть и другая полезная информация.

2. в python вам не нужно использовать len(name)-4 , но вы можете использовать напрямую -4 , как name[0:-4] или даже короче name[:-4] и похожее name[-4:] вместо name[(len(name) - 4):(len(name))] . Но вам это не нужно — используйте if name.endswith(".zip") . В конечном итоге используйте glob.glob("*.zip") вместо os.walk()

3. это может быть ошибка непосредственно в библиотеке C / C zlib , и, возможно, вы не можете ее поймать.

Понравилась статья? Поделить с друзьями:
  • Ошибка invalid csrf token что это
  • Ошибка insert boot disk and press any key
  • Ошибка ins 3620 мерседес атего
  • Ошибка ins 30131 при установке oracle
  • Ошибка ins 0508 мерседес актрос мп1