added invalid char check when searching for hashtags

git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/user/news-feed@100643 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Massimiliano Assante 2014-10-13 13:44:46 +00:00
parent d9190b42ad
commit 344273b08f
3 changed files with 13 additions and 5 deletions

View File

@ -4,6 +4,9 @@
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/target/generated-sources/gwt"/>
<dependent-module archiveName="workspace-light-tree-2.13.1-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/workspace-light-tree/workspace-light-tree">
<dependency-type>uses</dependency-type>
</dependent-module>
<property name="java-output-path" value="/${module}/target/www/WEB-INF/classes"/>
<property name="context-root" value="news-feed"/>
</wb-module>

View File

@ -275,7 +275,15 @@ public class NewsFeedPanel extends Composite {
filterPanel.removeFilterSelected();
}
else if (getHashtagParam() != null) {
String hashtag = Encoder.decode(getHashtagParam());
String hashtag = "";
try {
Encoder.decode(getHashtagParam());
} catch (Exception e) {
newsPanel.clear();
newsPanel.add(new HTML("<div class=\"nofeed-message\"><div style=\"padding-top: 90px;\">" +
"We're sorry, it seems you used an invalid character, please check the hashtag</div>"));
return;
}
GWT.log("Found hashtag " + hashtag);
showFeedsByHashtag(hashtag);
filterPanel.removeFilterSelected();

View File

@ -171,10 +171,7 @@ public class TweetTemplate extends Composite {
if (showTimelineSource && feed.getVreid() != null && feed.getVreid().compareTo("") != 0) {
String vreName = feed.getVreid().substring(feed.getVreid().lastIndexOf("/")+1);
vreSource.setHTML("<a class=\"link\" style=\"font-size: 10px; white-space: nowrap;\" href=\"/group/"+vreName.toLowerCase()+"\">[" +vreName + "]</a>");
} else {
vreSource.setHTML("[multiple]");
}
}
//check if the user has his own avatar
if (feed.getThumbnailURL().endsWith("img_id=0") || !feed.getThumbnailURL().contains("?")) { //it means no avatar is set
avatarImage.setVisible(false);