Skip to content

Add lastModified&contentLength to SJH URLConnections#55

Merged
Su5eD merged 2 commits intoMcModLauncher:mainfrom
shartte:improve-urlconnection
Nov 25, 2023
Merged

Add lastModified&contentLength to SJH URLConnections#55
Su5eD merged 2 commits intoMcModLauncher:mainfrom
shartte:improve-urlconnection

Conversation

@shartte
Copy link
Copy Markdown
Contributor

@shartte shartte commented Nov 23, 2023

Implement last modification time and content length in URLConnection for SJH modular class loaders. Enables support for javacpp.

javacpp tries to extract the native DLLs it is wrapping into a cache directory. In normal operation, it retrieves the lastModifiedDate+size from a JarURLConnection to handle conflicts. When using javacpp in Neoforge, this fails. javacpp cannot use its JarUrlConnection special case and will fall back to using the generic URLConnection methods getContentLength and getLastModified, which SJH does not implement. That leads to crashes (since javacpp can no longer detect if the DLL it is trying to extract is different from the one already on disk). Implementing these two methods in SJH fixes the issue.

Fixes bytedeco/javacpp#697

…for SJH modular class loaders. Enables support for javacpp.
Copy link
Copy Markdown
Contributor

@Technici4n Technici4n left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Comment thread src/main/java/cpw/mods/cl/ModularURLHandler.java
@Su5eD Su5eD merged commit 7cd8481 into McModLauncher:main Nov 25, 2023
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.

Crash when recursively extracting the same DLL and not using standard UrlClassLoader

5 participants