Project

General

Profile

« Previous | Next » 

Revision 1619

Added by Jing Tao over 21 years ago

add code to make sure subject, relationship and object is not null.

View differences:

src/edu/ucsb/nceas/metacat/RelationHandler.java
111 111
        //object = (new DocumentIdentifier(triple.getObject())).getIdentifier();
112 112
        object = MetaCatUtil.getDocIdFromString(triple.getObject());
113 113
        
114
        //put the new relation into xml_relation
115
        MetaCatUtil.debugMessage("Insert into xml_relation table", 30);
116
        tstmt.setString(1, docid);
117
        MetaCatUtil.debugMessage("Insert docid into xml_relation table" + 
114
        if (subject != null && relationship != null && object != null)
115
        {
116
        
117
          //put the new relation into xml_relation
118
          MetaCatUtil.debugMessage("Insert into xml_relation table", 30);
119
          tstmt.setString(1, docid);
120
          MetaCatUtil.debugMessage("Insert docid into xml_relation table" + 
118 121
                                docid, 30);
119
        tstmt.setString(2, packagetype);
120
        tstmt.setString(3, subject);
121
        MetaCatUtil.debugMessage("Insert subject into xml_relation table" + 
122
          tstmt.setString(2, packagetype);
123
          tstmt.setString(3, subject);
124
          MetaCatUtil.debugMessage("Insert subject into xml_relation table" + 
122 125
                               subject, 30);
123
        tstmt.setString(4, subDoctype);
124
        tstmt.setString(5, relationship);
125
        MetaCatUtil.debugMessage("Insert relationship into xml_relation table" + 
126
          tstmt.setString(4, subDoctype);
127
          tstmt.setString(5, relationship);
128
          MetaCatUtil.debugMessage("Insert relationship into xml_relation table" + 
126 129
                                relationship, 30);
127
        tstmt.setString(6, object);
128
        MetaCatUtil.debugMessage("Insert object into xml_relation table" + 
130
          tstmt.setString(6, object);
131
          MetaCatUtil.debugMessage("Insert object into xml_relation table" + 
129 132
                                object, 30);
130
        tstmt.setString(7, objDoctype);
131
        tstmt.execute();  
133
          tstmt.setString(7, objDoctype);
134
          tstmt.execute();  
135
        }//if
132 136
     
133 137
      }//for
134 138
    }//if

Also available in: Unified diff