/** * Set the debug setting for this Session. * <p> * Since the debug setting can be turned on only after the Session * has been created, to turn on debugging in the Session * constructor, set the property <code>mail.debug</code> in the * Properties object passed in to the constructor to true. The * value of the <code>mail.debug</code> property is used to * initialize the per-Session debugging flag. Subsequent calls to * the <code>setDebug</code> method manipulate the per-Session * debugging flag and have no affect on the <code>mail.debug</code> * property. * * @param debug Debug setting */ public synchronized void setDebug(boolean debug) { this.debug = debug; if (debug) pr("DEBUG: setDebug: JavaMail version " + Version.version); }
/** * Set the debug setting for this Session. * <p> * Since the debug setting can be turned on only after the Session * has been created, to turn on debugging in the Session * constructor, set the property <code>mail.debug</code> in the * Properties object passed in to the constructor to true. The * value of the <code>mail.debug</code> property is used to * initialize the per-Session debugging flag. Subsequent calls to * the <code>setDebug</code> method manipulate the per-Session * debugging flag and have no affect on the <code>mail.debug</code> * property. * * @param debug Debug setting */ public synchronized void setDebug(boolean debug) { this.debug = debug; if (debug) pr("DEBUG: setDebug: JavaMail version " + Version.version); }
/** * Load from the named file. */ private void loadFile(String name, StreamLoader loader) { InputStream clis = null; try { clis = new BufferedInputStream(new FileInputStream(name)); loader.load(clis); if (debug) pr("DEBUG: successfully loaded file: " + name); } catch (FileNotFoundException fex) { // ignore it } catch (IOException e) { if (debug) { pr("DEBUG: not loading file: " + name); pr("DEBUG: " + e); } } catch (SecurityException sex) { if (debug) { pr("DEBUG: not loading file: " + name); pr("DEBUG: " + sex); } } finally { try { if (clis != null) clis.close(); } catch (IOException ex) { } // ignore it } }
/** * Load from the named file. */ private void loadFile(String name, StreamLoader loader) { InputStream clis = null; try { clis = new BufferedInputStream(new FileInputStream(name)); loader.load(clis); if (debug) pr("DEBUG: successfully loaded file: " + name); } catch (IOException e) { if (debug) { pr("DEBUG: not loading file: " + name); pr("DEBUG: " + e); } } catch (SecurityException sex) { if (debug) { pr("DEBUG: not loading file: " + name); pr("DEBUG: " + sex); } } finally { try { if (clis != null) clis.close(); } catch (IOException ex) { } // ignore it } }
/** * Load from the named resource. */ private void loadResource(String name, Class cl, StreamLoader loader) { InputStream clis = null; try { clis = getResourceAsStream(cl, name); if (clis != null) { loader.load(clis); if (debug) pr("DEBUG: successfully loaded resource: " + name); } else { if (debug) pr("DEBUG: not loading resource: " + name); } } catch (IOException e) { if (debug) pr("DEBUG: " + e); } catch (SecurityException sex) { if (debug) pr("DEBUG: " + sex); } finally { try { if (clis != null) clis.close(); } catch (IOException ex) { } // ignore it } }
/** * Load from the named resource. */ private void loadResource(String name, Class cl, StreamLoader loader) { InputStream clis = null; try { clis = getResourceAsStream(cl, name); if (clis != null) { loader.load(clis); if (debug) pr("DEBUG: successfully loaded resource: " + name); } else { /* if (debug) pr("DEBUG: not loading resource: " + name); */ } } catch (IOException e) { if (debug) pr("DEBUG: " + e); } catch (SecurityException sex) { if (debug) pr("DEBUG: " + sex); } finally { try { if (clis != null) clis.close(); } catch (IOException ex) { } // ignore it } }
private Session(Properties props, Authenticator authenticator) { this.props = props; this.authenticator = authenticator; if (Boolean.valueOf(props.getProperty("mail.debug")).booleanValue()) debug = true; if (debug) pr("DEBUG: JavaMail version " + Version.version); // get the Class associated with the Authenticator Class cl; if (authenticator != null) cl = authenticator.getClass(); else cl = this.getClass(); // load the resources loadProviders(cl); loadAddressMap(cl); }
private Session(Properties props, Authenticator authenticator) { this.props = props; this.authenticator = authenticator; if (Boolean.valueOf(props.getProperty("mail.debug")).booleanValue()) debug = true; if (debug) pr("DEBUG: JavaMail version " + Version.version); // get the Class associated with the Authenticator Class cl; if (authenticator != null) cl = authenticator.getClass(); else cl = this.getClass(); // load the resources loadProviders(cl); loadAddressMap(cl); }
private void loadAddressMap(Class cl) { StreamLoader loader = new StreamLoader() { public void load(InputStream is) throws IOException { addressMap.load(is); } }; // load default META-INF/javamail.default.address.map from mail.jar loadResource("/META-INF/javamail.default.address.map", cl, loader); // load the META-INF/javamail.address.map file supplied by an app loadAllResources("META-INF/javamail.address.map", cl, loader); // load system-wide javamail.address.map from the <java.home>/lib dir try { String res = System.getProperty("java.home") + File.separator + "lib" + File.separator + "javamail.address.map"; loadFile(res, loader); } catch (SecurityException sex) { if (debug) pr("DEBUG: can't get java.home: " + sex); } if (addressMap.isEmpty()) { if (debug) pr("DEBUG: failed to load address map, using defaults"); addressMap.put("rfc822", "smtp"); } }
private void loadAddressMap(Class cl) { StreamLoader loader = new StreamLoader() { public void load(InputStream is) throws IOException { addressMap.load(is); } }; // load default META-INF/javamail.default.address.map from mail.jar loadResource("/META-INF/javamail.default.address.map", cl, loader); // load the META-INF/javamail.address.map file supplied by an app loadAllResources("META-INF/javamail.address.map", cl, loader); // load system-wide javamail.address.map from the <java.home>/lib dir try { String res = System.getProperty("java.home") + File.separator + "lib" + File.separator + "javamail.address.map"; loadFile(res, loader); } catch (SecurityException sex) { if (debug) pr("DEBUG: can't get java.home: " + sex); } if (addressMap.isEmpty()) { if (debug) pr("DEBUG: failed to load address map, using defaults"); addressMap.put("rfc822", "smtp"); } }
InputStream clis = null; if (debug) pr("DEBUG: URL " + url); try { clis = openStream(url); anyLoaded = true; if (debug) pr("DEBUG: successfully loaded resource: " + url); } else { if (debug) pr("DEBUG: not loading resource: " + url); pr("DEBUG: " + ioex); } catch (SecurityException sex) { if (debug) pr("DEBUG: " + sex); } finally { try { pr("DEBUG: " + ex); pr("DEBUG: !anyLoaded"); loadResource("/" + name, cl, loader);
InputStream clis = null; if (debug) pr("DEBUG: URL " + url); try { clis = openStream(url); anyLoaded = true; if (debug) pr("DEBUG: successfully loaded resource: " + url); } else { if (debug) pr("DEBUG: not loading resource: " + url); pr("DEBUG: " + ioex); } catch (SecurityException sex) { if (debug) pr("DEBUG: " + sex); } finally { try { pr("DEBUG: " + ex);
pr("DEBUG: Bad provider entry: " + currLine); continue;
pr("DEBUG: Bad provider entry: " + currLine); continue;
} catch (SecurityException sex) { if (debug) pr("DEBUG: can't get java.home: " + sex); pr("DEBUG: failed to load any providers, using defaults"); pr("DEBUG: Tables of loaded providers"); pr("DEBUG: Providers Listed By Class Name: " + providersByClassName.toString()); pr("DEBUG: Providers Listed By Protocol: " + providersByProtocol.toString());
} catch (SecurityException sex) { if (debug) pr("DEBUG: can't get java.home: " + sex); pr("DEBUG: failed to load any providers, using defaults"); pr("DEBUG: Tables of loaded providers"); pr("DEBUG: Providers Listed By Class Name: " + providersByClassName.toString()); pr("DEBUG: Providers Listed By Protocol: " + providersByProtocol.toString());