0

fix Lombok

This commit is contained in:
2018-03-07 01:05:59 +03:00
parent fc86ff0c57
commit 38dea96244

View File

@@ -4,13 +4,12 @@
*/ */
package lwjake2.qcommon; package lwjake2.qcommon;
import lombok.extern.slf4j.Slf4j;
import lwjake2.Defines; import lwjake2.Defines;
import lwjake2.Globals; import lwjake2.Globals;
import lwjake2.game.Cmd; import lwjake2.game.Cmd;
import lwjake2.game.cvar_t; import lwjake2.game.cvar_t;
import lwjake2.sys.Sys; import lwjake2.sys.Sys;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.File; import java.io.File;
import java.io.FileInputStream; import java.io.FileInputStream;
@@ -33,8 +32,8 @@ import static lwjake2.Defines.*;
* *
* ================================================== * ==================================================
*/ */
@Slf4j
public class BaseQ2FileSystem implements FileSystem { public class BaseQ2FileSystem implements FileSystem {
private static final Logger logger = LoggerFactory.getLogger(BaseQ2FileSystem.class);
private static final BaseQ2FileSystem instance = new BaseQ2FileSystem(); private static final BaseQ2FileSystem instance = new BaseQ2FileSystem();
private static final int IDPAKHEADER = (('K' << 24) + ('C' << 16) + ('A' << 8) + 'P'); private static final int IDPAKHEADER = (('K' << 24) + ('C' << 16) + ('A' << 8) + 'P');
private static final int MAX_FILES_IN_PACK = 4096; private static final int MAX_FILES_IN_PACK = 4096;
@@ -103,20 +102,20 @@ public class BaseQ2FileSystem implements FileSystem {
searchpath_t s; searchpath_t s;
filelink_t link; filelink_t link;
logger.info("Current search path:"); log.info("Current search path:");
for (s = fs_searchpaths; s != null; s = s.next) { for (s = fs_searchpaths; s != null; s = s.next) {
if (s == fs_base_searchpaths) if (s == fs_base_searchpaths)
logger.info("----------"); log.info("----------");
if (s.pack != null) if (s.pack != null)
logger.info("{} ({} files)", s.pack.filename, s.pack.numfiles); log.info("{} ({} files)", s.pack.filename, s.pack.numfiles);
else else
logger.info(s.filename); log.info(s.filename);
} }
logger.info("Links:"); log.info("Links:");
for (Iterator<filelink_t> it = fs_links.iterator(); it.hasNext();) { for (Iterator<filelink_t> it = fs_links.iterator(); it.hasNext();) {
link = it.next(); link = it.next();
logger.info("{} : {}", link.from, link.to); log.info("{} : {}", link.from, link.to);
} }
} }
@@ -127,7 +126,7 @@ public class BaseQ2FileSystem implements FileSystem {
filelink_t entry; filelink_t entry;
if (Cmd.Argc() != 3) { if (Cmd.Argc() != 3) {
logger.info("USAGE: link <from> <to>"); log.info("USAGE: link <from> <to>");
return; return;
} }
@@ -217,8 +216,8 @@ public class BaseQ2FileSystem implements FileSystem {
if (tmp != null) if (tmp != null)
tmp.replaceAll("\\\\", "/"); tmp.replaceAll("\\\\", "/");
logger.info("Directory of {}", findname); log.info("Directory of {}", findname);
logger.info("----"); log.info("----");
dirnames = listFiles(findname, 0, 0); dirnames = listFiles(findname, 0, 0);
@@ -226,9 +225,9 @@ public class BaseQ2FileSystem implements FileSystem {
int index = 0; int index = 0;
for (int i = 0; i < dirnames.length; i++) { for (int i = 0; i < dirnames.length; i++) {
if ((index = dirnames[i].lastIndexOf('/')) > 0) { if ((index = dirnames[i].lastIndexOf('/')) > 0) {
logger.info(dirnames[i].substring(index + 1, dirnames[i].length())); log.info(dirnames[i].substring(index + 1, dirnames[i].length()));
} else { } else {
logger.info(dirnames[i]); log.info(dirnames[i]);
} }
} }
} }
@@ -248,7 +247,7 @@ public class BaseQ2FileSystem implements FileSystem {
if (index > 0) { if (index > 0) {
File f = new File(path.substring(0, index)); File f = new File(path.substring(0, index));
if (!f.mkdirs() && !f.isDirectory()) { if (!f.mkdirs() && !f.isDirectory()) {
logger.warn("can't create path \"{}\"", path); log.warn("can't create path \"{}\"", path);
} }
} }
} }
@@ -349,7 +348,7 @@ public class BaseQ2FileSystem implements FileSystem {
pack.numfiles = numpackfiles; pack.numfiles = numpackfiles;
pack.files = newfiles; pack.files = newfiles;
logger.info("Added packfile {} ({} files)", packfile, numpackfiles); log.info("Added packfile {} ({} files)", packfile, numpackfiles);
return pack; return pack;
} }
@@ -427,7 +426,7 @@ public class BaseQ2FileSystem implements FileSystem {
if (dir.indexOf("..") != -1 || dir.indexOf("/") != -1 if (dir.indexOf("..") != -1 || dir.indexOf("/") != -1
|| dir.indexOf("\\") != -1 || dir.indexOf(":") != -1) { || dir.indexOf("\\") != -1 || dir.indexOf(":") != -1) {
logger.warn("Gamedir should be a single filename, not a path"); log.warn("Gamedir should be a single filename, not a path");
return; return;
} }
@@ -948,15 +947,15 @@ public class BaseQ2FileSystem implements FileSystem {
try { try {
read = file.read(buffer, offset, block); read = file.read(buffer, offset, block);
} catch (IOException e) { } catch (IOException e) {
logger.error(e.toString()); log.error(e.toString());
throw new RuntimeException("Look log file"); throw new RuntimeException("Look log file");
} }
if (read == 0) { if (read == 0) {
logger.error("FS_Read: 0 bytes read"); log.error("FS_Read: 0 bytes read");
throw new RuntimeException("Look log file"); throw new RuntimeException("Look log file");
} else if (read == -1) { } else if (read == -1) {
logger.error("FS_Read: -1 bytes read"); log.error("FS_Read: -1 bytes read");
throw new RuntimeException("Look log file"); throw new RuntimeException("Look log file");
} }
// //