Skip to content

Commit

Permalink
Add error message on empty public resources
Browse files Browse the repository at this point in the history
This should provide more understandable behavior in the case described in
#5077

RELNOTES: none
PiperOrigin-RevId: 193968203
  • Loading branch information
asteinb authored and meteorcloudy committed Apr 26, 2018
1 parent 24beb63 commit 9ab7ec8
Showing 1 changed file with 11 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -337,13 +337,17 @@ private Map<ResourceType, Integer> assignTypeIdsForPublic() {
"Cannot force ATTR to have type code other than 0x%02x (got 0x%02x from %s)",
ATTR_TYPE_ID, reservedTypeSlot, previousResource));
}
allocatedTypeIds.put(currentType, reservedTypeSlot);
ResourceType alreadyAssigned = assignedIds.put(reservedTypeSlot, currentType);
if (alreadyAssigned != null) {
logger.warning(
String.format(
"Multiple type names declared for public type identifier 0x%x (%s vs %s)",
reservedTypeSlot, alreadyAssigned, currentType));
if (reservedTypeSlot == null) {
logger.warning(String.format("Invalid public resource of type %s - ignoring", currentType));
} else {
allocatedTypeIds.put(currentType, reservedTypeSlot);
ResourceType alreadyAssigned = assignedIds.put(reservedTypeSlot, currentType);
if (alreadyAssigned != null) {
logger.warning(
String.format(
"Multiple type names declared for public type identifier 0x%x (%s vs %s)",
reservedTypeSlot, alreadyAssigned, currentType));
}
}
}
return allocatedTypeIds;
Expand Down

0 comments on commit 9ab7ec8

Please sign in to comment.