当前位置: 首页>>代码示例>>Java>>正文


Java JsonProcessingException.printStackTrace方法代码示例

本文整理汇总了Java中com.fasterxml.jackson.core.JsonProcessingException.printStackTrace方法的典型用法代码示例。如果您正苦于以下问题:Java JsonProcessingException.printStackTrace方法的具体用法?Java JsonProcessingException.printStackTrace怎么用?Java JsonProcessingException.printStackTrace使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.fasterxml.jackson.core.JsonProcessingException的用法示例。


在下文中一共展示了JsonProcessingException.printStackTrace方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: doInBackground

import com.fasterxml.jackson.core.JsonProcessingException; //导入方法依赖的package包/类
@Override
protected String doInBackground(Void... params) {
    ObjectMapper objectMapper = new ObjectMapper();
    String listaIntereses="";
    try {
        listaIntereses = objectMapper.writeValueAsString(intereses);
    } catch (JsonProcessingException e) {
        e.printStackTrace();
    }
    String resultado = null;
    //Construyo el JSON
    String interes = "{\"idUsuario\":\"" + idUsuario + "\",\"idsAreas\":"+listaIntereses+"}";

    resultado = ConsultasBBDD.hacerConsulta(ConsultasBBDD.insertaOEliminaInteres, interes, "POST");
    //resultado="";
    return resultado;
}
 
开发者ID:nen155,项目名称:TFG-SmartU-La-red-social,代码行数:18,代码来源:HUsuarioInteresa.java

示例2: manager

import com.fasterxml.jackson.core.JsonProcessingException; //导入方法依赖的package包/类
@RequestMapping(value = "/detail", method = RequestMethod.GET, produces = "text/html;charset=utf8")
@ResponseBody
public String manager(@RequestParam("wid") long wid) {
    WorkerInfo workerInfo = workerInfoService.queryDetailByWorkerId(wid);
    WorkerProfile workerProfile = workerProfileService.queryDetailByWorkerId(wid);
    WorkerDetail workerDetail;
    if (workerProfile == null) {
        workerProfileService.updateNewView(new WorkerProfile(wid, 1));
        workerProfile = workerProfileService.queryDetailByWorkerId(wid);
    }
    workerDetail = new WorkerDetail(workerInfo, workerProfile);
    ObjectMapper objectMapper = new ObjectMapper();
    try {
        return objectMapper.writeValueAsString(workerDetail);
    } catch (JsonProcessingException e) {
        e.printStackTrace();
        return "0";
    }

}
 
开发者ID:zxbangban,项目名称:zxbangban,代码行数:21,代码来源:WorkerServiceController.java

示例3: setPkg

import com.fasterxml.jackson.core.JsonProcessingException; //导入方法依赖的package包/类
public void setPkg(Package pkg) {
	this.pkg = pkg;
	this.packageMetadataId = pkg.getMetadata().getId();
	this.repositoryId = pkg.getMetadata().getRepositoryId();
	ObjectMapper mapper = new ObjectMapper();
	try {
		// TODO verify this behavior
		// Note that @JsonIgnore is on the package file byte array field.
		this.pkgJsonString = mapper.writeValueAsString(pkg);
	}
	catch (JsonProcessingException e) {
		e.printStackTrace();
	}
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-skipper,代码行数:15,代码来源:Release.java

示例4: objectToJson

import com.fasterxml.jackson.core.JsonProcessingException; //导入方法依赖的package包/类
/**
   * 将对象转换成json字符串。
   * <p>Title: pojoToJson</p>
   * <p>Description: </p>
   * @param data
   * @return
   */
  public static String objectToJson(Object data) {
  	try {
	String string = MAPPER.writeValueAsString(data);
	return string;
} catch (JsonProcessingException e) {
	e.printStackTrace();
}
  	return null;
  }
 
开发者ID:mmdsyl,项目名称:BLOG-Microservice,代码行数:17,代码来源:JsonUtils.java

示例5: startAllProcessors

import com.fasterxml.jackson.core.JsonProcessingException; //导入方法依赖的package包/类
private void startAllProcessors() throws MqttException {
    int datagramCount = 0;
    for (Map.Entry<Device, List<Processor>> entry : iProcessorMap.entrySet()) {
        String mqttTopic = entry.getKey().getDeviceUUID();
        ControlDatagram datagram = new ControlDatagram();
        datagram.setAckTopic(sessionId);
        datagram.setSessionId(sessionId);
        datagram.setResourceId(entry.getKey().getDeviceUUID());
        int sequence = 1;
        for (Processor processor : entry.getValue()) {
            ControlMethod method = new ControlMethod();
            method.setMethodName("start_processor");
            method.setSequenceId(sequence++);
            Map<String, String> params = new HashMap<>();
            params.put("proc_id", processor.getNifiId());
            method.setParams(params);
            datagram.addMethod(method);
        }
        String payloadJson = "";
        try {
            ObjectMapper objectMapper = new ObjectMapper();
            payloadJson = objectMapper.writeValueAsString(datagram);
        } catch (JsonProcessingException e) {
            e.printStackTrace();
        }
        System.out.println(payloadJson);
        // publish to Mqtt
        MqttMessage message = new MqttMessage(payloadJson.getBytes());
        message.setQos(2);
        mqttClient.publish(mqttTopic, message);
        datagramCount++;
    }
    Map<Integer, ResponseDatagram> responses =
            ControlResponseReceiver.receiveResponse(datagramCount, sessionId, mqttClient.getServerURI());
}
 
开发者ID:dream-lab,项目名称:echo,代码行数:36,代码来源:NifiDeployer.java

示例6: objectToJsonExclude

import com.fasterxml.jackson.core.JsonProcessingException; //导入方法依赖的package包/类
public static String objectToJsonExclude(Object data,String filterName, String  ...exName) {
  	try {
          SimpleBeanPropertyFilter theFilter = SimpleBeanPropertyFilter
                  .serializeAllExcept(exName);
          FilterProvider filters = new SimpleFilterProvider()
                  .addFilter(filterName, theFilter);

          return MAPPER.writer(filters).writeValueAsString(data);
} catch (JsonProcessingException e) {
	e.printStackTrace();
}
  	return null;
  }
 
开发者ID:mmdsyl,项目名称:BLOG-Microservice,代码行数:14,代码来源:JsonUtils.java

示例7: save

import com.fasterxml.jackson.core.JsonProcessingException; //导入方法依赖的package包/类
public void save(String key, Object object) {

        ObjectWriter objectWriter = new ObjectMapper().writer().withDefaultPrettyPrinter();
        try {
            String jsonString = objectWriter.writeValueAsString(object);
            preferences.edit().putString(key, jsonString).apply();
        } catch (JsonProcessingException e) {
            e.printStackTrace();
        }


    }
 
开发者ID:bojanb89pa,项目名称:OAuth2Android,代码行数:13,代码来源:DataCachingManager.java

示例8: toJson

import com.fasterxml.jackson.core.JsonProcessingException; //导入方法依赖的package包/类
/**
 * Helper method to convert a json object to a string.
 *
 * @param object object to convert to a string
 * @return the string
 */
public static String toJson(final Object object) {
    ObjectMapper mapper = new ObjectMapper();
    mapper.enable(SerializationFeature.INDENT_OUTPUT);
    String jsonRep = "";
    try {
        jsonRep = mapper.writeValueAsString(object);
    } catch (JsonProcessingException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    return jsonRep;
}
 
开发者ID:HewlettPackard,项目名称:loom,代码行数:19,代码来源:RestUtils.java

示例9: insert

import com.fasterxml.jackson.core.JsonProcessingException; //导入方法依赖的package包/类
public long insert(List<String> columns, List<Object> args, int[] types) {
    String insertColumns = primaryKeyName();
    String insertPlaceholders = "nextval('"+tableName()+"_id_seq')";
    for (String column : columns) {
        insertColumns += "," + column;
        insertPlaceholders += ",?";
    }

    insertColumns += ", " + createdAtName();
    insertPlaceholders += ", now()";
    insertColumns += ", " + updatedAtName();
    insertPlaceholders += ", now()";

    String sql = "insert into " + tableName() +
            " ("+insertColumns+") values ("+insertPlaceholders+")";

    KeyHolder keyHolder = new GeneratedKeyHolder();

    PreparedStatementCreatorFactory pscf = new PreparedStatementCreatorFactory(sql, types);
    pscf.setReturnGeneratedKeys(true);
    try {
        logger.info("insert.sql: {}, args: {}", sql, jsonMapper.writeValueAsString(args));
    } catch (JsonProcessingException e) {
        e.printStackTrace();
    }
    writeJdbcTemplate.update(pscf.newPreparedStatementCreator(args), keyHolder);
    if (keyHolder.getKeyList() != null && !keyHolder.getKeyList().isEmpty()) {
        return (long) keyHolder.getKeyList().get(0).get(primaryKeyName());
    }
    return -1;
}
 
开发者ID:myliang,项目名称:fish-admin,代码行数:32,代码来源:BaseRepository.java

示例10: sendRequest

import com.fasterxml.jackson.core.JsonProcessingException; //导入方法依赖的package包/类
/**
 * Send a JSON formatted request to the server
 */
protected void sendRequest(Map<String, String> reqMap) {
	ObjectMapper mapper = new ObjectMapper();
	try {
		String jsonRequest = mapper.writer().writeValueAsString(reqMap);
		out.println(jsonRequest);
		out.flush();
	} catch (JsonProcessingException e1) {
		e1.printStackTrace();
	}
}
 
开发者ID:ericaddison,项目名称:Dist_HW_2,代码行数:14,代码来源:Client.java

示例11: toJson

import com.fasterxml.jackson.core.JsonProcessingException; //导入方法依赖的package包/类
public String toJson() {
	ObjectMapper mapper = new ObjectMapper();
	try {
		return mapper.writeValueAsString(this);
	} catch (JsonProcessingException e) {
		e.printStackTrace();
	}
	return null;
}
 
开发者ID:proteus-h2020,项目名称:proteus-consumer-couchbase,代码行数:10,代码来源:SensorMeasurement.java

示例12: toJSON

import com.fasterxml.jackson.core.JsonProcessingException; //导入方法依赖的package包/类
public String toJSON() {
	try {
		return JsonUtils.getObjectMapper().writeValueAsString(this);
	} catch (JsonProcessingException e) {
		e.printStackTrace();
	}
	return "{}";
}
 
开发者ID:sgr-io,项目名称:telegram-bot-api,代码行数:9,代码来源:Location.java

示例13: getMessage

import com.fasterxml.jackson.core.JsonProcessingException; //导入方法依赖的package包/类
private String getMessage(@RequestBody Object object) {
    ObjectMapper mapper = new ObjectMapper();
    String result = null;
    try {
        result = mapper.writeValueAsString(object);
    } catch (JsonProcessingException e) {
        System.out.print("request boy convert to json error");
        e.printStackTrace();
    }
    return result;
}
 
开发者ID:daishicheng,项目名称:outcomes,代码行数:12,代码来源:BillingEventClient.java

示例14: objectToJson

import com.fasterxml.jackson.core.JsonProcessingException; //导入方法依赖的package包/类
protected static String objectToJson(Object obj) {
    try {
        return sMapper.writeValueAsString(obj);
    } catch (JsonProcessingException e) {
        e.printStackTrace();
    }
    return null;
}
 
开发者ID:suomenriistakeskus,项目名称:oma-riista-android,代码行数:9,代码来源:BaseDatabase.java

示例15: isValidConfig

import com.fasterxml.jackson.core.JsonProcessingException; //导入方法依赖的package包/类
public static void isValidConfig(CSVConfig config){
    List<String> typeArray = new ArrayList<String>();
    config.VertexTypes.forEach(vertextype -> typeArray.add(vertextype.name));
    for (EdgeTypeBean edgeType: config.EdgeTypes){
        for (RelationBean relation: edgeType.relations) {
        //validate left and right are in the vertex types
            if(!typeArray.contains(relation.left)){
                throw new RuntimeException("relationships: "
                        + relation.left + " is not of vertex types: " + typeArray.toString());}
            if(!typeArray.contains(relation.right))
                throw new RuntimeException("relationships: "
                        + relation.right + " is not of vertex types: " + typeArray.toString());        
            //validate supernode vertice number is less than the total
            Iterator<VertexTypeBean> vTypes = config.VertexTypes.iterator();
            while (vTypes.hasNext()){
                VertexTypeBean type = vTypes.next();
                if (relation.left.equals(type.name) &&
                    relation.supernode != null &&
                    relation.supernode.get("vertices") > type.row){
                    ObjectMapper mapper = new ObjectMapper();
                    try {
                        mapper.writeValueAsString(relation);
                        throw new RuntimeException(
                            mapper.writeValueAsString(relation) +
                            "supernode.vertices is greater than " +
                            type.name + "'s row"
                        );
                    } catch (JsonProcessingException e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                    }
                }
            }
        }
    }
}
 
开发者ID:tedhtchang,项目名称:JanusGraphBench,代码行数:37,代码来源:CSVGenerator.java


注:本文中的com.fasterxml.jackson.core.JsonProcessingException.printStackTrace方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。