Committed by
Gerrit Code Review
Explicitly specify charset
- Explicitly specify app name encoding, which will go over the wire. - Commented out unused Map for now Change-Id: I9a076a5ef452850706bf15b0730aa149b4532fbd
Showing
1 changed file
with
5 additions
and
5 deletions
... | @@ -15,8 +15,10 @@ | ... | @@ -15,8 +15,10 @@ |
15 | */ | 15 | */ |
16 | package org.onosproject.store.app; | 16 | package org.onosproject.store.app; |
17 | 17 | ||
18 | +import com.google.common.base.Charsets; | ||
18 | import com.google.common.collect.ImmutableSet; | 19 | import com.google.common.collect.ImmutableSet; |
19 | import com.google.common.util.concurrent.ListenableFuture; | 20 | import com.google.common.util.concurrent.ListenableFuture; |
21 | + | ||
20 | import org.apache.felix.scr.annotations.Activate; | 22 | import org.apache.felix.scr.annotations.Activate; |
21 | import org.apache.felix.scr.annotations.Component; | 23 | import org.apache.felix.scr.annotations.Component; |
22 | import org.apache.felix.scr.annotations.Deactivate; | 24 | import org.apache.felix.scr.annotations.Deactivate; |
... | @@ -52,8 +54,6 @@ import org.slf4j.Logger; | ... | @@ -52,8 +54,6 @@ import org.slf4j.Logger; |
52 | import java.io.ByteArrayInputStream; | 54 | import java.io.ByteArrayInputStream; |
53 | import java.io.IOException; | 55 | import java.io.IOException; |
54 | import java.io.InputStream; | 56 | import java.io.InputStream; |
55 | -import java.util.HashMap; | ||
56 | -import java.util.Map; | ||
57 | import java.util.Set; | 57 | import java.util.Set; |
58 | import java.util.concurrent.CountDownLatch; | 58 | import java.util.concurrent.CountDownLatch; |
59 | import java.util.concurrent.Executors; | 59 | import java.util.concurrent.Executors; |
... | @@ -297,8 +297,8 @@ public class GossipApplicationStore extends ApplicationArchive | ... | @@ -297,8 +297,8 @@ public class GossipApplicationStore extends ApplicationArchive |
297 | private void fetchBits(Application app) { | 297 | private void fetchBits(Application app) { |
298 | ControllerNode localNode = clusterService.getLocalNode(); | 298 | ControllerNode localNode = clusterService.getLocalNode(); |
299 | ClusterMessage message = new ClusterMessage(localNode.id(), APP_BITS_REQUEST, | 299 | ClusterMessage message = new ClusterMessage(localNode.id(), APP_BITS_REQUEST, |
300 | - app.id().name().getBytes()); | 300 | + app.id().name().getBytes(Charsets.UTF_8)); |
301 | - Map<ControllerNode, ListenableFuture<byte[]>> futures = new HashMap<>(); | 301 | + //Map<ControllerNode, ListenableFuture<byte[]>> futures = new HashMap<>(); |
302 | CountDownLatch latch = new CountDownLatch(1); | 302 | CountDownLatch latch = new CountDownLatch(1); |
303 | 303 | ||
304 | // FIXME: send message with name & version to make sure we don't get served old bits | 304 | // FIXME: send message with name & version to make sure we don't get served old bits |
... | @@ -329,7 +329,7 @@ public class GossipApplicationStore extends ApplicationArchive | ... | @@ -329,7 +329,7 @@ public class GossipApplicationStore extends ApplicationArchive |
329 | private class InternalBitServer implements ClusterMessageHandler { | 329 | private class InternalBitServer implements ClusterMessageHandler { |
330 | @Override | 330 | @Override |
331 | public void handle(ClusterMessage message) { | 331 | public void handle(ClusterMessage message) { |
332 | - String name = new String(message.payload()); | 332 | + String name = new String(message.payload(), Charsets.UTF_8); |
333 | try { | 333 | try { |
334 | message.respond(toByteArray(getApplicationInputStream(name))); | 334 | message.respond(toByteArray(getApplicationInputStream(name))); |
335 | } catch (Exception e) { | 335 | } catch (Exception e) { | ... | ... |
-
Please register or login to post a comment