Skip to content

Commit

Permalink
SAK-29370: Reduce log bloat due to 'numberofgrades' parsing when attr…
Browse files Browse the repository at this point in the history
…ibute doesn't exist
  • Loading branch information
bbailla2 committed May 15, 2015
1 parent 0fd33ad commit 5176311
Showing 1 changed file with 45 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10725,21 +10725,31 @@ public BaseAssignmentSubmission(Element el)
M_log.debug(" BaseAssignmentSubmission: CONSTRUCTOR : Exception reading logs : " + e);
}

intString = el.getAttribute("numberofgrades");
try
{
numAttributes = Integer.parseInt(intString);
for (int x = 0; x < numAttributes; x++)
{
attributeString = "grade" + x;
tempString = el.getAttribute(attributeString);
if (tempString != null) m_grades.add(tempString);
}
}
catch (Exception e)
{
M_log.warn(" BaseAssignmentSubmission: CONSTRUCTOR : Exception reading grades : " + e);
}
intString = el.getAttribute("numberofgrades");
if (intString == null)
{
M_log.debug("BaseAssignmentSubmission: numberofgrades property not found");
}
else
{
try
{
numAttributes = Integer.parseInt(intString);
for (int x = 0; x < numAttributes; x++)
{
attributeString = "grade" + x;
tempString = el.getAttribute(attributeString);
if (tempString != null)
{
m_grades.add(tempString);
}
}
}
catch (Exception e)
{
M_log.warn(" BaseAssignmentSubmission: CONSTRUCTOR : Exception reading grades : " + e);
}
}

// READ THE SUBMITTERS
m_submitters = new ArrayList();
Expand Down Expand Up @@ -11006,19 +11016,29 @@ public void startElement(String uri, String localName, String qName,
}

intString = attributes.getValue("numberofgrades");
try
if (intString == null)
{
numAttributes = NumberUtils.toInt(intString);
for (int x = 0; x < numAttributes; x++)
{
attributeString = "grade" + x;
tempString = attributes.getValue(attributeString);
if (tempString != null) m_grades.add(tempString);
}
M_log.debug("BaseAssignmentSubmission: numberofgrades property not found");
}
catch (Exception e)
else
{
M_log.warn(" BaseAssignmentSubmission: error parsing 'numberofgrades' property : " + e);
try
{
numAttributes = NumberUtils.toInt(intString);
for (int x = 0; x < numAttributes; x++)
{
attributeString = "grade" + x;
tempString = attributes.getValue(attributeString);
if (tempString != null)
{
m_grades.add(tempString);
}
}
}
catch (Exception e)
{
M_log.warn(" BaseAssignmentSubmission: error parsing 'numberofgrades' property : " + e);
}
}

// READ THE SUBMITTERS
Expand Down

0 comments on commit 5176311

Please sign in to comment.