Note that there are some explanatory texts on larger screens.

plurals
  1. PONullPointerException when writing to a file in Robocode
    primarykey
    data
    text
    <p>I get NullPointerException while trying to write to a file:</p> <pre><code> RobocodeFileWriter fileWriter=new RobocodeFileWriter("test.txt"); for (int i = 0; i &lt; state.countstates; i++) for (int j = 0; j &lt; state.countactions; j++) fileWriter.write((int) table[i][j]); } </code></pre> <p>The exception:</p> <pre><code>java.lang.NullPointerException at net.sf.robocode.host.security.ThreadManager.createRobotFileStream(ThreadManager.java:136) at robocode.RobocodeFileOutputStream.&lt;init&gt;(RobocodeFileOutputStream.java:88) at robocode.RobocodeFileOutputStream.&lt;init&gt;(RobocodeFileOutputStream.java:69) at robocode.RobocodeFileWriter.&lt;init&gt;(RobocodeFileWriter.java:69) at QTable.saveData(QTable.java:79) at MyFirstRobot.saveToFile(MyFirstRobot.java:471) at MyFirstRobot.onDeath(MyFirstRobot.java:414) at robocode.DeathEvent.dispatch(DeathEvent.java:63) at robocode.Event$HiddenEventHelper.dispatch(Event.java:259) at net.sf.robocode.security.HiddenAccess.dispatch(HiddenAccess.java:191) at net.sf.robocode.host.events.EventManager.dispatch(EventManager.java:422) at net.sf.robocode.host.events.EventManager.processEvents(EventManager.java:376) at net.sf.robocode.host.proxies.BasicRobotProxy.executeImpl(BasicRobotProxy.java:412) at net.sf.robocode.host.proxies.BasicRobotProxy.execute(BasicRobotProxy.java:121) at robocode.AdvancedRobot.execute(AdvancedRobot.java:549) at MyFirstRobot.run(MyFirstRobot.java:68) at net.sf.robocode.host.proxies.HostingRobotProxy.callUserCode(HostingRobotProxy.java:274) at net.sf.robocode.host.proxies.HostingRobotProxy.run(HostingRobotProxy.java:221) at java.lang.Thread.run(Thread.java:695) </code></pre> <p>This exception occurs even if I disable the security manager by passing -DNOSECURITY=true My robocode version is 1.8.3.0 and doing the development on Mac. Any help is appreciated. </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload