Add license into package json

This commit is contained in:
Lee moon soo 2016-04-17 09:31:12 +01:00
parent 620f79f404
commit 0730ece851
2 changed files with 23 additions and 1 deletions

View file

@ -1,3 +1,19 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
{
type : "APPLICATION",
name : "zeppelin.clock",

View file

@ -17,12 +17,14 @@
package org.apache.zeppelin.helium;
import com.google.gson.Gson;
import com.google.gson.stream.JsonReader;
import org.apache.commons.io.FileUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.File;
import java.io.IOException;
import java.io.StringReader;
import java.net.URI;
import java.util.LinkedList;
import java.util.List;
@ -38,6 +40,7 @@ public class HeliumLocalRegistry extends HeliumRegistry {
public HeliumLocalRegistry(String name, String uri) {
super(name, uri);
gson = new Gson();
}
@ -66,7 +69,10 @@ public class HeliumLocalRegistry extends HeliumRegistry {
private HeliumPackage readPackageInfo(File f) {
try {
return gson.fromJson(FileUtils.readFileToString(f), HeliumPackage.class);
JsonReader reader = new JsonReader(new StringReader(FileUtils.readFileToString(f)));
reader.setLenient(true);
return gson.fromJson(reader, HeliumPackage.class);
} catch (IOException e) {
logger.error(e.getMessage(), e);
return null;