Maven ComparableVersion contains a bug of "Load of known null value" - maven

https://github.com/apache/maven/blob/master/maven-artifact/src/main/java/org/apache/maven/artifact/versioning/ComparableVersion.java
The SpotBugs found this Load of known null value:
Load of known null value in package.ComparableVersion$ListItem.compareTo(ComparableVersion$Item) [package.ComparableVersion$ListItem] At ComparableVersion.java:[line 513] NP_LOAD_OF_KNOWN_NULL_VALUE
in the line of
int result = l == null ? (r == null ? 0 : -1 * r.compareTo(l))
: l.compareTo(r);
Environment:
Tryied both Windows command line and Eclipse
spotbugs-maven-plugin version: tried both 3.1.6 and 3.1.12
Maven version: 3.5.3
Java version: 1.8.0_171
May I ask how to fix it? Thank you so much!

Related

org.aspectj.apache.bcel.classfile.ClassFormatException: Invalid byte tag in constant pool: 15

Getting following error while run spring application
org.aspectj.apache.bcel.classfile.ClassFormatException: Invalid byte tag in constant pool: 15
at org.aspectj.apache.bcel.classfile.Constant.readConstant(Constant.java:133)
at org.aspectj.apache.bcel.classfile.ConstantPool.(ConstantPool.java:45)
at org.aspectj.apache.bcel.classfile.ClassParser.readConstantPool(ClassParser.java:186)
at org.aspectj.apache.bcel.classfile.ClassParser.parse(ClassParser.java:131)
at org.aspectj.apache.bcel.util.ClassLoaderRepository.loadClass(ClassLoaderRepository.java:323)
at org.aspectj.weaver.bcel.BcelWorld.lookupJavaClass(BcelWorld.java:390)
at org.aspectj.weaver.bcel.BcelWorld.resolveDelegate(BcelWorld.java:373)
at org.aspectj.weaver.ltw.LTWWorld.resolveDelegate(LTWWorld.java:111)
at org.aspectj.weaver.World.resolveToReferenceType(World.java:452)
at org.aspectj.weaver.World.resolve(World.java:298)
at org.aspectj.weaver.World.resolve(World.java:211)
at org.aspectj.weaver.bcel.BcelGenericSignatureToTypeXConverter.classTypeSignature2TypeX(BcelGenericSignatureToTypeXConverter.java:95)
at org.aspectj.weaver.bcel.BcelGenericSignatureToTypeXConverter.classTypeSignature2TypeX(BcelGenericSignatureToTypeXConverter.java:41)
at org.aspectj.weaver.bcel.BcelObjectType.ensureGenericSignatureUnpacked(BcelObjectType.java:807)
at org.aspectj.weaver.bcel.BcelObjectType.getDeclaredInterfaces(BcelObjectType.java:255)
at org.aspectj.weaver.ReferenceType.getDeclaredInterfaces(ReferenceType.java:625)
at org.aspectj.weaver.ResolvedType.getDirectSupertypes(ResolvedType.java:76)
at org.aspectj.weaver.patterns.TypePattern.matchesSubtypes(TypePattern.java:179)
at org.aspectj.weaver.patterns.ExactTypePattern.matchesSubtypes(ExactTypePattern.java:74)
at org.aspectj.weaver.patterns.TypePattern.matchesStatically(TypePattern.java:131)
at org.aspectj.weaver.patterns.OrTypePattern.matchesStatically(OrTypePattern.java:76)
at org.aspectj.weaver.patterns.SignaturePattern.matchesExactlyMethod(SignaturePattern.java:505)
I am using JDK 1.8 and spring version 3.0.5.RELEASE
Can you please let me know what is wrong?

Java class generated from protobuf has compilation errors

I'm trying to generated java classes from protobuf.
Below is my protobuf -
syntax = "proto2";
package part2;
option java_package = "part2";
message OnlineStoreUser {
required int32 userid = 1;
required string username = 2;
optional string useremail = 3;
}
I run the command main/exec/protoc --java_out=main/java main/proto/datamodel.proto
The protoc is downloaded from
link https://github.com/protocolbuffers/protobuf/releases/tag/v3.7.1 where osx-x86_64.zip. I tried version 3.8.0 and 3.9.1 as well.
First error is https://gist.github.com/rajcspsg/07c1ddb889410397ba6fc6f26ab2b158#file-gistfile1-txt-L78. The argument to this function UnusedPrivateParameter type is not found.
Second error is https://gist.github.com/rajcspsg/07c1ddb889410397ba6fc6f26ab2b158#file-gistfile1-txt-L890. The is no 2 arg overloaded version of internalBuildGeneratedFileFrom.
What is wrong with my proto file. How can I fix this issue?
Make sure the dependency that you're using in your code is the same as the one that you used as protobuf compiler, for example, here I'm using gradle:
compile group: 'com.google.protobuf', name: 'protobuf-java', version: '3.11.1'
And the for my compiler version is:
✗ protoc --version
libprotoc 3.11.1
Here's my test event:
syntax = "proto2";
option java_package = "com.github.irvifa.protobuf.schema";
message TestEvent {
optional string event_name = 1 [default = "test.event"];
optional string name = 2;
optional string email = 3;
}
And this works.
The errors you mention only happen for me with version 3.9.1. Version 3.7.1 generates a file that doesn't use the UnusedPrivateParameter or the version of internalBuildGeneratedFileFrom with 2 parameters. It rather uses the version with 3 parameters, which does not cause any errors.
Please check that you are using the correct protoc version:
$ main/exec/protoc --version
libprotoc 3.7.1

How to resolve (javaVersionNum != sparkJavaVersion) when starting SparkR in RStudio

I get the following error:
Error in if (javaVersionNum != sparkJavaVersion) { :
missing value where TRUE/FALSE needed
when I try to start a SparkR session in Rstudio.
How can I possibly resolve this?
The first check if the JAVA_HOME is defined.
Sys.getenv("JAVA_HOME")
Surely it is not defined. Not all java versions work. Version 1.8 works. To define it and always be sure it works.
if (nchar(Sys.getenv("JAVA_HOME")) < 1) {
Sys.setenv(JAVA_HOME = "/Library/Java/JavaVirtualMachines/jdk1.8.0_192.jdk/Contents/Home/")
}

Joda dateTime Exception

We are getting this exception only with componentTests (service tests).
> com.thoughtworks.xstream.converters.ConversionException: Cannot create
> org.joda.time.chrono.ISOChronology$Stub by JDK serialization : null :
> Cannot create org.joda.time.chrono.ISOChronology$Stub by JDK
> serialization : null
> ---- Debugging information ---- message             : Cannot create org.joda.time.chrono.ISOChronology$Stub by JDK serialization : null
> cause-exception     :
> com.thoughtworks.xstream.converters.reflection.ObjectAccessException
> cause-message       : Cannot create
> org.joda.time.chrono.ISOChronology$Stub by JDK serialization : null
> class               :
> com.orbitz.tbs.model.txn.reservation.ReservationInfo
> required-type       : org.joda.time.chrono.ISOChronology$Stub
> path                :
> /com.orbitz.tbs.model.txn.reservation.ReservationInfo/reservationsByLocator/entry/com.orbitz.tbs.model.txn.BookReservation/reservationDate/iChronology
When we actually run the code, we don't get any errors. Can anyone tell me what library versions should we use?
We updated to JDK 8 from 6 and that is when we started getting this error.

Support of HAVING for Sphinx running in Heroku

I have the following query:
search(params[:query],
with: { tag_id: params[:filter].values.flatten },
group_by: :technology_id,
having: "COUNT(*)=#{params[:filter].size}"
)
This is working locally, but when I deploy to heroku it throws:
ActionView::Template::Error (sphinxql: syntax error, unexpected IDENT, expecting $end
near 'HAVING COUNT(*)=1 LIMIT 0, 20; SHOW META' - SELECT *, groupby() AS
sphinx_internal_group, id AS sphinx_document_id, count(DISTINCT sphinx_document_id) AS
sphinx_internal_count FROM `technology_core` WHERE MATCH('cancer') AND `tag_id` IN (1) AND
`sphinx_deleted` = 0 GROUP BY `technology_id` HAVING COUNT(*)=1 LIMIT 0, 20; SHOW META):
The sphinx version is specified as follows:
# config/thinking_sphinx.yml
test:
mysql41: 9307
production:
version: '2.2.6'
Anyone knows what else could be?
At this point in time, the latest Sphinx version available on Flying Sphinx servers is 2.2.3 - can you change the version in your thinking_sphinx.yml, deploy and run rebuild/regenerate, and see if HAVING works?

Resources