Skip to content

Commit

Permalink
Merge branch 'string_utils' of https://github.com/GNUDimarik/jitsi in…
Browse files Browse the repository at this point in the history
…to GNUDimarik-string_utils

Closes #606
  • Loading branch information
ibauersachs committed Mar 21, 2020
2 parents 01c5f19 + a844b48 commit 0688fd0
Show file tree
Hide file tree
Showing 92 changed files with 288 additions and 188 deletions.
34 changes: 18 additions & 16 deletions .classpath
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
<classpathentry kind="lib" path="lib/os-specific/mac/OrangeExtensions.jar"/>
<classpathentry kind="lib" path="lib/installer-exclude/jmork-1.0.5.jar" sourcepath="/jmork"/>
<classpathentry kind="lib" path="lib/installer-exclude/bcprov-jdk15on-1.54.jar"/>
<classpathentry kind="lib" path="lib/installer-exclude/commons-lang3-3.1.jar"/>
<classpathentry kind="lib" path="lib/installer-exclude/commons-lang3-3.9.jar"/>
<classpathentry kind="lib" path="lib/installer-exclude/bccontrib-1.0.jar"/>
<classpathentry kind="lib" path="lib/installer-exclude/zrtp4j-light-4.1.0-jitsi-1-SNAPSHOT.jar"/>
<classpathentry kind="lib" path="lib/installer-exclude/jcalendar-1.4.jar"/>
Expand All @@ -82,20 +82,22 @@
<classpathentry kind="lib" path="lib/installer-exclude/dnssecjava-1.1.jar" sourcepath="/dnssecjava"/>
<classpathentry kind="lib" path="lib/installer-exclude/gson-2.8.0.jar"/>
<classpathentry kind="lib" path="lib/installer-exclude/commons-compress-1.15.jar"/>
<classpathentry kind="lib" path="lib/installer-exclude/smack-core-4.2.1.jar"/>
<classpathentry kind="lib" path="lib/installer-exclude/smack-debug-4.2.1.jar"/>
<classpathentry kind="lib" path="lib/installer-exclude/smack-extensions-4.2.1.jar"/>
<classpathentry kind="lib" path="lib/installer-exclude/smack-im-4.2.1.jar"/>
<classpathentry kind="lib" path="lib/installer-exclude/smack-java7-4.2.1.jar"/>
<classpathentry kind="lib" path="lib/installer-exclude/smack-legacy-4.2.1.jar"/>
<classpathentry kind="lib" path="lib/installer-exclude/smack-resolver-javax-4.2.1.jar"/>
<classpathentry kind="lib" path="lib/installer-exclude/smack-sasl-javax-4.2.1.jar"/>
<classpathentry kind="lib" path="lib/installer-exclude/smack-tcp-4.2.1.jar"/>
<classpathentry kind="lib" path="lib/installer-exclude/jxmpp-core-0.5.0.jar"/>
<classpathentry kind="lib" path="lib/installer-exclude/jxmpp-jid-0.5.0.jar"/>
<classpathentry kind="lib" path="lib/installer-exclude/jxmpp-util-cache-0.5.0.jar"/>
<classpathentry kind="lib" path="lib/installer-exclude/smack-bosh-4.2.1.jar"/>
<classpathentry kind="lib" path="lib/installer-exclude/xpp3-1.1.4c.jar"/>
<classpathentry kind="lib" path="lib/installer-exclude/smack-experimental-4.2.1.jar"/>
<classpathentry kind="lib" path="lib/installer-exclude/smack-core-4.2.4.jar"/>
<classpathentry kind="lib" path="lib/installer-exclude/smack-debug-4.2.4.jar"/>
<classpathentry kind="lib" path="lib/installer-exclude/smack-experimental-4.2.4.jar"/>
<classpathentry kind="lib" path="lib/installer-exclude/smack-extensions-4.2.4.jar"/>
<classpathentry kind="lib" path="lib/installer-exclude/smack-im-4.2.4.jar"/>
<classpathentry kind="lib" path="lib/installer-exclude/smack-java7-4.2.4.jar"/>
<classpathentry kind="lib" path="lib/installer-exclude/smack-legacy-4.2.4.jar"/>
<classpathentry kind="lib" path="lib/installer-exclude/smack-resolver-javax-4.2.4.jar"/>
<classpathentry kind="lib" path="lib/installer-exclude/smack-sasl-javax-4.2.4.jar"/>
<classpathentry kind="lib" path="lib/installer-exclude/smack-tcp-4.2.4.jar"/>
<classpathentry kind="lib" path="lib/installer-exclude/jxmpp-core-0.6.3.jar"/>
<classpathentry kind="lib" path="lib/installer-exclude/jxmpp-jid-0.6.3.jar"/>
<classpathentry kind="lib" path="lib/installer-exclude/jxmpp-util-cache-0.6.3.jar"/>
<classpathentry kind="lib" path="lib/installer-exclude/jitsi-xmpp-extensions-1.0-1-g9b2e85b.jar"/>
<classpathentry kind="lib" path="lib/installer-exclude/smack-bosh-4.2.4.jar"/>
<classpathentry kind="lib" path="lib/installer-exclude/xpp3-1.1.6.jar"/>
<classpathentry kind="lib" path="lib/installer-exclude/jitsi-utils-1.0-39-gd481c98.jar"/>
<classpathentry kind="output" path="classes"/>
</classpath>
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import java.util.*;
import java.util.regex.Pattern;

import org.apache.commons.lang3.StringUtils;
import org.jitsi.service.configuration.*;
import org.jitsi.service.fileaccess.*;
import org.jitsi.util.*;
Expand Down Expand Up @@ -992,7 +993,7 @@ public void logConfigurationProperties(String excludePattern)
return;

Pattern exclusion = null;
if (!StringUtils.isNullOrEmpty(excludePattern))
if (StringUtils.isNotEmpty(excludePattern))
{
exclusion = Pattern.compile(
excludePattern, Pattern.CASE_INSENSITIVE);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Bundle-Vendor: jitsi.org
Bundle-Version: 0.0.1
Bundle-SymbolicName: net.java.sip.communicator.configuration
Import-Package: org.jitsi.service.configuration,
org.apache.commons.lang3,
org.jitsi.service.fileaccess,
org.jitsi.service.libjitsi,
net.java.sip.communicator.util,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import net.java.sip.communicator.util.Logger;
import net.java.sip.communicator.plugin.desktoputil.*;

import org.apache.commons.lang3.StringUtils;
import org.jitsi.dnssec.validator.ValidatingResolver;
import org.jitsi.service.configuration.*;
import org.jitsi.service.resources.*;
Expand Down Expand Up @@ -88,7 +89,7 @@ public ConfigurableDnssecResolver(ExtendedResolver headResolver)
for (String propName : propNames)
{
String value = config.getProperty(propName);
if (!StringUtils.isNullOrEmpty(value))
if (StringUtils.isNotEmpty(value))
{
config.put(propName, value);
}
Expand Down Expand Up @@ -402,7 +403,7 @@ public void reset()
{
String forwarders = DnsUtilActivator.getConfigurationService()
.getString(DnsUtilActivator.PNAME_DNSSEC_NAMESERVERS);
if(!StringUtils.isNullOrEmpty(forwarders, true))
if(StringUtils.isNotBlank(forwarders))
{
if(logger.isTraceEnabled())
{
Expand Down
4 changes: 3 additions & 1 deletion src/net/java/sip/communicator/impl/dns/DnsUtilActivator.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
import net.java.sip.communicator.util.*;

import net.java.sip.communicator.util.Logger;

import org.apache.commons.lang3.StringUtils;
import org.jitsi.service.configuration.*;
import org.jitsi.service.resources.*;
import org.jitsi.utils.*;
Expand Down Expand Up @@ -176,7 +178,7 @@ private static boolean loadDNSProxyForward()
(String)getConfigurationService().getProperty(
ProxyInfo
.CONNECTION_PROXY_FORWARD_DNS_ADDRESS_PROPERTY_NAME);
if(StringUtils.isNullOrEmpty(serverAddress, true))
if(StringUtils.isBlank(serverAddress))
return false;

int port = SimpleResolver.DEFAULT_PORT;
Expand Down
3 changes: 2 additions & 1 deletion src/net/java/sip/communicator/impl/dns/dns.manifest.mf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ Bundle-SymbolicName: net.java.sip.communicator.impl.dns
Bundle-Description: A bundle that export packages with DNS utility classes.
Bundle-Vendor: jitsi.org
Bundle-Version: 0.0.1
Import-Package: org.jitsi.util,
Import-Package: org.jitsi.util,
org.apache.commons.lang3,
org.osgi.framework,
net.java.sip.communicator.util,
net.java.sip.communicator.plugin.desktoputil,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import net.java.sip.communicator.util.*;
import net.java.sip.communicator.util.account.*;

import org.apache.commons.lang3.StringUtils;
import org.jitsi.utils.*;

/**
Expand Down Expand Up @@ -142,7 +143,7 @@ public String getDisplayName(ProtocolProviderService pps)
*/
public String getGlobalDisplayName()
{
if (!StringUtils.isNullOrEmpty(provisionedDisplayName))
if (StringUtils.isNotEmpty(provisionedDisplayName))
return provisionedDisplayName;

return globalDisplayName;
Expand Down Expand Up @@ -308,7 +309,7 @@ public void avatarChanged(AvatarEvent event)
*/
public void serverStoredDetailsChanged(ServerStoredDetailsChangeEvent evt)
{
if(!StringUtils.isNullOrEmpty(provisionedDisplayName))
if(StringUtils.isNotEmpty(provisionedDisplayName))
return;

if(evt.getNewValue() instanceof
Expand Down Expand Up @@ -399,16 +400,16 @@ public void run()
}
}

if(!StringUtils.isNullOrEmpty(provisionedDisplayName)
|| (!StringUtils.isNullOrEmpty(globalDisplayName) && !isUpdate))
if(StringUtils.isNotEmpty(provisionedDisplayName)
|| (StringUtils.isNotEmpty(globalDisplayName) && !isUpdate))
return;

if (currentFirstName == null)
{
String firstName = AccountInfoUtils
.getFirstName(accountInfoOpSet);

if (!StringUtils.isNullOrEmpty(firstName))
if (StringUtils.isNotEmpty(firstName))
{
currentFirstName = firstName;
}
Expand All @@ -419,7 +420,7 @@ public void run()
String lastName = AccountInfoUtils
.getLastName(accountInfoOpSet);

if (!StringUtils.isNullOrEmpty(lastName))
if (StringUtils.isNotEmpty(lastName))
{
currentLastName = lastName;
}
Expand All @@ -444,19 +445,19 @@ public void run()
protected void setGlobalDisplayName()
{
String accountName = null;
if (!StringUtils.isNullOrEmpty(currentFirstName))
if (StringUtils.isNotEmpty(currentFirstName))
{
accountName = currentFirstName;
}

if (!StringUtils.isNullOrEmpty(currentLastName))
if (StringUtils.isNotEmpty(currentLastName))
{
/*
* If accountName is null, don't use += because
* it will make the accountName start with the
* string "null".
*/
if (StringUtils.isNullOrEmpty(accountName))
if (StringUtils.isEmpty(accountName))
accountName = currentLastName;
else
accountName += " " + currentLastName;
Expand All @@ -470,7 +471,7 @@ protected void setGlobalDisplayName()

globalDisplayName = accountName;

if (!StringUtils.isNullOrEmpty(globalDisplayName))
if (StringUtils.isNotEmpty(globalDisplayName))
{
fireGlobalDisplayNameEvent(globalDisplayName);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Bundle-Vendor: jitsi.org
Bundle-Version: 0.0.1
Bundle-SymbolicName: net.java.sip.communicator.globaldisplaydetails
Import-Package: org.jitsi.service.resources,
org.apache.commons.lang3,
org.jitsi.service.configuration,
net.java.sip.communicator.util,
org.osgi.framework,
Expand Down
29 changes: 15 additions & 14 deletions src/net/java/sip/communicator/impl/gui/main/call/CallManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
import net.java.sip.communicator.util.Logger;
import net.java.sip.communicator.util.account.*;

import org.apache.commons.lang3.StringUtils;
import org.jitsi.service.neomedia.*;
import org.jitsi.service.neomedia.codec.*;
import org.jitsi.service.neomedia.device.*;
Expand Down Expand Up @@ -1453,24 +1454,24 @@ public static String getPeerDisplayName(CallPeer peer,
displayName = contact.getDisplayName();
}

if(StringUtils.isNullOrEmpty(displayName, true))
if(StringUtils.isBlank(displayName))
displayName = uiContact.getDisplayName();
}

// We search for a contact corresponding to this call peer and
// try to get its display name.
if (StringUtils.isNullOrEmpty(displayName, true)
if (StringUtils.isBlank(displayName)
&& peer.getContact() != null)
{
displayName = peer.getContact().getDisplayName();
}

// We try to find the an alternative peer address.
if (StringUtils.isNullOrEmpty(displayName, true))
if (StringUtils.isBlank(displayName))
{
String imppAddress = peer.getAlternativeIMPPAddress();

if (!StringUtils.isNullOrEmpty(imppAddress))
if (StringUtils.isNotEmpty(imppAddress))
{
int protocolPartIndex = imppAddress.indexOf(":");

Expand All @@ -1496,7 +1497,7 @@ public static String getPeerDisplayName(CallPeer peer,
displayName = (contact != null)
? contact.getDisplayName() : null;

if(!StringUtils.isNullOrEmpty(displayName, true))
if(StringUtils.isNotBlank(displayName))
break;
}
}
Expand All @@ -1511,10 +1512,10 @@ public static String getPeerDisplayName(CallPeer peer,
}
}

if (StringUtils.isNullOrEmpty(displayName, true))
if (StringUtils.isBlank(displayName))
{
displayName = (!StringUtils.isNullOrEmpty
(peer.getDisplayName(), true))
displayName = (StringUtils.isNotBlank
(peer.getDisplayName()))
? peer.getDisplayName()
: peer.getAddress();

Expand Down Expand Up @@ -1576,7 +1577,7 @@ public static byte[] getPeerImage(CallPeer peer)
{
String imppAddress = peer.getAlternativeIMPPAddress();

if (!StringUtils.isNullOrEmpty(imppAddress))
if (StringUtils.isNotEmpty(imppAddress))
{
int protocolPartIndex = imppAddress.indexOf(":");

Expand Down Expand Up @@ -1672,7 +1673,7 @@ else if(uiContact.getDescriptor() instanceof SourceContact)
// We try to find the an alternative peer address.
String imppAddress = peer.getAlternativeIMPPAddress();

if (!StringUtils.isNullOrEmpty(imppAddress))
if (StringUtils.isNotEmpty(imppAddress))
{
int protocolPartIndex = imppAddress.indexOf(":");

Expand Down Expand Up @@ -1931,7 +1932,7 @@ else if(uiContact.getDescriptor() instanceof SourceContact)

String imppAddress = peer.getAlternativeIMPPAddress();

if (!StringUtils.isNullOrEmpty(imppAddress))
if (StringUtils.isNotEmpty(imppAddress))
{
int protocolPartIndex = imppAddress.indexOf(":");

Expand Down Expand Up @@ -2702,7 +2703,7 @@ private static void internalCall(
if (contact != null)
createdCall
= resourceTelephony.createCall(contact, contactResource);
else if (!StringUtils.isNullOrEmpty(stringContact))
else if (StringUtils.isNotEmpty(stringContact))
createdCall = resourceTelephony.createCall(
stringContact, contactResource.getResourceName());
}
Expand All @@ -2712,7 +2713,7 @@ else if (telephony != null)
{
createdCall = telephony.createCall(contact);
}
else if (!StringUtils.isNullOrEmpty(stringContact))
else if (StringUtils.isNotEmpty(stringContact))
createdCall = telephony.createCall(stringContact);
}

Expand Down Expand Up @@ -4182,7 +4183,7 @@ private static String queryContactSource(
{
String displayName = null;

if(!StringUtils.isNullOrEmpty(peerAddress))
if(StringUtils.isNotEmpty(peerAddress))
{
ContactSourceSearcher searcher
= new ContactSourceSearcher(peerAddress, listener);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import net.java.sip.communicator.service.protocol.*;
import net.java.sip.communicator.util.Logger;

import org.apache.commons.lang3.StringUtils;
import org.jitsi.util.*;
import org.jitsi.utils.*;

Expand Down Expand Up @@ -351,7 +352,7 @@ private String getPeerDisplayText(CallPeer peer, String displayName)
{
String peerAddress = peer.getAddress();

if(StringUtils.isNullOrEmpty(displayName, true))
if(StringUtils.isBlank(displayName))
return peerAddress;

if(!displayName.equalsIgnoreCase(peerAddress))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import net.java.sip.communicator.util.*;
import net.java.sip.communicator.util.skin.*;

import org.apache.commons.lang3.StringUtils;
import org.jitsi.util.*;
import org.jitsi.utils.*;

Expand Down Expand Up @@ -137,7 +138,7 @@ private void initCallLabel(final JLabel callLabel[])
if(displayName != null)
peerNamesTable.put(peer, displayName);

if(!StringUtils.isNullOrEmpty(peerAddress))
if(StringUtils.isNotEmpty(peerAddress))
textAddress = callLabel[2].getText()
+ trimPeerAddressToUsername(peerAddress);

Expand Down Expand Up @@ -322,7 +323,7 @@ private String getPeerDisplayAddress(CallPeer peer)
{
String peerAddress = peer.getAddress();

if(StringUtils.isNullOrEmpty(peerAddress, true))
if(StringUtils.isBlank(peerAddress))
return null;
else
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
package net.java.sip.communicator.impl.gui.main.call;

import net.java.sip.communicator.service.contactsource.*;

import org.apache.commons.lang3.StringUtils;
import org.jitsi.utils.*;

/**
Expand Down Expand Up @@ -138,7 +140,7 @@ public synchronized void stop()
*/
public boolean isFoundName()
{
return !StringUtils.isNullOrEmpty(resolvedName);
return StringUtils.isNotEmpty(resolvedName);
}

/**
Expand Down
Loading

0 comments on commit 0688fd0

Please sign in to comment.