Skip to content

Commit

Permalink
Fixing spotbugs issues
Browse files Browse the repository at this point in the history
  • Loading branch information
softwaremagico committed Jul 10, 2023
1 parent f92e55e commit fd195e0
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ public void assign() throws InvalidXmlElementException, InvalidRandomElementSele
}
}

@SuppressWarnings({"java:S3655"})
protected int assignBeneficeWithoutLevels(BeneficeDefinition benefice, int maxPoints) throws InvalidXmlElementException, RestrictedElementException {
final Set<AvailableBenefice> beneficeLevels = AvailableBeneficeFactory.getInstance()
.getAvailableBeneficesByDefinition(getCharacterPlayer().getLanguage(),
Expand All @@ -105,12 +106,10 @@ protected int assignBeneficeWithoutLevels(BeneficeDefinition benefice, int maxPo
throw new InvalidBeneficeException("Only benefices without multiples specializations can be use here.");
}
final Optional<AvailableBenefice> availableBenefice = beneficeLevels.stream().findAny();
if (availableBenefice.isPresent()) {
if (availableBenefice.get().getCost() <= maxPoints) {
cost = addBenefice(availableBenefice.get());
}
removeElementWeight(availableBenefice.get().getBeneficeDefinition());
if (availableBenefice.get().getCost() <= maxPoints) {
cost = addBenefice(availableBenefice.get());
}
removeElementWeight(availableBenefice.get().getBeneficeDefinition());
return cost;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import com.softwaremagico.tm.character.equipment.DamageType;
import com.softwaremagico.tm.character.equipment.Equipment;
import com.softwaremagico.tm.character.equipment.Size;
import com.softwaremagico.tm.log.SuppressFBWarnings;

import java.util.ArrayList;
import java.util.HashSet;
Expand Down Expand Up @@ -84,7 +83,7 @@ public WeaponType getType() {
}


@SuppressFBWarnings
@SuppressWarnings({"java:S3655"})
public boolean isMeleeWeapon() {
return getType() == WeaponType.MELEE || getType() == WeaponType.MELEE_ARTIFACT || getType() == WeaponType.MELEE_SHIELD ||
(getWeaponDamages().stream().findFirst().isPresent() && getWeaponDamages().stream().findFirst().get().getRange() == null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
*/

import com.softwaremagico.tm.log.ConfigurationLog;
import com.softwaremagico.tm.log.SuppressFBWarnings;

import java.io.BufferedReader;
import java.io.File;
Expand Down Expand Up @@ -255,7 +254,7 @@ public static File getResource(String fileName) throws NullPointerException {
return getResource(FileManager.class, fileName);
}

@SuppressFBWarnings
@SuppressWarnings({"java:S2259"})
public static File getResource(Class<?> classWithResources, String fileName) throws NullPointerException {
final URL url = classWithResources.getClassLoader().getResource(fileName);
if (url != null) {
Expand Down

0 comments on commit fd195e0

Please sign in to comment.