Add Config to Remove Crashing Items from Storage Cells #2573

Merged
merged 2 commits into from Nov 5, 2016

Projects

None yet

2 participants

@shartte
Contributor
shartte commented Nov 5, 2016

Added a configuration option to enable players to recover their world if any of their items in storage cause crashes on load.

@shartte shartte Added a configuration option to enable players to recover their world…
… if any of their items in storage cause crashes on load.
585eb29
@shartte shartte changed the title from Add Config to Remove Crashing Items fStorage Cells to Add Config to Remove Crashing Items from Storage Cells Nov 5, 2016
@@ -88,6 +88,7 @@
public boolean enableEffects = true;
public boolean useLargeFonts = false;
public boolean useColoredCraftingStatus;
+ public boolean removeCrashingItemsOnLoad = false;
@orod-org
orod-org Nov 5, 2016

MINOR Make removeCrashingItemsOnLoad a static final constant or non-public and provide accessors if needed. rule

@shartte shartte Slight refactoring.
e9f0639
+ try
+ {
+ t = ItemStack.loadItemStackFromNBT( compoundTag );
+ if( t == null )
@orod-org
orod-org Nov 5, 2016

INFO Redundant nullcheck of t, which is known to be non-null in appeng.me.storage.CellInventory.loadCellItem(NBTTagCompound, int) rule

+ t = ItemStack.loadItemStackFromNBT( compoundTag );
+ if( t == null )
+ {
+ AELog.warn( "Removing item " + compoundTag + " from storage cell because the associated item type couldn't be found." );
@orod-org
orod-org Nov 5, 2016

CRITICAL Define a constant instead of duplicating this literal "Removing item " 3 times. rule

+ return;
+ }
+ }
+ catch( Throwable ex )
@orod-org
orod-org Nov 5, 2016

MAJOR Catch Exception instead of Throwable. rule

+ // cellItems.clean();
+ }
+
+ private void loadCellItem( NBTTagCompound compoundTag, int stackSize )
@orod-org
orod-org Nov 5, 2016

CRITICAL The Cyclomatic Complexity of this method "loadCellItem" is 12 which is greater than 10 authorized. rule

+ {
+ this.cellItems.add( AEItemStack.create( t ) );
+ }
+ catch( Throwable ex )
@orod-org
orod-org Nov 5, 2016

MAJOR Catch Exception instead of Throwable. rule

@orod-org
orod-org commented Nov 5, 2016

SonarQube analysis reported 12 issues

  • CRITICAL 2 critical
  • MAJOR 5 major
  • MINOR 4 minor
  • INFO 1 info

Watch the comments in this conversation to review them.

6 extra issues

Note: The following issues were found on lines that were not modified in the pull request. Because these issues can't be reported as line comments, they are summarized here:

  1. MAJOR AEConfig.java#L65: Unread field: appeng.core.AEConfig.WirelessHighWirelessCount; should this field be static? rule
  2. MAJOR AEConfig.java#L73: Unread field: appeng.core.AEConfig.chargedChange; should this field be static? rule
  3. MAJOR CellInventory.java#L104: Method new appeng.me.storage.CellInventory(ItemStack, ISaveProvider) appears to call the same method on the same object redundantly rule
  4. MINOR AEConfig.java#L309: Rename this method name to match the regular expression '^[a-z][a-zA-Z0-9]*$'. rule
  5. MINOR AEConfig.java#L314: Rename this method name to match the regular expression '^[a-z][a-zA-Z0-9]*$'. rule
  6. MINOR AEConfig.java#L319: Rename this method name to match the regular expression '^[a-z][a-zA-Z0-9]*$'. rule
@shartte shartte merged commit 4253d65 into master Nov 5, 2016

3 of 4 checks passed

sonarqube SonarQube reported 12 issues, with 2 critical
continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details
jenkins Success
Details
@shartte shartte deleted the world-recovery branch Nov 5, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment