Checkstyle et checkstyle plus mechant ^^
authorDa Risk <darisk972@gmail.com>
Thu, 18 Feb 2010 20:02:01 +0100
changeset 677 b8d5e0378bcb
parent 676 ed7f90128426
child 681 9ca0e29b386f
child 685 bd5bddda04dd
Checkstyle et checkstyle plus mechant ^^
src/com/beem/project/beem/ui/Chat.java
tools/checkstyle.xml
--- a/src/com/beem/project/beem/ui/Chat.java	Thu Feb 18 19:43:54 2010 +0100
+++ b/src/com/beem/project/beem/ui/Chat.java	Thu Feb 18 20:02:01 2010 +0100
@@ -330,10 +330,10 @@
 	    mChat.removeMessageListener(mMessageListener);
 	}
 	mChat = mChatManager.getChat(contact);
-	if (mChat != null){
+	if (mChat != null) {
 	    mChat.setOpen(true);
 	    mChat.addMessageListener(mMessageListener);
-	    mChatManager.deleteChatNotification(mChat);	
+	    mChatManager.deleteChatNotification(mChat);
 	}
 	mContact = mRoster.getContact(contact.getJID());
 	if (mContact == null)
@@ -382,7 +382,7 @@
 		}
 
 		if (m.getBody() != null) {
-		    if (lastMessage == null || ! fromBareJid.equals(lastMessage.getBareJid())) {
+		    if (lastMessage == null || !fromBareJid.equals(lastMessage.getBareJid())) {
 			lastMessage = new MessageText(fromBareJid, name, m.getBody());
 			result.add(lastMessage);
 		    } else {
@@ -514,7 +514,7 @@
 			if (msg.getType() == Message.MSG_TYPE_ERROR) {
 			    mListMessages.add(new MessageText(fromBareJid, mContact.getName(), msg.getBody(), true));
 			    mMessagesListAdapter.notifyDataSetChanged();
-			} else if (msg.getBody() != null ) {
+			} else if (msg.getBody() != null) {
 			    MessageText lastMessage = mListMessages.size() != 0 ? mListMessages.get(mListMessages
 				.size() - 1) : null;
 
@@ -796,6 +796,9 @@
 	}
     }
 
+    /**
+     * This class is in charge of getting the new chat in the activity if someone talk to you.
+     */
     private class ChatManagerListener extends IChatManagerListener.Stub {
 
 	/**
@@ -808,12 +811,10 @@
 	public void chatCreated(IChat chat, boolean locally) {
 	    if (locally)
 		return;
-	    Log.d(TAG, "Chat created not locally" );
 	    try {
 		String contactJid = StringUtils.parseBareAddress(mContact.getJID());
 		String chatJid = StringUtils.parseBareAddress(chat.getParticipant().getJID());
-		if (chatJid.equals(contactJid)){
-		    Log.d(TAG, "Switching chat contact was the same");
+		if (chatJid.equals(contactJid)) {
 		    // This should not be happened but to be sure
 		    if (mChat != null) {
 			mChat.setOpen(false);
@@ -822,10 +823,10 @@
 		    mChat = chat;
 		    mChat.setOpen(true);
 		    mChat.addMessageListener(mMessageListener);
-		    mChatManager.deleteChatNotification(mChat);	
+		    mChatManager.deleteChatNotification(mChat);
 		}
 	    } catch (RemoteException ex) {
-		Log.d(TAG, "A remote exception occurs during the creation of a chat", ex);
+		Log.e(TAG, "A remote exception occurs during the creation of a chat", ex);
 	    }
 	}
     }
--- a/tools/checkstyle.xml	Thu Feb 18 19:43:54 2010 +0100
+++ b/tools/checkstyle.xml	Thu Feb 18 20:02:01 2010 +0100
@@ -171,18 +171,34 @@
 	<!-- Checks for whitespace                               -->
 	<!-- See http://checkstyle.sf.net/config_whitespace.html -->
 	<module name="EmptyForIteratorPad"/>
-	<module name="GenericWhitespace"/>
-	<module name="MethodParamPad"/>
-	<module name="NoWhitespaceAfter"/>
-	<module name="NoWhitespaceBefore"/>
+	<module name="GenericWhitespace">
+	    <property name="severity" value="error"/>
+	</module>
+	<module name="MethodParamPad">
+	    <property name="severity" value="error"/>
+	</module>
+	<module name="NoWhitespaceAfter">
+	    <property name="severity" value="error"/>
+	</module>
+	<module name="NoWhitespaceBefore">
+	    <property name="severity" value="error"/>
+	</module>
 	<module name="OperatorWrap"/>
-	<module name="ParenPad"/>
-	<module name="TypecastParenPad"/>
+	<module name="ParenPad">
+	    <property name="severity" value="error"/>
+	</module>
+	<module name="TypecastParenPad">
+	    <property name="severity" value="error"/>
+	</module>
 	<!-- We want mixed tabulation
 	  <module name="TabCharacter"/> 
 	  -->
-	<module name="WhitespaceAfter"/>
-	<module name="WhitespaceAround"/>
+	<module name="WhitespaceAfter">
+	    <property name="severity" value="error"/>
+	</module>
+	<module name="WhitespaceAround">
+	    <property name="severity" value="error"/>
+	</module>
 
 
 	<!-- Modifier Checks                                    -->