1
0
mirror of https://github.com/twiglet/cs2j.git synced 2025-01-18 13:15:17 +01:00

updates from scormengine port

This commit is contained in:
Kevin Glynn 2012-01-13 10:17:19 +01:00
parent 5287e7b1f7
commit 24cd7e967d
4 changed files with 22 additions and 16 deletions

View File

@ -20,6 +20,9 @@
package CS2JNet.System.Net.Mail;
import javax.mail.internet.AddressException;
import javax.mail.internet.InternetAddress;
/**
* @author keving
*
@ -28,27 +31,27 @@ public class MailAddress {
private String address, displayName, host, user;
private void parseAddress(String add) {
private void parseAddress(String add) throws AddressException {
// TODO: parse address into fields
address = add;
InternetAddress parsedMailaddress = new InternetAddress(add, false);
address = parsedMailaddress.getAddress();
displayName = parsedMailaddress.getPersonal();
}
public MailAddress(String inAddress) {
public MailAddress(String inAddress) throws AddressException {
parseAddress(inAddress);
}
public MailAddress(String inAddress, String inDisplayName) {
public MailAddress(String inAddress, String inDisplayName) throws AddressException {
parseAddress(inAddress);
if (inDisplayName != null && inDisplayName.length() > 0)
inAddress = inDisplayName;
displayName = inDisplayName;
}
// TODO:
//public MailAddress(String inAddress, Encoding enc) {
// parseAddress(inAddress);
// if (inDisplayName != null && inDisplayName.length() > 0)
// inAddress = inDisplayName;
//}
public MailAddress(InternetAddress inInternetAddress) throws AddressException {
address = inInternetAddress.getAddress();
displayName = inInternetAddress.getPersonal();
}
/**
@ -106,5 +109,6 @@ public class MailAddress {
public String getAddress() {
return address;
}
}

View File

@ -25,6 +25,8 @@ import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import javax.mail.internet.AddressException;
/**
* @author keving
*
@ -38,7 +40,7 @@ public class MailAddressCollection implements Collection<MailAddress> {
return addresses.add(arg0);
}
public boolean add(String arg0) {
public boolean add(String arg0) throws AddressException {
return addresses.add(new MailAddress(arg0));
}

View File

@ -17,7 +17,7 @@ public class MailMessage
private MailAddressCollection _to;
private boolean _html;
private String _body;
private InternetAddress _from;
private MailAddress _from;
private String _subject;
public MailAddressCollection getBcc() throws Exception
@ -55,12 +55,12 @@ public class MailMessage
_body = value;
}
public InternetAddress getFrom() throws Exception
public MailAddress getFrom() throws Exception
{
return _from;
}
public void setFrom(InternetAddress value) throws Exception
public void setFrom(MailAddress value) throws Exception
{
_from = value;
}

View File

@ -1,4 +1,4 @@
package RusticiSoftware.System.Web;
package CS2JNet.System.Web;
public class HttpException extends Exception {
private int httpCode = -1;