Skip to content

Commit

Permalink
Fix findbugs perf issues
Browse files Browse the repository at this point in the history
Summary: perf issues flagged by findbugs

Test Plan: Unit Tests
  • Loading branch information
Roy Williams authored and oconnor663 committed Apr 7, 2014
1 parent 1647cda commit 42fd2bc
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 7 deletions.
7 changes: 7 additions & 0 deletions findbugsfilter.xml
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>

<FindBugsFilter>
<Match classregex=".*ApkDescription$">
<BugCode name="OS"/>
</Match>
</FindBugsFilter>
2 changes: 1 addition & 1 deletion src/com/facebook/buck/apple/clang/HeaderMap.java
Expand Up @@ -454,7 +454,7 @@ private int addString(String str) {
}
putStringByte((byte) 0);

addedStrings.put(str, new Integer(offset));
addedStrings.put(str, offset);
return offset;
}
}
9 changes: 4 additions & 5 deletions src/com/facebook/buck/cli/TargetsCommand.java
Expand Up @@ -210,11 +210,10 @@ private void printJsonForTargetsInternal(
getStdOut().println("[");

ObjectMapper mapper = new ObjectMapper();
Iterator<String> keySetIterator = buildIndex.keySet().iterator();
Iterator<BuildRule> valueIterator = buildIndex.values().iterator();

while (keySetIterator.hasNext()) {
String key = keySetIterator.next();
BuildRule buildRule = buildIndex.get(key);
while (valueIterator.hasNext()) {
BuildRule buildRule = valueIterator.next();
BuildTarget buildTarget = buildRule.getBuildTarget();

List<Map<String, Object>> rules;
Expand Down Expand Up @@ -273,7 +272,7 @@ private void printJsonForTargetsInternal(
throw Throwables.propagate(e);
}
String output = stringWriter.getBuffer().toString();
if (keySetIterator.hasNext()) {
if (valueIterator.hasNext()) {
output += ",";
}
getStdOut().println(output);
Expand Down
2 changes: 1 addition & 1 deletion src/com/facebook/buck/test/XmlTestResultParser.java
Expand Up @@ -62,7 +62,7 @@ private static TestCaseSummary doParse(String xml) throws IOException {
for (int i = 0; i < testElements.getLength(); i++) {
Element node = (Element)testElements.item(i);
String testName = node.getAttribute("name");
long time = Long.valueOf(node.getAttribute("time"));
long time = Long.parseLong(node.getAttribute("time"));
String typeString = node.getAttribute("type");
ResultType type = ResultType.valueOf(typeString);

Expand Down

0 comments on commit 42fd2bc

Please sign in to comment.