• R/O
  • HTTP
  • SSH
  • HTTPS

提交

标签
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

build


Commit MetaInfo

修订版af82f810a55ac830fa8608ceaa676269994999e7 (tree)
时间2011-03-24 19:15:44
作者Chih-Wei Huang <cwhuang@linu...>
CommiterChih-Wei Huang

Log Message

Merge remote-tracking branch 'korg/froyo' into HEAD

更改概述

差异

--- a/tools/signapk/SignApk.java
+++ b/tools/signapk/SignApk.java
@@ -220,10 +220,12 @@ class SignApk {
220220 /** Write to another stream and also feed it to the Signature object. */
221221 private static class SignatureOutputStream extends FilterOutputStream {
222222 private Signature mSignature;
223+ private int mCount;
223224
224225 public SignatureOutputStream(OutputStream out, Signature sig) {
225226 super(out);
226227 mSignature = sig;
228+ mCount = 0;
227229 }
228230
229231 @Override
@@ -234,6 +236,7 @@ class SignApk {
234236 throw new IOException("SignatureException: " + e);
235237 }
236238 super.write(b);
239+ mCount++;
237240 }
238241
239242 @Override
@@ -244,11 +247,16 @@ class SignApk {
244247 throw new IOException("SignatureException: " + e);
245248 }
246249 super.write(b, off, len);
250+ mCount += len;
251+ }
252+
253+ public int size() {
254+ return mCount;
247255 }
248256 }
249257
250258 /** Write a .SF file with a digest of the specified manifest. */
251- private static void writeSignatureFile(Manifest manifest, OutputStream out)
259+ private static void writeSignatureFile(Manifest manifest, SignatureOutputStream out)
252260 throws IOException, GeneralSecurityException {
253261 Manifest sf = new Manifest();
254262 Attributes main = sf.getMainAttributes();
@@ -282,6 +290,15 @@ class SignApk {
282290 }
283291
284292 sf.write(out);
293+
294+ // A bug in the java.util.jar implementation of Android platforms
295+ // up to version 1.6 will cause a spurious IOException to be thrown
296+ // if the length of the signature file is a multiple of 1024 bytes.
297+ // As a workaround, add an extra CRLF in this case.
298+ if ((out.size() % 1024) == 0) {
299+ out.write('\r');
300+ out.write('\n');
301+ }
285302 }
286303
287304 /** Write a .RSA file with a digital signature. */