a1aw / ev3dev-lang-java

An ev3dev unified language binding for Java.
https://mob41.github.io/ev3dev-lang-java/
MIT License
0 stars 0 forks source link

The program jumps FileNotFoundException if the motor/sensor is removed. #1

Closed a1aw closed 8 years ago

a1aw commented 8 years ago

This is a critical bug Invalid Error Handling in this API. Probably this problem exists as all the sub-classes (e.g. Sensor, Motor) DOES NOT extends the Device class.

TODO:

a1aw commented 8 years ago

No tests are being ran at this time.

a1aw commented 8 years ago

The commit 6e38ad5 can easily lock the Device with a LegoPort and some class name (e.g. tacho-motor, lego-sensor)

a1aw commented 8 years ago

However, no tests were ran last 10 minutes. I am running tests on the recently commit 0534481d8998a85ff48818f517296dc9f273e528

a1aw commented 8 years ago

Test had failed 1/4. The motor can't auto-reconnect as the exception just stopped the thread.

a1aw commented 8 years ago

Test had failed 3/4. But, the motor can reconnect successfully. Yeah!

However, the file-system throws me a "Permission Denied" error. Delay?

Exception in thread "main" java.io.FileNotFoundException: /sys/class/tacho-motor/motor13/duty_cycle_sp (Permission denied)
        at java.io.FileOutputStream.open(Native Method)
        at java.io.FileOutputStream.<init>(FileOutputStream.java:221)
        at java.io.FileOutputStream.<init>(FileOutputStream.java:110)
        at java.io.PrintWriter.<init>(PrintWriter.java:184)
        at ev3dev.io.Sysclass.setProperty(Sysclass.java:102)
        at ev3dev.hardware.Device.setProperty(Device.java:134)
        at ev3dev.hardware.Device.setProperty(Device.java:118)
        at ev3dev.hardware.motors.Motor.setDutyCycleSP(Motor.java:201)
        at ev3dev.tests.TestOnEV3.main(TestOnEV3.java:18)

It is probably a bug?, or protection?

a1aw commented 8 years ago

Ha, this error FileNotFoundException of No such file exist SHOULD be exist. And the connected variable is only to be set when reading/writing to a property fails. Close.