|
1 | 1 | /*******************************************************************************
|
2 |
| - * Copyright (c) 2022 IBM Corporation and others. |
| 2 | + * Copyright (c) 2022, 2023 IBM Corporation and others. |
3 | 3 | * All rights reserved. This program and the accompanying materials
|
4 | 4 | * are made available under the terms of the Eclipse Public License v1.0
|
5 | 5 | * which accompanies this distribution, and is available at
|
|
11 | 11 | package io.openliberty.spacerover.game.websocket.server;
|
12 | 12 |
|
13 | 13 | import java.io.IOException;
|
| 14 | +import java.io.UnsupportedEncodingException; |
| 15 | +import java.net.URLDecoder; |
| 16 | +import java.nio.charset.StandardCharsets; |
14 | 17 | import java.util.Arrays;
|
15 | 18 | import java.util.logging.Level;
|
16 | 19 | import java.util.logging.Logger;
|
@@ -143,6 +146,12 @@ private String getErrorMessage(final String errorText) {
|
143 | 146 |
|
144 | 147 | private void startGame(final String[] properties) {
|
145 | 148 | String playerId = properties[0];
|
| 149 | + try { |
| 150 | + playerId = URLDecoder.decode(playerId, StandardCharsets.UTF_8.name()); |
| 151 | + } catch (UnsupportedEncodingException e) { |
| 152 | + // utf-8 always supported |
| 153 | + } |
| 154 | + |
146 | 155 | int gameMode = Integer.parseInt(properties[1]);
|
147 | 156 | LOGGER.log(Level.INFO, "Start Game received for player ID: {0}, GameMode: {1}",
|
148 | 157 | new Object[] { playerId, gameMode });
|
|
0 commit comments