This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JNI help needed: adding jstrings to jobjectArray

 
Matt Senecal
Ranch Hand
Posts: 255
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm trying to add jstrings to a jobjectArray, but I keep getting ArrayStoreExceptions, and I can't figure out why.
The array is declared here:

The string I'm adding is a field from a C struct. The C struct is defined as:

I'm doing the conversion and add here:

And that's where the exception is thrown. As far as I can tell, this should work. Am I missing something?
 
Matt Senecal
Ranch Hand
Posts: 255
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This goes under the "dumb mistake" category. I was declaring the array to be:

Which is an array of String arrays. Oops! What I wanted was an array of Strings:
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic