(Translated by https://www.hiragana.jp/)
Fix bug when reading local package assets by bioball · Pull Request #642 · apple/pkl · GitHub
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

Fix bug when reading local package assets #642

Merged
merged 1 commit into from
Sep 10, 2024

Conversation

bioball
Copy link
Contributor

@bioball bioball commented Sep 9, 2024

Closes #641

.evalError("noResourceReaderRegistered", uri.getScheme())
.build();
}
return resourceManager.doRead(reader, local, null);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The core problem is around using ResourceManager#read, which returns a org.pkl.core.runtime.VmTyped rather than a org.pkl.core.resource.Resource.

Additionally, we shouldn't use the ResourceManager here because that method statefully alters its cache. Since this method is already called within the same cache's computeIfAbsent call, mutating that cache results in a ConcurrentModificationException.

Copy link
Contributor

@stackoverflow stackoverflow left a comment

Choose a reason for hiding this comment

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

Looks good.

@bioball bioball merged commit 47f2143 into apple:main Sep 10, 2024
5 checks passed
@bioball bioball deleted the fix-local-pkg-read branch September 10, 2024 12:51
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.

PklBugException when reading assets from a local project dependency
2 participants