in geronimo-mail_2.1_spec/src/main/java/jakarta/mail/Session.java [678:729]
private void loadProviders(final ProviderInfo info, final InputStream is) throws IOException {
final BufferedReader reader = new BufferedReader(new InputStreamReader(is));
String line;
while ((line = reader.readLine()) != null) {
// Lines beginning with "#" are just comments.
if (line.startsWith("#")) {
continue;
}
final StringTokenizer tok = new StringTokenizer(line, ";");
String protocol = null;
Provider.Type type = null;
String className = null;
String vendor = null;
String version = null;
while (tok.hasMoreTokens()) {
final String property = tok.nextToken();
final int index = property.indexOf('=');
if (index == -1) {
continue;
}
final String key = property.substring(0, index).trim().toLowerCase();
final String value = property.substring(index+1).trim();
if (protocol == null && "protocol".equals(key)) {
protocol = value;
} else if (type == null && "type".equals(key)) {
if ("store".equals(value)) {
type = Provider.Type.STORE;
} else if ("transport".equals(value)) {
type = Provider.Type.TRANSPORT;
}
} else if (className == null && "class".equals(key)) {
className = value;
} else if ("vendor".equals(key)) {
vendor = value;
} else if ("version".equals(key)) {
version = value;
}
}
if (protocol == null || type == null || className == null) {
//todo should we log a warning?
continue;
}
if (debug) {
writeDebug("DEBUG: loading new provider protocol=" + protocol + ", className=" + className + ", vendor=" + vendor + ", version=" + version);
}
final Provider provider = new Provider(type, protocol, className, vendor, version);
// add to the info list.
info.addProvider(provider);
}
}