1
0
mirror of https://github.com/Rogiel/l2jserver2 synced 2025-12-05 23:22:47 +00:00

Fixes issues found by findbugs

This commit is contained in:
2011-12-29 13:27:55 -02:00
parent 92ebaacf67
commit 1f2b700311
10 changed files with 28 additions and 35 deletions

View File

@@ -63,8 +63,10 @@ public class CSVUtils {
public static <R> List<R> parseCSV(BufferedReader reader,
CSVProcessor<R> processor) throws IOException {
final List<R> results = CollectionFactory.newList();
final String header[] = reader.readLine().split(",");
String line;
String line = reader.readLine();
if (line == null)
return results;
final String header[] = line.split(",");
while ((line = reader.readLine()) != null) {
results.add(processor.process(header, line.split(",")));
}

View File

@@ -48,9 +48,9 @@ public class PluginLoader implements Loader, Unloader {
* @return list of Template classes to load/unload
*/
@SuppressWarnings({ "unchecked", "unused" })
private static Set<Class<? extends Template<?>>> getSuitableClasses(
private static Set<Class<? extends Template>> getSuitableClasses(
Class<?>[] classes) {
final Set<Class<? extends Template<?>>> suitable = CollectionFactory
final Set<Class<? extends Template>> suitable = CollectionFactory
.newSet();
for (Class<?> clazz : classes) {
if (!ClassUtils.isSubclass(clazz, Template.class))
@@ -63,7 +63,7 @@ public class PluginLoader implements Loader, Unloader {
if (clazz.isAnnotationPresent(DisabledPlugin.class))
continue;
suitable.add((Class<? extends Template<?>>) clazz);
suitable.add((Class<? extends Template>) clazz);
}
return suitable;

View File

@@ -72,7 +72,7 @@
<type>jar</type>
<scope>test</scope>
</dependency>
<!-- html parser/generator -->
<dependency>
<groupId>org.htmlparser</groupId>

View File

@@ -57,7 +57,7 @@ public class L2JGameServerMain {
/**
* List of start services
*/
public static final Class<?>[][] SERVICES = {
private static final Class<?>[][] SERVICES = {
// core services
{ CacheService.class, ConfigurationService.class,
DatabaseService.class, WorldIDService.class,

View File

@@ -45,7 +45,7 @@ public class CM_REQUEST_CHAR_TEMPLATE extends AbstractClientPacket {
/**
* List of {@link CharacterClass} templates sent to the client
*/
protected static final CharacterClass[] TEMPLATE_CLASSES = {
private static final CharacterClass[] TEMPLATE_CLASSES = {
CharacterClass.HUMAN_FIGHTER, CharacterClass.HUMAN_MYSTIC,
CharacterClass.ELVEN_FIGHTER, CharacterClass.ELVEN_MYSTIC,
CharacterClass.DARK_FIGHTER, CharacterClass.DARK_MYSTIC,

View File

@@ -37,7 +37,6 @@ import com.l2jserver.service.ServiceStartException;
import com.l2jserver.service.ServiceStopException;
import com.l2jserver.service.database.DataAccessObject;
import com.l2jserver.service.game.region.Region;
import com.l2jserver.service.game.region.RegionService;
import com.l2jserver.util.factory.CollectionFactory;
/**
@@ -56,10 +55,10 @@ public class SimpleChatService extends AbstractService implements ChatService {
* The {@link ChatLoggingService} implementation
*/
private final ChatLoggingService chatLoggingService;
/**
* The {@link RegionService}
*/
private final RegionService regionService;
// /**
// * The {@link RegionService}
// */
// private final RegionService regionService;
/**
* The {@link L2Character} DAO
*/
@@ -90,6 +89,7 @@ public class SimpleChatService extends AbstractService implements ChatService {
/**
* The list of regional chat channels
*/
@SuppressWarnings("unused")
private Map<Region, RegionChatChannelImpl> regionChannels;
/**
@@ -105,7 +105,6 @@ public class SimpleChatService extends AbstractService implements ChatService {
CharacterDAO charDao) {
this.chatLoggingService = chatLogService;
// this.regionService = regionService;
this.regionService = null;
this.charDao = charDao;
}
@@ -178,13 +177,14 @@ public class SimpleChatService extends AbstractService implements ChatService {
@Override
public PublicChatChannel getRegionChannel(L2Character character) {
Preconditions.checkNotNull(character, "character");
final Region region = regionService.getRegion(character);
RegionChatChannelImpl channel = regionChannels.get(region);
if (channel == null) {
channel = new RegionChatChannelImpl(region);
regionChannels.put(region, channel);
}
return channel;
// final Region region = regionService.getRegion(character);
// RegionChatChannelImpl channel = regionChannels.get(region);
// if (channel == null) {
// channel = new RegionChatChannelImpl(region);
// regionChannels.put(region, channel);
// }
// return channel;
return null;
}
@Override
@@ -468,6 +468,7 @@ public class SimpleChatService extends AbstractService implements ChatService {
* @param region
* the region represented in this channel
*/
@SuppressWarnings("unused")
public RegionChatChannelImpl(Region region) {
Preconditions.checkNotNull(region, "region");
this.region = region;

View File

@@ -174,14 +174,4 @@ public interface ScriptContext {
*/
@Override
int hashCode();
/**
* This method overrides finalization to ensure that active script context
* will not be collected by GC. If such situation happens -
* {@link #shutdown()} is called to ensure that resources were released.
*
* @throws Throwable
* if something goes wrong during finalization
*/
void finalize() throws Throwable;
}

View File

@@ -340,7 +340,7 @@ public class ScriptContextImpl implements ScriptContext {
* {@inheritDoc}
*/
@Override
public void finalize() throws Throwable {
protected void finalize() throws Throwable {
if (compilationResult != null) {
log.error("Finalization of initialized ScriptContext. Forcing context shutdown.");
shutdown();

View File

@@ -284,7 +284,7 @@ public class WorldEventDispatcherServiceImpl extends
return false;
if (complete)
return false;
return cancel(mayInterruptIfRunning);
return super.cancel(mayInterruptIfRunning);
}
@Override

View File

@@ -51,12 +51,12 @@ public class ItemTemplateIDAdapter extends XmlAdapter<Integer, ItemTemplateID> {
@Override
public ItemTemplateID unmarshal(Integer v) throws Exception {
if (v == null)
return null;
if (v == 0)
return null;
if (provider == null)
return new ItemTemplateID(v, null);
if (v == null)
v = 57; // FIXME create constant holding important item ids
return provider.resolveID(v);
}