Skip to content

Commit f02c023

Browse files
committed
Fixed id parsing
1 parent babfc0b commit f02c023

File tree

2 files changed

+6
-10
lines changed

2 files changed

+6
-10
lines changed

xchange-abucoins/src/main/java/org/knowm/xchange/abucoins/AbucoinsAdapters.java

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ public static Trade adaptTrade(AbucoinsTrade trade, CurrencyPair currencyPair) {
111111
/**
112112
* Adapts a AbucoinsTrade[] to a Trades Object
113113
*
114-
* @param cexioTrades The Abucoins trade data returned by API
114+
* @param abucoinsTrades The Abucoins trade data returned by API
115115
* @param currencyPair trade currencies
116116
* @return The trades
117117
*/
@@ -149,7 +149,7 @@ public static Ticker adaptTicker(AbucoinsTicker ticker, CurrencyPair currencyPai
149149
/**
150150
* Adapts Cex.IO Depth to OrderBook Object
151151
*
152-
* @param depth Cex.IO order book
152+
* @param abucoinsOrderBook Cex.IO order book
153153
* @param currencyPair The currency pair (e.g. BTC/USD)
154154
* @return The XChange OrderBook
155155
*/
@@ -172,7 +172,7 @@ public static AccountInfo adaptAccountInfo(AbucoinsAccount[] accounts) {
172172
/**
173173
* Adapts AbucoinsBalanceInfo to Wallet
174174
*
175-
* @param cexIOBalanceInfo AbucoinsBalanceInfo balance
175+
* @param account Abucoins account
176176
* @return The account info
177177
*/
178178
public static Wallet adaptWallet(AbucoinsAccount account) {
@@ -322,10 +322,6 @@ public static AbucoinsCreateLimitOrderRequest adaptAbucoinsCreateLimitOrderReque
322322
}
323323

324324
public static String[] adaptToSetOfIDs(String resp) {
325-
StringTokenizer tok = new StringTokenizer(resp, "[], ");
326-
List<String> res = new ArrayList<>();
327-
while ( tok.hasMoreTokens() )
328-
res.add( tok.nextToken());
329-
return res.toArray(new String[ res.size()]);
325+
return resp.replaceAll("\\[|]|\"| ", "").split(",");
330326
}
331327
}

xchange-abucoins/src/test/java/org/knowm/xchange/abucoins/AbucoinsAdaptersSplitIDsTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@ public class AbucoinsAdaptersSplitIDsTest {
99

1010
@Test
1111
public void testSingleID() {
12-
String[] string = AbucoinsAdapters.adaptToSetOfIDs("[1111]");
12+
String[] string = AbucoinsAdapters.adaptToSetOfIDs("[\"1111\"]");
1313
assertNotNull("null response", string);
1414
assertEquals("wrong number of strings", 1, string.length);
1515
assertEquals("Wrong value", "1111", string[0]);
1616
}
1717

1818
@Test
1919
public void testMultipleIDs() {
20-
String[] string = AbucoinsAdapters.adaptToSetOfIDs("[1111,2222, 3333]");
20+
String[] string = AbucoinsAdapters.adaptToSetOfIDs("[\"1111\",\"2222\", \"3333\"]");
2121
assertNotNull("null response", string);
2222
assertEquals("wrong number of strings", 3, string.length);
2323
assertEquals("Wrong value", "1111", string[0]);

0 commit comments

Comments
 (0)