Other way to createSchemaNode() - jackson

ObjectMapper objectMapper = new ObjectMapper();
ObjectNode properties = objectMapper.createObjectNode();
properties.set(KEY1, createSchemaNode("string"));
properties.set(KEY2,getSchemaFor(provider,EnvironmentType.class));
properties.set(KEY3, createSchemaNode("string"));
properties.set(KEY4, createSchemaNode("string"));
Need other approach to set the properties instead of using createSchemaNode() I am trying to upgrade Jackson version from 2.8 to 2.10. After updating Jackson version to 2.10 I am facing issue with createdSchemaNode(). Because createdSchemaNode() is deprecated from Jackson databind version 2.9.0

Related

OpenAPI Generator Kotlin Jackson

I use the openapi generator kotlin module to generate kotlin classes from my openapi.yaml file. The process works fine until I try to deserialize the received JSON in my code to a kotlin class using Jackson.
This is the generated class
data class Request (
#field:JsonProperty("name")
var name: kotlin.String,
)
This is the error I get
java.lang.IllegalArgumentException: Cannot construct instance of `...package.Request` (although at least one Creator exists): cannot deserialize from Object value (no delegate- or property-based Creator)
at [Source: UNKNOWN; byte offset: #UNKNOWN]
I noticed that when I remove the "#field:" part in the generated code, then everything works like a charm.
So now my question is can I either remove the #field from the generator or make Jackson deserialize it correctly?
The versions that I use are
jackson: 2.13.1
open-api-generator (gradle plugin): 5.3.0
I had the same error and registering the Kotlin Jackson module fixed it for me: https://github.com/FasterXML/jackson-module-kotlin

Migrating NHibernate 3.3 to 5, getting Method not found: System.Data.IDbCommand NHibernate.AdoNet.AbstractBatcher.get_CurrentCommand() with SqlAzure

I am busy migrating a project from NHibernate 3.3.3.4 to 5.1.3. I have picked up an error when committing a transaction or flushing the session.
The error I am currently receiving is as follows:
Method not found: 'System.Data.IDbCommand NHibernate.AdoNet.AbstractBatcher.get_CurrentCommand()'.
I have looked into the NHibernate 5.1.3 code and release notes and I can see that there has been a change to the CurrentCommand property getter for the AbstractBacther class. In this major release of NHibernate, this property has changed from being of type IDbCommand to type DbCommand. See the difference below:
Version 3.3.x Permalink
protected IDbCommand CurrentCommand
{
get { return _batchCommand; }
}
Version 5.1.3 Permalink
protected DbCommand CurrentCommand
{
get { return _batchCommand; }
}
I am using the SqlAzureClientDriver (NHibernate.SqlAzure) for reliable SQL Azure connections. I have noticed that the latest version of NHibernate.SqlAzure is still using the IDbCommand implementation.
Has anybody else using SqlAzureClientDriver experienced this problem and been able to resolve it?
Use the NHibernate5 version of SqlAzureClientDriver which can be installed as the nuget package NHibernate5.SqlAzure.

What is the replacement of PDDocument.silentprint() in pdfbox version 2.0.0 and above?

I am switching to the pdfbox version 2.0.0 and wanted to know what is the replace for replacement of PDDocument.silentprint() in pdfbox version 2.0.0 and above?
The method PDDocument.silentprint() mentioned by the OP effectively did something like
PrinterJob job = PrinterJob.getPrinterJob();
job.setPageable(new PDPageable(this, job));
job.print();
According to the PDFBox 2.0 Migration Guide:
PDF Printing
With PDFBox 2.0.0 PDFPrinter has been removed.
Users of PDFPrinter.silentPrint() should now use this code:
PrinterJob job = PrinterJob.getPrinterJob();
job.setPageable(new PDFPageable(document));
job.print();
While users of PDFPrinter.print() should now use this code:
PrinterJob job = PrinterJob.getPrinterJob();
job.setPageable(new PDFPageable(document));
if (job.printDialog()) {
job.print();
}
Advanced use case examples can be found in th examples package under org/apache/pdfbox/examples/printing/Printing.java
Thus, for a PDDocument document the replacement for the 1.8.x
document.silentprint();
should be the 2.0.x
PrinterJob job = PrinterJob.getPrinterJob();
job.setPageable(new PDFPageable(document));
job.print();

Jackson missing colon and value in JSON after key

I'm trying to chase a bug where Jackson serializes some class ApiDeclaration { String apiVersion ... private JSONObject models } as {"apiVersion":"1.0.0", ..., "models"}" - note that "models" is a JSON key with the ':' and value missing!
This is in app where this worked before, and it's possible that a recent upgrade from Jackson 2.3.2 -> 2.7.4 may have broken this for us.
Does application code have to something particular for a "mixed bean" (i.e. a static Java class with some 'normal' fields but also a JSONObject) ?

indexOf for strings not working after struts jquery plugin 3.7.1 upgrade

I upgraded struts jquery plugin to 3.7.1 and jquery-ui.js to 1.10.4.
With my previous struts jquery plugin 3.1.1 and jquery-ui.js 1.8.15, indexOf for the strings is working. Dont know where it hit after upgrade. I get the following error.
SCRIPT5007: Unable to get value of the property 'indexOf': object is null or undefined
My code is as below.
var innerSpanId = $(this).attr('id');
var value = innerSpanId.indexOf('accountcheckbox');
Do give in your suggestions?
I was trying to get the index of strings without an object.
In upgraded jquery use the string object.
var innerSpanId = new String($(this).attr('id'));
var value = innerSpanId.indexOf('accountcheckbox');
Works Perfect!!!