Mercurial > hg > LGServices
comparison src/main/java/de/mpiwg/web/jsp/TopicPage.java @ 42:815cd86bb9ec
bug fixed: some NullPointer situations caused by null topicId
author | Zoe Hong <zhong@mpiwg-berlin.mpg.de> |
---|---|
date | Fri, 18 Dec 2015 11:50:24 +0100 |
parents | ba9515f22897 |
children | 9dbbbfd474f4 |
comparison
equal
deleted
inserted
replaced
41:ba9515f22897 | 42:815cd86bb9ec |
---|---|
89 | 89 |
90 public void forceLoadTopicSectionRelation() { | 90 public void forceLoadTopicSectionRelation() { |
91 | 91 |
92 logger.debug("forceLoadTopicSectionRelation"); | 92 logger.debug("forceLoadTopicSectionRelation"); |
93 DataProvider.getInstance().setTopicSectionRelationMap(null); | 93 DataProvider.getInstance().setTopicSectionRelationMap(null); |
94 | 94 |
95 this.loadTopic(this.topic); | 95 this.loadTopic(this.topicId); |
96 } | 96 |
97 | 97 } |
98 | 98 |
99 public void loadTopic(Long topicId0){ | |
100 | |
101 LGTopic topic = DataProvider.getInstance().getTopic(topicId0); | |
102 if(topic != null){ | |
103 this.loadTopic(topic); | |
104 }else{ | |
105 addMsg("topic [id=" + topicId + "] no found."); | |
106 } | |
107 } | |
99 | 108 |
100 public void loadTopic(String topicId0){ | 109 public void loadTopic(String topicId0){ |
101 try { | 110 try { |
102 | 111 |
103 this.topicId = Long.parseLong(topicId0); | 112 this.topicId = Long.parseLong(topicId0); |
104 | 113 |
105 LGTopic topic = DataProvider.getInstance().getTopic(topicId); | 114 this.loadTopic(this.topicId); |
106 if(topic != null){ | |
107 this.loadTopic(topic); | |
108 }else{ | |
109 addMsg("topic [id=" + topicId + "] no found."); | |
110 } | |
111 | 115 |
112 | 116 |
113 } catch (Exception e) { | 117 } catch (Exception e) { |
114 internalError(e); | 118 internalError(e); |
115 } | 119 } |
156 | 160 |
157 if(topic != null && topic.isPersistent()){ | 161 if(topic != null && topic.isPersistent()){ |
158 this.loadBranches(); | 162 this.loadBranches(); |
159 try { | 163 try { |
160 this.topic = (LGTopic)topic.clone(); | 164 this.topic = (LGTopic)topic.clone(); |
165 | |
161 this.contributors = new ArrayList<VDCUser>(); | 166 this.contributors = new ArrayList<VDCUser>(); |
162 for(Long userId : this.topic.getContributorsList()){ | 167 for(Long userId : this.topic.getContributorsList()){ |
163 VDCUser user = DataverseUtils.getUser(userId); | 168 VDCUser user = DataverseUtils.getUser(userId); |
164 if(user != null){ | 169 if(user != null){ |
165 this.contributors.add(user); | 170 this.contributors.add(user); |
196 | 201 |
197 | 202 |
198 public void deleteSection(Long sectionId) throws Exception { | 203 public void deleteSection(Long sectionId) throws Exception { |
199 // delete the record with sectionId, topicId in topicSectionRelation database table | 204 // delete the record with sectionId, topicId in topicSectionRelation database table |
200 | 205 |
201 logger.debug("delete sectionId=" + sectionId + " in topicId=" + topicId); | 206 logger.debug("delete sectionId=" + sectionId + " in topicId=" + this.topicId); |
202 | 207 |
203 DataProvider.getInstance().deleteTopicSectionRelation(topicId, sectionId); | 208 DataProvider.getInstance().deleteTopicSectionRelation(this.topicId, sectionId); |
204 | 209 |
205 | 210 |
206 // update completeSectionList | 211 // update completeSectionList |
207 this.completeSectionList = DataProvider.getInstance().getAllSectionsInTopic(topic.getId()); | 212 this.completeSectionList = DataProvider.getInstance().getAllSectionsInTopic(this.topicId); |
208 | 213 |
209 | 214 this.filter(); |
210 } | 215 } |
211 | 216 |
212 | 217 |
213 | 218 |
214 private void loadSuggestionUserList() throws Exception{ | 219 private void loadSuggestionUserList() throws Exception{ |