Code with Finding: |
class ExtensionsConfigFileReader { /* * This method corresponds to an iteration of the loop at line 2212 Notes: * 1. [general] and [globals] are allowed to be a context here if they contain only configvariables * 2. switch and ignorepat are treated like regular ConfigVariable. */ @Override protected ConfigElement processTextLine(String configfile, int lineno, String line) throws ConfigParseException { ConfigElement configElement; if( (line.trim().startsWith("exten") || line.trim().startsWith("include")) && currentCategory != null && (currentCategory.getName().equals("general") || currentCategory.getName().equals("globals")) ) throw new ConfigParseException(configfile, lineno, "cannot have 'exten' or 'include' in global or general sections");
/* * Goal here is to break out anything unique that we might want to * look at and parse separately. For now, only exten and include fit * that criteria. Eventually, I could see parsing sections for things * from macros, contexts to differentiate them from categories, switch * for realtime, and more. */ if (line.trim().startsWith("exten")) { configElement = parseExtension(configfile, lineno, line); currentCategory.addElement(configElement); return configElement; } else if(line.trim().startsWith("include")) { // use parseVariable since we have access to it ConfigVariable configvar = parseVariable(configfile, lineno, line); configElement = new ConfigInclude(configfile, lineno, configvar.getValue()); currentCategory.addElement(configElement); return configElement; } // leave everything else the same configElement = super.processTextLine(configfile, lineno, line); return configElement; }
}
|