Crash when storing to directory
java.lang.StringIndexOutOfBoundsException: String index out of range: -1
at java.lang.String.substring(String.java:1967)
at org.gimnechiske.irm.IrmApplication.keyFromFilename(IrmApplication.java:46)
at net.morimekta.providence.storage.dir.DefaultFileManager.tmpFileFor(DefaultFileManager.java:60)
at net.morimekta.providence.storage.DirectoryMessageStore.write(DirectoryMessageStore.java:171)
at net.morimekta.providence.storage.DirectoryMessageStore.lambda$putAll$4(DirectoryMessageStore.java:122)
at com.google.common.collect.SingletonImmutableBiMap.forEach(SingletonImmutableBiMap.java:65)
at net.morimekta.providence.storage.DirectoryMessageStore.lambda$putAll$5(DirectoryMessageStore.java:120)
at net.morimekta.util.concurrent.ReentrantReadWriteMutex.lockForWriting(ReentrantReadWriteMutex.java:75)
at net.morimekta.providence.storage.DirectoryMessageStore.putAll(DirectoryMessageStore.java:118)
at net.morimekta.providence.storage.ReadWriteStore.put(ReadWriteStore.java:42)
at org.gimnechiske.irm.api.IrmDataServiceImpl.updateRule(IrmDataServiceImpl.java:30)
at org.gimnechiske.irm.api.IrmDataService$Processor.handleCall(IrmDataService.java:202)
at net.morimekta.providence.PProcessor.handleCall(PProcessor.java:62)
at net.morimekta.providence.server.ProvidenceServlet.lambda$doPost$3(ProvidenceServlet.java:132)
at net.morimekta.providence.server.WrappedProcessor.handleCall(WrappedProcessor.java:64)
at net.morimekta.providence.PProcessor.handleCall(PProcessor.java:62)
at net.morimekta.providence.server.DefaultProcessorHandler.process(DefaultProcessorHandler.java:96)
at net.morimekta.providence.server.ProvidenceServlet.doPost(ProvidenceServlet.java:182)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:665)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:750)
at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:865)
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:535)
at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:255)
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1340)
at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:203)
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:473)
at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:201)
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1242)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:144)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
at org.eclipse.jetty.server.Server.handle(Server.java:503)
at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:364)
at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:260)
at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:305)
at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:103)
at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:118)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:765)
at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:683)
at java.lang.Thread.run(Thread.java:748)```
Edited by Aun Johnsen