어짜피 예제에도 리턴값을 활용하고 있지 않기 때문에 뭐 큰 문제는 없을 것으로 생각되지만,
진짜 어쩔수 없을 경우에만 사용하시는게 좋을 것 같습니다.
다른 함수에서도 에러가 나면 같은 방법으로 ??
public class Me2API_Android extends Me2API {
public Me2API_Android() throws ParserConfigurationException { super(); // TODO Auto-generated constructor stub }
@Override /** * 자신의 미투데이에 새로운 글을 포스트합니다. 이 메서드를 사용할 경우 분류 아이콘은 '생각'이 됩니다. * */ public String post(Post post) throws IOException { if (post.getLength() > 150) throw new IllegalArgumentException( "message.length must less than 150"); if (post.getIconIndex() < 1 || post.getIconIndex() > 12) throw new IllegalArgumentException("icon must be between 1 and 12"); if (super.getUsername() == null) throw new IllegalStateException("username cannot be null"); if (super.getUserKey() == null) throw new IllegalStateException("userKey cannot be null"); if (super.getApplicationKey() == null) throw new IllegalStateException("appKey cannot be null");
XPath 가 API Level 8 부터 지원됨으로 인해 오류가 발생하는 것 같습니다.
프로요 업데이트 되기 전까지 아주 지극히 꼼수적인 방법을 써보는건 어떠세요?
Me2API 를 상속받아서 XPath 를 사용하는 부분을 싹 제거해 버리는 겁니다.
어짜피 예제에도 리턴값을 활용하고 있지 않기 때문에 뭐 큰 문제는 없을 것으로 생각되지만,
진짜 어쩔수 없을 경우에만 사용하시는게 좋을 것 같습니다.
다른 함수에서도 에러가 나면 같은 방법으로 ??
public class Me2API_Android extends Me2API {
public Me2API_Android() throws ParserConfigurationException {
super();
// TODO Auto-generated constructor stub
}
@Override
/**
* 자신의 미투데이에 새로운 글을 포스트합니다. 이 메서드를 사용할 경우 분류 아이콘은 '생각'이 됩니다.
*
*/
public String post(Post post) throws IOException {
if (post.getLength() > 150)
throw new IllegalArgumentException(
"message.length must less than 150");
if (post.getIconIndex() < 1 || post.getIconIndex() > 12)
throw new IllegalArgumentException("icon must be between 1 and 12");
if (super.getUsername() == null)
throw new IllegalStateException("username cannot be null");
if (super.getUserKey() == null)
throw new IllegalStateException("userKey cannot be null");
if (super.getApplicationKey() == null)
throw new IllegalStateException("appKey cannot be null");
URL url = new URL("http://me2day.net/api/create_post");
Map<String, Object> params = new HashMap<String, Object>();
params.put("post[body]", post.getBody());
params.put("post[tags]", post.getTags());
params.put("post[icon]", String.valueOf(post.getIconIndex()));
params.put("receive_sms", String.valueOf(post.isReceiveSMS()));
params.put("close_comment", String.valueOf(post.isCloseComment()));
if (post.hasLocation()) {
params.put("longitude", String.valueOf(post.getLongitude()));
params.put("latitude", String.valueOf(post.getLatitude()));
}
if (post.getContentType() != null)
params.put("content_type", post.getContentType());
if (post.getCallbackUrl() != null)
params.put("callback_url", post.getCallbackUrl());
Document doc = null;
if (post.getAttachment() != null) {
params.put("attachment", post.getAttachment());
doc = requestMultipart(url, params);
} else {
doc = request(url, "POST", params);
}
// XPath xpath = XPathFactory.newInstance().newXPath();
// String permalink = null;
// try {
// permalink = xpath.evaluate("/post/permalink/text()", doc);
// } catch (XPathExpressionException e) {
// }
// return permalink;
return null;
}
}