List of usage examples for com.google.gwt.rpc.client.impl RemoteException RemoteException
public RemoteException()
From source file:org.smartsnip.server.ISnippetImpl.java
@Override public void addComment(long id, String comment) throws NoAccessException, NotFoundException { if (comment == null || comment.isEmpty()) return;//from w w w . j av a 2 s. co m Session session = getSession(); if (!session.getPolicy().canComment(session)) throw new NoAccessException(); User user = session.getUser(); if (user == null) throw new NoAccessException(); Snippet snippet = Snippet.getSnippet(id); if (snippet == null) throw new NotFoundException("Snippet with id " + id + " not found"); try { Comment objComment = null; objComment = snippet.addComment(comment, user); logInfo("Added new comment with id=" + objComment.getHashID()); } catch (IOException e) { logError("IOException during adding a new comment: " + e.getMessage()); System.err .println("IOException during creating of new comment on snippet " + id + ": " + e.getMessage()); e.printStackTrace(System.err); throw new RemoteException(); } if (!snippet.getOwner().equals(user)) notifyUser(snippet.getOwnerUsername(), user.getUsername() + " commented on your snippet", "Snippet " + snippet.getName()); }