Screw Ups

People screw up, and I definitely do, too. But let me start with other people screwing up first: Dr. Nguyen told me today that he couldn’t run DrJava in Symonds II lab. When we looked at the situation together, we determined that the file (actually, pretty much the entire user drive) that DrJava uses for its preferences file (.drjava) was neither readable nor writable. IT screwed up.

Fortunately, I had earlier fixed DrJava bug 1543649 and could provide the following work-around:

Note for Rice Users Fall 2006: The IT department seems to have configured its network server for the ADRICE domain improperly, preventing DrJava to access its preferences file in the user’s home directory (typically U:\pcprofile\.drjava). This prevents DrJava from saving its preferences and under some circumstances even prevents it from starting. Until the IT department fixes this problem, here is a work-around:

  1. Download the latest version of DrJava as a jar file (drjava-stable-20060821-1502 or later)
  2. Save the file to a directory on the computer’s local drive, i.e. C:\ not somewhere on U:\
  3. Open a command shell by clicking on the “Start” button, selecting “Run…”, typing in “cmd” in the edit field, and pressing “OK”.
  4. Change into the directory where you saved the DrJava jar file. Example: If you saved it to C:\Temp, then you would type in the following commands in the command shell, each followed by pressing the “return” key:
    • C:
    • cd \Temp
  5. Now you’re in the directory with the DrJava jar file and you can run it. However, because of the IT department problems, you have to start it differently and specify an alternate preferences file using the -config switch. This is how you do it:
    • java -jar drjava.jar -config drjava.cfg
  6. Depending on the name of the DrJava version you downloaded, you may have to change the name of the DrJava jar file, e.g. from drjava.jar to drjava-stable-20060821-1502.jar.
  7. You should also make sure that the alternate preferences file, in this example drjava.cfg, does not initially exist. Just choose a name that is not in use. That will make DrJava start out with everything at the default preferences. All changes to the preferences will be saved to that file.
  8. When you start DrJava again later and want to re-use the preferences from the last execution, make sure to start from the same directory and specify the same alternate preferences file, in this example drjava.cfg. That will make DrJava re-load the preferences you saved when you last quit DrJava.
  9. If you need any help while the IT department resolves this problem, please let us know.

I’m always utterly amazed by how thorougly IT manages to screw the instructors over. Out of the, oh, ten semesters I guess that maybe three went smoothly. They even swapped the versions of Microsoft Office after Dr. Nguyen had ordered the textbooks!

Now to me screwing up: I’ve started instrumenting DrJava, and DrJava is a bit bigger than the test files I’ve worked with before. One of the situations that I ran into for the first time was a short that was “so large”, Java interpreted it as negative (Java only has signed datatypes). Negative array indices are sort of problematic. Now I’ve switched the entire codebase to using int and added a few assert statements to make sure that the numbers are equal to or less than unsigned 0xffff. I hope I found all of the places. My unit tests pass, but I think I’ll have to look around a little bit more.

Anyway, just as a test, I decided to write a simple external XML file and then run DrJava. Both the XML file and the resulting log are shown below:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<?xml version="1.0" encoding="UTF-8"?>
<concutest>
  <threadcheck>
    <edu>
      <rice>
        <cs>
          <drjava>
            <DrJava>
              <method sig="main([Ljava/lang/String;)V">
                <name type="not" value="main"/>
              </method>
            </DrJava>
          </drjava>
        </cs>
      </rice>
    </edu>
  </threadcheck>
</concutest>

When DrJava is run, the main method is of course entered by the main thread, so the annotation is violated:

Thread Name Violation: NotRunBy
        Current thread 'main', id 1, group 'main'
        Natched disallowed pattern 'main'
        at edu.rice.cs.drjava.DrJava.main (DrJava.java:-1)

Again I didn’t get to writing a class/jar browser that allows the developer to write these XML files more easily (or perhaps to generate them from the annotations), but at least I did get started with DrJava, and I improved the file instrumentor a little.

Now it’s time to sleep. Oh no wait, it’s not. It’s past 7 AM. I guess it’s time to get up. I have an appointment at 9:30 AM.

Share

About Mathias

Software development engineer. Principal developer of DrJava. Recent Ph.D. graduate from the Department of Computer Science at Rice University.
This entry was posted in Concurrent Unit Testing, DrJava, Uncategorized. Bookmark the permalink.

Leave a Reply