You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Greetings, when using the latest release of Schema Spy, 6.2.4, this line throws a big ugly stack trace when trying to create the HTML output due to trying to trim a null reference.
I updated and compiled a jar locally after changing that line to entry.getValue() == null ? "" : entry.getValue().trim()) and everything was peachy. Seems like a fairly quick and harmless fix, or at least it did the trick for me.
I'm by no means a database or Java expert, but evidently it's possible when using Microsoft SQL (Azure SQL) to have a null value returned for that property. Can't speak to much beyond the fact that that is true of our production database unfortunately.
Expected Behavior
Schema Spy gracefully handles null values returned for that property.
Current Behavior
Terminating error, causing partial rendering of the images and web assets.
.....Exception in thread "main" java.lang.reflect.InvocationTargetException
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(Unknown Source)
at java.base/java.lang.reflect.Method.invoke(Unknown Source)
at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48)
at org.springframework.boot.loader.Launcher.launch(Launcher.java:87)
at org.springframework.boot.loader.Launcher.launch(Launcher.java:51)
at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:52)
Caused by: java.lang.NullPointerException: Cannot invoke "String.trim()" because the return value of "java.util.Map$Entry.getValue()" is null
at org.schemaspy.view.HtmlConstraintsPage.lambda$collectCheckConstraints$1(HtmlConstraintsPage.java:83)
at java.base/java.util.stream.ReferencePipeline$3$1.accept(Unknown Source)
at java.base/java.util.TreeMap$EntrySpliterator.forEachRemaining(Unknown Source)
at java.base/java.util.stream.AbstractPipeline.copyInto(Unknown Source)
at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(Unknown Source)
at java.base/java.util.stream.ForEachOps$ForEachOp.evaluateSequential(Unknown Source)
at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(Unknown Source)
at java.base/java.util.stream.AbstractPipeline.evaluate(Unknown Source)
at java.base/java.util.stream.ReferencePipeline.forEach(Unknown Source)
at java.base/java.util.stream.ReferencePipeline$7$1.accept(Unknown Source)
at java.base/java.util.stream.ReferencePipeline$2$1.accept(Unknown Source)
at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(Unknown Source)
at java.base/java.util.stream.AbstractPipeline.copyInto(Unknown Source)
at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(Unknown Source)
at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(Unknown Source)
at java.base/java.util.stream.AbstractPipeline.evaluate(Unknown Source)
at java.base/java.util.stream.ReferencePipeline.collect(Unknown Source)
at org.schemaspy.view.HtmlConstraintsPage.collectCheckConstraints(HtmlConstraintsPage.java:85)
at org.schemaspy.view.HtmlConstraintsPage.write(HtmlConstraintsPage.java:64)
at org.schemaspy.SchemaAnalyzer.generateHtmlDoc(SchemaAnalyzer.java:443)
at org.schemaspy.SchemaAnalyzer.analyze(SchemaAnalyzer.java:289)
at org.schemaspy.SchemaAnalyzer.analyze(SchemaAnalyzer.java:135)
at org.schemaspy.cli.SchemaSpyRunner.runAnalyzer(SchemaSpyRunner.java:109)
at org.schemaspy.cli.SchemaSpyRunner.run(SchemaSpyRunner.java:98)
at org.schemaspy.Main.main(Main.java:55)
... 6 more
Possible Solution
Some logic to only call trim() if the object isn't null. entry.getValue() == null ? "" : entry.getValue().trim()) worked for my use case.
Steps to Reproduce (for bugs)
I'm going to do a bad job filling this out :(. If really necessary I can provide a Docker compose file that will likely reproduce the problem, but I'd have to dig for a bit to figure out what in the db is causing a null value to be returned.
Happy to do so if necessary, but I think this might be simple enough that that's overkill. Please do let me know.
Context
Use Schema Spy against MS SQL
Microsoft SQL (Azure)
mssql-jdbc JRE 11 (latest)
Your DDL (sample how to reproduce the issue):
Full command including arguments how you run SchemaSpy:
It's the following query select OBJECT_NAME(parent_object_id) as table_name, name AS constraint_name, definition as text from sys.check_constraints
That returns null for the text alias of definition in sys.check_constraints
Are you able to run the query as well as just list columns in sys.check_constraints. I wonder if they might have changed the column name or something like that. Since it would be strange from a db perspective to have a check constraints thats missing the check definition.
There might be a scenario that I'll look into if they have any secondary columns that defines a function or something like that.
If the table is empty we are creating an empty entry when nothing should be added.
Greetings, when using the latest release of Schema Spy, 6.2.4, this line throws a big ugly stack trace when trying to create the HTML output due to trying to trim a null reference.
I updated and compiled a jar locally after changing that line to
entry.getValue() == null ? "" : entry.getValue().trim())
and everything was peachy. Seems like a fairly quick and harmless fix, or at least it did the trick for me.I'm by no means a database or Java expert, but evidently it's possible when using Microsoft SQL (Azure SQL) to have a null value returned for that property. Can't speak to much beyond the fact that that is true of our production database unfortunately.
Expected Behavior
Schema Spy gracefully handles null values returned for that property.
Current Behavior
Terminating error, causing partial rendering of the images and web assets.
Possible Solution
Some logic to only call
trim()
if the object isn't null.entry.getValue() == null ? "" : entry.getValue().trim())
worked for my use case.Steps to Reproduce (for bugs)
I'm going to do a bad job filling this out :(. If really necessary I can provide a Docker compose file that will likely reproduce the problem, but I'd have to dig for a bit to figure out what in the db is causing a null value to be returned.
Happy to do so if necessary, but I think this might be simple enough that that's overkill. Please do let me know.
Context
Use Schema Spy against MS SQL
schemaspy.jar -t "mssql17" -db "test" -dp "lib/mssql17-jdbc.jar" -s "dbo" -u "test" -p "test" -host "test.database.windows.net" -o /var/www/html -hq -vizjs
Your Environment
eclipse-temurin:21-jre-alpine
as a base Docker imageThe text was updated successfully, but these errors were encountered: