You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jaxme-dev@ws.apache.org by jo...@apache.org on 2004/02/07 22:55:30 UTC
cvs commit: ws-jaxme/src/pm/org/apache/ws/jaxme/pm/ino InoManager.java
jochen 2004/02/07 13:55:30
Modified: src/pm/org/apache/ws/jaxme/pm/ino InoManager.java
Log:
Replaced deprecated URLEncoder.encode(s) with URLEncoder.encode(s, "UTF-8").
Revision Changes Path
1.2 +43 -23 ws-jaxme/src/pm/org/apache/ws/jaxme/pm/ino/InoManager.java
Index: InoManager.java
===================================================================
RCS file: /home/cvs/ws-jaxme/src/pm/org/apache/ws/jaxme/pm/ino/InoManager.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- InoManager.java 20 Oct 2003 20:32:42 -0000 1.1
+++ InoManager.java 7 Feb 2004 21:55:29 -0000 1.2
@@ -49,6 +49,7 @@
package org.apache.ws.jaxme.pm.ino;
import java.io.StringWriter;
+import java.io.UnsupportedEncodingException;
import java.lang.reflect.InvocationTargetException;
import javax.xml.bind.Element;
@@ -84,6 +85,14 @@
spf.setValidating(false);
}
+ protected String getUser() {
+ return user;
+ }
+
+ protected String getPassword() {
+ return password;
+ }
+
public String getElementTag() {
return elementTag;
}
@@ -122,33 +131,36 @@
/** <p>Returns a query suited for deleting the element.</p>
*/
protected String getDeleteQuery(Element pElement)
- throws JAXBException, InvocationTargetException, IllegalAccessException, NoSuchMethodException {
+ throws JAXBException, InvocationTargetException, IllegalAccessException,
+ NoSuchMethodException, UnsupportedEncodingException {
String id = getId(pElement);
if (id == null || id.length() == 0) {
throw new JAXBException("The element being deleted doesn't have an ID.");
}
return "_delete=" +
- java.net.URLEncoder.encode(getElementTag() + '[' + getIdTag() + '=' + id + ']');
+ java.net.URLEncoder.encode(getElementTag() + '[' + getIdTag() + '=' + id + ']', "UTF8");
}
/** <p>Returns a query suited for updating the element.</p>
*/
- protected String getUpdateQuery(Element pElement) throws JAXBException {
+ protected String getUpdateQuery(Element pElement)
+ throws JAXBException, UnsupportedEncodingException {
StringWriter sw = new StringWriter();
Marshaller marshaller = getManager().getFactory().createMarshaller();
marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.FALSE);
marshaller.marshal(pElement, sw);
- return "_process=" + java.net.URLEncoder.encode(sw.toString());
+ return "_process=" + java.net.URLEncoder.encode(sw.toString(), "UTF8");
}
/** <p>Returns a query suited for inserting the element.</p>
*/
- protected String getInsertQuery(Element pElement) throws JAXBException {
+ protected String getInsertQuery(Element pElement)
+ throws JAXBException, UnsupportedEncodingException {
StringWriter sw = new StringWriter();
Marshaller marshaller = getManager().getFactory().createMarshaller();
marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.FALSE);
marshaller.marshal(pElement, sw);
- return "_process=" + java.net.URLEncoder.encode(sw.toString());
+ return "_process=" + java.net.URLEncoder.encode(sw.toString(), "UTF8");
}
/** <p>Performs a single database query.</p>
@@ -236,16 +248,16 @@
} else {
q = "_xql=";
}
- q += java.net.URLEncoder.encode(pQuery);
InoResponseHandler irh = new InoResponseHandler();
Class c = getManager().getHandlerClass();
try {
- JMHandler handler = (JMHandler) c.newInstance();
- handler.init((JMUnmarshaller) null);
- handler.setObserver(pObserver);
- irh.setResultHandler(handler);
- performQuery(q, irh);
+ q += java.net.URLEncoder.encode(pQuery, "UTF8");
+ JMHandler handler = (JMHandler) c.newInstance();
+ handler.init((JMUnmarshaller) null);
+ handler.setObserver(pObserver);
+ irh.setResultHandler(handler);
+ performQuery(q, irh);
} catch (InstantiationException e) {
throw new PMException(e);
} catch (IllegalAccessException e) {
@@ -258,6 +270,8 @@
} else {
throw new PMException(e);
}
+ } catch (UnsupportedEncodingException e) {
+ throw new PMException(e);
}
}
@@ -280,6 +294,8 @@
} else {
throw new PMException(e);
}
+ } catch (UnsupportedEncodingException e) {
+ throw new PMException(e);
}
}
@@ -287,18 +303,20 @@
* @see org.apache.ws.jaxme.PM#update(javax.xml.bind.Element)
*/
public void update(javax.xml.bind.Element pElement) throws PMException {
- try {
- String query = getUpdateQuery(pElement);
- performQuery(query, (java.util.List) null);
- } catch (SAXException e) {
- throw new PMException(e);
- } catch (JAXBException e) {
- if (e instanceof PMException) {
- throw (PMException) e;
- } else {
- throw new PMException(e);
+ try {
+ String query = getUpdateQuery(pElement);
+ performQuery(query, (java.util.List) null);
+ } catch (SAXException e) {
+ throw new PMException(e);
+ } catch (UnsupportedEncodingException e) {
+ throw new PMException(e);
+ } catch (JAXBException e) {
+ if (e instanceof PMException) {
+ throw (PMException) e;
+ } else {
+ throw new PMException(e);
+ }
}
- }
}
/* (non-Javadoc)
@@ -322,6 +340,8 @@
} else {
throw new PMException(e);
}
+ } catch (UnsupportedEncodingException e) {
+ throw new PMException(e);
}
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: jaxme-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: jaxme-dev-help@ws.apache.org