pentaho / pdi-sdk-plugins

PDI SDK plugins
111 stars 156 forks source link

java.lang.NoSuchMethodError: org.pentaho.di.core.Const.isEmpty #31

Closed Mutley5000 closed 8 years ago

Mutley5000 commented 8 years ago

Is anyone else getting this error with plugin development?

java.lang.NoSuchMethodError: org.pentaho.di.core.Const.isEmpty(Ljava/lang/CharSequence;)Z

I've been getting this everywhere I've been checking input fields for content e.g.

if ( !Const.isEmpty( filenameField ))

and have been working around the error by entering the method contents directly e.g.

if (filenameField != null || filenameField.length())

The error doesn't seem to occur when checking arrays but it does for strings. It's weird that it compiles fine. I only encounter the error when adding it to Spoon and testing it. I can't figure out what the problem is. Has anyone else noticed this? Thanks for your time.

Kind regards,

Braydon

matthewtckr commented 8 years ago

The Const.isEmpty( CharSequence ) method is only available in the master branch of the kettle-core artifact. You'll want to use the kettle artifacts for the given release of spoon, which has other versions of the isEmpty() method.

Mutley5000 commented 8 years ago

I see. I'll give that a go. Thank you.

Mutley5000 commented 8 years ago

Well, thank you Matthew once again. I changed my plugin pom.xml to have the version of Spoon I am running for the version of kettle-core and rebuilt the plugin. When I tested the plugin I no longer had the issue.

So just out of interest (probably a really noob question but anyway) why is there the difference between the master (which seems what the SNAPSHOTS are built from) and the release? And also does this mean that I need to have a version of my plugin for each release of Pentaho?

matthewtckr commented 8 years ago

The master branch (and snapshots) are in-development code that is typically for the next version to be released, We maintain compatibility within a major version (e.g. 4.x, 5.x, or 6.x), and may deprecate and/or remove in newer major versions.

Historically, ABI has maintained much better compatibility even across major versions, so it's not typically necessary to have a "5.x" and a "6.x" version, though there may be new features that aren't available without building on the newer API versions.

There is a bug report about the isEmpty methods in the master branch, which is being looked into.