More work on package processing robustness

This commit is contained in:
Grahame Grieve 2019-11-13 09:41:54 +11:00
parent 3de429ae6a
commit 62815fe2b5
3 changed files with 2 additions and 2 deletions

View File

@ -192,6 +192,7 @@ public class NpmPackage {
try { try {
res.readIndexFile((JsonObject) JsonTrackingParser.parseJson(new String(res.content.get("package/.index.json")))); res.readIndexFile((JsonObject) JsonTrackingParser.parseJson(new String(res.content.get("package/.index.json"))));
} catch (Exception e) { } catch (Exception e) {
TextFile.bytesToFile(res.content.get("package/.index.json"), "c:\\temp\\.index.json");
throw new IOException("Error parsing package/.index.json: "+e.getMessage(), e); throw new IOException("Error parsing package/.index.json: "+e.getMessage(), e);
} }
return res; return res;

View File

@ -565,7 +565,6 @@ public class PackageCacheManager {
if (progress) if (progress)
System.out.println(" done."); System.out.println(" done.");
//todo: load dependencies
NpmPackage pck = loadPackageInfo(packRoot); NpmPackage pck = loadPackageInfo(packRoot);
if (!id.equals(JSONUtil.str(npm.getNpm(), "name")) || !version.equals(JSONUtil.str(npm.getNpm(), "version"))) { if (!id.equals(JSONUtil.str(npm.getNpm(), "name")) || !version.equals(JSONUtil.str(npm.getNpm(), "version"))) {
if (!id.equals(JSONUtil.str(npm.getNpm(), "name"))) { if (!id.equals(JSONUtil.str(npm.getNpm(), "name"))) {

View File

@ -370,7 +370,7 @@ public class JsonTrackingParser {
JsonTrackingParser self = new JsonTrackingParser(); JsonTrackingParser self = new JsonTrackingParser();
self.map = map; self.map = map;
self.setErrorOnDuplicates(!allowDuplicates); self.setErrorOnDuplicates(!allowDuplicates);
return self.parse(source); return self.parse(Utilities.stripBOM(source));
} }
private JsonObject parse(String source) throws IOException { private JsonObject parse(String source) throws IOException {