mdsplus icon indicating copy to clipboard operation
mdsplus copied to clipboard

Java/MDSplus/Event.waitData(milliseconds) throws MdsException always

Open leewin12 opened this issue 1 year ago • 4 comments

Affiliation None

Version(s) Affected Since commit-id d360c055 (2012-12-28)

Platform(s) Any

Installation Method(s) Any

Describe the bug Event.waitData(int milliseconds) set timeout flag true at the beginning. The method throws MdsException if timeout flag is true after wait(milliseconds). Since there's no update on timeout flag anywhere, method throws MdsException always.

To Reproduce Steps to reproduce the behavior:

Not sure. I noticed it while reading the code.

Expected behavior

Not sure.

My guesses: a) Wait for milliseconds and then call getData()? b) Call getData() with a timeout?

Screenshots n/a

Additional context a) This is an old bug, so we may want to reconsider whether this method is still needed. b) I'll prepare a PR once the expected behavior is clarified.

leewin12 avatar Oct 08 '25 04:10 leewin12

Hi @leewin12,

This post doesn't answer your question about the intent of the function, but does provide additional context.

A search of the entire source code reveals that the waitData(int milliseconds) is unused. The function is defined in the Java API for the mdsobjects, java/mdsobjects/src/main/java/MDSplus/Event.java. However, it is not used in any of the Java code.

Also, a scan for waitData( in the entire source code shows that there is a C++ function in the LabVIEW API for mdsobjects that does wait for one second with a waitData(1) call. See these files:

  • mdsobjects/labview/mdseventobjectswrp.cpp
  • mdsobjects/labview/mdsobjecswrp.h
  • include/mdsobjects.h

A conjecture is that the Java waitData(int milliseconds) was intended to be used in a similar manner as the waitData() in the mdsobjects.h file. Note though the the former uses milliseconds and the latter uses seconds.

mwinkel-dev avatar Oct 08 '25 17:10 mwinkel-dev

As per @leewin12's suggestion a) above, should we just delete the Java waitData(int milliseconds) function?

mwinkel-dev avatar Oct 08 '25 17:10 mwinkel-dev

I would be happy to delete it, or at least mark it as @Deprecated

WhoBrokeTheBuild avatar Oct 15 '25 17:10 WhoBrokeTheBuild

@WhoBrokeTheBuild Thanks for guidance and your offer. I'll open a PR since it's been a low priority and your time is much more precious than mine.

leewin12 avatar Nov 09 '25 08:11 leewin12