Unexpected root page type: -99

岁酱吖の 提交于 2020-01-25 10:17:08

问题


When trying to upload a file using VFS my app throws this error, what could be wrong in my code:

  jetbrains.exodus.ExodusException: Unexpected root page type: -99
        at jetbrains.exodus.tree.patricia.PatriciaTree.<init>(PatriciaTree.java:37)
        at jetbrains.exodus.env.StoreImpl.openImmutableTree(StoreImpl.java:220)
        at jetbrains.exodus.env.TransactionBase.getTree(TransactionBase.java:125)
        at jetbrains.exodus.env.ReadWriteTransaction.getTree(ReadWriteTransaction.java:186)
        at jetbrains.exodus.env.StoreImpl.get(StoreImpl.java:69)
        at jetbrains.exodus.vfs.VirtualFileSystem.openFile(VirtualFileSystem.java:267)
        at com.backend.repository.jee.JeeXodusVFSRepository$2.execute(JeeXodusVFSRepository.java:101)

Here's the code:

public com.backend.model.File put(
      String appId, String namespace, String name, InputStream is) {
    final com.backend.model.File[] createdFile = {null};
    final Environment env = manager.getEnvironment(xodusRoot, appId);
    final VirtualFileSystem vfs = manager.getVirtualFileSystem(env);
    env.executeInTransaction(
        new TransactionalExecutable() {
          @Override
          public void execute(@NotNull final Transaction txn) {
            final File file = vfs.openFile(txn, name, true); // Line 101
            DataOutputStream output = new DataOutputStream(vfs.writeFile(txn, file));
            try {
              output.write(ByteStreams.toByteArray(is));
            } catch (IOException e) {
              e.printStackTrace();
            }
            createdFile[0] = new com.backend.model.File();
            createdFile[0].setDescriptor(file.getDescriptor());
            createdFile[0].setName(name);
            createdFile[0].setCreated(file.getCreated());
            createdFile[0].setModified(file.getLastModified());
          }
        });
    // vfs.shutdown();
    // env.close();
    return createdFile[0];
  }

来源:https://stackoverflow.com/questions/59096823/unexpected-root-page-type-99

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!