Skip to content

Commit

Permalink
BUG FIX: Skip MOs with no attributes in the dump
Browse files Browse the repository at this point in the history
  • Loading branch information
erssebaggala authored Mar 26, 2019
1 parent a2e5595 commit 0828bb2
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 9 deletions.
Binary file modified dist/boda-nokiacmdataparser.jar
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,19 @@
import org.apache.commons.cli.Option;
import org.apache.commons.cli.Options;
import org.apache.commons.cli.ParseException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class NokiaCMDataParser
{
private static final Logger LOGGER = LoggerFactory.getLogger(NokiaCMDataParser.class);

/**
* Current version
*
* @since 1.1.0
*/
final static public String VERSION = "2.2.0";
final static public String VERSION = "2.2.1";

/**
* Tracks Managed Object attributes to write to file. This is dictated by
Expand Down Expand Up @@ -260,8 +263,6 @@ public static void main( String[] args )
}




try{

if(showVersion == true ){
Expand Down Expand Up @@ -661,7 +662,7 @@ public void endELementEvent(XMLEvent xmlEvent)
EndElement endElement = xmlEvent.asEndElement();
String prefix = endElement.getName().getPrefix();
String qName = endElement.getName().getLocalPart();

if(qName.equals("head")){
inHead = false;
}
Expand Down Expand Up @@ -697,12 +698,16 @@ public void endELementEvent(XMLEvent xmlEvent)

//Collect the managed object parameter values
if(qName.equals("managedObject")){
//Skip MO if it is not in the parameterfile
if(!moColumns.containsKey(moClassName) && parameterFile != null){
return;
}

//System.out.println("managedObject:" + moClassName);
String paramNames = "FILENAME,DATETIME,VERSION,DISTNAME,MOID";
String paramValues = baseFileName+ "," + dateTime + ","+moVersion+","+moDistName+","+moId;

if(ParserStates.EXTRACTING_PARAMETERS == parserState){

if(!moColumns.containsKey(moClassName)){
moColumns.put(moClassName, new Stack());
}
Expand All @@ -725,16 +730,18 @@ public void endELementEvent(XMLEvent xmlEvent)
if(ParserStates.EXTRACTING_VALUES == parserState){
Stack columns = moColumns.get(moClassName);

if (columns.size() == 0){
// moiParameterValueMap.clear();
// moClassName = null;
return;
}

//Create print writer and write the file header to it
if( !moiPrintWriters.containsKey(moClassName)){

String moiFile = outputDirectory + File.separatorChar + moClassName + ".csv";
moiPrintWriters.put(moClassName, new PrintWriter(moiFile));



for(int i =0; i < columns.size(); i++){

String pName = columns.get(i).toString();
if(pName.equals("FILENAME") || pName.equals("DATETIME")
|| pName.equals("VERSION") || pName.equals("DISTNAME")
Expand Down

0 comments on commit 0828bb2

Please sign in to comment.