181 midletInfo.addAttribute(name.getValue(), value.getValue()); |
181 midletInfo.addAttribute(name.getValue(), value.getValue()); |
182 |
182 |
183 // Determine what is the <n> of this MIDlet, |
183 // Determine what is the <n> of this MIDlet, |
184 // (which attribute "Nokia-MIDlet-Localized-<n>" contains the localized |
184 // (which attribute "Nokia-MIDlet-Localized-<n>" contains the localized |
185 // name of this MIDlet) |
185 // name of this MIDlet) |
186 if ((value.getValue().indexOf(midletInfo.getName()) > -1) && |
186 String valueStr = value.getValue(); |
187 name.getValue().startsWith("MIDlet-")) |
187 String nameStr = name.getValue(); |
|
188 if ((valueStr.indexOf(midletInfo.getName()) > -1) && |
|
189 nameStr.startsWith("MIDlet-") && |
|
190 !nameStr.equals("MIDlet-Name") |
|
191 ) |
188 { |
192 { |
189 try |
193 try |
190 { |
194 { |
191 // Try to parse the rest of attribute name (after "MIDlet-") |
195 // Try to parse the rest of attribute name (after "MIDlet-") |
192 // into an int. If this throws exception, the attribute was |
196 // into an int. |
193 // propably 'MIDlet-Name' |
197 midletN = Integer.parseInt(nameStr.substring(7)); |
194 midletN = Integer.parseInt(name.getValue().substring(7)); |
|
195 } |
198 } |
196 catch (NumberFormatException ne) {}; |
199 catch (NumberFormatException ne) |
|
200 { |
|
201 Log.logW("Error in getting localized name: " + nameStr, ne); |
|
202 } |
197 } |
203 } |
198 } |
204 } |
199 |
205 |
200 // Set the localized name of the MIDlet. |
206 // Set the localized name of the MIDlet. |
201 String localizedName = midletInfo.getAttribute("Nokia-MIDlet-Localized-" + midletN); |
207 String localizedName = midletInfo.getAttribute("Nokia-MIDlet-Localized-" + midletN); |