Skip to content

Support blank/zero-byte files in configset zip uploads#37

Draft
Copilot wants to merge 5 commits intomainfrom
copilot/fix-blank-file-zip-handling
Draft

Support blank/zero-byte files in configset zip uploads#37
Copilot wants to merge 5 commits intomainfrom
copilot/fix-blank-file-zip-handling

Conversation

Copy link
Copy Markdown

Copilot AI commented Mar 29, 2026

ZipInputStream throws ZipException: only DEFLATED entries can have EXT descriptor when reading a STORED-method entry with the data descriptor (EXT) flag set — the format some tools emit for 0-byte files (e.g. touch conf/blank.txt && zip -r conf.zip conf/). Previously this surfaced as a 500, then was patched to a 400; but an empty file is valid and should simply upload successfully.

Changes

  • UploadConfigSet.java — Replace ZipInputStream with ZipFile. ZipFile reads the central directory first (where size/CRC are always present) and seeks to entry data, so it is immune to the STORED+EXT limitation. The request body is buffered to a temp file (required by ZipFile) and deleted in a finally block. A ZipException catch is retained for genuinely malformed archives, returning 400.

  • TestConfigSetsAPI.testUploadWithBlankFile — Updated to assert the upload succeeds (status 0) and that blank.txt is stored in ZooKeeper with 0 bytes, rather than expecting a 400.

  • Changelog — Updated entry title to reflect that blank files are now supported rather than producing a clearer error.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • develocity.apache.org
    • Triggering command: /usr/lib/jvm/temurin-21-jdk-amd64/bin/java /usr/lib/jvm/temurin-21-jdk-amd64/bin/java -XX:ReservedCodeCacheSize=256m -XX:TieredStopAtLevel=1 -XX:+UseParallelGC -XX:ActiveProcessorCount=1 --add-exports jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.invoke=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED (dns block)
  • metadata.google.internal
    • Triggering command: /usr/lib/jvm/temurin-21-jdk-amd64/bin/java /usr/lib/jvm/temurin-21-jdk-amd64/bin/java -Dcommon-solr.dir=/home/REDACTED/work/solr/solr/solr -Dgradle.lib.dir=/home/REDACTED/.gradle/wrapper/dists/gradle-8.10-bin/deqhafrv1ntovfmgh0nh3npr9/gradle-8.10/lib -Dgradle.user.home=/home/REDACTED/.gradle -Dgradle.worker.jar=/home/REDACTED/.gradle/caches/8.10/workerMain/gradle-worker.jar -Djava.awt.headless=true -Djava.security.egd=file:/dev/./urandom -Djava.security.manager=default -Djava.security.policy=/home/REDACTED/work/solr/solr/gradle/testing/randomization/policies/solr-tests.policy -Djava.util.logging.config.file=/home/REDACTED/work/solr/solr/gradle/testing/defaults-tests/logging.properties -Djdk.map.althashing.threshold=0 -Djetty.insecurerandom=1 -Djetty.testMode=1 -Djunit4.childvm.count=1 -Djunit4.childvm.id=0 -Dorg.gradle.internal.worker.tmpdir=/home/REDACTED/work/solr/solr/solr/core/build/tmp/test/work -DtempDir=/home/REDACTED/work/solr/solr/build/tmp/tests-tmp -Dtests.LUCENE_VERSION=10.4.0 -Dtests.asserts=true -Dtests.codec=random (dns block)

If you need me to access, download, or install something from one of these locations, you can either:


⚡ Quickly spin up Copilot coding agent tasks from anywhere on your macOS or Windows machine with Raycast.

Copilot AI changed the title [WIP] Fix handling of blank files in zip uploads Handle ZipException from blank files in configset zip upload Mar 29, 2026
Copilot AI requested a review from epugh March 29, 2026 19:21
@epugh
Copy link
Copy Markdown
Owner

epugh commented Mar 29, 2026

This is what the output looks like now:

  sample_techproducts_configs git:(copilot/fix-blank-file-zip-handling) zip -r - * | curl -X POST --header "Content-Type:application/octet-stream" --data-binary @- "http://localhost:8983/solr/admin/configs?action=UPLOAD&name=c5"
  adding: conf/ (stored 0%)
  adding: conf/blank.txt (stored 0%)
  adding: conf/update-script.js (deflated 51%)
  adding: conf/elevate.xml (deflated 47%)
  adding: conf/_schema_analysis_synonyms_english.json (deflated 24%)
  adding: conf/mapping-FoldToASCII.txt (deflated 80%)
  adding: conf/params.json (deflated 33%)
  adding: conf/lang/ (stored 0%)
  adding: conf/lang/stopwords_gl.txt (deflated 54%)
  adding: conf/lang/stopwords_es.txt (deflated 67%)
  adding: conf/lang/stopwords_fi.txt (deflated 61%)
  adding: conf/lang/stopwords_da.txt (deflated 59%)
  adding: conf/lang/stopwords_hu.txt (deflated 46%)
  adding: conf/lang/stopwords_id.txt (deflated 62%)
  adding: conf/lang/hyphenations_ga.txt (deflated 14%)
  adding: conf/lang/contractions_it.txt (deflated 33%)
  adding: conf/lang/stopwords_ro.txt (deflated 52%)
  adding: conf/lang/stopwords_eu.txt (deflated 55%)
  adding: conf/lang/stopwords_pt.txt (deflated 65%)
  adding: conf/lang/stopwords_et.txt (deflated 64%)
  adding: conf/lang/stopwords_de.txt (deflated 66%)
  adding: conf/lang/stoptags_ja.txt (deflated 62%)
  adding: conf/lang/stopwords_it.txt (deflated 68%)
  adding: conf/lang/contractions_ca.txt (deflated 19%)
  adding: conf/lang/stopwords_ca.txt (deflated 52%)
  adding: conf/lang/stopwords_th.txt (deflated 59%)
  adding: conf/lang/stopwords_bg.txt (deflated 58%)
  adding: conf/lang/stopwords_lv.txt (deflated 50%)
  adding: conf/lang/userdict_ja.txt (deflated 47%)
  adding: conf/lang/stopwords_ckb.txt (deflated 50%)
  adding: conf/lang/stopwords_cz.txt (deflated 44%)
  adding: conf/lang/stopwords_ar.txt (deflated 48%)
  adding: conf/lang/stopwords_tr.txt (deflated 49%)
  adding: conf/lang/stemdict_nl.txt (deflated 25%)
  adding: conf/lang/stopwords_no.txt (deflated 67%)
  adding: conf/lang/stopwords_nl.txt (deflated 61%)
  adding: conf/lang/stopwords_fa.txt (deflated 56%)
  adding: conf/lang/stopwords_sv.txt (deflated 63%)
  adding: conf/lang/stopwords_el.txt (deflated 53%)
  adding: conf/lang/stopwords_ja.txt (deflated 49%)
  adding: conf/lang/stopwords_hi.txt (deflated 64%)
  adding: conf/lang/stopwords_en.txt (deflated 44%)
  adding: conf/lang/contractions_ga.txt (deflated 15%)
  adding: conf/lang/contractions_fr.txt (deflated 23%)
  adding: conf/lang/stopwords_ru.txt (deflated 65%)
  adding: conf/lang/stopwords_ga.txt (deflated 48%)
  adding: conf/lang/stopwords_fr.txt (deflated 65%)
  adding: conf/lang/stopwords_hy.txt (deflated 44%)
  adding: conf/protwords.txt (deflated 45%)
  adding: conf/_schema_analysis_stopwords_english.json (deflated 64%)
  adding: conf/currency.xml (deflated 62%)
  adding: conf/synonyms.txt (deflated 45%)
  adding: conf/mapping-ISOLatin1Accent.txt (deflated 64%)
  adding: conf/xslt/ (stored 0%)
  adding: conf/xslt/example.xsl (deflated 63%)
  adding: conf/xslt/example_atom.xsl (deflated 55%)
  adding: conf/xslt/luke.xsl (deflated 81%)
  adding: conf/xslt/updateXml.xsl (deflated 59%)
  adding: conf/xslt/example_rss.xsl (deflated 56%)
  adding: conf/managed-schema.xml (deflated 77%)
  adding: conf/spellings.txt (deflated -14%)
  adding: conf/_rest_managed.json (deflated -5%)
  adding: conf/solrconfig.xml (deflated 72%)
  adding: conf/stopwords.txt (deflated 42%)
{
  "responseHeader":{
    "status":400,
    "QTime":11
  },
  "error":{
    "metadata":{
      "error-class":"org.apache.solr.common.SolrException",
      "root-error-class":"java.util.zip.ZipException"
    },
    "errorClass":"org.apache.solr.common.SolrException",
    "msg":"Failed to read the uploaded zip file. The file may be malformed or use an unsupported format. Please recreate the zip file using standard compression tools: only DEFLATED entries can have EXT descriptor",
    "code":400
  }
}% 

…nfigSet.java

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copilot AI changed the title Handle ZipException from blank files in configset zip upload Support blank/zero-byte files in configset zip uploads Mar 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants