Zay-ES-net, latest commit to fix Reverted HostedEntityData.getStringInfo() to send -1 instead of null


#1

@pspeed + @Ali_RS

This line here:

Should include 0. The very first index that is generated, is 0, not 1.

At least this is bugging me on my end:

Server-side:

and I’m getting -1 when asking remoteentitydata for legacy. Am I doing something wrong?

Kind regards,
AssoFohdz


#2

And we continue to learn valuable lessons about pushing PRs without being able to test them myself… sigh…

In this case, I don’t even know why I’m not hitting the issue locally.

Without testing/running/etc., I’m going to guess that the check should be >= 0.

I must locally use up some string IDs and then never use them on the client or something. That’s the only way I can explain not seeing this.


#3

I’m not sure if that’s the only place affected by the >0 check though. This is just where I ran into it :slight_smile:


#4

It should be the only place as it’s the case trying to decide whether or not to cache the value passed back from the server.

Just based on the logic alone, ‘0’ is clearly a gap here. The check should be >= 0 otherwise 0 gets converted to -1. I missed it on code review and somehow didn’t hit it in testing.

Edit: it’s also funny how things evolve because idiomatically speaking, I would not normally have code the block this way and would have opted for one return result at the end. The upside being you wouldn’t have hit this issue. The downside being that result=0 would never have been cached and we’d never know. Makes me think.


#5

Ah sorry, I made a mistake again on this fix for the second time I guess :frowning:, I would prefer to not be the one to fix it this time.


#6

Not sure how to test it locally. I have the Zay-ES-Net fix in a local repo, I build the .jar-file. Now I dont know how to use this local updated jar in my gradle-project (instead the one from jcenter). Any pointers? :slight_smile:


#7

In your IDE right click on your local repo of Zay-ES-Net -> tasks -> install, this will install it to your maven local (USER_HOME/.m2) now you can use it in your gradle project by adding it in dependencies.

Edit:
Also make sure to add mavenLocal() in repositories

repositories {
    
    //Uncomment this if you install local dependencies.
    mavenLocal()
}

Edit2:
You can also install it with gradle install or gradlew install command without using an IDE.


#8

But the Zay-ES-Net is not a gradle project. So I cannot use gradle install

And I already have mavenlocal added as repository for dependencies. But I can’t move it ahead of the remote maven-repo, because of other dependencies.

I just dont know how to add the Zay-ES-Net.jar to the local repo - cannot google my way to the command.


#9

Yes, it definitely is.

Edit: https://github.com/jMonkeyEngine-Contributions/zay-es/blob/master/extensions/Zay-ES-Net/build.gradle

Edit 2: check out zay-es. Run gradle install. Watch as both zay-es and zay-es-net are installed into your local m2 repo.


#10

It is, see there is already a build.gradle in it, but it also is a maven and netbeans projects too as it also has build.xml and nbproject.
If you want your IDE detects it as gradle projetc just rename build.xml to no_build.xml and nbproject to no_nbproject and restart your IDE.


#11

Ah. Not used to projects being multiple ‘types’. I just saw it in the IDE as regular Netbeans and jumped the gun.

Will try to install locally and get my game to use that jar instead of the jcenter one.


#12

I forgot those were still in there. They can be removed, I guess. One sec.

Edit: Ah, I remember why I left them… because the examples haven’t been converted to gradle yet and I was hoping that the whole thing was still buildable in netbeans (even if I haven’t tried it for 4+ years or whatever).


#13

If you have been normally using the real version then switching your project dependencies to the -SNAPSHOT version in the build.gradle files should be enough.


#14

It works. No issues after using a locally fixed snapshot version.

Only the fix already mentioned here was applied.

It’s not an exhaustive test, just a use-case test I guess.


#15

If someone makes a PR then I will merge it… and if you catch me at the right time, I might even push a patch release.


#16

I have changed the > check to >=… I may push a patch release in a second.

Edit: Done.

https://bintray.com/simsilica/Sim-tools/zay-es-net/1.4.2#files/com%2Fsimsilica%2Fzay-es-net%2F1.4.2

…hopefully it really fixes the problem finally. :wink:


#17

Cool. Thanks :slight_smile: