[Biojava-dev] [Bug 2360] New: saving of ProfileHmm cause NullPointerException

bugzilla-daemon at portal.open-bio.org bugzilla-daemon at portal.open-bio.org
Sat Sep 8 23:20:12 UTC 2007


http://bugzilla.open-bio.org/show_bug.cgi?id=2360

           Summary: saving of ProfileHmm cause NullPointerException
           Product: BioJava
           Version: 1.5
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: dist/dp
        AssignedTo: biojava-dev at biojava.org
        ReportedBy: daniel.rohrbach at web.de


saving an untrained ProfileHMM via serialization cause a NullPointerException.
After training the model saving works well.

I used biojava 1.5 latest build 9/8/07 2:22 AM 

the stack trace:

Exception in thread "main" java.lang.NullPointerException
        at
org.biojava.bio.dist.SimpleDistribution.writeObject(SimpleDistribution.java:79)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at
java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:945)
        at
java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1461)
        at
java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392)
        at
java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150)
        at
java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1509)
        at
java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1474)
        at
java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392)
        at
java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150)
        at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:326)
        at java.util.HashSet.writeObject(HashSet.java:267)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at
java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:945)
        at
java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1461)
        at
java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392)
        at
java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150)
        at
java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1509)
        at
java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1474)
        at
java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392)
        at
java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150)
        at
java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1509)
        at
java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1474)
        at
java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392)
        at
java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150)
        at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:326)
        at biojavabugs.SingleDBBug.main(SingleDBBug.java:66)



and the code I used to create the exception

            //create the HMM
            ProfileHMM hmm = new ProfileHMM(ProteinTools.getAlphabet(),
                             12,
                             DistributionFactory.DEFAULT,
                             DistributionFactory.DEFAULT,
                             "biojava profile hmm");


            // the filename
            File load = new File("/home/dani/Desktop/hmm");

            FilePermission fp = new FilePermission(load.getAbsolutePath(),
"write");

            if(!load.createNewFile())
            {
                    throw new IOException("file '" + load.getAbsolutePath() +
"' could not be created!");
            }

            FileOutputStream fos = new FileOutputStream(load);
            ObjectOutputStream oos = new ObjectOutputStream(fos);

            //store object to disk

            //here comes the exception
            oos.writeObject(hmm);
            oos.close();

            //create an SingleDP object which we want to save and load
            DP dp = (SingleDP) DPFactory.DEFAULT.createDP(hmm);
            PairwiseDP pdp = new PairwiseDP(hmm, new DPInterpreter.Maker());


-- 
Configure bugmail: http://bugzilla.open-bio.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.



More information about the biojava-dev mailing list