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

Default theme is not loaded from inside plantuml JAR library #948

Closed
raducoravu opened this issue Mar 10, 2022 · 5 comments
Closed

Default theme is not loaded from inside plantuml JAR library #948

raducoravu opened this issue Mar 10, 2022 · 5 comments

Comments

@raducoravu
Copy link

raducoravu commented Mar 10, 2022

Let's say the method "net.sourceforge.plantuml.style.StyleLoader.getInputStreamForStyle(String)" is called with "plantuml.skin", the method "FileSystem.getFile" throws an IOException because the file is not on the local disk and thus the fallback "StyleLoader.class.getResourceAsStream" is no longer called to retrieve the skin from inside the JAR.
So I get this error when attempting to convert a diagram to SVG:

         [xslt] java.io.IOException: The system cannot find the path specified
         [xslt] 	at java.base/java.io.WinNTFileSystem.canonicalize0(Native Method)
         [xslt] 	at java.base/java.io.WinNTFileSystem.canonicalize(WinNTFileSystem.java:417)
         [xslt] 	at java.base/java.io.File.getCanonicalPath(File.java:626)
         [xslt] 	at java.base/java.io.File.getCanonicalFile(File.java:651)
         [xslt] 	at net.sourceforge.plantuml.security.SFile.getCanonicalFile(SFile.java:126)
         [xslt] 	at net.sourceforge.plantuml.security.SecurityUtils.getPath(SecurityUtils.java:224)
         [xslt] 	at net.sourceforge.plantuml.FileSystem.getFile(FileSystem.java:95)
         [xslt] 	at net.sourceforge.plantuml.style.StyleLoader.getInputStreamForStyle(StyleLoader.java:92)
         [xslt] 	at net.sourceforge.plantuml.style.StyleLoader.loadSkin(StyleLoader.java:73)
         [xslt] 	at net.sourceforge.plantuml.SkinParam.getCurrentStyleBuilderInternal(SkinParam.java:172)
         [xslt] 	at net.sourceforge.plantuml.SkinParam.getCurrentStyleBuilder(SkinParam.java:149)
         [xslt] 	at net.sourceforge.plantuml.descdiagram.command.CommandLinkElement.executeArg(CommandLinkElement.java:268)
         [xslt] 	at net.sourceforge.plantuml.descdiagram.command.CommandLinkElement.executeArg(CommandLinkElement.java:67)
         [xslt] 	at net.sourceforge.plantuml.command.SingleLineCommand2.execute(SingleLineCommand2.java:150)
         [xslt] 	at net.sourceforge.plantuml.command.ProtectedCommand.execute(ProtectedCommand.java:54)
         [xslt] 	at net.sourceforge.plantuml.AbstractPSystem.executeCommand(AbstractPSystem.java:157)
         [xslt] 	at net.sourceforge.plantuml.command.PSystemCommandFactory.executeFewLines(PSystemCommandFactory.java:123)
         [xslt] 	at net.sourceforge.plantuml.command.PSystemCommandFactory.createSystem(PSystemCommandFactory.java:106)
         [xslt] 	at net.sourceforge.plantuml.PSystemBuilder.createPSystem(PSystemBuilder.java:136)
         [xslt] 	at net.sourceforge.plantuml.BlockUml.getDiagram(BlockUml.java:180)
         [xslt] 	at net.sourceforge.plantuml.SourceStringReader.outputImage(SourceStringReader.java:166)
         [xslt] 	at net.sourceforge.plantuml.SourceStringReader.outputImage(SourceStringReader.java:141)
arnaudroques added a commit that referenced this issue Mar 10, 2022
@arnaudroques
Copy link
Contributor

Thanks for the report.
Here is a now snapshot that may work better.
Tell us if it does not.

@raducoravu
Copy link
Author

I looked a bit in the code, the method SecurityUtils.getPath is actually the one which catches an IOException and does an e.printStackTrace(), so it seems that even the code before your fix worked but showed that exception in the console.
Your fix does not hurt though, I think you should also the logging system in the SecurityUtils.getPath instead of doing an e.printStackTrace().

@raducoravu
Copy link
Author

@arnaudroques and thanks for the help

@arnaudroques
Copy link
Contributor

I think you should also the logging system in the SecurityUtils.getPath instead of doing an e.printStackTrace().

You're right, thanks.

We're going to improve this.

@The-Lum
Copy link
Collaborator

The-Lum commented Jan 13, 2023

Hi all,

[This is an Issue Review]
This is now fixed.

  • Thanks @raducoravu for the report.
  • Thanks PlantUML team for your work.

Regards.

@The-Lum The-Lum closed this as completed Jan 13, 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

No branches or pull requests

3 participants