Fix add duplicate listeners. Doesn't allow empty username entering credentials for provisioning. Adds handling 403 http error code.

cusax-fix
Damian Minkov 14 years ago
parent 036cab07fa
commit ff50e53314

@ -30,9 +30,7 @@
*/
public class SearchFieldUI
extends SIPCommTextFieldUI
implements Skinnable,
MouseMotionListener,
MouseListener
implements Skinnable
{
/**
* The icon indicating that this is a search field.
@ -91,33 +89,6 @@ public SearchFieldUI()
loadSkin();
}
/**
* Adds the custom mouse listeners defined in this class to the installed
* listeners.
*/
protected void installListeners()
{
super.installListeners();
if (isCallButtonEnabled)
{
getComponent().addMouseListener(this);
getComponent().addMouseMotionListener(this);
}
}
/**
* Uninstalls listeners for the UI.
*/
protected void uninstallListeners()
{
super.uninstallListeners();
getComponent().removeMouseListener(this);
getComponent().removeMouseMotionListener(this);
}
/**
* Implements parent paintSafely method and enables antialiasing.
* @param g the <tt>Graphics</tt> object that notified us
@ -210,7 +181,10 @@ protected Rectangle getVisibleEditorRect()
*/
public void mouseClicked(MouseEvent e)
{
updateCallIcon(e);
super.mouseClicked(e);
if(isCallButtonEnabled)
updateCallIcon(e);
}
/**
@ -219,7 +193,10 @@ public void mouseClicked(MouseEvent e)
*/
public void mouseEntered(MouseEvent e)
{
updateCallIcon(e);
super.mouseEntered(e);
if(isCallButtonEnabled)
updateCallIcon(e);
}
/**
@ -228,12 +205,21 @@ public void mouseEntered(MouseEvent e)
*/
public void mouseExited(MouseEvent e)
{
updateCallIcon(e);
super.mouseExited(e);
if(isCallButtonEnabled)
updateCallIcon(e);
}
public void mousePressed(MouseEvent e) {}
public void mousePressed(MouseEvent e)
{
super.mousePressed(e);
}
public void mouseReleased(MouseEvent e) {}
public void mouseReleased(MouseEvent e)
{
super.mouseReleased(e);
}
/**
* Updates the delete icon when the mouse is dragged over.
@ -241,7 +227,10 @@ public void mouseReleased(MouseEvent e) {}
*/
public void mouseDragged(MouseEvent e)
{
updateCallIcon(e);
super.mouseDragged(e);
if(isCallButtonEnabled)
updateCallIcon(e);
}
/**
@ -250,7 +239,10 @@ public void mouseDragged(MouseEvent e)
*/
public void mouseMoved(MouseEvent e)
{
updateCallIcon(e);
super.mouseMoved(e);
if(isCallButtonEnabled)
updateCallIcon(e);
}
/**

@ -159,13 +159,17 @@ private static HttpEntity executeMethod(DefaultHttpClient httpClient,
int redirects = 0;
while(response == null
|| response.getStatusLine().getStatusCode()
== HttpStatus.SC_UNAUTHORIZED)
== HttpStatus.SC_UNAUTHORIZED
|| response.getStatusLine().getStatusCode()
== HttpStatus.SC_FORBIDDEN)
{
// if we were unauthorized, lets clear the method and recreate it
// for new connection with new credentials.
if(response != null
&& response.getStatusLine().getStatusCode()
== HttpStatus.SC_UNAUTHORIZED)
&& (response.getStatusLine().getStatusCode()
== HttpStatus.SC_UNAUTHORIZED
|| response.getStatusLine().getStatusCode()
== HttpStatus.SC_FORBIDDEN))
{
if(logger.isDebugEnabled())
logger.debug("Will retry http connect and " +
@ -455,13 +459,20 @@ private static HttpEntity postForm(
HTTPCredentialsProvider prov = (HTTPCredentialsProvider)
httpClient.getCredentialsProvider();
creds = prov.getCredentials(
new AuthScope(url.getHost(), url.getPort()));
// it was user canceled lets stop processing
if(creds == null && !prov.retry())
// don't allow empty username
while(creds == null
|| creds.getUserPrincipal() == null
|| StringUtils.isNullOrEmpty(
creds.getUserPrincipal().getName()))
{
return null;
creds = prov.getCredentials(
new AuthScope(url.getHost(), url.getPort()));
// it was user canceled lets stop processing
if(creds == null && !prov.retry())
{
return null;
}
}
}

Loading…
Cancel
Save