[Beepcore-java-commits] CVS: beepcore-java/src/org/beepcore/beep/core BEEPError.java,1.5,1.6 Profile
Status: Beta
Brought to you by:
huston
|
From: Huston F. <hu...@us...> - 2001-11-29 04:00:03
|
Update of /cvsroot/beepcore-java/beepcore-java/src/org/beepcore/beep/core
In directory usw-pr-cvs1:/tmp/cvs-serv29433/src/org/beepcore/beep/core
Modified Files:
BEEPError.java ProfileRegistry.java Session.java
Log Message:
First pass cleanup
Index: BEEPError.java
===================================================================
RCS file: /cvsroot/beepcore-java/beepcore-java/src/org/beepcore/beep/core/BEEPError.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -r1.5 -r1.6
*** BEEPError.java 2001/11/08 05:51:34 1.5
--- BEEPError.java 2001/11/29 04:00:00 1.6
***************
*** 42,61 ****
private static final String ERR_MALFORMED_XML_MSG = "Malformed XML";
- private static final String ERR_UNKNOWN_OPERATION_ELEMENT_MSG =
- "Unknown operation element";
- private static final String ERR_PCDATA_TOO_BIG_MSG =
- "Element's PCDATA exceeds the maximum size";
-
- private static final String FRAGMENT_ANGLE_SUFFIX = ">";
- private static final String FRAGMENT_CODE_PREFIX = "code='";
- private static final String FRAGMENT_ERROR_PREFIX = "<error ";
- private static final String FRAGMENT_ERROR_SUFFIX = "</error>";
- private static final String FRAGMENT_QUOTE_SLASH_ANGLE_SUFFIX = "' />";
- private static final String FRAGMENT_QUOTE_SUFFIX = "' ";
- private static final String FRAGMENT_XML_LANG_PREFIX = "xml:lang='";
-
- private static final String TAG_CODE = "code";
- private static final String TAG_ERROR = "error";
- private static final String TAG_XML_LANG = "xml:lang";
private int code;
--- 42,45 ----
***************
*** 187,207 ****
StringBuffer sb = new StringBuffer(128);
! sb.append(FRAGMENT_ERROR_PREFIX);
! sb.append(FRAGMENT_CODE_PREFIX);
sb.append(code);
if (xmlLang != null) {
! sb.append(FRAGMENT_QUOTE_SUFFIX);
! sb.append(FRAGMENT_XML_LANG_PREFIX);
sb.append(xmlLang);
}
if (diagnostic != null) {
! sb.append(FRAGMENT_QUOTE_SUFFIX);
! sb.append(FRAGMENT_ANGLE_SUFFIX);
sb.append(diagnostic);
! sb.append(FRAGMENT_ERROR_SUFFIX);
} else {
! sb.append(FRAGMENT_QUOTE_SLASH_ANGLE_SUFFIX);
}
--- 171,188 ----
StringBuffer sb = new StringBuffer(128);
! sb.append("<error code='");
sb.append(code);
if (xmlLang != null) {
! sb.append("' xml:lang='");
sb.append(xmlLang);
}
if (diagnostic != null) {
! sb.append("' >");
sb.append(diagnostic);
! sb.append("</error>");
} else {
! sb.append("' />");
}
***************
*** 258,266 ****
if (elementName == null) {
throw new BEEPException(ERR_MALFORMED_XML_MSG);
! } else if (!elementName.equals(TAG_ERROR)) {
! throw new BEEPException(ERR_UNKNOWN_OPERATION_ELEMENT_MSG);
}
! String code = topElement.getAttribute(TAG_CODE);
if (code == null) {
--- 239,247 ----
if (elementName == null) {
throw new BEEPException(ERR_MALFORMED_XML_MSG);
! } else if (!elementName.equals("error")) {
! throw new BEEPException("Unknown operation element");
}
! String code = topElement.getAttribute("code");
if (code == null) {
***************
*** 269,273 ****
// this attribute is implied
! String xmlLang = topElement.getAttribute(TAG_XML_LANG);
Node dataNode = topElement.getFirstChild();
String data = null;
--- 250,254 ----
// this attribute is implied
! String xmlLang = topElement.getAttribute("xml:lang");
Node dataNode = topElement.getFirstChild();
String data = null;
Index: ProfileRegistry.java
===================================================================
RCS file: /cvsroot/beepcore-java/beepcore-java/src/org/beepcore/beep/core/ProfileRegistry.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -r1.10 -r1.11
*** ProfileRegistry.java 2001/11/27 17:37:22 1.10
--- ProfileRegistry.java 2001/11/29 04:00:00 1.11
***************
*** 39,61 ****
public class ProfileRegistry implements Cloneable {
- private static final String SPACE = " ";
- private static final String FRAGMENT_ANGLE_SUFFIX = ">";
- private static final String FRAGMENT_FEATURES_PREFIX = "features='";
- private static final String FRAGMENT_GREETING_PREFIX = "<greeting";
- private static final String FRAGMENT_GREETING_SUFFIX = "</greeting>";
- private static final String FRAGMENT_LOCALIZE_PREFIX = "localize='";
- private static final String FRAGMENT_PROFILE_PREFIX = "<profile ";
- private static final String FRAGMENT_QUOTE_ANGLE_SUFFIX = "'>";
- private static final String FRAGMENT_QUOTE_SLASH_ANGLE_SUFFIX = "' />";
- private static final String FRAGMENT_QUOTE_SUFFIX = "' ";
- private static final String FRAGMENT_URI_PREFIX = "uri='";
- private static final int FRAGMENT_GREETING_LENGTH =
- FRAGMENT_GREETING_PREFIX.length()
- + FRAGMENT_QUOTE_ANGLE_SUFFIX.length()
- + FRAGMENT_GREETING_SUFFIX.length();
- private static final int FRAGMENT_PROFILE_LENGTH =
- FRAGMENT_PROFILE_PREFIX.length()
- + FRAGMENT_QUOTE_ANGLE_SUFFIX.length();
-
// Instance Data
private class InternalProfile {
--- 39,42 ----
***************
*** 65,71 ****
private Hashtable profileListeners;
- String greeting;
String localize;
- String features;
// Constructors
--- 46,50 ----
***************
*** 78,92 ****
public ProfileRegistry()
{
- this.greeting = null;
- this.features = null;
this.localize = Constants.LOCALIZE_DEFAULT;
this.profileListeners = new Hashtable();
}
! private ProfileRegistry(String greeting, String localize,
! String features, Hashtable profiles)
{
- this.greeting = greeting;
- this.features = features;
this.localize = localize;
this.profileListeners = profiles;
--- 57,66 ----
public ProfileRegistry()
{
this.localize = Constants.LOCALIZE_DEFAULT;
this.profileListeners = new Hashtable();
}
! private ProfileRegistry(String localize, Hashtable profiles)
{
this.localize = localize;
this.profileListeners = profiles;
***************
*** 95,100 ****
public Object clone()
{
! return new ProfileRegistry(this.greeting, this.localize,
! this.features,
(Hashtable) this.profileListeners.clone());
}
--- 69,73 ----
public Object clone()
{
! return new ProfileRegistry(this.localize,
(Hashtable) this.profileListeners.clone());
}
***************
*** 240,247 ****
return this.localize;
}
! byte[] getGreeting(Session session)
{
! int bufferSize = FRAGMENT_GREETING_LENGTH;
int profileCount = 0;
--- 213,224 ----
return this.localize;
}
+
+ byte[] getGreeting(Session session) {
+ return getGreeting(session, null);
+ }
! byte[] getGreeting(Session session, String features)
{
! int bufferSize = "<greeting></greeting>".length();
int profileCount = 0;
***************
*** 252,256 ****
while (e.hasMoreElements()) {
bufferSize += ((String) e.nextElement()).length()
! + FRAGMENT_PROFILE_LENGTH;
}
--- 229,233 ----
while (e.hasMoreElements()) {
bufferSize += ((String) e.nextElement()).length()
! + "<profile>".length();
}
***************
*** 263,283 ****
Enumeration f = profileListeners.keys();
! sb.append(FRAGMENT_GREETING_PREFIX);
if ((localize != null)
&&!localize.equals(Constants.LOCALIZE_DEFAULT)) {
! sb.append(this.SPACE);
! sb.append(FRAGMENT_LOCALIZE_PREFIX);
sb.append(localize);
! sb.append(FRAGMENT_QUOTE_SUFFIX);
}
if (features != null) {
! sb.append(FRAGMENT_FEATURES_PREFIX);
sb.append(features);
! sb.append(FRAGMENT_QUOTE_SUFFIX);
}
! sb.append(FRAGMENT_ANGLE_SUFFIX);
while (f.hasMoreElements()) {
--- 240,259 ----
Enumeration f = profileListeners.keys();
! sb.append("<greeting");
if ((localize != null)
&&!localize.equals(Constants.LOCALIZE_DEFAULT)) {
! sb.append(" localize='");
sb.append(localize);
! sb.append("' ");
}
if (features != null) {
! sb.append("features='");
sb.append(features);
! sb.append("' ");
}
! sb.append('>');
while (f.hasMoreElements()) {
***************
*** 309,316 ****
profile.listener.advertiseProfile(session)))
{
! sb.append(FRAGMENT_PROFILE_PREFIX);
! sb.append(FRAGMENT_URI_PREFIX);
! sb.append((String) profileName);
! sb.append(FRAGMENT_QUOTE_SLASH_ANGLE_SUFFIX);
}
} catch (BEEPException x) {
--- 285,291 ----
profile.listener.advertiseProfile(session)))
{
! sb.append("<profile uri='");
! sb.append(profileName);
! sb.append("' />");
}
} catch (BEEPException x) {
***************
*** 321,325 ****
}
! sb.append(FRAGMENT_GREETING_SUFFIX);
return StringUtil.stringBufferToAscii(sb);
--- 296,300 ----
}
! sb.append("</greeting>");
return StringUtil.stringBufferToAscii(sb);
Index: Session.java
===================================================================
RCS file: /cvsroot/beepcore-java/beepcore-java/src/org/beepcore/beep/core/Session.java,v
retrieving revision 1.21
retrieving revision 1.22
diff -C2 -r1.21 -r1.22
*** Session.java 2001/11/27 17:37:22 1.21
--- Session.java 2001/11/29 04:00:00 1.22
***************
*** 83,87 ****
/** @todo check this */
- private static final int MAX_PAYLOAD_SIZE = 4096;
private static final int MAX_PCDATA_SIZE = 4096;
private static final int MAX_START_CHANNEL_WAIT = 60000;
--- 83,86 ----
***************
*** 90,148 ****
private static final String CHANNEL_ZERO = "0";
- private static final String ERR_GREETING_FAILED =
- "Greeting exchange failed";
- private static final String ERR_ILLEGAL_SHUTDOWN =
- "Illegal state for shutdown";
- private static final String ERR_PROFILES_UNAVAILABLE =
- "all requested profiles are unsupported";
- private static final String ERR_NONEXISTENT_CHANNEL =
- "Session call on nonexistent channel.";
- private static final String ERR_STATE_CHANGE =
- "Illegal session state transition";
private static final String ERR_MALFORMED_XML_MSG = "Malformed XML";
- private static final String ERR_PCDATA_TOO_BIG_MSG =
- "Element's PCDATA exceeds the maximum size";
private static final String ERR_UNKNOWN_OPERATION_ELEMENT_MSG =
"Unknown operation element";
- private static final String ERR_MALFORMED_PROFILE_MSG =
- "Malformed profile";
! private static final String FRAGMENT_ANGLE_SUFFIX = ">";
! private static final String FRAGMENT_CDATA_PREFIX = "<![CDATA[";
! private static final String FRAGMENT_CDATA_SUFFIX = "]]>";
! private static final String FRAGMENT_CLOSE_PREFIX = "<close ";
! private static final String FRAGMENT_CODE_PREFIX = "code='";
! private static final String FRAGMENT_ENCODING_PREFIX = "encoding='";
! private static final String FRAGMENT_NUMBER_PREFIX = "number='";
! private static final String FRAGMENT_OK = "<ok />";
! private static final String FRAGMENT_PROFILE_PREFIX = "<profile ";
! private static final String FRAGMENT_PROFILE_SUFFIX = "</profile>";
! private static final String FRAGMENT_QUOTE_ANGLE_SUFFIX = "'>";
! private static final String FRAGMENT_QUOTE_SLASH_ANGLE_SUFFIX = "' />";
! private static final String FRAGMENT_QUOTE_SUFFIX = "' ";
! private static final String FRAGMENT_SERVERNAME_PREFIX = "serverName='";
! private static final String FRAGMENT_SLASH_ANGLE_SUFFIX = " />";
! private static final String FRAGMENT_START_PREFIX = "<start ";
! private static final String FRAGMENT_START_SUFFIX = "</start>";
! private static final String FRAGMENT_URI_PREFIX = "uri='";
! private static final String FRAGMENT_XML_LANG_PREFIX = "xml:lang='";
!
! private static final String TAG_CLOSE = "close";
! private static final String TAG_CODE = "code";
! private static final String TAG_ENCODING = "encoding";
! private static final String TAG_FEATURES = "features";
! private static final String TAG_GREETING = "greeting";
! private static final String TAG_LOCALIZE = "localize";
! private static final String TAG_NUMBER = "number";
! private static final String TAG_OK = "ok";
! private static final String TAG_PROFILE = "profile";
! private static final String TAG_START = "start";
! private static final String TAG_SERVER_NAME = "serverName";
! private static final String TAG_URI = "uri";
! private static final String TAG_XML_LANG = "xml:lang";
// Instance Data
private int state;
- private long messageNumber;
private long nextChannelNumber = 0;
private Channel zero;
--- 89,101 ----
private static final String CHANNEL_ZERO = "0";
private static final String ERR_MALFORMED_XML_MSG = "Malformed XML";
private static final String ERR_UNKNOWN_OPERATION_ELEMENT_MSG =
"Unknown operation element";
! private static final byte[] OK_ELEMENT =
! StringUtil.stringToAscii("<ok />");
// Instance Data
private int state;
private long nextChannelNumber = 0;
private Channel zero;
***************
*** 248,252 ****
// check the channel state and return the appropriate exception
if (zero.getState() == Channel.STATE_ERROR) {
! throw new BEEPException(ERR_GREETING_FAILED);
}
}
--- 201,205 ----
// check the channel state and return the appropriate exception
if (zero.getState() == Channel.STATE_ERROR) {
! throw new BEEPException("Greeting exchange failed");
}
}
***************
*** 557,564 ****
StringBuffer startBuffer = new StringBuffer();
! startBuffer.append(FRAGMENT_START_PREFIX);
! startBuffer.append(FRAGMENT_NUMBER_PREFIX);
startBuffer.append(channelNumber);
! startBuffer.append(FRAGMENT_QUOTE_ANGLE_SUFFIX);
Iterator i = profiles.iterator();
--- 510,516 ----
StringBuffer startBuffer = new StringBuffer();
! startBuffer.append("<start number='");
startBuffer.append(channelNumber);
! startBuffer.append("'>");
Iterator i = profiles.iterator();
***************
*** 568,578 ****
// @todo maybe we should check these against peerSupportedProfiles
! startBuffer.append(FRAGMENT_PROFILE_PREFIX);
! startBuffer.append(FRAGMENT_URI_PREFIX);
startBuffer.append(p.uri);
! startBuffer.append(FRAGMENT_QUOTE_SUFFIX);
if (p.data == null) {
! startBuffer.append(FRAGMENT_SLASH_ANGLE_SUFFIX);
} else {
if (p.base64Encoding) {
--- 520,529 ----
// @todo maybe we should check these against peerSupportedProfiles
! startBuffer.append("<profile uri='");
startBuffer.append(p.uri);
! startBuffer.append("' ");
if (p.data == null) {
! startBuffer.append(" />");
} else {
if (p.base64Encoding) {
***************
*** 580,592 ****
}
! startBuffer.append(FRAGMENT_ANGLE_SUFFIX);
! startBuffer.append(FRAGMENT_CDATA_PREFIX);
startBuffer.append(p.data);
! startBuffer.append(FRAGMENT_CDATA_SUFFIX);
! startBuffer.append(FRAGMENT_PROFILE_SUFFIX);
}
}
! startBuffer.append(FRAGMENT_START_SUFFIX);
// @todo handle the data element
--- 531,541 ----
}
! startBuffer.append("><![CDATA[");
startBuffer.append(p.data);
! startBuffer.append("]]></profile>");
}
}
! startBuffer.append("</start>");
// @todo handle the data element
***************
*** 666,670 ****
&&!((newState == SESSION_STATE_INITIALIZED)
|| (newState == SESSION_STATE_CLOSED))) {
! throw new BEEPException(ERR_STATE_CHANGE);
}
--- 615,619 ----
&&!((newState == SESSION_STATE_INITIALIZED)
|| (newState == SESSION_STATE_CLOSED))) {
! throw new BEEPException("Illegal session state transition");
}
***************
*** 673,677 ****
|| (newState == SESSION_STATE_GREETING_RECEIVED)
|| (newState == SESSION_STATE_CLOSED))) {
! throw new BEEPException(ERR_STATE_CHANGE);
}
--- 622,626 ----
|| (newState == SESSION_STATE_GREETING_RECEIVED)
|| (newState == SESSION_STATE_CLOSED))) {
! throw new BEEPException("Illegal session state transition");
}
***************
*** 680,684 ****
&& (newState != SESSION_STATE_TERMINATING)
&& (newState != SESSION_STATE_CLOSING)) {
! throw new BEEPException(ERR_STATE_CHANGE);
}
--- 629,633 ----
&& (newState != SESSION_STATE_TERMINATING)
&& (newState != SESSION_STATE_CLOSING)) {
! throw new BEEPException("Illegal session state transition");
}
***************
*** 745,749 ****
if (ch == null) {
! throw new BEEPException(ERR_NONEXISTENT_CHANNEL);
}
--- 694,698 ----
if (ch == null) {
! throw new BEEPException("Session call on nonexistent channel.");
}
***************
*** 967,984 ****
StringBuffer closeBuffer = new StringBuffer();
! closeBuffer.append(FRAGMENT_CLOSE_PREFIX);
! closeBuffer.append(FRAGMENT_NUMBER_PREFIX);
closeBuffer.append(channel.getNumberAsString());
! closeBuffer.append(FRAGMENT_QUOTE_SUFFIX);
! closeBuffer.append(FRAGMENT_CODE_PREFIX);
closeBuffer.append(code);
if (xmlLang != null) {
! closeBuffer.append(FRAGMENT_QUOTE_SUFFIX);
! closeBuffer.append(FRAGMENT_XML_LANG_PREFIX);
closeBuffer.append(xmlLang);
}
! closeBuffer.append(FRAGMENT_QUOTE_SLASH_ANGLE_SUFFIX);
// Lock necessary because we have to know the msgNo
--- 916,930 ----
StringBuffer closeBuffer = new StringBuffer();
! closeBuffer.append("<close number='");
closeBuffer.append(channel.getNumberAsString());
! closeBuffer.append("' code='");
closeBuffer.append(code);
if (xmlLang != null) {
! closeBuffer.append("' xml:lang='");
closeBuffer.append(xmlLang);
}
! closeBuffer.append("' />");
// Lock necessary because we have to know the msgNo
***************
*** 1023,1027 ****
if (ch == null) {
! throw new BEEPException(ERR_NONEXISTENT_CHANNEL);
}
--- 969,973 ----
if (ch == null) {
! throw new BEEPException("Session call on nonexistent channel.");
}
***************
*** 1036,1051 ****
StringBuffer sb = new StringBuffer();
! sb.append(FRAGMENT_PROFILE_PREFIX);
! sb.append(FRAGMENT_URI_PREFIX);
sb.append(uri);
if (datum != null) {
! sb.append(FRAGMENT_QUOTE_ANGLE_SUFFIX);
! sb.append(FRAGMENT_CDATA_PREFIX);
sb.append(datum);
! sb.append(FRAGMENT_CDATA_SUFFIX);
! sb.append(FRAGMENT_PROFILE_SUFFIX);
} else {
! sb.append(FRAGMENT_QUOTE_SLASH_ANGLE_SUFFIX);
}
--- 982,994 ----
StringBuffer sb = new StringBuffer();
! sb.append("<profile uri='");
sb.append(uri);
if (datum != null) {
! sb.append("'><![CDATA[");
sb.append(datum);
! sb.append("]]></profile>");
} else {
! sb.append("' />");
}
***************
*** 1166,1170 ****
OutputDataStream sds =
new ByteOutputDataStream(MimeHeaders.BEEP_XML_CONTENT_TYPE,
! StringUtil.stringToAscii(FRAGMENT_OK));
try {
--- 1109,1113 ----
OutputDataStream sds =
new ByteOutputDataStream(MimeHeaders.BEEP_XML_CONTENT_TYPE,
! OK_ELEMENT);
try {
***************
*** 1192,1196 ****
// @todo got consecutive shutdowns... now what... log it?
! // Utility.assert(ERR_ILLEGAL_SHUTDOWN, -1);
}
} catch (BEEPException e) {
--- 1135,1139 ----
// @todo got consecutive shutdowns... now what... log it?
! // Utility.assert("Illegal state for shutdown", -1);
}
} catch (BEEPException e) {
***************
*** 1244,1248 ****
OutputDataStream sds =
new ByteOutputDataStream(MimeHeaders.BEEP_XML_CONTENT_TYPE,
! StringUtil.stringToAscii(FRAGMENT_OK));
try {
--- 1187,1191 ----
OutputDataStream sds =
new ByteOutputDataStream(MimeHeaders.BEEP_XML_CONTENT_TYPE,
! OK_ELEMENT);
try {
***************
*** 1357,1361 ****
try {
! ((Message)zero.getAppData()).sendERR(BEEPError.CODE_REQUESTED_ACTION_NOT_TAKEN2, ERR_PROFILES_UNAVAILABLE);
} catch (Exception x) {
terminate("Error sending error. " + x.getMessage());
--- 1300,1304 ----
try {
! ((Message)zero.getAppData()).sendERR(BEEPError.CODE_REQUESTED_ACTION_NOT_TAKEN2, "all requested profiles are unsupported");
} catch (Exception x) {
terminate("Error sending error. " + x.getMessage());
***************
*** 1446,1454 ****
// is this MSG a <start>
! if (elementName.equals(TAG_START)) {
Log.logEntry(Log.SEV_DEBUG, CORE,
"Received a start channel request");
! String channelNumber = topElement.getAttribute(TAG_NUMBER);
if (channelNumber == null) {
--- 1389,1397 ----
// is this MSG a <start>
! if (elementName.equals("start")) {
Log.logEntry(Log.SEV_DEBUG, CORE,
"Received a start channel request");
! String channelNumber = topElement.getAttribute("number");
if (channelNumber == null) {
***************
*** 1458,1464 ****
// this attribute is implied
! String serverName = topElement.getAttribute(TAG_SERVER_NAME);
NodeList profiles =
! topElement.getElementsByTagName(TAG_PROFILE);
if (profiles == null) {
--- 1401,1407 ----
// this attribute is implied
! String serverName = topElement.getAttribute("serverName");
NodeList profiles =
! topElement.getElementsByTagName("profile");
if (profiles == null) {
***************
*** 1471,1475 ****
for (int i = 0; i < profiles.getLength(); i++) {
Element profile = (Element) profiles.item(i);
! String uri = profile.getAttribute(TAG_URI);
if (uri == null) {
--- 1414,1418 ----
for (int i = 0; i < profiles.getLength(); i++) {
Element profile = (Element) profiles.item(i);
! String uri = profile.getAttribute("uri");
if (uri == null) {
***************
*** 1478,1482 ****
}
! String encoding = profile.getAttribute(TAG_ENCODING);
boolean b64;
--- 1421,1425 ----
}
! String encoding = profile.getAttribute("encoding");
boolean b64;
***************
*** 1500,1504 ****
if (data.length() > MAX_PCDATA_SIZE) {
throw new BEEPError(BEEPError.CODE_PARAMETER_ERROR,
! ERR_PCDATA_TOO_BIG_MSG);
}
}
--- 1443,1448 ----
if (data.length() > MAX_PCDATA_SIZE) {
throw new BEEPError(BEEPError.CODE_PARAMETER_ERROR,
! "Element's PCDATA exceeds " +
! "the maximum size");
}
}
***************
*** 1512,1520 ****
// is this MSG a <close>
! else if (elementName.equals(TAG_CLOSE)) {
Log.logEntry(Log.SEV_DEBUG, CORE,
"Received a channel close request");
! String channelNumber = topElement.getAttribute(TAG_NUMBER);
if (channelNumber == null) {
--- 1456,1464 ----
// is this MSG a <close>
! else if (elementName.equals("close")) {
Log.logEntry(Log.SEV_DEBUG, CORE,
"Received a channel close request");
! String channelNumber = topElement.getAttribute("number");
if (channelNumber == null) {
***************
*** 1523,1527 ****
}
! String code = topElement.getAttribute(TAG_CODE);
if (code == null) {
--- 1467,1471 ----
}
! String code = topElement.getAttribute("code");
if (code == null) {
***************
*** 1531,1535 ****
// this attribute is implied
! String xmlLang = topElement.getAttribute(TAG_XML_LANG);
String data = null;
Node dataNode = topElement.getFirstChild();
--- 1475,1479 ----
// this attribute is implied
! String xmlLang = topElement.getAttribute("xml:lang");
String data = null;
Node dataNode = topElement.getFirstChild();
***************
*** 1540,1544 ****
if (data.length() > MAX_PCDATA_SIZE) {
throw new BEEPError(BEEPError.CODE_PARAMETER_ERROR,
! ERR_PCDATA_TOO_BIG_MSG);
}
}
--- 1484,1489 ----
if (data.length() > MAX_PCDATA_SIZE) {
throw new BEEPError(BEEPError.CODE_PARAMETER_ERROR,
! "Element's PCDATA exceeds " +
! "the maximum size");
}
}
***************
*** 1566,1570 ****
if (elementName == null) {
throw new BEEPException(ERR_MALFORMED_XML_MSG);
! } else if (!elementName.equals(TAG_GREETING)) {
throw new BEEPException(ERR_UNKNOWN_OPERATION_ELEMENT_MSG);
}
--- 1511,1515 ----
if (elementName == null) {
throw new BEEPException(ERR_MALFORMED_XML_MSG);
! } else if (!elementName.equals("greeting")) {
throw new BEEPException(ERR_UNKNOWN_OPERATION_ELEMENT_MSG);
}
***************
*** 1573,1580 ****
// this attribute is implied
! String features = topElement.getAttribute(TAG_FEATURES);
// This attribute has a default value
! String localize = topElement.getAttribute(TAG_LOCALIZE);
if (localize == null) {
--- 1518,1525 ----
// this attribute is implied
! String features = topElement.getAttribute("features");
// This attribute has a default value
! String localize = topElement.getAttribute("localize");
if (localize == null) {
***************
*** 1585,1589 ****
// with 0 profiles
NodeList profiles =
! topElement.getElementsByTagName(TAG_PROFILE);
if (profiles.getLength() > 0) {
--- 1530,1534 ----
// with 0 profiles
NodeList profiles =
! topElement.getElementsByTagName("profile");
if (profiles.getLength() > 0) {
***************
*** 1592,1602 ****
for (int i = 0; i < profiles.getLength(); i++) {
Element profile = (Element) profiles.item(i);
! String uri = profile.getAttribute(TAG_URI);
if (uri == null) {
! throw new BEEPException(ERR_MALFORMED_PROFILE_MSG);
}
! String encoding = profile.getAttribute(TAG_ENCODING);
// encoding is not allowed in greetings
--- 1537,1547 ----
for (int i = 0; i < profiles.getLength(); i++) {
Element profile = (Element) profiles.item(i);
! String uri = profile.getAttribute("uri");
if (uri == null) {
! throw new BEEPException("Malformed profile");
}
! String encoding = profile.getAttribute("encoding");
// encoding is not allowed in greetings
***************
*** 1668,1681 ****
// is this RPY a <profile>
! } else if (elementName.equals(TAG_PROFILE)) {
try {
! String uri = topElement.getAttribute(TAG_URI);
if (uri == null) {
! throw new BEEPException(ERR_MALFORMED_PROFILE_MSG);
}
String encoding =
! topElement.getAttribute(TAG_ENCODING);
if (encoding == null) {
--- 1613,1626 ----
// is this RPY a <profile>
! } else if (elementName.equals("profile")) {
try {
! String uri = topElement.getAttribute("uri");
if (uri == null) {
! throw new BEEPException("Malformed profile");
}
String encoding =
! topElement.getAttribute("encoding");
if (encoding == null) {
***************
*** 1691,1695 ****
if (data.length() > MAX_PCDATA_SIZE) {
! throw new BEEPException(ERR_PCDATA_TOO_BIG_MSG);
}
}
--- 1636,1642 ----
if (data.length() > MAX_PCDATA_SIZE) {
! throw new BEEPException("Element's PCDATA " +
! "exceeds the " +
! "maximum size");
}
}
***************
*** 1792,1796 ****
// is this RPY an <ok> (the positive response to a
// channel close)
! } else if (elementName.equals(TAG_OK)) {
Log.logEntry(Log.SEV_DEBUG, CORE,
"Received an OK for channel close");
--- 1739,1743 ----
// is this RPY an <ok> (the positive response to a
// channel close)
! } else if (elementName.equals("ok")) {
Log.logEntry(Log.SEV_DEBUG, CORE,
"Received an OK for channel close");
|