src.samples.java.ex.UAA_Sample Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of fb-contrib Show documentation
Show all versions of fb-contrib Show documentation
An auxiliary findbugs.sourceforge.net plugin for java bug detectors that fall outside the narrow scope of detectors to be packaged with the product itself.
package ex;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
public class UAA_Sample {
private final Set in = new HashSet();
private final Set out = new HashSet();
public Set testLocalSet(Set in) {
Set out = new HashSet();
out.add("Foo");
out.add("Bar");
for (String s : in) {
out.add(s);
}
return out;
}
public Set testFPCondition(Set in) {
Set out = new HashSet();
for (String s : in) {
if (s.startsWith("a"))
out.add(s);
}
return out;
}
public Set testKeyOrValueAdd(Map in) {
Set out = new HashSet();
for (String s : in.keySet())
out.add(s);
for (String s : in.values())
out.add(s);
return out;
}
public void fpPrematureLoopEnd(List ss) {
for (String s : ss) {
out.add(s);
if (s.length() == 0) {
continue;
}
out.add(s);
}
}
public void testMemberSet() {
for (String s : in)
out.add(s);
}
public Set testFromArray(String[] in) {
Set out = new HashSet();
for (String s : in)
out.add(s);
return out;
}
public void testFPIfAtEndOfLoop(List d, List s, int i) {
Iterator it = s.iterator();
while (it.hasNext()) {
if (i == 0) {
d.add(it.next());
}
}
}
public void testFPAddWithCheck(List src, List dst) {
for (String s : src) {
if (dst.add(s))
System.out.println("Hmm");
}
}
public void testFP1934619_A(final List out, final Set currentParents) {
for (String currentOid : currentParents) {
out.add(currentOid);
if (currentOid.indexOf("xx") > -1) {
continue;
}
out.add("don't forget me");
}
}
public void testFP1934619_B(final List out, final Set currentParents) {
for (String currentOid : currentParents) {
if (currentOid.indexOf("xx") > -1) {
throw new RuntimeException("enough is enough");
}
out.add(currentOid);
}
}
}