-
Notifications
You must be signed in to change notification settings - Fork 196
Update jsvg to 2.1.0 in org.eclipse.swt.svg #3283
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
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
.../org.eclipse.swt.svg/resources/META-INF/services/com.github.weisj.jsvg.logging.LogManager
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| org.eclipse.swt.svg.logging.JVSGLoggerLogManager |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
bundles/org.eclipse.swt.svg/src/org/eclipse/swt/svg/logging/JVSGLoggerLogManager.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| /******************************************************************************* | ||
| * Copyright (c) 2026 Eclipse contributors and others. | ||
| * | ||
| * This program and the accompanying materials are made available under the terms of the Eclipse | ||
| * Public License 2.0 which accompanies this distribution, and is available at | ||
| * https://www.eclipse.org/legal/epl-2.0/ | ||
| * | ||
| * SPDX-License-Identifier: EPL-2.0 | ||
| * | ||
| *******************************************************************************/ | ||
| package org.eclipse.swt.svg.logging; | ||
|
|
||
| import java.util.function.Supplier; | ||
|
|
||
| import com.github.weisj.jsvg.logging.LogManager; | ||
| import com.github.weisj.jsvg.logging.Logger; | ||
|
|
||
| public class JVSGLoggerLogManager implements LogManager { | ||
|
|
||
| private static final Logger.Level LEVEL = Logger.Level.valueOf(System.getProperty("org.eclipse.swt.svg.logging", "ERROR")); | ||
|
|
||
| @Override | ||
| public Logger createLogger(String name) { | ||
| return new Logger() { | ||
| @Override | ||
| public void log(Logger.Level level, String message, Throwable e) { | ||
| if (level.compareTo(LEVEL) <= 0) { | ||
| return; | ||
| } | ||
| doLog(level, message); | ||
| e.printStackTrace(); | ||
| } | ||
|
|
||
| @Override | ||
| public void log(Logger.Level level, Supplier<String> messageSupplier) { | ||
| if (level.compareTo(LEVEL) < 0) { | ||
| return; | ||
| } | ||
| doLog(level, messageSupplier.get()); | ||
| } | ||
|
|
||
| @Override | ||
| public void log(Logger.Level level, String message) { | ||
| if (level.compareTo(LEVEL) < 0) { | ||
| return; | ||
| } | ||
| doLog(level, message); | ||
| } | ||
|
|
||
| private void doLog(Logger.Level level, String message) { | ||
| System.err.format("JSVGRasterizer: %s: %s: %s", level, name, message).println(); | ||
| } | ||
| }; | ||
| } | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not very robust. Using a string does not exactly (including capitalization) match one of the existing logger levels results in no SVG being rendered. You will nothing very quickly 😆 but maybe we could be more resilient and in case the
Logger.Level.valueOf(...)log some error stating that the set log level is unsupported and then make the log level default to error?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes it's true. As we discussed, I'll push this through now so I can clean up the target platform before the nightly build and then you can improve this aspect at your leisure. You're right that in invalid value is kind of swallowed without good feedback.