Commit Graph

10 Commits

Author SHA1 Message Date
juanvallejo
07ca219828 Prevent json decoder panic on invalid input
This patch handles cases where `ioutil.ReadAll` will return a single
character output on an invalid json input, causing the `Decode` method
to panic when it tries to calculate the line number for the syntax
error. The example below would cause a panic due to the trailing comma
at the end:

```
{
  "kind": "Pod",
  "apiVersion": "v1",
  "metadata": {
    "name": "",
    "labels": {
      "name": ""
    },
    "generateName": "",
    "namespace": "",
    "annotations": []
  },
  "spec": {}
},
```
2016-12-09 16:32:46 -05:00
AdoHe
919bb01b04 fix yaml decode issue 2016-10-07 11:22:44 +08:00
Andy Goldstein
8b171081d1 Add newline to printf to fix junit 2016-08-17 10:40:27 -04:00
AdoHe
2d06408300 use Reader.ReadLine instead of bufio.Scanner to support bigger yaml 2016-08-14 16:02:43 +08:00
David McMahon
ef0c9f0c5b Remove "All rights reserved" from all the headers. 2016-06-29 17:47:36 -07:00
Michal Fojtik
543a8b2d06 Display line number on JSON errors 2016-05-06 13:10:47 +02:00
Clayton Coleman
33085c0cf2 Update tests to handle codec changes 2016-01-22 13:27:26 -05:00
Eric Paris
6b3a6e6b98 Make copyright ownership statement generic
Instead of saying "Google Inc." (which is not always correct) say "The
Kubernetes Authors", which is generic.
2015-05-01 17:49:56 -04:00
Clayton Coleman
31413c8727 Add more tests around JSON/YAML decoding from the CLI
Switch the ignore stream errors behavior to print a Warningf on
failure to parse, not v(2)
2015-01-14 12:38:36 -05:00
Clayton Coleman
22cf8b94e6 Add a package for doing YAML-to-JSON streaming, one document at a time
Will be moved upstream soon
2015-01-14 00:50:07 -05:00