Tal Nisan has uploaded a new change for review.

Change subject: findbugs: Fix fingbugs errors in LoginModel class
......................................................................

findbugs: Fix fingbugs errors in LoginModel class

Change-Id: Ic6eab28be9e32b4f866d4cab7777c2b8685cb8cf
Signed-off-by: Tal Nisan <[email protected]>
---
M 
frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/system/BaseApplicationInit.java
M 
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/LoginModel.java
M 
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/userportal/UserPortalLoginModel.java
3 files changed, 25 insertions(+), 32 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/73/14473/1

diff --git 
a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/system/BaseApplicationInit.java
 
b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/system/BaseApplicationInit.java
index 0c84773..ef0b9dc 100644
--- 
a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/system/BaseApplicationInit.java
+++ 
b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/system/BaseApplicationInit.java
@@ -157,7 +157,7 @@
             @Override
             public void execute() {
                 lockInteractionManager.showLoadingIndicator();
-                getLoginModel().AutoLogin(vdcUser);
+                getLoginModel().autoLogin(vdcUser);
             }
         });
 
diff --git 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/LoginModel.java
 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/LoginModel.java
index 140e1d4..282f01b 100644
--- 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/LoginModel.java
+++ 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/LoginModel.java
@@ -21,11 +21,7 @@
 
 public class LoginModel extends Model
 {
-
-    public static final String BeginLoginStage = "BeginTest"; //$NON-NLS-1$
-    public static final String EndLoginStage = "EndTest"; //$NON-NLS-1$
-
-    public static EventDefinition LoggedInEventDefinition;
+    public final static EventDefinition loggedInEventDefinition;
     private Event privateLoggedInEvent;
 
     public Event getLoggedInEvent()
@@ -38,7 +34,7 @@
         privateLoggedInEvent = value;
     }
 
-    public static EventDefinition LoginFailedEventDefinition;
+    public final static EventDefinition loginFailedEventDefinition;
     private Event privateLoginFailedEvent;
 
     public Event getLoginFailedEvent()
@@ -132,14 +128,14 @@
 
     static
     {
-        LoggedInEventDefinition = new EventDefinition("LoggedIn", 
LoginModel.class); //$NON-NLS-1$
-        LoginFailedEventDefinition = new EventDefinition("LoginFailed", 
LoginModel.class); //$NON-NLS-1$
+        loggedInEventDefinition = new EventDefinition("LoggedIn", 
LoginModel.class); //$NON-NLS-1$
+        loginFailedEventDefinition = new EventDefinition("LoginFailed", 
LoginModel.class); //$NON-NLS-1$
     }
 
     public LoginModel()
     {
-        setLoggedInEvent(new Event(LoggedInEventDefinition));
-        setLoginFailedEvent(new Event(LoginFailedEventDefinition));
+        setLoggedInEvent(new Event(loggedInEventDefinition));
+        setLoginFailedEvent(new Event(loginFailedEventDefinition));
 
         UICommand tempVar = new UICommand("Login", this); //$NON-NLS-1$
         tempVar.setIsExecutionAllowed(false);
@@ -209,18 +205,18 @@
 
     private void UserName_EntityChanged()
     {
-        getDomain().setIsChangable(GetDomainAvailability());
+        getDomain().setIsChangable(getDomainAvailability());
     }
 
-    private boolean GetDomainAvailability()
+    private boolean getDomainAvailability()
     {
         // Check whether the user name contains domain part.
-        boolean hasDomain = GetUserNameParts((String) 
getUserName().getEntity())[1] != null;
+        boolean hasDomain = getUserNameParts((String) 
getUserName().getEntity())[1] != null;
 
         return !hasDomain;
     }
 
-    private String[] GetUserNameParts(String value)
+    private String[] getUserNameParts(String value)
     {
         if (!StringHelper.isNullOrEmpty(value))
         {
@@ -234,9 +230,9 @@
         return new String[] { "", null }; //$NON-NLS-1$
     }
 
-    public void Login()
+    public void login()
     {
-        if (!Validate())
+        if (!validate())
         {
             return;
         }
@@ -245,7 +241,7 @@
         disableLoginScreen();
 
         String fullUserName = (String) getUserName().getEntity();
-        String[] parts = GetUserNameParts(fullUserName);
+        String[] parts = getUserNameParts(fullUserName);
         String domain = parts[1];
         AsyncQuery _asyncQuery = new AsyncQuery();
         _asyncQuery.setModel(this);
@@ -258,7 +254,7 @@
                 if (result != null)
                 {
                     VdcReturnValueBase returnValue = (VdcReturnValueBase) 
result;
-                    if (returnValue != null && returnValue.getSucceeded())
+                    if (returnValue.getSucceeded())
                     {
                         user = (VdcUser) returnValue.getActionReturnValue();
                         loginModel.setLoggedUser(user);
@@ -266,10 +262,7 @@
                     if (user == null)
                     {
                         loginModel.getPassword().setEntity(""); //$NON-NLS-1$
-                        if (returnValue != null)
-                        {
-                            
loginModel.setMessage(Linq.firstOrDefault(returnValue.getCanDoActionMessages()));
-                        }
+                        
loginModel.setMessage(Linq.firstOrDefault(returnValue.getCanDoActionMessages()));
                         loginModel.getUserName().setIsChangable(true);
                         loginModel.getPassword().setIsChangable(true);
                         loginModel.getDomain().setIsChangable(true);
@@ -295,7 +288,7 @@
         AsyncDataProvider.initCache(this);
     }
 
-    public void AutoLogin(VdcUser user)
+    public void autoLogin(VdcUser user)
     {
         loggingInAutomatically = true;
         getUserName().setEntity(user.getUserName());
@@ -312,7 +305,7 @@
         getLoginCommand().setIsExecutionAllowed(false);
     }
 
-    protected boolean Validate()
+    protected boolean validate()
     {
         getUserName().validateEntity(new IValidation[] { new 
NotEmptyValidation() });
         getPassword().validateEntity(new IValidation[] { new 
NotEmptyValidation() });
@@ -328,15 +321,15 @@
 
         if (command == getLoginCommand())
         {
-            Login();
+            login();
         }
         else if (StringHelper.stringsEqual(command.getName(), "Cancel")) 
//$NON-NLS-1$
         {
-            Cancel();
+            cancel();
         }
     }
 
-    public void Cancel()
+    public void cancel()
     {
         setWindow(null);
     }
diff --git 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/userportal/UserPortalLoginModel.java
 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/userportal/UserPortalLoginModel.java
index 1b74f5f..3ca2a33 100644
--- 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/userportal/UserPortalLoginModel.java
+++ 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/userportal/UserPortalLoginModel.java
@@ -179,10 +179,10 @@
     }
 
     @Override
-    public void Login()
+    public void login()
     {
         // Completely override the base class functionality.
-        if (!Validate())
+        if (!validate())
         {
             return;
         }
@@ -243,9 +243,9 @@
     }
 
     @Override
-    protected boolean Validate()
+    protected boolean validate()
     {
-        boolean baseValidation = super.Validate();
+        boolean baseValidation = super.validate();
 
         if (getIsChangingPassword())
         {


--
To view, visit http://gerrit.ovirt.org/14473
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic6eab28be9e32b4f866d4cab7777c2b8685cb8cf
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Tal Nisan <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to