Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Had one too many next() calls string keyed maps

Signed-off-by: Nick Tolomiczenko <nick.tolomiczenko@gmail.com>
  • Loading branch information...
commit 64e89b3da65b11b527f1642516b0675e73e6533b 1 parent 89f9666
Nick Tolomiczenko authored
30 hyperclient/java/extra_src/ByteArray.java
@@ -88,30 +88,23 @@ public static String decode(ByteArray ba, String encoding) throws TypeError
88 88 return decode(ba.getBytes(), encoding);
89 89 }
90 90
91   - public String toString(String encoding)
  91 + public String toString(String encoding) throws TypeError
92 92 {
93   - String ret = "<could not decode bytes using java string encoding '"
94   - + encoding + "'>";
95   -
96   - try
97   - {
98   - ret = decode(encoding);
99   - }
100   - catch(TypeError e)
101   - {
102   - }
  93 + return decode(encoding);
  94 + }
103 95
104   - return ret;
  96 + public static String toString(byte[] bytes, String encoding) throws TypeError
  97 + {
  98 + return decode(bytes, encoding);
105 99 }
106 100
107   - public static String toString(byte[] bytes, String encoding)
  101 + public String toString()
108 102 {
109   - String ret = "<could not decode bytes using java string encoding '"
110   - + encoding + "'>";
  103 + String ret = "";
111 104
112 105 try
113 106 {
114   - ret = decode(bytes, encoding);
  107 + ret = toString(defaultEncoding);
115 108 }
116 109 catch(TypeError e)
117 110 {
@@ -120,11 +113,6 @@ public static String toString(byte[] bytes, String encoding)
120 113 return ret;
121 114 }
122 115
123   - public String toString()
124   - {
125   - return toString(defaultEncoding);
126   - }
127   -
128 116 public byte[] getBytes()
129 117 {
130 118 return bytes;
4 hyperclient/java/proxies/HyperClient.i
@@ -885,7 +885,7 @@
885 885 // Use C byte array sorting.
886 886
887 887 java.util.Iterator str_m_it=map.keySet().iterator();
888   - Object curKey = str_m_it.next();
  888 + Object curKey = null;
889 889
890 890 if ( str_m_it.hasNext()
891 891 && ((curKey = str_m_it.next()) instanceof String) )
@@ -914,7 +914,7 @@
914 914 catch(Exception e)
915 915 {
916 916 // Try to box the byte[] keys with ByteArray
917   - // Throw an exception if not key are not all byte[]
  917 + // Throw an exception if not all keys are byte[]
918 918
919 919 java.util.TreeMap<ByteArray,Object> sorted_map
920 920 = new java.util.TreeMap<ByteArray,Object>();

0 comments on commit 64e89b3

Please sign in to comment.
Something went wrong with that request. Please try again.