2011-07-17 23 views
10

मैं एंड्रॉइड -7 (2.1) चलाने वाले एमुलेटर का उपयोग करके एक सरल एंड्रॉइड ऐप के साथ खेल रहा हूं और एक मोटो-डिफाई एंड्रॉइड -8 (2.2) चल रहा है।एंड्रॉइड जावा कार्यान्वयन त्रुटियां .. क्या वे दस्तावेज हैं?

मैं एक दिलचस्प समस्या में भाग गया जहां एक सीएसवी पार्सिंग एप्लिकेशन एमुलेटर पर असफल रहा, लेकिन असफल और नियमित जावा ऐप्स (सूर्य जावा का उपयोग करके) में सफल रहा।

मैं नीचे समस्या पर नज़र रखी और कारण यह है कि StringReader के एंड्रॉयड-7 के कार्यान्वयन के लिए एक नकारात्मक छोड़ आपरेशन का समर्थन नहीं करता है:

एंड्रॉयड -7:

/** 
* Skips {@code amount} characters in the source string. Subsequent calls of 
* {@code read} methods will not return these characters unless {@code 
* reset()} is used. 
* 
* @param ns 
*   the maximum number of characters to skip. 
* @return the number of characters actually skipped or 0 if {@code ns < 0}. 
* @throws IOException 
*    if this reader is closed. 
* @see #mark(int) 
* @see #markSupported() 
* @see #reset() 
*/ 
@Override 
public long skip(long ns) throws IOException { 
    synchronized (lock) { 
     if (isClosed()) { 
      throw new IOException(Msg.getString("K0083")); //$NON-NLS-1$ 
     } 
     if (ns <= 0) { 
      return 0; 
     } 
     long skipped = 0; 
     if (ns < this.count - pos) { 
      pos = pos + (int) ns; 
      skipped = ns; 
     } else { 
      skipped = this.count - pos; 
      pos = this.count; 
     } 
     return skipped; 
    } 
} 

J2SE 1.6:

/** 
* Skips the specified number of characters in the stream. Returns 
* the number of characters that were skipped. 
* 
* <p>The <code>ns</code> parameter may be negative, even though the 
* <code>skip</code> method of the {@link Reader} superclass throws 
* an exception in this case. Negative values of <code>ns</code> cause the 
* stream to skip backwards. Negative return values indicate a skip 
* backwards. It is not possible to skip backwards past the beginning of 
* the string. 
* 
* <p>If the entire string has been read or skipped, then this method has 
* no effect and always returns 0. 
* 
* @exception IOException If an I/O error occurs 
*/ 
public long skip(long ns) throws IOException { 
    synchronized (lock) { 
     ensureOpen(); 
     if (next >= length) 
      return 0; 
     // Bound skip by beginning and end of the source 
     long n = Math.min(length - next, ns); 
     n = Math.max(-next, n); 
     next += n; 
     return n; 
    } 
} 

इसलिए, पीछे की तरफ छोड़ने के बजाय (पार्सर कुछ मामलों में एक चरित्र को पूर्व-पढ़ने के लिए इसका उपयोग करता है) एंड्रॉइड संस्करण एक चरित्र आगे रहता है।

मेरा सवाल है, कहीं भी दस्तावेज किए गए जे 2 एसई स्पेक से विभिन्न असंगतताओं और भिन्नताएं हैं? यदि नहीं, तो आप किस दूसरी समस्या में भाग लेते हैं।

धन्यवाद, पी।

उत्तर

1

एंड्रॉइड इश्यू ट्रैकर देखने के लिए एक जगह है।

अपाचे हार्मनी इश्यू ट्रैकर देखने के लिए एक और जगह है।

मान लीजिए, समस्या ट्रैकर्स का उपयोग सावधानी से वर्गीकृत मुद्दों के वेब ब्राउज़ करने के बजाय खोजना शामिल होगा। आप एक अवसर के रूप में इस के बारे में सोच सकता है ...


FWIW - खोज सद्भाव समस्या ट्रैकर पता चलता है वहाँ विभिन्न धारा कक्षाओं में skip के व्यवहार के साथ कुछ मुद्दों किया गया है। एक मुद्दे ने शिकायत की कि कुछ वर्ग का व्यवहार जावाडोक से मेल नहीं खाता ... और यह बंद कर दिया गया था कि यह आरआई व्यवहार से मेल खाता है, और यह कि बग इसलिए जावडोक में था।

मेरा लेना यह है कि सूर्य/ओरेकल को उचित शर्तों के तहत अपाचे हार्मनी परियोजना में टीके लाइसेंस देने से इंकार करने के कारण इस तरह की चीज के लिए बहुत अधिक दोष है।