• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Androidの本当にあった怖い話
 

Androidの本当にあった怖い話

on

  • 23,046 views

 

Statistics

Views

Total Views
23,046
Views on SlideShare
19,157
Embed Views
3,889

Actions

Likes
15
Downloads
38
Comments
1

12 Embeds 3,889

http://samuraism.jp 3684
https://twitter.com 93
https://si0.twimg.com 27
https://twimg0-a.akamaihd.net 21
http://a0.twimg.com 20
http://paper.li 18
http://us-w1.rockmelt.com 7
http://twitter.com 7
http://www.onlydoo.com 6
http://www.iweb34.com 3
http://tweetedtimes.com 2
http://localhost 1
More...

Accessibility

Upload Details

Uploaded via as Adobe PDF

Usage Rights

CC Attribution License

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel

11 of 1 previous next

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
  • XMLとかJSONが素ではバグが潜んでて危険とか、ちょっと怖い。テストで気をつけなきゃ。
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Androidの本当にあった怖い話 Androidの本当にあった怖い話 Presentation Transcript

    • http://samuraism.jp/ @yusukeyCopyright(c) Yusuke Yamamoto All rights reserved.
    • Java Twitter APIBSD : 2.1.10 : • JDK1.4.2 • Google App Engine • Android Copyright(c) Yusuke Yamamoto All rights reserved.
    • Android 2010/1/17 @yusukey Copyright(c) Yusuke Yamamoto All rights reserved.
    • Android• Sun• XML• JSON Copyright(c) Yusuke Yamamoto All rights reserved.
    • new sun.misc.BASE64Encoder().encode(buf);02-20 18:03:59.843: WARN/dalvikvm(526): VFY: unable to resolvenew-instance 105 (Lsun/misc/BASE64Encoder;) in Ltwitter4j/http/HttpClient;02-20 18:03:59.843: WARN/dalvikvm(526): VFY: rejecting opcode0x22 at 0x0011 :Android sun.misc.* / com.sun.* Copyright(c) Yusuke Yamamoto All rights reserved.
    • • BASE64 (Commons-Codec ok)• sun.misc.* com.sun.* Copyright(c) Yusuke Yamamoto All rights reserved.
    • XML • Twitter4J// XMLprivate String toString(Element doc){ StringWriter output = new StringWriter(); Transformer t =TransformerFactory.newInstance() .newTransformer(); t.transform(new DOMSource(doc), new StreamResult(output)); return output.toString();} Copyright(c) Yusuke Yamamoto All rights reserved.
    • 07-07 23:55:42.993: ERROR/dalvikvm(11182): Could not find methodjavax.xml.transform.TransformerFactory.newInstance, referenced from method twitter4j.TwitterResponse.toString :Android XSLT Copyright(c) Yusuke Yamamoto All rights reserved.
    • // XMLprivate static String toString(Element doc){ StringWriter output = new StringWriter(); try{ Transformer t = TransformerFactory.newInstance().newTransformer(); t.transform(new DOMSource(doc), new StreamResult(output)); return output.toString(); }catch(ClassNotFoundException cnfe){ // javax.xml.transform.TransformerFactory // “” return “”; }} Copyright(c) Yusuke Yamamoto All rights reserved.
    • 01-16 23:20:58.637: ERROR/AndroidRuntime(209): Uncaught handler: thread main exitingdue to uncaught exception01-16 23:20:58.668: ERROR/AndroidRuntime(209): java.lang.VerifyError:com.example.MyActivity at java.lang.Class.newInstanceImpl(Native Method) at java.lang.Class.newInstance(Class.java:1472) at android.app.Instrumentation.newActivity(Instrumentation.java:1097) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2316) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2417) at android.app.ActivityThread.access$2100(ActivityThread.java:116) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1794) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:123) at android.app.ActivityThread.main(ActivityThread.java:4203) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:521) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:791) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:549) at dalvik.system.NativeStart.main(Native Method) : VerifyError Copyright(c) Yusuke Yamamoto All rights reserved.
    • -- // XML-- private static String toString(Element doc){-- StringWriter output = new StringWriter();-- try{-- Transformer t = TransformerFactory.newInstance().newTransformer();-- t.transform(new DOMSource(doc),-- new StreamResult(output));-- return output.toString();-- }catch(ClassNotFoundException cnfe){-- // javax.xml.transform.TransformerFactory-- // “”-- return “”;-- }--} Transformer Copyright(c) Yusuke Yamamoto All rights reserved.
    • XMLString xml = "<title>English &amp; </title>";DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();dbf.setCoalescing(true);dbf.setExpandEntityReferences(true);ByteArrayInputStream stream = new ByteArrayInputStream( xml.getBytes());DocumentBuilder builder = null;builder = dbf.newDocumentBuilder();Document doc = builder.parse(stream);Node titleNode = doc.getFirstChild();NodeList children = titleNode.getChildNodes();System.out.println(children.item(0).getTextContent()); : “English & ” : “English” Copyright(c) Yusuke Yamamoto All rights reserved.
    • String xml = "<title>English &amp; </title>";DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();dbf.setCoalescing(true);dbf.setExpandEntityReferences(true);ByteArrayInputStream stream = new ByteArrayInputStream( xml.getBytes());DocumentBuilder builder = null;builder = dbf.newDocumentBuilder();Document doc = builder.parse(stream);Node titleNode = doc.getFirstChild();NodeList children = titleNode.getChildNodes();System.out.println(children.item(0).getTextContent()); :XML Copyright(c) Yusuke Yamamoto All rights reserved.
    • XMLCopyright(c) Yusuke Yamamoto All rights reserved.
    • JSON• Twitter xml, JSON, atom, rss• JSON • JavaScript Object Notation • Web API Twitter4J JSON Copyright(c) Yusuke Yamamoto All rights reserved.
    • JSON(“foo”:null, “longvalue”:”13857270119014401”}JSONObject json = new JSONObject ("{"foo":null,"longvalue":"13857270119014401"}");// trueSystem.out.println(json.isNull("foo"));// trueSystem.out.println(null == json.getString("foo"));// falseSystem.out.println("null".equals(json.getString("foo")));// 13857270119014401System.out.println(json.getLong("longvalue")); Copyright(c) Yusuke Yamamoto All rights reserved.
    • JSONObject json = new JSONObject ("{"foo":null,"longvalue":"13857270119014401"}");// true trueSystem.out.println(json.isNull("foo"));// true trueSystem.out.println(null == json.getString("foo"));// false trueSystem.out.println("null".equals(json.getString("foo")));// 13857270119014401 13857270119014400System.out.println(json.getLong("longvalue")); :json Copyright(c) Yusuke Yamamoto All rights reserved.
    • json.org twitter4j.internal.org.json.* Copyright(c) Yusuke Yamamoto All rights reserved.
    • • XSLT (Froyo )• VerifyError • Eclair(Android 2.1)• XML • Froyo(Android 2.2)• JSON •• Sun Copyright(c) Yusuke Yamamoto All rights reserved.
    • • Androidpublic static final boolean IS_DALVIK;static{ try { // dalvik.system.VMRuntime class should be existing onAndroid platform. // @see http://developer.android.com/reference/dalvik/system/VMRuntime.html Class.forName("dalvik.system.VMRuntime"); dalvikDetected = true; } catch (ClassNotFoundException cnfe) { dalvikDetected = false"; } IS_DALVIK = dalvikDetected;} Copyright(c) Yusuke Yamamoto All rights reserved.
    • - Issue 2607 - android - org.apache.harmony.xml.parsers.DocumentBuilderImpl does notresolve unicode entity refshttp://code.google.com/p/android/issues/detail?id=2607- Issue 9244 - android - org.json packages out of datehttp://code.google.com/p/android/issues/detail?id=9244- Issue 13830 - JSONObject.getString() returns "null" string literal for null valueinstead of null object.http://code.google.com/p/android/issues/detail?id=13830- Issue 13831 - JSONObject.getLong() returns rounded and inaccurate valuehttp://code.google.com/p/android/issues/detail?id=13831 Copyright(c) Yusuke Yamamoto All rights reserved.