SlideShare a Scribd company logo
1 of 24
Download to read offline
Android
                 2011/1/17
                      @yusukey




   Copyright(c) Yusuke Yamamoto All rights reserved.
http://samuraism.jp/
                      @yusukey



http://tinyurl.com/android-java
          Copyright(c) Yusuke Yamamoto All rights reserved.
↑
Java Twitter API


  • JDK1.4.2
  • Google App Engine
  • Android
      Copyright(c) Yusuke Yamamoto All rights reserved.
Android Java



      Copyright(c) Yusuke Yamamoto All rights reserved.
Android




    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 resolve
new-instance 105 (Lsun/misc/BASE64Encoder;) in Ltwitter4j/http/
HttpClient;
02-20 18:03:59.843: WARN/dalvikvm(526): VFY: rejecting opcode
0x22 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



 Copyright(c) Yusuke Yamamoto All rights reserved.
XML
   •   Twitter4J
// XML
private 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 method
javax.xml.transform.TransformerFactory.newInstance,
 referenced from method twitter4j.TwitterResponse.toString




                  :Android                  XSLT




                   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 “”;
    }
}
                     Copyright(c) Yusuke Yamamoto All rights reserved.
01-16 23:20:58.637: ERROR/AndroidRuntime(209): Uncaught handler: thread main exiting
due to uncaught exception
01-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.
XML
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());




                   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 &
                       : “English ByteArrayInputStream(
                                           ”
        xml.getBytes());
DocumentBuilder builder = “English”
                     :     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.
XML




Copyright(c) Yusuke Yamamoto All rights reserved.
• Twitter       xml, JSON, atom, rss

• JSON
 •   JavaScript Object Notation
 •   Web API




               Twitter4J              JSON



               Copyright(c) Yusuke Yamamoto All rights reserved.
JSON



 Copyright(c) Yusuke Yamamoto All rights reserved.
JSON
(“foo”:null, “longvalue”:”13857270119014401”}

JSONObject json = new JSONObject
   ("{"foo":null,"longvalue":"13857270119014401"}");
// true
System.out.println(json.isNull("foo"));
// true

System.out.println(null == json.getString("foo"));
// false
System.out.println("null".equals(json.getString("foo")));
// 13857270119014401
System.out.println(json.getLong("longvalue"));

                 Copyright(c) Yusuke Yamamoto All rights reserved.
JSONObject json = new JSONObject
   ("{"foo":null,"longvalue":"13857270119014401"}");
// true                                            true
System.out.println(json.isNull("foo"));
// true                                            true
System.out.println(null == json.getString("foo"));
// false                                           true
System.out.println("null".equals(json.getString("foo")));
// 13857270119014401                            13857270119014400
System.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.
• Android
public static final boolean IS_DALVIK;
static{
  try {
    // dalvik.system.VMRuntime class should be existing on
Android 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 not
resolve unicode entity refs
http://code.google.com/p/android/issues/detail?id=2607

- Issue 9244 - android - org.json packages out of date
http://code.google.com/p/android/issues/detail?id=9244

- Issue 13830 - JSONObject.getString() returns "null" string
literal for null value instead of null object.
http://code.google.com/p/android/issues/detail?id=13830

- Issue 13831 - JSONObject.getLong() returns rounded and
inaccurate value
http://code.google.com/p/android/issues/detail?id=13831


                   Copyright(c) Yusuke Yamamoto All rights reserved.

More Related Content

What's hot

"Applied Enterprise Metaprogramming in JavaScript", Vladyslav Dukhin
"Applied Enterprise Metaprogramming in JavaScript", Vladyslav Dukhin"Applied Enterprise Metaprogramming in JavaScript", Vladyslav Dukhin
"Applied Enterprise Metaprogramming in JavaScript", Vladyslav DukhinFwdays
 
Startup groovysession1
Startup groovysession1Startup groovysession1
Startup groovysession1kyon mm
 
Django & Buildout (en)
Django & Buildout (en)Django & Buildout (en)
Django & Buildout (en)zerok
 
Marvel of Annotation Preprocessing in Java by Alexey Buzdin
Marvel of Annotation Preprocessing in Java by Alexey BuzdinMarvel of Annotation Preprocessing in Java by Alexey Buzdin
Marvel of Annotation Preprocessing in Java by Alexey BuzdinJava User Group Latvia
 
Detecting headless browsers
Detecting headless browsersDetecting headless browsers
Detecting headless browsersSergey Shekyan
 
Introduction to zc.buildout
Introduction to zc.buildoutIntroduction to zc.buildout
Introduction to zc.buildoutRicardo Newbery
 
Gradle talk, Javarsovia 2010
Gradle talk, Javarsovia 2010Gradle talk, Javarsovia 2010
Gradle talk, Javarsovia 2010Tomek Kaczanowski
 
Infrastructure as code - Python Saati #36
Infrastructure as code - Python Saati #36Infrastructure as code - Python Saati #36
Infrastructure as code - Python Saati #36Halil Kaya
 
Testing JS with Jasmine
Testing JS with JasmineTesting JS with Jasmine
Testing JS with JasmineEvgeny Gurin
 
An intro to the JAMStack and Eleventy
An intro to the JAMStack and EleventyAn intro to the JAMStack and Eleventy
An intro to the JAMStack and EleventyLuciano Mammino
 
PyCon Korea 2019 REST API Document Generation
PyCon Korea 2019 REST API Document GenerationPyCon Korea 2019 REST API Document Generation
PyCon Korea 2019 REST API Document Generation용선 이
 
Functional Reactive Programming on Android
Functional Reactive Programming on AndroidFunctional Reactive Programming on Android
Functional Reactive Programming on AndroidSam Lee
 
Testing of javacript
Testing of javacriptTesting of javacript
Testing of javacriptLei Kang
 
Selenium & PHPUnit made easy with Steward (Berlin, April 2017)
Selenium & PHPUnit made easy with Steward (Berlin, April 2017)Selenium & PHPUnit made easy with Steward (Berlin, April 2017)
Selenium & PHPUnit made easy with Steward (Berlin, April 2017)Ondřej Machulda
 
Asynchronous Module Definition (AMD)
Asynchronous Module Definition (AMD)Asynchronous Module Definition (AMD)
Asynchronous Module Definition (AMD)xMartin12
 
Like a Genie from a Lamp: Headless JavaScript Unit Testing with Jasmine and P...
Like a Genie from a Lamp: Headless JavaScript Unit Testing with Jasmine and P...Like a Genie from a Lamp: Headless JavaScript Unit Testing with Jasmine and P...
Like a Genie from a Lamp: Headless JavaScript Unit Testing with Jasmine and P...Rob Friesel
 

What's hot (20)

"Applied Enterprise Metaprogramming in JavaScript", Vladyslav Dukhin
"Applied Enterprise Metaprogramming in JavaScript", Vladyslav Dukhin"Applied Enterprise Metaprogramming in JavaScript", Vladyslav Dukhin
"Applied Enterprise Metaprogramming in JavaScript", Vladyslav Dukhin
 
Startup groovysession1
Startup groovysession1Startup groovysession1
Startup groovysession1
 
Django & Buildout (en)
Django & Buildout (en)Django & Buildout (en)
Django & Buildout (en)
 
Marvel of Annotation Preprocessing in Java by Alexey Buzdin
Marvel of Annotation Preprocessing in Java by Alexey BuzdinMarvel of Annotation Preprocessing in Java by Alexey Buzdin
Marvel of Annotation Preprocessing in Java by Alexey Buzdin
 
Detecting headless browsers
Detecting headless browsersDetecting headless browsers
Detecting headless browsers
 
Introduction to zc.buildout
Introduction to zc.buildoutIntroduction to zc.buildout
Introduction to zc.buildout
 
Gradle talk, Javarsovia 2010
Gradle talk, Javarsovia 2010Gradle talk, Javarsovia 2010
Gradle talk, Javarsovia 2010
 
Test your modules
Test your modulesTest your modules
Test your modules
 
Infrastructure as code - Python Saati #36
Infrastructure as code - Python Saati #36Infrastructure as code - Python Saati #36
Infrastructure as code - Python Saati #36
 
Testing JS with Jasmine
Testing JS with JasmineTesting JS with Jasmine
Testing JS with Jasmine
 
An intro to the JAMStack and Eleventy
An intro to the JAMStack and EleventyAn intro to the JAMStack and Eleventy
An intro to the JAMStack and Eleventy
 
PyCon Korea 2019 REST API Document Generation
PyCon Korea 2019 REST API Document GenerationPyCon Korea 2019 REST API Document Generation
PyCon Korea 2019 REST API Document Generation
 
Functional Reactive Programming on Android
Functional Reactive Programming on AndroidFunctional Reactive Programming on Android
Functional Reactive Programming on Android
 
Hands on the Gradle
Hands on the GradleHands on the Gradle
Hands on the Gradle
 
Testing of javacript
Testing of javacriptTesting of javacript
Testing of javacript
 
Zombiejs
ZombiejsZombiejs
Zombiejs
 
Selenium & PHPUnit made easy with Steward (Berlin, April 2017)
Selenium & PHPUnit made easy with Steward (Berlin, April 2017)Selenium & PHPUnit made easy with Steward (Berlin, April 2017)
Selenium & PHPUnit made easy with Steward (Berlin, April 2017)
 
Asynchronous Module Definition (AMD)
Asynchronous Module Definition (AMD)Asynchronous Module Definition (AMD)
Asynchronous Module Definition (AMD)
 
groovy & grails - lecture 6
groovy & grails - lecture 6groovy & grails - lecture 6
groovy & grails - lecture 6
 
Like a Genie from a Lamp: Headless JavaScript Unit Testing with Jasmine and P...
Like a Genie from a Lamp: Headless JavaScript Unit Testing with Jasmine and P...Like a Genie from a Lamp: Headless JavaScript Unit Testing with Jasmine and P...
Like a Genie from a Lamp: Headless JavaScript Unit Testing with Jasmine and P...
 

Similar to Androidの本当にあった怖い話

A topology of memory leaks on the JVM
A topology of memory leaks on the JVMA topology of memory leaks on the JVM
A topology of memory leaks on the JVMRafael Winterhalter
 
JJUG CCC 2011 Spring
JJUG CCC 2011 SpringJJUG CCC 2011 Spring
JJUG CCC 2011 SpringKiyotaka Oku
 
33rd Degree 2013, Bad Tests, Good Tests
33rd Degree 2013, Bad Tests, Good Tests33rd Degree 2013, Bad Tests, Good Tests
33rd Degree 2013, Bad Tests, Good TestsTomek Kaczanowski
 
Construire une application JavaFX 8 avec gradle
Construire une application JavaFX 8 avec gradleConstruire une application JavaFX 8 avec gradle
Construire une application JavaFX 8 avec gradleThierry Wasylczenko
 
Workshop 23: ReactJS, React & Redux testing
Workshop 23: ReactJS, React & Redux testingWorkshop 23: ReactJS, React & Redux testing
Workshop 23: ReactJS, React & Redux testingVisual Engineering
 
2. Design patterns. part #2
2. Design patterns. part #22. Design patterns. part #2
2. Design patterns. part #2Leonid Maslov
 
ClojureScript loves React, DomCode May 26 2015
ClojureScript loves React, DomCode May 26 2015ClojureScript loves React, DomCode May 26 2015
ClojureScript loves React, DomCode May 26 2015Michiel Borkent
 
Android and the Seven Dwarfs from Devox'15
Android and the Seven Dwarfs from Devox'15Android and the Seven Dwarfs from Devox'15
Android and the Seven Dwarfs from Devox'15Murat Yener
 
Jersey framework
Jersey frameworkJersey framework
Jersey frameworkknight1128
 
Codestrong 2012 breakout session hacking titanium
Codestrong 2012 breakout session   hacking titaniumCodestrong 2012 breakout session   hacking titanium
Codestrong 2012 breakout session hacking titaniumAxway Appcelerator
 
New Features Of JDK 7
New Features Of JDK 7New Features Of JDK 7
New Features Of JDK 7Deniz Oguz
 
Java 7 Whats New(), Whats Next() from Oredev
Java 7 Whats New(), Whats Next() from OredevJava 7 Whats New(), Whats Next() from Oredev
Java 7 Whats New(), Whats Next() from OredevMattias Karlsson
 
RxJava и Android. Плюсы, минусы, подводные камни
RxJava и Android. Плюсы, минусы, подводные камниRxJava и Android. Плюсы, минусы, подводные камни
RxJava и Android. Плюсы, минусы, подводные камниStfalcon Meetups
 
Reactive programming on Android
Reactive programming on AndroidReactive programming on Android
Reactive programming on AndroidTomáš Kypta
 
Kotlin 1.2: Sharing code between platforms
Kotlin 1.2: Sharing code between platformsKotlin 1.2: Sharing code between platforms
Kotlin 1.2: Sharing code between platformsKirill Rozov
 
2012 JDays Bad Tests Good Tests
2012 JDays Bad Tests Good Tests2012 JDays Bad Tests Good Tests
2012 JDays Bad Tests Good TestsTomek Kaczanowski
 
Teste de Integração com DbUnit e jIntegrity
Teste de Integração com DbUnit e jIntegrityTeste de Integração com DbUnit e jIntegrity
Teste de Integração com DbUnit e jIntegrityWashington Botelho
 

Similar to Androidの本当にあった怖い話 (20)

A topology of memory leaks on the JVM
A topology of memory leaks on the JVMA topology of memory leaks on the JVM
A topology of memory leaks on the JVM
 
JJUG CCC 2011 Spring
JJUG CCC 2011 SpringJJUG CCC 2011 Spring
JJUG CCC 2011 Spring
 
33rd Degree 2013, Bad Tests, Good Tests
33rd Degree 2013, Bad Tests, Good Tests33rd Degree 2013, Bad Tests, Good Tests
33rd Degree 2013, Bad Tests, Good Tests
 
Construire une application JavaFX 8 avec gradle
Construire une application JavaFX 8 avec gradleConstruire une application JavaFX 8 avec gradle
Construire une application JavaFX 8 avec gradle
 
Workshop 23: ReactJS, React & Redux testing
Workshop 23: ReactJS, React & Redux testingWorkshop 23: ReactJS, React & Redux testing
Workshop 23: ReactJS, React & Redux testing
 
2. Design patterns. part #2
2. Design patterns. part #22. Design patterns. part #2
2. Design patterns. part #2
 
ClojureScript loves React, DomCode May 26 2015
ClojureScript loves React, DomCode May 26 2015ClojureScript loves React, DomCode May 26 2015
ClojureScript loves React, DomCode May 26 2015
 
Android and the Seven Dwarfs from Devox'15
Android and the Seven Dwarfs from Devox'15Android and the Seven Dwarfs from Devox'15
Android and the Seven Dwarfs from Devox'15
 
Jersey framework
Jersey frameworkJersey framework
Jersey framework
 
Xml & Java
Xml & JavaXml & Java
Xml & Java
 
Codestrong 2012 breakout session hacking titanium
Codestrong 2012 breakout session   hacking titaniumCodestrong 2012 breakout session   hacking titanium
Codestrong 2012 breakout session hacking titanium
 
New Features Of JDK 7
New Features Of JDK 7New Features Of JDK 7
New Features Of JDK 7
 
Java 7 Whats New(), Whats Next() from Oredev
Java 7 Whats New(), Whats Next() from OredevJava 7 Whats New(), Whats Next() from Oredev
Java 7 Whats New(), Whats Next() from Oredev
 
RxJava и Android. Плюсы, минусы, подводные камни
RxJava и Android. Плюсы, минусы, подводные камниRxJava и Android. Плюсы, минусы, подводные камни
RxJava и Android. Плюсы, минусы, подводные камни
 
Ejb3 Dan Hinojosa
Ejb3 Dan HinojosaEjb3 Dan Hinojosa
Ejb3 Dan Hinojosa
 
Reactive programming on Android
Reactive programming on AndroidReactive programming on Android
Reactive programming on Android
 
Kotlin 1.2: Sharing code between platforms
Kotlin 1.2: Sharing code between platformsKotlin 1.2: Sharing code between platforms
Kotlin 1.2: Sharing code between platforms
 
Java
JavaJava
Java
 
2012 JDays Bad Tests Good Tests
2012 JDays Bad Tests Good Tests2012 JDays Bad Tests Good Tests
2012 JDays Bad Tests Good Tests
 
Teste de Integração com DbUnit e jIntegrity
Teste de Integração com DbUnit e jIntegrityTeste de Integração com DbUnit e jIntegrity
Teste de Integração com DbUnit e jIntegrity
 

More from Yusuke Yamamoto

株式会社サムライズム 新製品発表会 物理イカリングのご紹介 #gbdaitokai
株式会社サムライズム 新製品発表会 物理イカリングのご紹介 #gbdaitokai株式会社サムライズム 新製品発表会 物理イカリングのご紹介 #gbdaitokai
株式会社サムライズム 新製品発表会 物理イカリングのご紹介 #gbdaitokaiYusuke Yamamoto
 
これからはじめるGit、GitHub #stapy
これからはじめるGit、GitHub #stapyこれからはじめるGit、GitHub #stapy
これからはじめるGit、GitHub #stapyYusuke Yamamoto
 
誰も知らない IntelliJ IDEA凄技100選 #kotlin_sansan
誰も知らない IntelliJ IDEA凄技100選 #kotlin_sansan誰も知らない IntelliJ IDEA凄技100選 #kotlin_sansan
誰も知らない IntelliJ IDEA凄技100選 #kotlin_sansanYusuke Yamamoto
 
JetBrains IDEハンズオン
JetBrains IDEハンズオンJetBrains IDEハンズオン
JetBrains IDEハンズオンYusuke Yamamoto
 
Java Küche 2016 LT 在室状況自動通知ボット #JavaKueche
Java Küche 2016 LT 在室状況自動通知ボット #JavaKuecheJava Küche 2016 LT 在室状況自動通知ボット #JavaKueche
Java Küche 2016 LT 在室状況自動通知ボット #JavaKuecheYusuke Yamamoto
 
Java Küche 2016 #JavaKueche
Java Küche 2016 #JavaKuecheJava Küche 2016 #JavaKueche
Java Küche 2016 #JavaKuecheYusuke Yamamoto
 
JavaOne2016 #CON5929 Time-Saving Tips and Tricks for Building Quality Java Ap...
JavaOne2016 #CON5929 Time-Saving Tips and Tricks for Building Quality Java Ap...JavaOne2016 #CON5929 Time-Saving Tips and Tricks for Building Quality Java Ap...
JavaOne2016 #CON5929 Time-Saving Tips and Tricks for Building Quality Java Ap...Yusuke Yamamoto
 
WebStormから始まる快適Web開発ワークフロー #html5jk
WebStormから始まる快適Web開発ワークフロー #html5jkWebStormから始まる快適Web開発ワークフロー #html5jk
WebStormから始まる快適Web開発ワークフロー #html5jkYusuke Yamamoto
 
データクラスから始めるKotlin / JetBrainsに行ってきました #kotlin_kansai #jkug
データクラスから始めるKotlin / JetBrainsに行ってきました #kotlin_kansai #jkug データクラスから始めるKotlin / JetBrainsに行ってきました #kotlin_kansai #jkug
データクラスから始めるKotlin / JetBrainsに行ってきました #kotlin_kansai #jkug Yusuke Yamamoto
 
Troubleshooting Slowdowns, Freezes, Deadlocks : Introduction to Thread Dump #...
Troubleshooting Slowdowns, Freezes, Deadlocks : Introduction to Thread Dump #...Troubleshooting Slowdowns, Freezes, Deadlocks : Introduction to Thread Dump #...
Troubleshooting Slowdowns, Freezes, Deadlocks : Introduction to Thread Dump #...Yusuke Yamamoto
 
カジュアルにスレッドダンプ - @yusuke #javacasual
カジュアルにスレッドダンプ - @yusuke #javacasualカジュアルにスレッドダンプ - @yusuke #javacasual
カジュアルにスレッドダンプ - @yusuke #javacasualYusuke Yamamoto
 
Excel方眼紙アプリケーションサーバと侍の新機能 #jjug
Excel方眼紙アプリケーションサーバと侍の新機能 #jjugExcel方眼紙アプリケーションサーバと侍の新機能 #jjug
Excel方眼紙アプリケーションサーバと侍の新機能 #jjugYusuke Yamamoto
 
Twitter4jハンズオン 5/1 #twtr_hack
Twitter4jハンズオン 5/1 #twtr_hackTwitter4jハンズオン 5/1 #twtr_hack
Twitter4jハンズオン 5/1 #twtr_hackYusuke Yamamoto
 
株式会社サムライズム@samuraismがcoincheck for ECを使ってビットコイン決済に対応した話 #gbdaitokai
株式会社サムライズム@samuraismがcoincheck for ECを使ってビットコイン決済に対応した話 #gbdaitokai 株式会社サムライズム@samuraismがcoincheck for ECを使ってビットコイン決済に対応した話 #gbdaitokai
株式会社サムライズム@samuraismがcoincheck for ECを使ってビットコイン決済に対応した話 #gbdaitokai Yusuke Yamamoto
 
Botを使った業務効率化 / Java8を使ったBot実装効率化 @yusuke #jjug
Botを使った業務効率化 / Java8を使ったBot実装効率化 @yusuke #jjugBotを使った業務効率化 / Java8を使ったBot実装効率化 @yusuke #jjug
Botを使った業務効率化 / Java8を使ったBot実装効率化 @yusuke #jjugYusuke Yamamoto
 
Twitter API最新事情 - API Meetup Tokyo #1 #apijp
Twitter API最新事情 - API Meetup Tokyo #1 #apijpTwitter API最新事情 - API Meetup Tokyo #1 #apijp
Twitter API最新事情 - API Meetup Tokyo #1 #apijpYusuke Yamamoto
 
Java デバッガ活用術 ~勘デバッグ・print デバッグから抜けだそう~ #jjug_ccc #ccc_h4
Java デバッガ活用術 ~勘デバッグ・print デバッグから抜けだそう~ #jjug_ccc #ccc_h4Java デバッガ活用術 ~勘デバッグ・print デバッグから抜けだそう~ #jjug_ccc #ccc_h4
Java デバッガ活用術 ~勘デバッグ・print デバッグから抜けだそう~ #jjug_ccc #ccc_h4Yusuke Yamamoto
 
貧乏人のHeroku活用術 #herokujp
貧乏人のHeroku活用術 #herokujp貧乏人のHeroku活用術 #herokujp
貧乏人のHeroku活用術 #herokujpYusuke Yamamoto
 
リーンスタートアップ x Java #jjug #jjug_ccc #ccc_h4
リーンスタートアップ x Java #jjug #jjug_ccc #ccc_h4リーンスタートアップ x Java #jjug #jjug_ccc #ccc_h4
リーンスタートアップ x Java #jjug #jjug_ccc #ccc_h4Yusuke Yamamoto
 
JavaScript時代のJava #kansumiB7 #kansumi
JavaScript時代のJava #kansumiB7 #kansumiJavaScript時代のJava #kansumiB7 #kansumi
JavaScript時代のJava #kansumiB7 #kansumiYusuke Yamamoto
 

More from Yusuke Yamamoto (20)

株式会社サムライズム 新製品発表会 物理イカリングのご紹介 #gbdaitokai
株式会社サムライズム 新製品発表会 物理イカリングのご紹介 #gbdaitokai株式会社サムライズム 新製品発表会 物理イカリングのご紹介 #gbdaitokai
株式会社サムライズム 新製品発表会 物理イカリングのご紹介 #gbdaitokai
 
これからはじめるGit、GitHub #stapy
これからはじめるGit、GitHub #stapyこれからはじめるGit、GitHub #stapy
これからはじめるGit、GitHub #stapy
 
誰も知らない IntelliJ IDEA凄技100選 #kotlin_sansan
誰も知らない IntelliJ IDEA凄技100選 #kotlin_sansan誰も知らない IntelliJ IDEA凄技100選 #kotlin_sansan
誰も知らない IntelliJ IDEA凄技100選 #kotlin_sansan
 
JetBrains IDEハンズオン
JetBrains IDEハンズオンJetBrains IDEハンズオン
JetBrains IDEハンズオン
 
Java Küche 2016 LT 在室状況自動通知ボット #JavaKueche
Java Küche 2016 LT 在室状況自動通知ボット #JavaKuecheJava Küche 2016 LT 在室状況自動通知ボット #JavaKueche
Java Küche 2016 LT 在室状況自動通知ボット #JavaKueche
 
Java Küche 2016 #JavaKueche
Java Küche 2016 #JavaKuecheJava Küche 2016 #JavaKueche
Java Küche 2016 #JavaKueche
 
JavaOne2016 #CON5929 Time-Saving Tips and Tricks for Building Quality Java Ap...
JavaOne2016 #CON5929 Time-Saving Tips and Tricks for Building Quality Java Ap...JavaOne2016 #CON5929 Time-Saving Tips and Tricks for Building Quality Java Ap...
JavaOne2016 #CON5929 Time-Saving Tips and Tricks for Building Quality Java Ap...
 
WebStormから始まる快適Web開発ワークフロー #html5jk
WebStormから始まる快適Web開発ワークフロー #html5jkWebStormから始まる快適Web開発ワークフロー #html5jk
WebStormから始まる快適Web開発ワークフロー #html5jk
 
データクラスから始めるKotlin / JetBrainsに行ってきました #kotlin_kansai #jkug
データクラスから始めるKotlin / JetBrainsに行ってきました #kotlin_kansai #jkug データクラスから始めるKotlin / JetBrainsに行ってきました #kotlin_kansai #jkug
データクラスから始めるKotlin / JetBrainsに行ってきました #kotlin_kansai #jkug
 
Troubleshooting Slowdowns, Freezes, Deadlocks : Introduction to Thread Dump #...
Troubleshooting Slowdowns, Freezes, Deadlocks : Introduction to Thread Dump #...Troubleshooting Slowdowns, Freezes, Deadlocks : Introduction to Thread Dump #...
Troubleshooting Slowdowns, Freezes, Deadlocks : Introduction to Thread Dump #...
 
カジュアルにスレッドダンプ - @yusuke #javacasual
カジュアルにスレッドダンプ - @yusuke #javacasualカジュアルにスレッドダンプ - @yusuke #javacasual
カジュアルにスレッドダンプ - @yusuke #javacasual
 
Excel方眼紙アプリケーションサーバと侍の新機能 #jjug
Excel方眼紙アプリケーションサーバと侍の新機能 #jjugExcel方眼紙アプリケーションサーバと侍の新機能 #jjug
Excel方眼紙アプリケーションサーバと侍の新機能 #jjug
 
Twitter4jハンズオン 5/1 #twtr_hack
Twitter4jハンズオン 5/1 #twtr_hackTwitter4jハンズオン 5/1 #twtr_hack
Twitter4jハンズオン 5/1 #twtr_hack
 
株式会社サムライズム@samuraismがcoincheck for ECを使ってビットコイン決済に対応した話 #gbdaitokai
株式会社サムライズム@samuraismがcoincheck for ECを使ってビットコイン決済に対応した話 #gbdaitokai 株式会社サムライズム@samuraismがcoincheck for ECを使ってビットコイン決済に対応した話 #gbdaitokai
株式会社サムライズム@samuraismがcoincheck for ECを使ってビットコイン決済に対応した話 #gbdaitokai
 
Botを使った業務効率化 / Java8を使ったBot実装効率化 @yusuke #jjug
Botを使った業務効率化 / Java8を使ったBot実装効率化 @yusuke #jjugBotを使った業務効率化 / Java8を使ったBot実装効率化 @yusuke #jjug
Botを使った業務効率化 / Java8を使ったBot実装効率化 @yusuke #jjug
 
Twitter API最新事情 - API Meetup Tokyo #1 #apijp
Twitter API最新事情 - API Meetup Tokyo #1 #apijpTwitter API最新事情 - API Meetup Tokyo #1 #apijp
Twitter API最新事情 - API Meetup Tokyo #1 #apijp
 
Java デバッガ活用術 ~勘デバッグ・print デバッグから抜けだそう~ #jjug_ccc #ccc_h4
Java デバッガ活用術 ~勘デバッグ・print デバッグから抜けだそう~ #jjug_ccc #ccc_h4Java デバッガ活用術 ~勘デバッグ・print デバッグから抜けだそう~ #jjug_ccc #ccc_h4
Java デバッガ活用術 ~勘デバッグ・print デバッグから抜けだそう~ #jjug_ccc #ccc_h4
 
貧乏人のHeroku活用術 #herokujp
貧乏人のHeroku活用術 #herokujp貧乏人のHeroku活用術 #herokujp
貧乏人のHeroku活用術 #herokujp
 
リーンスタートアップ x Java #jjug #jjug_ccc #ccc_h4
リーンスタートアップ x Java #jjug #jjug_ccc #ccc_h4リーンスタートアップ x Java #jjug #jjug_ccc #ccc_h4
リーンスタートアップ x Java #jjug #jjug_ccc #ccc_h4
 
JavaScript時代のJava #kansumiB7 #kansumi
JavaScript時代のJava #kansumiB7 #kansumiJavaScript時代のJava #kansumiB7 #kansumi
JavaScript時代のJava #kansumiB7 #kansumi
 

Recently uploaded

Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024The Digital Insurer
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Wonjun Hwang
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 

Recently uploaded (20)

Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 

Androidの本当にあった怖い話

  • 1. Android 2011/1/17 @yusukey Copyright(c) Yusuke Yamamoto All rights reserved.
  • 2. http://samuraism.jp/ @yusukey http://tinyurl.com/android-java Copyright(c) Yusuke Yamamoto All rights reserved.
  • 3. ↑ Java Twitter API • JDK1.4.2 • Google App Engine • Android Copyright(c) Yusuke Yamamoto All rights reserved.
  • 4. Android Java Copyright(c) Yusuke Yamamoto All rights reserved.
  • 5. Android Copyright(c) Yusuke Yamamoto All rights reserved.
  • 6. new sun.misc.BASE64Encoder().encode(buf); 02-20 18:03:59.843: WARN/dalvikvm(526): VFY: unable to resolve new-instance 105 (Lsun/misc/BASE64Encoder;) in Ltwitter4j/http/ HttpClient; 02-20 18:03:59.843: WARN/dalvikvm(526): VFY: rejecting opcode 0x22 at 0x0011 :Android sun.misc.* / com.sun.* Copyright(c) Yusuke Yamamoto All rights reserved.
  • 7. • BASE64 (Commons-Codec ok) • sun.misc.* com.sun.* Copyright(c) Yusuke Yamamoto All rights reserved.
  • 8. XML Copyright(c) Yusuke Yamamoto All rights reserved.
  • 9. XML • Twitter4J // XML private 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.
  • 10. 07-07 23:55:42.993: ERROR/dalvikvm(11182): Could not find method javax.xml.transform.TransformerFactory.newInstance, referenced from method twitter4j.TwitterResponse.toString :Android XSLT Copyright(c) Yusuke Yamamoto All rights reserved.
  • 11. // 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 “”; } } Copyright(c) Yusuke Yamamoto All rights reserved.
  • 12. 01-16 23:20:58.637: ERROR/AndroidRuntime(209): Uncaught handler: thread main exiting due to uncaught exception 01-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.
  • 13. -- // 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.
  • 14. XML 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()); Copyright(c) Yusuke Yamamoto All rights reserved.
  • 15. String xml = "<title>English &amp; </title>"; DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance (); dbf.setCoalescing(true); dbf.setExpandEntityReferences(true); ByteArrayInputStream stream = new & : “English ByteArrayInputStream( ” xml.getBytes()); DocumentBuilder builder = “English” : 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.
  • 16. XML Copyright(c) Yusuke Yamamoto All rights reserved.
  • 17. • Twitter xml, JSON, atom, rss • JSON • JavaScript Object Notation • Web API Twitter4J JSON Copyright(c) Yusuke Yamamoto All rights reserved.
  • 18. JSON Copyright(c) Yusuke Yamamoto All rights reserved.
  • 19. JSON (“foo”:null, “longvalue”:”13857270119014401”} JSONObject json = new JSONObject ("{"foo":null,"longvalue":"13857270119014401"}"); // true System.out.println(json.isNull("foo")); // true System.out.println(null == json.getString("foo")); // false System.out.println("null".equals(json.getString("foo"))); // 13857270119014401 System.out.println(json.getLong("longvalue")); Copyright(c) Yusuke Yamamoto All rights reserved.
  • 20. JSONObject json = new JSONObject ("{"foo":null,"longvalue":"13857270119014401"}"); // true true System.out.println(json.isNull("foo")); // true true System.out.println(null == json.getString("foo")); // false true System.out.println("null".equals(json.getString("foo"))); // 13857270119014401 13857270119014400 System.out.println(json.getLong("longvalue")); :json Copyright(c) Yusuke Yamamoto All rights reserved.
  • 21. json.org twitter4j.internal.org.json.* Copyright(c) Yusuke Yamamoto All rights reserved.
  • 22. XSLT (Froyo ) • VerifyError • Eclair(Android 2.1) • XML • Froyo(Android 2.2) • JSON • • Sun Copyright(c) Yusuke Yamamoto All rights reserved.
  • 23. • Android public static final boolean IS_DALVIK; static{ try { // dalvik.system.VMRuntime class should be existing on Android 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.
  • 24. - Issue 2607 - android - org.apache.harmony.xml.parsers.DocumentBuilderImpl does not resolve unicode entity refs http://code.google.com/p/android/issues/detail?id=2607 - Issue 9244 - android - org.json packages out of date http://code.google.com/p/android/issues/detail?id=9244 - Issue 13830 - JSONObject.getString() returns "null" string literal for null value instead of null object. http://code.google.com/p/android/issues/detail?id=13830 - Issue 13831 - JSONObject.getLong() returns rounded and inaccurate value http://code.google.com/p/android/issues/detail?id=13831 Copyright(c) Yusuke Yamamoto All rights reserved.