Skip to content

Commit 2b08768

Browse files
authored
Merge branch '5.0.1-develop' into 1227_Create_an_entity_-_The_translation_function_is_not_call_on_the_buttons_label
2 parents 578474c + c3d701f commit 2b08768

File tree

2 files changed

+19
-4
lines changed

2 files changed

+19
-4
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0).
1313
- Create an entity - The translation function is not call on the buttons label [#1273](https://github.com/magento/magento2-phpstorm-plugin/pull/1273)
1414
- Covered possible NullPointerException in InjectAViewModelDialog.java [#1213](https://github.com/magento/magento2-phpstorm-plugin/pull/1213)
1515
- AWT events are not allowed inside write action [#1271](https://github.com/magento/magento2-phpstorm-plugin/pull/1271)
16+
- MapReduceIndexMappingException: java.lang.NumberFormatException: For input string: "" [#1235](https://github.com/magento/magento2-phpstorm-plugin/pull/1235)
1617

1718
## 5.0.0
1819

src/com/magento/idea/magento2plugin/stubs/indexes/PluginIndex.java

+18-4
Original file line numberDiff line numberDiff line change
@@ -96,11 +96,10 @@ private Set<PluginData> getPluginsForType(final XmlTag typeNode) {
9696

9797
for (final XmlTag pluginTag: typeNode.findSubTags(ModuleDiXml.PLUGIN_TAG_NAME)) {
9898
final String pluginType = pluginTag.getAttributeValue(ModuleDiXml.TYPE_ATTR);
99-
String pluginSortOrder = pluginTag.getAttributeValue(ModuleDiXml.SORT_ORDER_ATTR);
99+
final String pluginSortOrder = pluginTag.getAttributeValue(ModuleDiXml.SORT_ORDER_ATTR);
100100

101101
if (pluginType != null && !pluginType.isEmpty()) {
102-
pluginSortOrder = pluginSortOrder == null ? "0" : pluginSortOrder;
103-
final PluginData pluginData = getPluginDataObject(pluginType, Integer.parseInt(pluginSortOrder));
102+
final PluginData pluginData = getPluginDataObject(pluginType, getIntegerOrZeroValue(pluginSortOrder));
104103
try {
105104
phpIndex.getAnyByFQN(pluginData.getType());
106105
results.add(pluginData);
@@ -113,7 +112,22 @@ private Set<PluginData> getPluginsForType(final XmlTag typeNode) {
113112
return results;
114113
}
115114

116-
private PluginData getPluginDataObject(final String pluginType, final Integer sortOrder) {
115+
private Integer getIntegerOrZeroValue(final String sortOrder) {
116+
if (sortOrder == null || sortOrder.isEmpty()) {
117+
return 0;
118+
}
119+
120+
try {
121+
return Integer.parseInt(sortOrder);
122+
} catch (NumberFormatException e) {
123+
return 0;
124+
}
125+
}
126+
127+
private PluginData getPluginDataObject(
128+
final String pluginType,
129+
final Integer sortOrder
130+
) {
117131
return new PluginData(pluginType, sortOrder);
118132
}
119133
};

0 commit comments

Comments
 (0)