MovingBlocks / Terasology

Terasology - open source voxel world
http://terasology.org
Apache License 2.0
3.69k stars 1.34k forks source link

Commands like listBlocks or search may fail if bad data is present #2718

Open Cervator opened 7 years ago

Cervator commented 7 years ago

This will happen if some asset is misconfigured (stray comma, etc) then encountered during command execution for listBlocks or search probably others as well.

Either we should not allow such an asset to create a "corrupt" asset entry or at least make the commands able to skip them gracefully and finish. Maybe they could list an error in the in-game console that asset x or whatever appeared to be corrupt.

Sample error snippet (was a search goose in SimpleFarming for a gooseberry bush being tested):

00:13:29.240 [main] INFO  o.t.logic.console.ConsoleImpl - [CONSOLE] Welcome to the wonderful world of Terasology!

Type 'help' to see a list with available commands or 'help <commandName>' for command details.
Text parameters do not need quotes, unless containing spaces. No commas between parameters.
You can use auto-completion by typing a partial command then hitting [tab] - examples:

gh + [tab] => 'ghost'
help gh + [tab] => 'help ghost' (can auto complete commands fed to help)
giv + [tab] => 'give givePermission' (use [tab] again to cycle between choices)
lS + [tab] => 'listShapes' (camel casing abbreviated commands)

00:13:32.596 [main] ERROR org.terasology.assets.AssetType - Failed to load asset 'SimpleFarming:GooseberryBushFull'
java.io.IOException: Invalid tile - must be square with power-of-two sides
    at org.terasology.world.block.tiles.TileFormat.load(TileFormat.java:48)
    at org.terasology.world.block.tiles.TileFormat.load(TileFormat.java:35)
    at org.terasology.assets.module.UnloadedAssetData$AssetSourceResolver.load(UnloadedAssetData.java:292)
    at org.terasology.assets.module.UnloadedAssetData.load(UnloadedAssetData.java:180)
    at org.terasology.assets.module.ModuleAssetDataProducer.getAssetData(ModuleAssetDataProducer.java:228)
    at org.terasology.assets.AssetType.lambda$reload$1(AssetType.java:356)
    at org.terasology.assets.AssetType$$Lambda$73/1868805237.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at org.terasology.assets.AssetType.reload(AssetType.java:354)
    at org.terasology.assets.AssetType.getNormalAsset(AssetType.java:383)
    at org.terasology.assets.AssetType.getAsset(AssetType.java:262)
    at org.terasology.assets.management.AssetManager.getAsset(AssetManager.java:223)
    at org.terasology.world.block.loader.AutoBlockProvider.lambda$getAvailableAssetUrns$341(AutoBlockProvider.java:51)
    at org.terasology.world.block.loader.AutoBlockProvider$$Lambda$292/1415835701.apply(Unknown Source)
    at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
    at java.util.Iterator.forEachRemaining(Iterator.java:116)
    at java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801)
    at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:512)
    at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:502)
    at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:151)
    at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:174)
    at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
    at java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:418)
    at org.terasology.world.block.loader.AutoBlockProvider.getAvailableAssetUrns(AutoBlockProvider.java:53)
    at org.terasology.assets.AssetType.getAvailableAssetUrns(AssetType.java:593)
    at org.terasology.assets.management.AssetManager.getAvailableAssets(AssetManager.java:129)
    at org.terasology.logic.console.commands.CoreCommands.findBlockMatches(CoreCommands.java:199)
    at org.terasology.logic.console.commands.CoreCommands.search(CoreCommands.java:152)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at org.terasology.logic.console.commandSystem.AbstractCommand.execute(AbstractCommand.java:237)
    at org.terasology.logic.console.ConsoleImpl.execute(ConsoleImpl.java:240)
    at org.terasology.logic.console.ConsoleImpl.execute(ConsoleImpl.java:204)
    at org.terasology.logic.console.ui.ConsoleScreen.lambda$initialise$148(ConsoleScreen.java:76)
    at org.terasology.logic.console.ui.ConsoleScreen$$Lambda$287/1391249801.onActivated(Unknown Source)
    at org.terasology.rendering.nui.widgets.UIText.onKeyEvent(UIText.java:401)
    at org.terasology.logic.console.ui.UICommandEntry.onKeyEvent(UICommandEntry.java:83)
    at org.terasology.rendering.nui.internal.NUIManagerInternal.keyEvent(NUIManagerInternal.java:604)
    at org.terasology.rendering.nui.internal.NUIManagerInternalMethodAccess.invoke(Unknown Source)
    at org.terasology.entitySystem.event.internal.EventSystemImpl$ByteCodeEventHandlerInfo.invoke(EventSystemImpl.java:506)
    at org.terasology.entitySystem.event.internal.EventSystemImpl.sendConsumableEvent(EventSystemImpl.java:279)
    at org.terasology.entitySystem.event.internal.EventSystemImpl.send(EventSystemImpl.java:258)
    at org.terasology.entitySystem.entity.internal.BaseEntityRef.send(BaseEntityRef.java:145)
    at org.terasology.input.InputSystem.sendKeyEvent(InputSystem.java:475)
    at org.terasology.input.InputSystem.processKeyboardInput(InputSystem.java:425)
    at org.terasology.input.InputSystem.update(InputSystem.java:272)
    at org.terasology.engine.modes.StateIngame.handleInput(StateIngame.java:179)
    at org.terasology.engine.subsystem.lwjgl.LwjglInput.postUpdate(LwjglInput.java:54)
    at org.terasology.engine.TerasologyEngine.mainLoop(TerasologyEngine.java:422)
    at org.terasology.engine.TerasologyEngine.run(TerasologyEngine.java:368)
    at org.terasology.engine.Terasology.main(Terasology.java:152)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147)
00:13:32.597 [main] ERROR o.t.logic.console.ConsoleImpl - An error occurred while executing a command
org.terasology.logic.console.commandSystem.exceptions.CommandExecutionException: java.util.NoSuchElementException: No value present
    at org.terasology.logic.console.commandSystem.AbstractCommand.execute(AbstractCommand.java:242)
    at org.terasology.logic.console.ConsoleImpl.execute(ConsoleImpl.java:240)
    at org.terasology.logic.console.ConsoleImpl.execute(ConsoleImpl.java:204)
    at org.terasology.logic.console.ui.ConsoleScreen.lambda$initialise$148(ConsoleScreen.java:76)
    at org.terasology.logic.console.ui.ConsoleScreen$$Lambda$287/1391249801.onActivated(Unknown Source)
    at org.terasology.rendering.nui.widgets.UIText.onKeyEvent(UIText.java:401)
    at org.terasology.logic.console.ui.UICommandEntry.onKeyEvent(UICommandEntry.java:83)
    at org.terasology.rendering.nui.internal.NUIManagerInternal.keyEvent(NUIManagerInternal.java:604)
    at org.terasology.rendering.nui.internal.NUIManagerInternalMethodAccess.invoke(Unknown Source)
    at org.terasology.entitySystem.event.internal.EventSystemImpl$ByteCodeEventHandlerInfo.invoke(EventSystemImpl.java:506)
    at org.terasology.entitySystem.event.internal.EventSystemImpl.sendConsumableEvent(EventSystemImpl.java:279)
    at org.terasology.entitySystem.event.internal.EventSystemImpl.send(EventSystemImpl.java:258)
    at org.terasology.entitySystem.entity.internal.BaseEntityRef.send(BaseEntityRef.java:145)
    at org.terasology.input.InputSystem.sendKeyEvent(InputSystem.java:475)
    at org.terasology.input.InputSystem.processKeyboardInput(InputSystem.java:425)
    at org.terasology.input.InputSystem.update(InputSystem.java:272)
    at org.terasology.engine.modes.StateIngame.handleInput(StateIngame.java:179)
    at org.terasology.engine.subsystem.lwjgl.LwjglInput.postUpdate(LwjglInput.java:54)
    at org.terasology.engine.TerasologyEngine.mainLoop(TerasologyEngine.java:422)
    at org.terasology.engine.TerasologyEngine.run(TerasologyEngine.java:368)
    at org.terasology.engine.Terasology.main(Terasology.java:152)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147)
Caused by: java.util.NoSuchElementException: No value present
    at java.util.Optional.get(Optional.java:135)
    at org.terasology.world.block.loader.AutoBlockProvider.lambda$getAvailableAssetUrns$341(AutoBlockProvider.java:51)
    at org.terasology.world.block.loader.AutoBlockProvider$$Lambda$292/1415835701.apply(Unknown Source)
    at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
    at java.util.Iterator.forEachRemaining(Iterator.java:116)
    at java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801)
    at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:512)
    at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:502)
    at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:151)
    at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:174)
    at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
    at java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:418)
    at org.terasology.world.block.loader.AutoBlockProvider.getAvailableAssetUrns(AutoBlockProvider.java:53)
    at org.terasology.assets.AssetType.getAvailableAssetUrns(AssetType.java:593)
    at org.terasology.assets.management.AssetManager.getAvailableAssets(AssetManager.java:129)
    at org.terasology.logic.console.commands.CoreCommands.findBlockMatches(CoreCommands.java:199)
    at org.terasology.logic.console.commands.CoreCommands.search(CoreCommands.java:152)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at org.terasology.logic.console.commandSystem.AbstractCommand.execute(AbstractCommand.java:237)
    ... 25 common frames omitted
00:13:32.598 [main] INFO  o.t.logic.console.ConsoleImpl - [ERROR] An error occurred while executing command 'search': No value present
00:13:40.384 [main] INFO  o.t.p.i.ReadWriteStorageManager - Saving - Creating game snapshot
lokesh-sharma commented 7 years ago

I modified the lavender asset (inserted a comma ) in core/assets/blocks/flora/lavender.block and when running the game it crashes during loading the assets . It crashes before the games loads to screen