DriveBackupV2

DriveBackupV2

46.6k Downloads

Error when using glob

lwheelden56 opened this issue ยท 8 comments

commented

I have the glob setup as per the wiki example and i get this error:

[02:00:01] [Craft Scheduler Thread - 3050 - DriveBackupV2/WARN]: [DriveBackupV2] Plugin DriveBackupV2 v1.3.8 generated an exception while executing task 19
java.lang.Error: Unresolved compilation problem: 
	The method of(String) is undefined for the type Path

	at ratismal.drivebackup.util.FileUtil.generateGlobFolderList(FileUtil.java:261) ~[?:?]
	at ratismal.drivebackup.UploadThread.run(UploadThread.java:203) ~[?:?]
	at org.bukkit.craftbukkit.v1_16_R3.scheduler.CraftTask.run(CraftTask.java:100) ~[patched_1.16.5.jar:git-Purpur-978]
	at org.bukkit.craftbukkit.v1_16_R3.scheduler.CraftAsyncTask.run(CraftAsyncTask.java:58) ~[patched_1.16.5.jar:git-Purpur-978]
	at com.destroystokyo.paper.ServerSchedulerReportingWrapper.run(ServerSchedulerReportingWrapper.java:22) ~[patched_1.16.5.jar:git-Purpur-978]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) [?:?]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) [?:?]
	at java.lang.Thread.run(Thread.java:834) [?:?]

This is my config:

# 
# DriveBackupV2   -   by Max Maeder (MaxTheGinus)
delay: -1
backup-thread-priority: 7
keep-count: 10
local-keep-count: 15
zip-compression: -1
backups-require-players: true
disable-saving-during-backups: true
scheduled-backups: true
schedule-timezone: -05:00
backup-schedule-list:
- days:
  - everyday
  time: 02:00
backup-format-timezone: -05:00
backup-list:
- glob: world*
  format: '''Backup-world-''yyyy-M-d--HH-mm''.zip'''
  create: true
- path: plugins
  format: '''Backup-plugins-''yyyy-M-d--HH-mm''.zip'''
  create: true
  blacklist:
  - '**/*.jar'
  - dynmap/**
dir: backups
destination: backups
googledrive:
  enabled: true
onedrive:
  enabled: false
ftp:
  enabled: false
  hostname: ftp.example.com
  port: 21
  sftp: false
  ftps: false
  username: Username
messages:
  send-in-chat: true
  no-perm: You don't have permission to do this!
  backup-start: Creating backups...
  backup-complete: Backup complete,
  next-backup: the next backup is in %TIME minutes
  next-schedule-backup: the next backup is at %DATE
  next-schedule-backup-format: h:mm a EEE, MMM d O
  auto-backups-disabled: Automatic backups are disabled
advanced:
  metrics: false
  update-check: true
  suppress-errors: false
  message-prefix: '&6[&4DriveBackupV2&6] '
  default-message-color: '&3'
  date-language: en
  ftp-file-separator: /

Any help would be appreciated.

commented

I just decided not to use glob and put the exact paths of each of the worlds.

commented

This looks like a bug. I will look into this.

commented

@frereit I believe this is related to the code you contributed. Mind taking a look? If it helps, DriveBackupV2 is built with Java 8.

Thanks

commented

Yes, I will take a look later today! (I'm in CEST so I was sleeping when you tagged me, sorry for the late reply)

commented

Hmm.. I am having trouble reproducing the issue even when building with openjdk-8:

$ /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java -version 
openjdk version "1.8.0_282"
OpenJDK Runtime Environment (build 1.8.0_282-8u282-b08-0ubuntu1~20.04-b08)
OpenJDK 64-Bit Server VM (build 25.282-b08, mixed mode)

I can reproduce the issue only when downloading the prebuilt jar, could you give me more details on the build process so I can try to reproduce the issue locally?

commented

Could you have possibly meant Paths.get()? This seems to take in a String as a parameter and return a Path.

commented

Yeah, curious. Apparently I somehow still build with java 11 even though when I set my JAVA_HOME to java 8 and
Maven tells me that it's building with Java 8 so I'm not really sure what's going on.

In Java 11 Path.of replaced Paths.get, see this stackoverflow thread and the mails linked in the answer.
Sorry about that, I thought I was building with java 8 but apparently I wasn't. Replacing it with Paths.get still builds and seems to work fine, so I'll submit a PR with that fix.

commented

This is the JDK I use to build the plugin. I should really get some CI workflow set up to avoid issues like this in the future.

C:\Users\maxsm>java -version
openjdk version "1.8.0_282"
OpenJDK Runtime Environment (AdoptOpenJDK)(build 1.8.0_282-b08)
OpenJDK 64-Bit Server VM (AdoptOpenJDK)(build 25.282-b08, mixed mode)

I also can't see a Path.of() method in the documentation. Can you point me to where you see this is a valid method?