Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

Commit

Permalink
Fix null exception in more activity load: https://bugzilla.redhat.com…
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Eng committed Jun 18, 2015
1 parent 73f9283 commit 2ff4212
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
1 change: 1 addition & 0 deletions docs/release-notes.md
Expand Up @@ -56,6 +56,7 @@ Example usage in html file: `<link rel="shortcut icon" href="#{assets['img/logo/
* [1230419](https://bugzilla.redhat.com/show_bug.cgi?id=1230419) - Only show "approved" figure in version page if "Review required" is enable or value more than 0
* [1229940](https://bugzilla.redhat.com/show_bug.cgi?id=1229940) - When deleting a version or project remove links and replace icon from the activity feed
* [1230424](https://bugzilla.redhat.com/show_bug.cgi?id=1230424) - Update message "Archived" to "Deleted" in activity table
* [1231054](https://bugzilla.redhat.com/show_bug.cgi?id=1231054) - Exception when clicking "more activity" when there is no valid "editor url"

-----------------------

Expand Down
22 changes: 17 additions & 5 deletions zanata-war/src/main/java/org/zanata/ui/ActivityEntry.java
Expand Up @@ -35,6 +35,7 @@
import org.zanata.model.Activity;
import org.zanata.model.HDocument;
import org.zanata.model.HProjectIteration;
import org.zanata.model.HTextFlow;
import org.zanata.model.HTextFlowTarget;
import org.zanata.model.type.EntityType;
import org.zanata.service.ActivityService;
Expand Down Expand Up @@ -206,10 +207,13 @@ public String getEditorUrl(Activity activity) {
HProjectIteration version = (HProjectIteration) context;
HTextFlowTarget tft = (HTextFlowTarget) lastTarget;

return urlUtil.editorTransUnitUrl(version.getProject().getSlug(),
version.getSlug(), tft.getLocaleId(), tft.getTextFlow()
if (tft != null) {
return urlUtil
.editorTransUnitUrl(version.getProject().getSlug(),
version.getSlug(), tft.getLocaleId(), tft.getTextFlow()
.getLocale(), tft.getTextFlow().getDocument()
.getDocId(), tft.getTextFlow().getId());
}
} else if (activity.getActivityType() == ActivityType.UPLOAD_SOURCE_DOCUMENT) {
// not supported for upload source action
} else if (activity.getActivityType() == ActivityType.UPLOAD_TRANSLATION_DOCUMENT) {
Expand Down Expand Up @@ -360,7 +364,10 @@ public String getDocumentName(Activity activity) {

if (isTranslationUpdateActivity(activity.getActivityType())) {
HTextFlowTarget tft = (HTextFlowTarget) lastTarget;
docName = tft.getTextFlow().getDocument().getName();
HTextFlow tf = tft.getTextFlow();
if(tf != null) {
docName = tf.getDocument().getName();
}
} else if (activity.getActivityType() == UPLOAD_SOURCE_DOCUMENT
|| activity.getActivityType() == UPLOAD_TRANSLATION_DOCUMENT) {
HDocument document = (HDocument) lastTarget;
Expand All @@ -377,7 +384,9 @@ public String getLanguageName(Activity activity) {

if (isTranslationUpdateActivity(activity.getActivityType())) {
HTextFlowTarget tft = (HTextFlowTarget) lastTarget;
name = tft.getLocaleId().getId();
if (tft.getLocale() != null) {
name = tft.getLocaleId().getId();
}
} else if (activity.getActivityType() == UPLOAD_SOURCE_DOCUMENT) {
// not supported for upload source action
} else if (activity.getActivityType() == UPLOAD_TRANSLATION_DOCUMENT) {
Expand All @@ -401,7 +410,10 @@ public String getLastTextFlowContent(Activity activity) {

if (isTranslationUpdateActivity(activity.getActivityType())) {
HTextFlowTarget tft = (HTextFlowTarget) lastTarget;
content = tft.getTextFlow().getContents().get(0);
HTextFlow tf = tft.getTextFlow();
if(tf != null) {
content = tf.getContents().get(0);
}
}

return ShortString.shorten(content);
Expand Down

0 comments on commit 2ff4212

Please sign in to comment.