Skip to content

Commit 314246c

Browse files
author
Maik Scheibler
committed
explicit ClassLoader parameter for ServiceLoader
The explicit classloader is necessary for Android to be able to find and load the declared NetworkModuleFactories Signed-off-by: Maik Scheibler <eclipse@scheibler-family.de>
1 parent 16e394e commit 314246c

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

org.eclipse.paho.client.mqttv3/src/main/java/org/eclipse/paho/client/mqttv3/internal/NetworkModuleService.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
* and Eclipse Distribution License v1.0 which accompany this distribution.
55
*
66
* The Eclipse Public License is available at
7-
* http://www.eclipse.org/legal/epl-v10.html
7+
* http://www.eclipse.org/legal/epl-v10.html
88
* and the Eclipse Distribution License is available at
9-
* http://www.eclipse.org/org/documents/edl-v10.php.
9+
* http://www.eclipse.org/org/documents/edl-v10.php.
1010
*/
1111
package org.eclipse.paho.client.mqttv3.internal;
1212

@@ -34,7 +34,7 @@ public class NetworkModuleService {
3434
private static final Logger LOG = LoggerFactory.getLogger(LoggerFactory.MQTT_CLIENT_MSG_CAT,
3535
NetworkModuleService.class.getSimpleName());
3636
private static final ServiceLoader<NetworkModuleFactory> FACTORY_SERVICE_LOADER = ServiceLoader.load(
37-
NetworkModuleFactory.class);
37+
NetworkModuleFactory.class, NetworkModuleService.class.getClassLoader());
3838

3939
/** Pattern to match URI authority parts: {@code authority = [userinfo"@"]host[":"port]} */
4040
private static final Pattern AUTHORITY_PATTERN = Pattern.compile("((.+)@)?([^:]*)(:(\\d+))?");
@@ -126,7 +126,7 @@ static void applyRFC3986AuthorityPatch(URI toPatch) {
126126
return;
127127
}
128128
Matcher matcher = AUTHORITY_PATTERN.matcher(toPatch.getAuthority());
129-
if (matcher.matches()) {
129+
if (matcher.find()) {
130130
setURIField(toPatch, "userInfo", matcher.group(AUTH_GROUP_USERINFO));
131131
setURIField(toPatch, "host", matcher.group(AUTH_GROUP_HOST));
132132
String portString = matcher.group(AUTH_GROUP_PORT);

0 commit comments

Comments
 (0)