summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPierrick MARIE2012-07-06 04:30:58 (EDT)
committerBenjamin Cabé2012-07-06 04:30:58 (EDT)
commit25617549d504d0e35d71434055b5599690205455 (patch)
treef81489cd29f69181a7374eb5f33e0233ad969b2a
parentcad25cab065cbc1fda4be035ca75be657df1dded (diff)
downloadorg.eclipse.koneki.protocols-25617549d504d0e35d71434055b5599690205455.zip
org.eclipse.koneki.protocols-25617549d504d0e35d71434055b5599690205455.tar.gz
org.eclipse.koneki.protocols-25617549d504d0e35d71434055b5599690205455.tar.bz2
Put in the right order Type and Format (Bug 377522)
-rw-r--r--omadm/bundles/org.eclipse.koneki.protocols.omadm.client/src/org/eclipse/koneki/protocols/omadm/client/basic/DMBasicSession.java80
1 files changed, 44 insertions, 36 deletions
diff --git a/omadm/bundles/org.eclipse.koneki.protocols.omadm.client/src/org/eclipse/koneki/protocols/omadm/client/basic/DMBasicSession.java b/omadm/bundles/org.eclipse.koneki.protocols.omadm.client/src/org/eclipse/koneki/protocols/omadm/client/basic/DMBasicSession.java
index e6f2b58..b0e8d99 100644
--- a/omadm/bundles/org.eclipse.koneki.protocols.omadm.client/src/org/eclipse/koneki/protocols/omadm/client/basic/DMBasicSession.java
+++ b/omadm/bundles/org.eclipse.koneki.protocols.omadm.client/src/org/eclipse/koneki/protocols/omadm/client/basic/DMBasicSession.java
@@ -216,11 +216,6 @@ final class DMBasicSession implements Runnable {
writer.writeStartElement("Meta"); //$NON-NLS-1$
- writer.writeStartElement("Format"); //$NON-NLS-1$
- writer.writeAttribute("xmlns", "syncml:metinf"); //$NON-NLS-1$ //$NON-NLS-2$
- writer.writeCharacters("b64"); //$NON-NLS-1$
- writer.writeEndElement();
-
writer.writeStartElement("Type"); //$NON-NLS-1$
writer.writeAttribute("xmlns", "syncml:metinf"); //$NON-NLS-1$ //$NON-NLS-2$
@@ -232,12 +227,15 @@ final class DMBasicSession implements Runnable {
writer.writeCharacters("syncml:auth-basic"); //$NON-NLS-1$
writer.writeEndElement();
+ writer.writeStartElement("Format"); //$NON-NLS-1$
+ writer.writeAttribute("xmlns", "syncml:metinf"); //$NON-NLS-1$ //$NON-NLS-2$
+ writer.writeCharacters("b64"); //$NON-NLS-1$
writer.writeEndElement();
- writer.writeStartElement("Data"); //$NON-NLS-1$
- writer.writeCharacters(computeBasicAuthentication());
writer.writeEndElement();
+ writer.writeStartElement("Data"); //$NON-NLS-1$
+ writer.writeCharacters(computeBasicAuthentication());
break;
/*
* Add md5 authentication
@@ -247,12 +245,15 @@ final class DMBasicSession implements Runnable {
writer.writeCharacters("syncml:auth-md5"); //$NON-NLS-1$
writer.writeEndElement();
+ writer.writeStartElement("Format"); //$NON-NLS-1$
+ writer.writeAttribute("xmlns", "syncml:metinf"); //$NON-NLS-1$ //$NON-NLS-2$
+ writer.writeCharacters("b64"); //$NON-NLS-1$
writer.writeEndElement();
- writer.writeStartElement("Data"); //$NON-NLS-1$
- writer.writeCharacters(computeMd5Authentication());
writer.writeEndElement();
+ writer.writeStartElement("Data"); //$NON-NLS-1$
+ writer.writeCharacters(computeMd5Authentication());
break;
/*
* Add hmac authentication
@@ -262,6 +263,9 @@ final class DMBasicSession implements Runnable {
writer.writeCharacters("syncml:auth-MAC"); //$NON-NLS-1$
writer.writeEndElement();
+ writer.writeStartElement("Format"); //$NON-NLS-1$
+ writer.writeAttribute("xmlns", "syncml:metinf"); //$NON-NLS-1$ //$NON-NLS-2$
+ writer.writeCharacters("b64"); //$NON-NLS-1$
writer.writeEndElement();
break;
@@ -270,6 +274,9 @@ final class DMBasicSession implements Runnable {
break;
}
+
+ writer.writeEndElement();
+
/*
* There are no credential with HMAC
*/
@@ -531,18 +538,18 @@ final class DMBasicSession implements Runnable {
// if (globalFormat == null || globalType == null) {
writer.writeStartElement("Meta"); //$NON-NLS-1$
{
- // if (globalFormat == null) {
- writer.writeStartElement("Format"); //$NON-NLS-1$
- writer.writeAttribute("xmlns", "syncml:metinf"); //$NON-NLS-1$ //$NON-NLS-2$
- writer.writeCharacters(results.getFormat());
- writer.writeEndElement();
- // }
// if (globalType == null) {
writer.writeStartElement("Type"); //$NON-NLS-1$
writer.writeAttribute("xmlns", "syncml:metinf"); //$NON-NLS-1$ //$NON-NLS-2$
writer.writeCharacters(results.getType());
writer.writeEndElement();
// }
+ // if (globalFormat == null) {
+ writer.writeStartElement("Format"); //$NON-NLS-1$
+ writer.writeAttribute("xmlns", "syncml:metinf"); //$NON-NLS-1$ //$NON-NLS-2$
+ writer.writeCharacters(results.getFormat());
+ writer.writeEndElement();
+ // }
}
writer.writeEndElement();
// }
@@ -661,18 +668,18 @@ final class DMBasicSession implements Runnable {
if (sameFormat || sameType) {
writer.writeStartElement("Meta"); //$NON-NLS-1$
{
- if (sameFormat) {
- writer.writeStartElement("Format"); //$NON-NLS-1$
- writer.writeAttribute("xmlns", "syncml:metinf"); //$NON-NLS-1$ //$NON-NLS-2$
- writer.writeCharacters(this.devInfoNodes[0].getFormat());
- writer.writeEndElement();
- }
if (sameType) {
writer.writeStartElement("Type"); //$NON-NLS-1$
writer.writeAttribute("xmlns", "syncml:metinf"); //$NON-NLS-1$ //$NON-NLS-2$
writer.writeCharacters(this.devInfoNodes[0].getType());
writer.writeEndElement();
}
+ if (sameFormat) {
+ writer.writeStartElement("Format"); //$NON-NLS-1$
+ writer.writeAttribute("xmlns", "syncml:metinf"); //$NON-NLS-1$ //$NON-NLS-2$
+ writer.writeCharacters(this.devInfoNodes[0].getFormat());
+ writer.writeEndElement();
+ }
}
writer.writeEndElement();
}
@@ -689,18 +696,18 @@ final class DMBasicSession implements Runnable {
if (!sameFormat || !sameType) {
writer.writeStartElement("Meta"); //$NON-NLS-1$
{
- if (!sameFormat) {
- writer.writeStartElement("Format"); //$NON-NLS-1$
- writer.writeAttribute("xmlns", "syncml:metinf"); //$NON-NLS-1$ //$NON-NLS-2$
- writer.writeCharacters(devInfoNode.getFormat());
- writer.writeEndElement();
- }
if (!sameType) {
writer.writeStartElement("Type"); //$NON-NLS-1$
writer.writeAttribute("xmlns", "syncml:metinf"); //$NON-NLS-1$ //$NON-NLS-2$
writer.writeCharacters(devInfoNode.getType());
writer.writeEndElement();
}
+ if (!sameFormat) {
+ writer.writeStartElement("Format"); //$NON-NLS-1$
+ writer.writeAttribute("xmlns", "syncml:metinf"); //$NON-NLS-1$ //$NON-NLS-2$
+ writer.writeCharacters(devInfoNode.getFormat());
+ writer.writeEndElement();
+ }
}
writer.writeEndElement();
}
@@ -839,9 +846,10 @@ final class DMBasicSession implements Runnable {
});
if (nextNonce.equals("")) { //$NON-NLS-1$
- jumpToStartTag(reader, "NextNonce"); //$NON-NLS-1$
- if (reader.getLocalName().equals("NextNonce")) { //$NON-NLS-1$
- nextNonce = reader.getElementText();
+ if (jumpToStartTag(reader, "NextNonce")) { //$NON-NLS-1$
+ if (reader.getLocalName().equals("NextNonce")) { //$NON-NLS-1$
+ nextNonce = reader.getElementText();
+ }
}
}
}
@@ -1340,38 +1348,38 @@ final class DMBasicSession implements Runnable {
}
}
- private static void jumpToStartTag(final XMLStreamReader reader, final String tag) throws XMLStreamException {
+ private static boolean jumpToStartTag(final XMLStreamReader reader, final String tag) throws XMLStreamException {
while (true) {
if (reader.hasName() && reader.isStartElement()) {
if (reader.getLocalName().equals(tag)) {
- break;
+ return true;
}
}
if (reader.hasNext()) {
reader.next();
} else {
- break;
+ return false;
}
}
}
- private static void jumpToEndTag(final XMLStreamReader reader, final String tag) throws XMLStreamException {
+ private static boolean jumpToEndTag(final XMLStreamReader reader, final String tag) throws XMLStreamException {
while (true) {
if (reader.hasName() && reader.isEndElement()) {
if (reader.getLocalName().equals(tag)) {
- break;
+ return true;
}
}
if (reader.hasNext()) {
reader.next();
} else {
- break;
+ return false;
}
}
}