Fixes warnings.

cusax-fix
Lyubomir Marinov 13 years ago
parent 74c2b852d1
commit d18143cf6d

@ -1043,9 +1043,14 @@ private static String getThumbprint(Certificate cert, String algorithm)
byte[] encodedCert = cert.getEncoded(); byte[] encodedCert = cert.getEncoded();
StringBuilder sb = new StringBuilder(encodedCert.length * 2); StringBuilder sb = new StringBuilder(encodedCert.length * 2);
Formatter f = new Formatter(sb); Formatter f = new Formatter(sb);
for (byte b : digest.digest(encodedCert)) try
{
for (byte b : digest.digest(encodedCert))
f.format("%02x", b);
}
finally
{ {
f.format("%02x", b); f.close();
} }
return sb.toString(); return sb.toString();
} }

@ -150,7 +150,7 @@ public void commitPage()
* Empty interface method implementation, unused in the case of the * Empty interface method implementation, unused in the case of the
* {@link EmptyAccountRegistrationWizardPage} * {@link EmptyAccountRegistrationWizardPage}
*/ */
public void changedUpdate(@SuppressWarnings("unused") DocumentEvent e) public void changedUpdate(DocumentEvent e)
{ {
} }

@ -49,7 +49,7 @@ public AutoAnswerMenu()
loadSkin(); loadSkin();
this.registerMenuItems(this); registerMenuItems(this);
} }
/** /**

@ -139,8 +139,7 @@ public void publishStatus(
else else
{ {
loginManager.setManuallyDisconnected(true); loginManager.setManuallyDisconnected(true);
GuiActivator.getUIService().getLoginManager() LoginManager.logoff(protocolProvider);
.logoff(protocolProvider);
} }
} }
else if (registrationState != RegistrationState.REGISTERED else if (registrationState != RegistrationState.REGISTERED
@ -156,8 +155,7 @@ else if (!status.isOnline()
== RegistrationState.UNREGISTERING)) == RegistrationState.UNREGISTERING))
{ {
loginManager.setManuallyDisconnected(true); loginManager.setManuallyDisconnected(true);
GuiActivator.getUIService().getLoginManager() LoginManager.logoff(protocolProvider);
.logoff(protocolProvider);
} }
if(rememberStatus) if(rememberStatus)
@ -247,8 +245,7 @@ else if (itemName.equals(GlobalStatusEnum.OFFLINE_STATUS))
saveStatusInformation( protocolProvider, saveStatusInformation( protocolProvider,
itemName); itemName);
GuiActivator.getUIService().getLoginManager() LoginManager.logoff(protocolProvider);
.logoff(protocolProvider);
continue; continue;
} }

@ -535,9 +535,17 @@ public void actionPerformed(ActionEvent e)
lastAvatarDir = file.getParentFile(); lastAvatarDir = file.getParentFile();
FileInputStream in = new FileInputStream(file); FileInputStream in = new FileInputStream(file);
byte buffer[] = new byte[in.available()]; byte[] buffer;
in.read(buffer);
try
{
buffer = new byte[in.available()];
in.read(buffer);
}
finally
{
in.close();
}
if (buffer == null || buffer.length <= 0) if (buffer == null || buffer.length <= 0)
return; return;

@ -264,12 +264,21 @@ private static boolean isOurCrashLog(File file)
try try
{ {
BufferedReader reader = new BufferedReader(new FileReader(file)); BufferedReader reader = new BufferedReader(new FileReader(file));
String line = null;
while((line = reader.readLine()) != null) try
if(JAVA_ERROR_LOG_PATTERN.matcher(line).find()) {
return true; String line;
while((line = reader.readLine()) != null)
if(JAVA_ERROR_LOG_PATTERN.matcher(line).find())
return true;
}
finally
{
reader.close();
}
} }
catch(Throwable e) catch(Throwable t)
{} {}
return false; return false;

@ -2065,12 +2065,27 @@ private void releasedImage()
try try
{ {
lastDir = file.getParentFile(); lastDir = file.getParentFile();
FileInputStream in = new FileInputStream(file); FileInputStream in = new FileInputStream(file);
byte buffer[] = new byte[in.available()]; byte[] buffer;
in.read(buffer);
WhiteboardShapeImage image = try
new WhiteboardShapeImage(id(), new WhiteboardPoint(drawX, {
drawY), originWidth, originHeight, buffer); buffer = new byte[in.available()];
in.read(buffer);
}
finally
{
in.close();
}
WhiteboardShapeImage image
= new WhiteboardShapeImage(
id(),
new WhiteboardPoint(drawX, drawY),
originWidth, originHeight,
buffer);
appendAndSend(image); appendAndSend(image);
} }
catch (IOException ex) catch (IOException ex)

@ -162,6 +162,9 @@ public static int decode(
return encoder.decode(data, out); return encoder.decode(data, out);
} }
/** Prevents the initialization of <tt>Base64</tt> instances. */
private Base64() {}
public static class Base64Encoder public static class Base64Encoder
{ {
protected final byte[] encodingTable = protected final byte[] encodingTable =
@ -471,5 +474,4 @@ private int nextI(String data, int i, int finish)
return i; return i;
} }
} }
}
}

@ -428,9 +428,9 @@ public void waitForEvent(long waitFor)
} }
//the follwoing methods only have dummy implementations here as they // The following methods only have dummy implementations here as they do
//do not interest us. complete implementatios are provider in the // not interest us. Complete implementations are provided in the basic
//basic instant messaging operation set. // instant messaging operation set.
public void buddyInfoUpdated(IcbmService service, Screenname buddy, public void buddyInfoUpdated(IcbmService service, Screenname buddy,
IcbmBuddyInfo info){} IcbmBuddyInfo info){}
public void conversationClosed(Conversation c){} public void conversationClosed(Conversation c){}

@ -141,7 +141,7 @@ public void testInstallationPersistency() throws Exception
= fixture.findProtocolProviderBundle(fixture.provider1); = fixture.findProtocolProviderBundle(fixture.provider1);
//set the global providerBundle reference that we will be using //set the global providerBundle reference that we will be using
//in the last series of tests (Account uninstallation persistency) //in the last series of tests (Account uninstallation persistence)
SipSlickFixture.providerBundle = providerBundle; SipSlickFixture.providerBundle = providerBundle;
assertNotNull("Couldn't find a bundle for the tested provider" assertNotNull("Couldn't find a bundle for the tested provider"

@ -17,8 +17,6 @@
*/ */
public class TestBase64 extends TestCase public class TestBase64 extends TestCase
{ {
private Base64 base64 = null;
/** /**
* Create a TestBase64 wrapper over the test with the specified name. * Create a TestBase64 wrapper over the test with the specified name.
* @param name the name of the test to run * @param name the name of the test to run
@ -35,8 +33,6 @@ public TestBase64(String name)
protected void setUp() throws Exception protected void setUp() throws Exception
{ {
super.setUp(); super.setUp();
base64 = new Base64();
} }
/** /**
@ -45,8 +41,6 @@ protected void setUp() throws Exception
*/ */
protected void tearDown() throws Exception protected void tearDown() throws Exception
{ {
base64 = null;
super.tearDown(); super.tearDown();
} }
@ -59,8 +53,8 @@ public void testEncodeDecode()
String data = "string to encode"; String data = "string to encode";
byte[] expectedReturn = data.getBytes(); byte[] expectedReturn = data.getBytes();
byte[] encodedData = base64.encode(data.getBytes()); byte[] encodedData = Base64.encode(data.getBytes());
byte[] actualReturn = base64.decode(encodedData); byte[] actualReturn = Base64.decode(encodedData);
assertTrue("encode decode failed.", Arrays.equals( assertTrue("encode decode failed.", Arrays.equals(
expectedReturn, actualReturn)); expectedReturn, actualReturn));
} }
@ -74,11 +68,11 @@ public void testEncodeDecode1()
String data = "string to encode"; String data = "string to encode";
byte[] expectedReturn = data.getBytes(); byte[] expectedReturn = data.getBytes();
byte[] encodedData = base64.encode(data.getBytes()); byte[] encodedData = Base64.encode(data.getBytes());
String encodedString = new String(encodedData); String encodedString = new String(encodedData);
byte[] actualReturn = base64.decode(encodedString); byte[] actualReturn = Base64.decode(encodedString);
assertTrue("encode decode failed.", Arrays.equals( assertTrue("encode decode failed.", Arrays.equals(
expectedReturn, actualReturn)); expectedReturn, actualReturn));

Loading…
Cancel
Save