id
int64
22
34.9k
comment_id
int64
0
328
comment
stringlengths
2
2.55k
code
stringlengths
31
107k
classification
stringclasses
6 values
isFinished
bool
1 class
code_context_2
stringlengths
21
27.3k
code_context_10
stringlengths
29
27.3k
code_context_20
stringlengths
29
27.3k
24,804
2
// 判断签字是否存在 // 打印签字信息
@SuppressWarnings("restriction") private void updateDJTSign(ChildVaccinaterecord childVaccinaterecord, Map<String, Object> maplist, Map<String, Object> code) { logger.info("获取排号签字数据开始" + childVaccinaterecord.getNid().substring(0, 2) + "||" + childVaccinaterecord.getVaccineid()); Object signObjVaccid = CacheUtils.get(CacheUtils.SIGN_CACHE, childVaccinaterecord.getChildid() + "_" + childVaccinaterecord.getNid().substring(0, 2)); logger.info("signObjVaccid-->" + (signObjVaccid == null)); CacheUtils.remove(CacheUtils.SIGN_CACHE, childVaccinaterecord.getChildid() + "_" + childVaccinaterecord.getNid().substring(0, 2)); Object signObj = CacheUtils.get(CacheUtils.SIGN_CACHE, childVaccinaterecord.getChildid() + "_" + childVaccinaterecord.getVaccineid()); logger.info("signObj-->" + (signObj == null)); CacheUtils.remove(CacheUtils.SIGN_CACHE, childVaccinaterecord.getChildid() + "_" + childVaccinaterecord.getVaccineid()); if (signObj == null) { signObj = signObjVaccid; } logger.info("signObjFinal-->" + (signObj == null)); if (signObj != null) { String signStr = (String) signObj; // 初始化记录数据 childVaccinaterecord = childVaccinaterecordService.get(childVaccinaterecord); if (childVaccinaterecord != null) { // 判断签字是否存在 // 打印签字信息 code.put("sign", signStr); // base64 转换签字 BASE64Decoder decoder = new BASE64Decoder(); try { byte[] sign = decoder.decodeBuffer(signStr); if (null != sign && sign.length > 0) { childVaccinaterecord.setSignatureData(sign); childVaccinaterecord.setStype(ChildVaccinaterecord.SIGNATURE_SOURCE_DJT); // 查询该记录签字是否存在 int count = childVaccinaterecordService.querySignature(childVaccinaterecord); if (count == 0) { // 新增签字 childVaccinaterecordService.insertSignatures(childVaccinaterecord); } // 修改签字状态 childVaccinaterecord.setSignature(ChildVaccinaterecord.SIGNATURE_YES); childVaccinaterecordService.updateSignatures(childVaccinaterecord); } } catch (Exception e) { logger.error("微信签字base64转bytes失败", e.getMessage()); } // 签字状态 } maplist.put("success", true); logger.error("打印排号获取签字成功" + childVaccinaterecord.getNid().substring(0, 2) + "||" + childVaccinaterecord.getVaccineid()); } else { logger.error("打印排号获取签字失败" + childVaccinaterecord.getNid().substring(0, 2) + "||" + childVaccinaterecord.getVaccineid()); } }
NONSATD
true
childVaccinaterecord = childVaccinaterecordService.get(childVaccinaterecord); if (childVaccinaterecord != null) { // 判断签字是否存在 // 打印签字信息 code.put("sign", signStr); // base64 转换签字
childVaccinaterecord.getChildid() + "_" + childVaccinaterecord.getVaccineid()); if (signObj == null) { signObj = signObjVaccid; } logger.info("signObjFinal-->" + (signObj == null)); if (signObj != null) { String signStr = (String) signObj; // 初始化记录数据 childVaccinaterecord = childVaccinaterecordService.get(childVaccinaterecord); if (childVaccinaterecord != null) { // 判断签字是否存在 // 打印签字信息 code.put("sign", signStr); // base64 转换签字 BASE64Decoder decoder = new BASE64Decoder(); try { byte[] sign = decoder.decodeBuffer(signStr); if (null != sign && sign.length > 0) { childVaccinaterecord.setSignatureData(sign); childVaccinaterecord.setStype(ChildVaccinaterecord.SIGNATURE_SOURCE_DJT); // 查询该记录签字是否存在 int count = childVaccinaterecordService.querySignature(childVaccinaterecord);
+ childVaccinaterecord.getVaccineid()); Object signObjVaccid = CacheUtils.get(CacheUtils.SIGN_CACHE, childVaccinaterecord.getChildid() + "_" + childVaccinaterecord.getNid().substring(0, 2)); logger.info("signObjVaccid-->" + (signObjVaccid == null)); CacheUtils.remove(CacheUtils.SIGN_CACHE, childVaccinaterecord.getChildid() + "_" + childVaccinaterecord.getNid().substring(0, 2)); Object signObj = CacheUtils.get(CacheUtils.SIGN_CACHE, childVaccinaterecord.getChildid() + "_" + childVaccinaterecord.getVaccineid()); logger.info("signObj-->" + (signObj == null)); CacheUtils.remove(CacheUtils.SIGN_CACHE, childVaccinaterecord.getChildid() + "_" + childVaccinaterecord.getVaccineid()); if (signObj == null) { signObj = signObjVaccid; } logger.info("signObjFinal-->" + (signObj == null)); if (signObj != null) { String signStr = (String) signObj; // 初始化记录数据 childVaccinaterecord = childVaccinaterecordService.get(childVaccinaterecord); if (childVaccinaterecord != null) { // 判断签字是否存在 // 打印签字信息 code.put("sign", signStr); // base64 转换签字 BASE64Decoder decoder = new BASE64Decoder(); try { byte[] sign = decoder.decodeBuffer(signStr); if (null != sign && sign.length > 0) { childVaccinaterecord.setSignatureData(sign); childVaccinaterecord.setStype(ChildVaccinaterecord.SIGNATURE_SOURCE_DJT); // 查询该记录签字是否存在 int count = childVaccinaterecordService.querySignature(childVaccinaterecord); if (count == 0) { // 新增签字 childVaccinaterecordService.insertSignatures(childVaccinaterecord); } // 修改签字状态 childVaccinaterecord.setSignature(ChildVaccinaterecord.SIGNATURE_YES); childVaccinaterecordService.updateSignatures(childVaccinaterecord); } } catch (Exception e) { logger.error("微信签字base64转bytes失败", e.getMessage());
24,804
3
// base64 转换签字
@SuppressWarnings("restriction") private void updateDJTSign(ChildVaccinaterecord childVaccinaterecord, Map<String, Object> maplist, Map<String, Object> code) { logger.info("获取排号签字数据开始" + childVaccinaterecord.getNid().substring(0, 2) + "||" + childVaccinaterecord.getVaccineid()); Object signObjVaccid = CacheUtils.get(CacheUtils.SIGN_CACHE, childVaccinaterecord.getChildid() + "_" + childVaccinaterecord.getNid().substring(0, 2)); logger.info("signObjVaccid-->" + (signObjVaccid == null)); CacheUtils.remove(CacheUtils.SIGN_CACHE, childVaccinaterecord.getChildid() + "_" + childVaccinaterecord.getNid().substring(0, 2)); Object signObj = CacheUtils.get(CacheUtils.SIGN_CACHE, childVaccinaterecord.getChildid() + "_" + childVaccinaterecord.getVaccineid()); logger.info("signObj-->" + (signObj == null)); CacheUtils.remove(CacheUtils.SIGN_CACHE, childVaccinaterecord.getChildid() + "_" + childVaccinaterecord.getVaccineid()); if (signObj == null) { signObj = signObjVaccid; } logger.info("signObjFinal-->" + (signObj == null)); if (signObj != null) { String signStr = (String) signObj; // 初始化记录数据 childVaccinaterecord = childVaccinaterecordService.get(childVaccinaterecord); if (childVaccinaterecord != null) { // 判断签字是否存在 // 打印签字信息 code.put("sign", signStr); // base64 转换签字 BASE64Decoder decoder = new BASE64Decoder(); try { byte[] sign = decoder.decodeBuffer(signStr); if (null != sign && sign.length > 0) { childVaccinaterecord.setSignatureData(sign); childVaccinaterecord.setStype(ChildVaccinaterecord.SIGNATURE_SOURCE_DJT); // 查询该记录签字是否存在 int count = childVaccinaterecordService.querySignature(childVaccinaterecord); if (count == 0) { // 新增签字 childVaccinaterecordService.insertSignatures(childVaccinaterecord); } // 修改签字状态 childVaccinaterecord.setSignature(ChildVaccinaterecord.SIGNATURE_YES); childVaccinaterecordService.updateSignatures(childVaccinaterecord); } } catch (Exception e) { logger.error("微信签字base64转bytes失败", e.getMessage()); } // 签字状态 } maplist.put("success", true); logger.error("打印排号获取签字成功" + childVaccinaterecord.getNid().substring(0, 2) + "||" + childVaccinaterecord.getVaccineid()); } else { logger.error("打印排号获取签字失败" + childVaccinaterecord.getNid().substring(0, 2) + "||" + childVaccinaterecord.getVaccineid()); } }
NONSATD
true
// 打印签字信息 code.put("sign", signStr); // base64 转换签字 BASE64Decoder decoder = new BASE64Decoder(); try {
} logger.info("signObjFinal-->" + (signObj == null)); if (signObj != null) { String signStr = (String) signObj; // 初始化记录数据 childVaccinaterecord = childVaccinaterecordService.get(childVaccinaterecord); if (childVaccinaterecord != null) { // 判断签字是否存在 // 打印签字信息 code.put("sign", signStr); // base64 转换签字 BASE64Decoder decoder = new BASE64Decoder(); try { byte[] sign = decoder.decodeBuffer(signStr); if (null != sign && sign.length > 0) { childVaccinaterecord.setSignatureData(sign); childVaccinaterecord.setStype(ChildVaccinaterecord.SIGNATURE_SOURCE_DJT); // 查询该记录签字是否存在 int count = childVaccinaterecordService.querySignature(childVaccinaterecord); if (count == 0) { // 新增签字
logger.info("signObjVaccid-->" + (signObjVaccid == null)); CacheUtils.remove(CacheUtils.SIGN_CACHE, childVaccinaterecord.getChildid() + "_" + childVaccinaterecord.getNid().substring(0, 2)); Object signObj = CacheUtils.get(CacheUtils.SIGN_CACHE, childVaccinaterecord.getChildid() + "_" + childVaccinaterecord.getVaccineid()); logger.info("signObj-->" + (signObj == null)); CacheUtils.remove(CacheUtils.SIGN_CACHE, childVaccinaterecord.getChildid() + "_" + childVaccinaterecord.getVaccineid()); if (signObj == null) { signObj = signObjVaccid; } logger.info("signObjFinal-->" + (signObj == null)); if (signObj != null) { String signStr = (String) signObj; // 初始化记录数据 childVaccinaterecord = childVaccinaterecordService.get(childVaccinaterecord); if (childVaccinaterecord != null) { // 判断签字是否存在 // 打印签字信息 code.put("sign", signStr); // base64 转换签字 BASE64Decoder decoder = new BASE64Decoder(); try { byte[] sign = decoder.decodeBuffer(signStr); if (null != sign && sign.length > 0) { childVaccinaterecord.setSignatureData(sign); childVaccinaterecord.setStype(ChildVaccinaterecord.SIGNATURE_SOURCE_DJT); // 查询该记录签字是否存在 int count = childVaccinaterecordService.querySignature(childVaccinaterecord); if (count == 0) { // 新增签字 childVaccinaterecordService.insertSignatures(childVaccinaterecord); } // 修改签字状态 childVaccinaterecord.setSignature(ChildVaccinaterecord.SIGNATURE_YES); childVaccinaterecordService.updateSignatures(childVaccinaterecord); } } catch (Exception e) { logger.error("微信签字base64转bytes失败", e.getMessage()); } // 签字状态
24,804
4
// 查询该记录签字是否存在
@SuppressWarnings("restriction") private void updateDJTSign(ChildVaccinaterecord childVaccinaterecord, Map<String, Object> maplist, Map<String, Object> code) { logger.info("获取排号签字数据开始" + childVaccinaterecord.getNid().substring(0, 2) + "||" + childVaccinaterecord.getVaccineid()); Object signObjVaccid = CacheUtils.get(CacheUtils.SIGN_CACHE, childVaccinaterecord.getChildid() + "_" + childVaccinaterecord.getNid().substring(0, 2)); logger.info("signObjVaccid-->" + (signObjVaccid == null)); CacheUtils.remove(CacheUtils.SIGN_CACHE, childVaccinaterecord.getChildid() + "_" + childVaccinaterecord.getNid().substring(0, 2)); Object signObj = CacheUtils.get(CacheUtils.SIGN_CACHE, childVaccinaterecord.getChildid() + "_" + childVaccinaterecord.getVaccineid()); logger.info("signObj-->" + (signObj == null)); CacheUtils.remove(CacheUtils.SIGN_CACHE, childVaccinaterecord.getChildid() + "_" + childVaccinaterecord.getVaccineid()); if (signObj == null) { signObj = signObjVaccid; } logger.info("signObjFinal-->" + (signObj == null)); if (signObj != null) { String signStr = (String) signObj; // 初始化记录数据 childVaccinaterecord = childVaccinaterecordService.get(childVaccinaterecord); if (childVaccinaterecord != null) { // 判断签字是否存在 // 打印签字信息 code.put("sign", signStr); // base64 转换签字 BASE64Decoder decoder = new BASE64Decoder(); try { byte[] sign = decoder.decodeBuffer(signStr); if (null != sign && sign.length > 0) { childVaccinaterecord.setSignatureData(sign); childVaccinaterecord.setStype(ChildVaccinaterecord.SIGNATURE_SOURCE_DJT); // 查询该记录签字是否存在 int count = childVaccinaterecordService.querySignature(childVaccinaterecord); if (count == 0) { // 新增签字 childVaccinaterecordService.insertSignatures(childVaccinaterecord); } // 修改签字状态 childVaccinaterecord.setSignature(ChildVaccinaterecord.SIGNATURE_YES); childVaccinaterecordService.updateSignatures(childVaccinaterecord); } } catch (Exception e) { logger.error("微信签字base64转bytes失败", e.getMessage()); } // 签字状态 } maplist.put("success", true); logger.error("打印排号获取签字成功" + childVaccinaterecord.getNid().substring(0, 2) + "||" + childVaccinaterecord.getVaccineid()); } else { logger.error("打印排号获取签字失败" + childVaccinaterecord.getNid().substring(0, 2) + "||" + childVaccinaterecord.getVaccineid()); } }
NONSATD
true
childVaccinaterecord.setSignatureData(sign); childVaccinaterecord.setStype(ChildVaccinaterecord.SIGNATURE_SOURCE_DJT); // 查询该记录签字是否存在 int count = childVaccinaterecordService.querySignature(childVaccinaterecord); if (count == 0) {
// 判断签字是否存在 // 打印签字信息 code.put("sign", signStr); // base64 转换签字 BASE64Decoder decoder = new BASE64Decoder(); try { byte[] sign = decoder.decodeBuffer(signStr); if (null != sign && sign.length > 0) { childVaccinaterecord.setSignatureData(sign); childVaccinaterecord.setStype(ChildVaccinaterecord.SIGNATURE_SOURCE_DJT); // 查询该记录签字是否存在 int count = childVaccinaterecordService.querySignature(childVaccinaterecord); if (count == 0) { // 新增签字 childVaccinaterecordService.insertSignatures(childVaccinaterecord); } // 修改签字状态 childVaccinaterecord.setSignature(ChildVaccinaterecord.SIGNATURE_YES); childVaccinaterecordService.updateSignatures(childVaccinaterecord); } } catch (Exception e) {
childVaccinaterecord.getChildid() + "_" + childVaccinaterecord.getVaccineid()); if (signObj == null) { signObj = signObjVaccid; } logger.info("signObjFinal-->" + (signObj == null)); if (signObj != null) { String signStr = (String) signObj; // 初始化记录数据 childVaccinaterecord = childVaccinaterecordService.get(childVaccinaterecord); if (childVaccinaterecord != null) { // 判断签字是否存在 // 打印签字信息 code.put("sign", signStr); // base64 转换签字 BASE64Decoder decoder = new BASE64Decoder(); try { byte[] sign = decoder.decodeBuffer(signStr); if (null != sign && sign.length > 0) { childVaccinaterecord.setSignatureData(sign); childVaccinaterecord.setStype(ChildVaccinaterecord.SIGNATURE_SOURCE_DJT); // 查询该记录签字是否存在 int count = childVaccinaterecordService.querySignature(childVaccinaterecord); if (count == 0) { // 新增签字 childVaccinaterecordService.insertSignatures(childVaccinaterecord); } // 修改签字状态 childVaccinaterecord.setSignature(ChildVaccinaterecord.SIGNATURE_YES); childVaccinaterecordService.updateSignatures(childVaccinaterecord); } } catch (Exception e) { logger.error("微信签字base64转bytes失败", e.getMessage()); } // 签字状态 } maplist.put("success", true); logger.error("打印排号获取签字成功" + childVaccinaterecord.getNid().substring(0, 2) + "||" + childVaccinaterecord.getVaccineid()); } else { logger.error("打印排号获取签字失败" + childVaccinaterecord.getNid().substring(0, 2) + "||" + childVaccinaterecord.getVaccineid());
24,804
5
// 新增签字
@SuppressWarnings("restriction") private void updateDJTSign(ChildVaccinaterecord childVaccinaterecord, Map<String, Object> maplist, Map<String, Object> code) { logger.info("获取排号签字数据开始" + childVaccinaterecord.getNid().substring(0, 2) + "||" + childVaccinaterecord.getVaccineid()); Object signObjVaccid = CacheUtils.get(CacheUtils.SIGN_CACHE, childVaccinaterecord.getChildid() + "_" + childVaccinaterecord.getNid().substring(0, 2)); logger.info("signObjVaccid-->" + (signObjVaccid == null)); CacheUtils.remove(CacheUtils.SIGN_CACHE, childVaccinaterecord.getChildid() + "_" + childVaccinaterecord.getNid().substring(0, 2)); Object signObj = CacheUtils.get(CacheUtils.SIGN_CACHE, childVaccinaterecord.getChildid() + "_" + childVaccinaterecord.getVaccineid()); logger.info("signObj-->" + (signObj == null)); CacheUtils.remove(CacheUtils.SIGN_CACHE, childVaccinaterecord.getChildid() + "_" + childVaccinaterecord.getVaccineid()); if (signObj == null) { signObj = signObjVaccid; } logger.info("signObjFinal-->" + (signObj == null)); if (signObj != null) { String signStr = (String) signObj; // 初始化记录数据 childVaccinaterecord = childVaccinaterecordService.get(childVaccinaterecord); if (childVaccinaterecord != null) { // 判断签字是否存在 // 打印签字信息 code.put("sign", signStr); // base64 转换签字 BASE64Decoder decoder = new BASE64Decoder(); try { byte[] sign = decoder.decodeBuffer(signStr); if (null != sign && sign.length > 0) { childVaccinaterecord.setSignatureData(sign); childVaccinaterecord.setStype(ChildVaccinaterecord.SIGNATURE_SOURCE_DJT); // 查询该记录签字是否存在 int count = childVaccinaterecordService.querySignature(childVaccinaterecord); if (count == 0) { // 新增签字 childVaccinaterecordService.insertSignatures(childVaccinaterecord); } // 修改签字状态 childVaccinaterecord.setSignature(ChildVaccinaterecord.SIGNATURE_YES); childVaccinaterecordService.updateSignatures(childVaccinaterecord); } } catch (Exception e) { logger.error("微信签字base64转bytes失败", e.getMessage()); } // 签字状态 } maplist.put("success", true); logger.error("打印排号获取签字成功" + childVaccinaterecord.getNid().substring(0, 2) + "||" + childVaccinaterecord.getVaccineid()); } else { logger.error("打印排号获取签字失败" + childVaccinaterecord.getNid().substring(0, 2) + "||" + childVaccinaterecord.getVaccineid()); } }
NONSATD
true
int count = childVaccinaterecordService.querySignature(childVaccinaterecord); if (count == 0) { // 新增签字 childVaccinaterecordService.insertSignatures(childVaccinaterecord); }
// base64 转换签字 BASE64Decoder decoder = new BASE64Decoder(); try { byte[] sign = decoder.decodeBuffer(signStr); if (null != sign && sign.length > 0) { childVaccinaterecord.setSignatureData(sign); childVaccinaterecord.setStype(ChildVaccinaterecord.SIGNATURE_SOURCE_DJT); // 查询该记录签字是否存在 int count = childVaccinaterecordService.querySignature(childVaccinaterecord); if (count == 0) { // 新增签字 childVaccinaterecordService.insertSignatures(childVaccinaterecord); } // 修改签字状态 childVaccinaterecord.setSignature(ChildVaccinaterecord.SIGNATURE_YES); childVaccinaterecordService.updateSignatures(childVaccinaterecord); } } catch (Exception e) { logger.error("微信签字base64转bytes失败", e.getMessage()); } // 签字状态
} logger.info("signObjFinal-->" + (signObj == null)); if (signObj != null) { String signStr = (String) signObj; // 初始化记录数据 childVaccinaterecord = childVaccinaterecordService.get(childVaccinaterecord); if (childVaccinaterecord != null) { // 判断签字是否存在 // 打印签字信息 code.put("sign", signStr); // base64 转换签字 BASE64Decoder decoder = new BASE64Decoder(); try { byte[] sign = decoder.decodeBuffer(signStr); if (null != sign && sign.length > 0) { childVaccinaterecord.setSignatureData(sign); childVaccinaterecord.setStype(ChildVaccinaterecord.SIGNATURE_SOURCE_DJT); // 查询该记录签字是否存在 int count = childVaccinaterecordService.querySignature(childVaccinaterecord); if (count == 0) { // 新增签字 childVaccinaterecordService.insertSignatures(childVaccinaterecord); } // 修改签字状态 childVaccinaterecord.setSignature(ChildVaccinaterecord.SIGNATURE_YES); childVaccinaterecordService.updateSignatures(childVaccinaterecord); } } catch (Exception e) { logger.error("微信签字base64转bytes失败", e.getMessage()); } // 签字状态 } maplist.put("success", true); logger.error("打印排号获取签字成功" + childVaccinaterecord.getNid().substring(0, 2) + "||" + childVaccinaterecord.getVaccineid()); } else { logger.error("打印排号获取签字失败" + childVaccinaterecord.getNid().substring(0, 2) + "||" + childVaccinaterecord.getVaccineid()); } }
24,804
6
// 修改签字状态
@SuppressWarnings("restriction") private void updateDJTSign(ChildVaccinaterecord childVaccinaterecord, Map<String, Object> maplist, Map<String, Object> code) { logger.info("获取排号签字数据开始" + childVaccinaterecord.getNid().substring(0, 2) + "||" + childVaccinaterecord.getVaccineid()); Object signObjVaccid = CacheUtils.get(CacheUtils.SIGN_CACHE, childVaccinaterecord.getChildid() + "_" + childVaccinaterecord.getNid().substring(0, 2)); logger.info("signObjVaccid-->" + (signObjVaccid == null)); CacheUtils.remove(CacheUtils.SIGN_CACHE, childVaccinaterecord.getChildid() + "_" + childVaccinaterecord.getNid().substring(0, 2)); Object signObj = CacheUtils.get(CacheUtils.SIGN_CACHE, childVaccinaterecord.getChildid() + "_" + childVaccinaterecord.getVaccineid()); logger.info("signObj-->" + (signObj == null)); CacheUtils.remove(CacheUtils.SIGN_CACHE, childVaccinaterecord.getChildid() + "_" + childVaccinaterecord.getVaccineid()); if (signObj == null) { signObj = signObjVaccid; } logger.info("signObjFinal-->" + (signObj == null)); if (signObj != null) { String signStr = (String) signObj; // 初始化记录数据 childVaccinaterecord = childVaccinaterecordService.get(childVaccinaterecord); if (childVaccinaterecord != null) { // 判断签字是否存在 // 打印签字信息 code.put("sign", signStr); // base64 转换签字 BASE64Decoder decoder = new BASE64Decoder(); try { byte[] sign = decoder.decodeBuffer(signStr); if (null != sign && sign.length > 0) { childVaccinaterecord.setSignatureData(sign); childVaccinaterecord.setStype(ChildVaccinaterecord.SIGNATURE_SOURCE_DJT); // 查询该记录签字是否存在 int count = childVaccinaterecordService.querySignature(childVaccinaterecord); if (count == 0) { // 新增签字 childVaccinaterecordService.insertSignatures(childVaccinaterecord); } // 修改签字状态 childVaccinaterecord.setSignature(ChildVaccinaterecord.SIGNATURE_YES); childVaccinaterecordService.updateSignatures(childVaccinaterecord); } } catch (Exception e) { logger.error("微信签字base64转bytes失败", e.getMessage()); } // 签字状态 } maplist.put("success", true); logger.error("打印排号获取签字成功" + childVaccinaterecord.getNid().substring(0, 2) + "||" + childVaccinaterecord.getVaccineid()); } else { logger.error("打印排号获取签字失败" + childVaccinaterecord.getNid().substring(0, 2) + "||" + childVaccinaterecord.getVaccineid()); } }
NONSATD
true
childVaccinaterecordService.insertSignatures(childVaccinaterecord); } // 修改签字状态 childVaccinaterecord.setSignature(ChildVaccinaterecord.SIGNATURE_YES); childVaccinaterecordService.updateSignatures(childVaccinaterecord);
byte[] sign = decoder.decodeBuffer(signStr); if (null != sign && sign.length > 0) { childVaccinaterecord.setSignatureData(sign); childVaccinaterecord.setStype(ChildVaccinaterecord.SIGNATURE_SOURCE_DJT); // 查询该记录签字是否存在 int count = childVaccinaterecordService.querySignature(childVaccinaterecord); if (count == 0) { // 新增签字 childVaccinaterecordService.insertSignatures(childVaccinaterecord); } // 修改签字状态 childVaccinaterecord.setSignature(ChildVaccinaterecord.SIGNATURE_YES); childVaccinaterecordService.updateSignatures(childVaccinaterecord); } } catch (Exception e) { logger.error("微信签字base64转bytes失败", e.getMessage()); } // 签字状态 } maplist.put("success", true); logger.error("打印排号获取签字成功" + childVaccinaterecord.getNid().substring(0, 2) + "||"
String signStr = (String) signObj; // 初始化记录数据 childVaccinaterecord = childVaccinaterecordService.get(childVaccinaterecord); if (childVaccinaterecord != null) { // 判断签字是否存在 // 打印签字信息 code.put("sign", signStr); // base64 转换签字 BASE64Decoder decoder = new BASE64Decoder(); try { byte[] sign = decoder.decodeBuffer(signStr); if (null != sign && sign.length > 0) { childVaccinaterecord.setSignatureData(sign); childVaccinaterecord.setStype(ChildVaccinaterecord.SIGNATURE_SOURCE_DJT); // 查询该记录签字是否存在 int count = childVaccinaterecordService.querySignature(childVaccinaterecord); if (count == 0) { // 新增签字 childVaccinaterecordService.insertSignatures(childVaccinaterecord); } // 修改签字状态 childVaccinaterecord.setSignature(ChildVaccinaterecord.SIGNATURE_YES); childVaccinaterecordService.updateSignatures(childVaccinaterecord); } } catch (Exception e) { logger.error("微信签字base64转bytes失败", e.getMessage()); } // 签字状态 } maplist.put("success", true); logger.error("打印排号获取签字成功" + childVaccinaterecord.getNid().substring(0, 2) + "||" + childVaccinaterecord.getVaccineid()); } else { logger.error("打印排号获取签字失败" + childVaccinaterecord.getNid().substring(0, 2) + "||" + childVaccinaterecord.getVaccineid()); } }
24,804
7
// 签字状态
@SuppressWarnings("restriction") private void updateDJTSign(ChildVaccinaterecord childVaccinaterecord, Map<String, Object> maplist, Map<String, Object> code) { logger.info("获取排号签字数据开始" + childVaccinaterecord.getNid().substring(0, 2) + "||" + childVaccinaterecord.getVaccineid()); Object signObjVaccid = CacheUtils.get(CacheUtils.SIGN_CACHE, childVaccinaterecord.getChildid() + "_" + childVaccinaterecord.getNid().substring(0, 2)); logger.info("signObjVaccid-->" + (signObjVaccid == null)); CacheUtils.remove(CacheUtils.SIGN_CACHE, childVaccinaterecord.getChildid() + "_" + childVaccinaterecord.getNid().substring(0, 2)); Object signObj = CacheUtils.get(CacheUtils.SIGN_CACHE, childVaccinaterecord.getChildid() + "_" + childVaccinaterecord.getVaccineid()); logger.info("signObj-->" + (signObj == null)); CacheUtils.remove(CacheUtils.SIGN_CACHE, childVaccinaterecord.getChildid() + "_" + childVaccinaterecord.getVaccineid()); if (signObj == null) { signObj = signObjVaccid; } logger.info("signObjFinal-->" + (signObj == null)); if (signObj != null) { String signStr = (String) signObj; // 初始化记录数据 childVaccinaterecord = childVaccinaterecordService.get(childVaccinaterecord); if (childVaccinaterecord != null) { // 判断签字是否存在 // 打印签字信息 code.put("sign", signStr); // base64 转换签字 BASE64Decoder decoder = new BASE64Decoder(); try { byte[] sign = decoder.decodeBuffer(signStr); if (null != sign && sign.length > 0) { childVaccinaterecord.setSignatureData(sign); childVaccinaterecord.setStype(ChildVaccinaterecord.SIGNATURE_SOURCE_DJT); // 查询该记录签字是否存在 int count = childVaccinaterecordService.querySignature(childVaccinaterecord); if (count == 0) { // 新增签字 childVaccinaterecordService.insertSignatures(childVaccinaterecord); } // 修改签字状态 childVaccinaterecord.setSignature(ChildVaccinaterecord.SIGNATURE_YES); childVaccinaterecordService.updateSignatures(childVaccinaterecord); } } catch (Exception e) { logger.error("微信签字base64转bytes失败", e.getMessage()); } // 签字状态 } maplist.put("success", true); logger.error("打印排号获取签字成功" + childVaccinaterecord.getNid().substring(0, 2) + "||" + childVaccinaterecord.getVaccineid()); } else { logger.error("打印排号获取签字失败" + childVaccinaterecord.getNid().substring(0, 2) + "||" + childVaccinaterecord.getVaccineid()); } }
NONSATD
true
logger.error("微信签字base64转bytes失败", e.getMessage()); } // 签字状态 } maplist.put("success", true);
// 新增签字 childVaccinaterecordService.insertSignatures(childVaccinaterecord); } // 修改签字状态 childVaccinaterecord.setSignature(ChildVaccinaterecord.SIGNATURE_YES); childVaccinaterecordService.updateSignatures(childVaccinaterecord); } } catch (Exception e) { logger.error("微信签字base64转bytes失败", e.getMessage()); } // 签字状态 } maplist.put("success", true); logger.error("打印排号获取签字成功" + childVaccinaterecord.getNid().substring(0, 2) + "||" + childVaccinaterecord.getVaccineid()); } else { logger.error("打印排号获取签字失败" + childVaccinaterecord.getNid().substring(0, 2) + "||" + childVaccinaterecord.getVaccineid()); } }
// base64 转换签字 BASE64Decoder decoder = new BASE64Decoder(); try { byte[] sign = decoder.decodeBuffer(signStr); if (null != sign && sign.length > 0) { childVaccinaterecord.setSignatureData(sign); childVaccinaterecord.setStype(ChildVaccinaterecord.SIGNATURE_SOURCE_DJT); // 查询该记录签字是否存在 int count = childVaccinaterecordService.querySignature(childVaccinaterecord); if (count == 0) { // 新增签字 childVaccinaterecordService.insertSignatures(childVaccinaterecord); } // 修改签字状态 childVaccinaterecord.setSignature(ChildVaccinaterecord.SIGNATURE_YES); childVaccinaterecordService.updateSignatures(childVaccinaterecord); } } catch (Exception e) { logger.error("微信签字base64转bytes失败", e.getMessage()); } // 签字状态 } maplist.put("success", true); logger.error("打印排号获取签字成功" + childVaccinaterecord.getNid().substring(0, 2) + "||" + childVaccinaterecord.getVaccineid()); } else { logger.error("打印排号获取签字失败" + childVaccinaterecord.getNid().substring(0, 2) + "||" + childVaccinaterecord.getVaccineid()); } }
8,421
0
// Validate boolean preferences
@POST @Path("setPreference") public synchronized void setPreference( @FormParam("preferencename") String preferenceName, @FormParam("preferencevalue") String preferenceValue) { if ((preferenceName == null) || (preferenceValue == null)) return; Object newValue = null; // Validate boolean preferences String[] booleanPrefs = {"advanced-mode", "allow-anonymous-usage-tracking", "fs-reverse"}; if (Arrays.asList(booleanPrefs).contains(preferenceName)){ switch (preferenceValue){ case "true": newValue = Boolean.TRUE; break; case "false": newValue = Boolean.FALSE; break; default: return; } if (preferenceName.equals("advanced-mode")) this.isUseAdvancedMode = (Boolean) newValue; else if (preferenceName == "allow") this.isAllowAnonymousTracking = (Boolean) newValue; } // Validate edit mode else if (preferenceName.equals("edit-mode")){ String[] validModes = {"vim", "emacs", "default"}; if (Arrays.asList(validModes).contains(preferenceValue)){ newValue = preferenceValue; this.editMode = preferenceValue; } } // Validate edit mode else if (preferenceName.equals("fs-order-by")){ String[] validModes = {"uri", "modified"}; if (Arrays.asList(validModes).contains(preferenceValue)){ newValue = preferenceValue; } } final String preferenceFileUrl = this.bkConfig.getPreferenceFileUrl(); // TODO, assume the url is a file path for now. // System.out.println(preferenceFileUrl + " url!!!!\n"); // Use a temporary for atomic writing java.nio.file.Path preferenceFileTmp = Paths.get(preferenceFileUrl + ".tmp"); java.nio.file.Path preferenceFile = Paths.get(preferenceFileUrl); try { ObjectMapper om = new ObjectMapper(); TypeReference readType = new TypeReference<HashMap<String, Object>>() { }; Map<String, Object> prefs = om.readValue(preferenceFile.toFile(), readType); Object oldValue = (Object) prefs.get(preferenceName); // If value changed, write it to the file too if (!Objects.equals(newValue, oldValue)) { Files.deleteIfExists(preferenceFileTmp); prefs.put(preferenceName, newValue); om.writerWithDefaultPrettyPrinter().writeValue(preferenceFileTmp.toFile(), prefs); // Move tmp to normal Files.move(preferenceFileTmp, preferenceFile, REPLACE_EXISTING); } } catch (IOException e) { e.printStackTrace(); } }
NONSATD
true
return; Object newValue = null; // Validate boolean preferences String[] booleanPrefs = {"advanced-mode", "allow-anonymous-usage-tracking", "fs-reverse"}; if (Arrays.asList(booleanPrefs).contains(preferenceName)){
@POST @Path("setPreference") public synchronized void setPreference( @FormParam("preferencename") String preferenceName, @FormParam("preferencevalue") String preferenceValue) { if ((preferenceName == null) || (preferenceValue == null)) return; Object newValue = null; // Validate boolean preferences String[] booleanPrefs = {"advanced-mode", "allow-anonymous-usage-tracking", "fs-reverse"}; if (Arrays.asList(booleanPrefs).contains(preferenceName)){ switch (preferenceValue){ case "true": newValue = Boolean.TRUE; break; case "false": newValue = Boolean.FALSE; break; default:
@POST @Path("setPreference") public synchronized void setPreference( @FormParam("preferencename") String preferenceName, @FormParam("preferencevalue") String preferenceValue) { if ((preferenceName == null) || (preferenceValue == null)) return; Object newValue = null; // Validate boolean preferences String[] booleanPrefs = {"advanced-mode", "allow-anonymous-usage-tracking", "fs-reverse"}; if (Arrays.asList(booleanPrefs).contains(preferenceName)){ switch (preferenceValue){ case "true": newValue = Boolean.TRUE; break; case "false": newValue = Boolean.FALSE; break; default: return; } if (preferenceName.equals("advanced-mode")) this.isUseAdvancedMode = (Boolean) newValue; else if (preferenceName == "allow") this.isAllowAnonymousTracking = (Boolean) newValue; } // Validate edit mode else if (preferenceName.equals("edit-mode")){ String[] validModes = {"vim", "emacs", "default"};
8,421
1
// Validate edit mode
@POST @Path("setPreference") public synchronized void setPreference( @FormParam("preferencename") String preferenceName, @FormParam("preferencevalue") String preferenceValue) { if ((preferenceName == null) || (preferenceValue == null)) return; Object newValue = null; // Validate boolean preferences String[] booleanPrefs = {"advanced-mode", "allow-anonymous-usage-tracking", "fs-reverse"}; if (Arrays.asList(booleanPrefs).contains(preferenceName)){ switch (preferenceValue){ case "true": newValue = Boolean.TRUE; break; case "false": newValue = Boolean.FALSE; break; default: return; } if (preferenceName.equals("advanced-mode")) this.isUseAdvancedMode = (Boolean) newValue; else if (preferenceName == "allow") this.isAllowAnonymousTracking = (Boolean) newValue; } // Validate edit mode else if (preferenceName.equals("edit-mode")){ String[] validModes = {"vim", "emacs", "default"}; if (Arrays.asList(validModes).contains(preferenceValue)){ newValue = preferenceValue; this.editMode = preferenceValue; } } // Validate edit mode else if (preferenceName.equals("fs-order-by")){ String[] validModes = {"uri", "modified"}; if (Arrays.asList(validModes).contains(preferenceValue)){ newValue = preferenceValue; } } final String preferenceFileUrl = this.bkConfig.getPreferenceFileUrl(); // TODO, assume the url is a file path for now. // System.out.println(preferenceFileUrl + " url!!!!\n"); // Use a temporary for atomic writing java.nio.file.Path preferenceFileTmp = Paths.get(preferenceFileUrl + ".tmp"); java.nio.file.Path preferenceFile = Paths.get(preferenceFileUrl); try { ObjectMapper om = new ObjectMapper(); TypeReference readType = new TypeReference<HashMap<String, Object>>() { }; Map<String, Object> prefs = om.readValue(preferenceFile.toFile(), readType); Object oldValue = (Object) prefs.get(preferenceName); // If value changed, write it to the file too if (!Objects.equals(newValue, oldValue)) { Files.deleteIfExists(preferenceFileTmp); prefs.put(preferenceName, newValue); om.writerWithDefaultPrettyPrinter().writeValue(preferenceFileTmp.toFile(), prefs); // Move tmp to normal Files.move(preferenceFileTmp, preferenceFile, REPLACE_EXISTING); } } catch (IOException e) { e.printStackTrace(); } }
NONSATD
true
this.isAllowAnonymousTracking = (Boolean) newValue; } // Validate edit mode else if (preferenceName.equals("edit-mode")){ String[] validModes = {"vim", "emacs", "default"};
newValue = Boolean.FALSE; break; default: return; } if (preferenceName.equals("advanced-mode")) this.isUseAdvancedMode = (Boolean) newValue; else if (preferenceName == "allow") this.isAllowAnonymousTracking = (Boolean) newValue; } // Validate edit mode else if (preferenceName.equals("edit-mode")){ String[] validModes = {"vim", "emacs", "default"}; if (Arrays.asList(validModes).contains(preferenceValue)){ newValue = preferenceValue; this.editMode = preferenceValue; } } // Validate edit mode else if (preferenceName.equals("fs-order-by")){ String[] validModes = {"uri", "modified"};
return; Object newValue = null; // Validate boolean preferences String[] booleanPrefs = {"advanced-mode", "allow-anonymous-usage-tracking", "fs-reverse"}; if (Arrays.asList(booleanPrefs).contains(preferenceName)){ switch (preferenceValue){ case "true": newValue = Boolean.TRUE; break; case "false": newValue = Boolean.FALSE; break; default: return; } if (preferenceName.equals("advanced-mode")) this.isUseAdvancedMode = (Boolean) newValue; else if (preferenceName == "allow") this.isAllowAnonymousTracking = (Boolean) newValue; } // Validate edit mode else if (preferenceName.equals("edit-mode")){ String[] validModes = {"vim", "emacs", "default"}; if (Arrays.asList(validModes).contains(preferenceValue)){ newValue = preferenceValue; this.editMode = preferenceValue; } } // Validate edit mode else if (preferenceName.equals("fs-order-by")){ String[] validModes = {"uri", "modified"}; if (Arrays.asList(validModes).contains(preferenceValue)){ newValue = preferenceValue; } } final String preferenceFileUrl = this.bkConfig.getPreferenceFileUrl(); // TODO, assume the url is a file path for now. // System.out.println(preferenceFileUrl + " url!!!!\n"); // Use a temporary for atomic writing java.nio.file.Path preferenceFileTmp = Paths.get(preferenceFileUrl + ".tmp"); java.nio.file.Path preferenceFile = Paths.get(preferenceFileUrl);
8,421
2
// Validate edit mode
@POST @Path("setPreference") public synchronized void setPreference( @FormParam("preferencename") String preferenceName, @FormParam("preferencevalue") String preferenceValue) { if ((preferenceName == null) || (preferenceValue == null)) return; Object newValue = null; // Validate boolean preferences String[] booleanPrefs = {"advanced-mode", "allow-anonymous-usage-tracking", "fs-reverse"}; if (Arrays.asList(booleanPrefs).contains(preferenceName)){ switch (preferenceValue){ case "true": newValue = Boolean.TRUE; break; case "false": newValue = Boolean.FALSE; break; default: return; } if (preferenceName.equals("advanced-mode")) this.isUseAdvancedMode = (Boolean) newValue; else if (preferenceName == "allow") this.isAllowAnonymousTracking = (Boolean) newValue; } // Validate edit mode else if (preferenceName.equals("edit-mode")){ String[] validModes = {"vim", "emacs", "default"}; if (Arrays.asList(validModes).contains(preferenceValue)){ newValue = preferenceValue; this.editMode = preferenceValue; } } // Validate edit mode else if (preferenceName.equals("fs-order-by")){ String[] validModes = {"uri", "modified"}; if (Arrays.asList(validModes).contains(preferenceValue)){ newValue = preferenceValue; } } final String preferenceFileUrl = this.bkConfig.getPreferenceFileUrl(); // TODO, assume the url is a file path for now. // System.out.println(preferenceFileUrl + " url!!!!\n"); // Use a temporary for atomic writing java.nio.file.Path preferenceFileTmp = Paths.get(preferenceFileUrl + ".tmp"); java.nio.file.Path preferenceFile = Paths.get(preferenceFileUrl); try { ObjectMapper om = new ObjectMapper(); TypeReference readType = new TypeReference<HashMap<String, Object>>() { }; Map<String, Object> prefs = om.readValue(preferenceFile.toFile(), readType); Object oldValue = (Object) prefs.get(preferenceName); // If value changed, write it to the file too if (!Objects.equals(newValue, oldValue)) { Files.deleteIfExists(preferenceFileTmp); prefs.put(preferenceName, newValue); om.writerWithDefaultPrettyPrinter().writeValue(preferenceFileTmp.toFile(), prefs); // Move tmp to normal Files.move(preferenceFileTmp, preferenceFile, REPLACE_EXISTING); } } catch (IOException e) { e.printStackTrace(); } }
NONSATD
true
this.isAllowAnonymousTracking = (Boolean) newValue; } // Validate edit mode else if (preferenceName.equals("edit-mode")){ String[] validModes = {"vim", "emacs", "default"};
newValue = Boolean.FALSE; break; default: return; } if (preferenceName.equals("advanced-mode")) this.isUseAdvancedMode = (Boolean) newValue; else if (preferenceName == "allow") this.isAllowAnonymousTracking = (Boolean) newValue; } // Validate edit mode else if (preferenceName.equals("edit-mode")){ String[] validModes = {"vim", "emacs", "default"}; if (Arrays.asList(validModes).contains(preferenceValue)){ newValue = preferenceValue; this.editMode = preferenceValue; } } // Validate edit mode else if (preferenceName.equals("fs-order-by")){ String[] validModes = {"uri", "modified"};
return; Object newValue = null; // Validate boolean preferences String[] booleanPrefs = {"advanced-mode", "allow-anonymous-usage-tracking", "fs-reverse"}; if (Arrays.asList(booleanPrefs).contains(preferenceName)){ switch (preferenceValue){ case "true": newValue = Boolean.TRUE; break; case "false": newValue = Boolean.FALSE; break; default: return; } if (preferenceName.equals("advanced-mode")) this.isUseAdvancedMode = (Boolean) newValue; else if (preferenceName == "allow") this.isAllowAnonymousTracking = (Boolean) newValue; } // Validate edit mode else if (preferenceName.equals("edit-mode")){ String[] validModes = {"vim", "emacs", "default"}; if (Arrays.asList(validModes).contains(preferenceValue)){ newValue = preferenceValue; this.editMode = preferenceValue; } } // Validate edit mode else if (preferenceName.equals("fs-order-by")){ String[] validModes = {"uri", "modified"}; if (Arrays.asList(validModes).contains(preferenceValue)){ newValue = preferenceValue; } } final String preferenceFileUrl = this.bkConfig.getPreferenceFileUrl(); // TODO, assume the url is a file path for now. // System.out.println(preferenceFileUrl + " url!!!!\n"); // Use a temporary for atomic writing java.nio.file.Path preferenceFileTmp = Paths.get(preferenceFileUrl + ".tmp"); java.nio.file.Path preferenceFile = Paths.get(preferenceFileUrl);
8,421
3
// TODO, assume the url is a file path for now. // System.out.println(preferenceFileUrl + " url!!!!\n"); // Use a temporary for atomic writing
@POST @Path("setPreference") public synchronized void setPreference( @FormParam("preferencename") String preferenceName, @FormParam("preferencevalue") String preferenceValue) { if ((preferenceName == null) || (preferenceValue == null)) return; Object newValue = null; // Validate boolean preferences String[] booleanPrefs = {"advanced-mode", "allow-anonymous-usage-tracking", "fs-reverse"}; if (Arrays.asList(booleanPrefs).contains(preferenceName)){ switch (preferenceValue){ case "true": newValue = Boolean.TRUE; break; case "false": newValue = Boolean.FALSE; break; default: return; } if (preferenceName.equals("advanced-mode")) this.isUseAdvancedMode = (Boolean) newValue; else if (preferenceName == "allow") this.isAllowAnonymousTracking = (Boolean) newValue; } // Validate edit mode else if (preferenceName.equals("edit-mode")){ String[] validModes = {"vim", "emacs", "default"}; if (Arrays.asList(validModes).contains(preferenceValue)){ newValue = preferenceValue; this.editMode = preferenceValue; } } // Validate edit mode else if (preferenceName.equals("fs-order-by")){ String[] validModes = {"uri", "modified"}; if (Arrays.asList(validModes).contains(preferenceValue)){ newValue = preferenceValue; } } final String preferenceFileUrl = this.bkConfig.getPreferenceFileUrl(); // TODO, assume the url is a file path for now. // System.out.println(preferenceFileUrl + " url!!!!\n"); // Use a temporary for atomic writing java.nio.file.Path preferenceFileTmp = Paths.get(preferenceFileUrl + ".tmp"); java.nio.file.Path preferenceFile = Paths.get(preferenceFileUrl); try { ObjectMapper om = new ObjectMapper(); TypeReference readType = new TypeReference<HashMap<String, Object>>() { }; Map<String, Object> prefs = om.readValue(preferenceFile.toFile(), readType); Object oldValue = (Object) prefs.get(preferenceName); // If value changed, write it to the file too if (!Objects.equals(newValue, oldValue)) { Files.deleteIfExists(preferenceFileTmp); prefs.put(preferenceName, newValue); om.writerWithDefaultPrettyPrinter().writeValue(preferenceFileTmp.toFile(), prefs); // Move tmp to normal Files.move(preferenceFileTmp, preferenceFile, REPLACE_EXISTING); } } catch (IOException e) { e.printStackTrace(); } }
DESIGN
true
} final String preferenceFileUrl = this.bkConfig.getPreferenceFileUrl(); // TODO, assume the url is a file path for now. // System.out.println(preferenceFileUrl + " url!!!!\n"); // Use a temporary for atomic writing java.nio.file.Path preferenceFileTmp = Paths.get(preferenceFileUrl + ".tmp"); java.nio.file.Path preferenceFile = Paths.get(preferenceFileUrl);
} } // Validate edit mode else if (preferenceName.equals("fs-order-by")){ String[] validModes = {"uri", "modified"}; if (Arrays.asList(validModes).contains(preferenceValue)){ newValue = preferenceValue; } } final String preferenceFileUrl = this.bkConfig.getPreferenceFileUrl(); // TODO, assume the url is a file path for now. // System.out.println(preferenceFileUrl + " url!!!!\n"); // Use a temporary for atomic writing java.nio.file.Path preferenceFileTmp = Paths.get(preferenceFileUrl + ".tmp"); java.nio.file.Path preferenceFile = Paths.get(preferenceFileUrl); try { ObjectMapper om = new ObjectMapper(); TypeReference readType = new TypeReference<HashMap<String, Object>>() { }; Map<String, Object> prefs = om.readValue(preferenceFile.toFile(), readType); Object oldValue = (Object) prefs.get(preferenceName); // If value changed, write it to the file too if (!Objects.equals(newValue, oldValue)) {
this.isUseAdvancedMode = (Boolean) newValue; else if (preferenceName == "allow") this.isAllowAnonymousTracking = (Boolean) newValue; } // Validate edit mode else if (preferenceName.equals("edit-mode")){ String[] validModes = {"vim", "emacs", "default"}; if (Arrays.asList(validModes).contains(preferenceValue)){ newValue = preferenceValue; this.editMode = preferenceValue; } } // Validate edit mode else if (preferenceName.equals("fs-order-by")){ String[] validModes = {"uri", "modified"}; if (Arrays.asList(validModes).contains(preferenceValue)){ newValue = preferenceValue; } } final String preferenceFileUrl = this.bkConfig.getPreferenceFileUrl(); // TODO, assume the url is a file path for now. // System.out.println(preferenceFileUrl + " url!!!!\n"); // Use a temporary for atomic writing java.nio.file.Path preferenceFileTmp = Paths.get(preferenceFileUrl + ".tmp"); java.nio.file.Path preferenceFile = Paths.get(preferenceFileUrl); try { ObjectMapper om = new ObjectMapper(); TypeReference readType = new TypeReference<HashMap<String, Object>>() { }; Map<String, Object> prefs = om.readValue(preferenceFile.toFile(), readType); Object oldValue = (Object) prefs.get(preferenceName); // If value changed, write it to the file too if (!Objects.equals(newValue, oldValue)) { Files.deleteIfExists(preferenceFileTmp); prefs.put(preferenceName, newValue); om.writerWithDefaultPrettyPrinter().writeValue(preferenceFileTmp.toFile(), prefs); // Move tmp to normal Files.move(preferenceFileTmp, preferenceFile, REPLACE_EXISTING); } } catch (IOException e) { e.printStackTrace(); } }
8,421
4
// If value changed, write it to the file too
@POST @Path("setPreference") public synchronized void setPreference( @FormParam("preferencename") String preferenceName, @FormParam("preferencevalue") String preferenceValue) { if ((preferenceName == null) || (preferenceValue == null)) return; Object newValue = null; // Validate boolean preferences String[] booleanPrefs = {"advanced-mode", "allow-anonymous-usage-tracking", "fs-reverse"}; if (Arrays.asList(booleanPrefs).contains(preferenceName)){ switch (preferenceValue){ case "true": newValue = Boolean.TRUE; break; case "false": newValue = Boolean.FALSE; break; default: return; } if (preferenceName.equals("advanced-mode")) this.isUseAdvancedMode = (Boolean) newValue; else if (preferenceName == "allow") this.isAllowAnonymousTracking = (Boolean) newValue; } // Validate edit mode else if (preferenceName.equals("edit-mode")){ String[] validModes = {"vim", "emacs", "default"}; if (Arrays.asList(validModes).contains(preferenceValue)){ newValue = preferenceValue; this.editMode = preferenceValue; } } // Validate edit mode else if (preferenceName.equals("fs-order-by")){ String[] validModes = {"uri", "modified"}; if (Arrays.asList(validModes).contains(preferenceValue)){ newValue = preferenceValue; } } final String preferenceFileUrl = this.bkConfig.getPreferenceFileUrl(); // TODO, assume the url is a file path for now. // System.out.println(preferenceFileUrl + " url!!!!\n"); // Use a temporary for atomic writing java.nio.file.Path preferenceFileTmp = Paths.get(preferenceFileUrl + ".tmp"); java.nio.file.Path preferenceFile = Paths.get(preferenceFileUrl); try { ObjectMapper om = new ObjectMapper(); TypeReference readType = new TypeReference<HashMap<String, Object>>() { }; Map<String, Object> prefs = om.readValue(preferenceFile.toFile(), readType); Object oldValue = (Object) prefs.get(preferenceName); // If value changed, write it to the file too if (!Objects.equals(newValue, oldValue)) { Files.deleteIfExists(preferenceFileTmp); prefs.put(preferenceName, newValue); om.writerWithDefaultPrettyPrinter().writeValue(preferenceFileTmp.toFile(), prefs); // Move tmp to normal Files.move(preferenceFileTmp, preferenceFile, REPLACE_EXISTING); } } catch (IOException e) { e.printStackTrace(); } }
NONSATD
true
Map<String, Object> prefs = om.readValue(preferenceFile.toFile(), readType); Object oldValue = (Object) prefs.get(preferenceName); // If value changed, write it to the file too if (!Objects.equals(newValue, oldValue)) { Files.deleteIfExists(preferenceFileTmp);
// System.out.println(preferenceFileUrl + " url!!!!\n"); // Use a temporary for atomic writing java.nio.file.Path preferenceFileTmp = Paths.get(preferenceFileUrl + ".tmp"); java.nio.file.Path preferenceFile = Paths.get(preferenceFileUrl); try { ObjectMapper om = new ObjectMapper(); TypeReference readType = new TypeReference<HashMap<String, Object>>() { }; Map<String, Object> prefs = om.readValue(preferenceFile.toFile(), readType); Object oldValue = (Object) prefs.get(preferenceName); // If value changed, write it to the file too if (!Objects.equals(newValue, oldValue)) { Files.deleteIfExists(preferenceFileTmp); prefs.put(preferenceName, newValue); om.writerWithDefaultPrettyPrinter().writeValue(preferenceFileTmp.toFile(), prefs); // Move tmp to normal Files.move(preferenceFileTmp, preferenceFile, REPLACE_EXISTING); } } catch (IOException e) { e.printStackTrace(); }
} // Validate edit mode else if (preferenceName.equals("fs-order-by")){ String[] validModes = {"uri", "modified"}; if (Arrays.asList(validModes).contains(preferenceValue)){ newValue = preferenceValue; } } final String preferenceFileUrl = this.bkConfig.getPreferenceFileUrl(); // TODO, assume the url is a file path for now. // System.out.println(preferenceFileUrl + " url!!!!\n"); // Use a temporary for atomic writing java.nio.file.Path preferenceFileTmp = Paths.get(preferenceFileUrl + ".tmp"); java.nio.file.Path preferenceFile = Paths.get(preferenceFileUrl); try { ObjectMapper om = new ObjectMapper(); TypeReference readType = new TypeReference<HashMap<String, Object>>() { }; Map<String, Object> prefs = om.readValue(preferenceFile.toFile(), readType); Object oldValue = (Object) prefs.get(preferenceName); // If value changed, write it to the file too if (!Objects.equals(newValue, oldValue)) { Files.deleteIfExists(preferenceFileTmp); prefs.put(preferenceName, newValue); om.writerWithDefaultPrettyPrinter().writeValue(preferenceFileTmp.toFile(), prefs); // Move tmp to normal Files.move(preferenceFileTmp, preferenceFile, REPLACE_EXISTING); } } catch (IOException e) { e.printStackTrace(); } }
8,421
5
// Move tmp to normal
@POST @Path("setPreference") public synchronized void setPreference( @FormParam("preferencename") String preferenceName, @FormParam("preferencevalue") String preferenceValue) { if ((preferenceName == null) || (preferenceValue == null)) return; Object newValue = null; // Validate boolean preferences String[] booleanPrefs = {"advanced-mode", "allow-anonymous-usage-tracking", "fs-reverse"}; if (Arrays.asList(booleanPrefs).contains(preferenceName)){ switch (preferenceValue){ case "true": newValue = Boolean.TRUE; break; case "false": newValue = Boolean.FALSE; break; default: return; } if (preferenceName.equals("advanced-mode")) this.isUseAdvancedMode = (Boolean) newValue; else if (preferenceName == "allow") this.isAllowAnonymousTracking = (Boolean) newValue; } // Validate edit mode else if (preferenceName.equals("edit-mode")){ String[] validModes = {"vim", "emacs", "default"}; if (Arrays.asList(validModes).contains(preferenceValue)){ newValue = preferenceValue; this.editMode = preferenceValue; } } // Validate edit mode else if (preferenceName.equals("fs-order-by")){ String[] validModes = {"uri", "modified"}; if (Arrays.asList(validModes).contains(preferenceValue)){ newValue = preferenceValue; } } final String preferenceFileUrl = this.bkConfig.getPreferenceFileUrl(); // TODO, assume the url is a file path for now. // System.out.println(preferenceFileUrl + " url!!!!\n"); // Use a temporary for atomic writing java.nio.file.Path preferenceFileTmp = Paths.get(preferenceFileUrl + ".tmp"); java.nio.file.Path preferenceFile = Paths.get(preferenceFileUrl); try { ObjectMapper om = new ObjectMapper(); TypeReference readType = new TypeReference<HashMap<String, Object>>() { }; Map<String, Object> prefs = om.readValue(preferenceFile.toFile(), readType); Object oldValue = (Object) prefs.get(preferenceName); // If value changed, write it to the file too if (!Objects.equals(newValue, oldValue)) { Files.deleteIfExists(preferenceFileTmp); prefs.put(preferenceName, newValue); om.writerWithDefaultPrettyPrinter().writeValue(preferenceFileTmp.toFile(), prefs); // Move tmp to normal Files.move(preferenceFileTmp, preferenceFile, REPLACE_EXISTING); } } catch (IOException e) { e.printStackTrace(); } }
NONSATD
true
prefs.put(preferenceName, newValue); om.writerWithDefaultPrettyPrinter().writeValue(preferenceFileTmp.toFile(), prefs); // Move tmp to normal Files.move(preferenceFileTmp, preferenceFile, REPLACE_EXISTING); }
ObjectMapper om = new ObjectMapper(); TypeReference readType = new TypeReference<HashMap<String, Object>>() { }; Map<String, Object> prefs = om.readValue(preferenceFile.toFile(), readType); Object oldValue = (Object) prefs.get(preferenceName); // If value changed, write it to the file too if (!Objects.equals(newValue, oldValue)) { Files.deleteIfExists(preferenceFileTmp); prefs.put(preferenceName, newValue); om.writerWithDefaultPrettyPrinter().writeValue(preferenceFileTmp.toFile(), prefs); // Move tmp to normal Files.move(preferenceFileTmp, preferenceFile, REPLACE_EXISTING); } } catch (IOException e) { e.printStackTrace(); } }
newValue = preferenceValue; } } final String preferenceFileUrl = this.bkConfig.getPreferenceFileUrl(); // TODO, assume the url is a file path for now. // System.out.println(preferenceFileUrl + " url!!!!\n"); // Use a temporary for atomic writing java.nio.file.Path preferenceFileTmp = Paths.get(preferenceFileUrl + ".tmp"); java.nio.file.Path preferenceFile = Paths.get(preferenceFileUrl); try { ObjectMapper om = new ObjectMapper(); TypeReference readType = new TypeReference<HashMap<String, Object>>() { }; Map<String, Object> prefs = om.readValue(preferenceFile.toFile(), readType); Object oldValue = (Object) prefs.get(preferenceName); // If value changed, write it to the file too if (!Objects.equals(newValue, oldValue)) { Files.deleteIfExists(preferenceFileTmp); prefs.put(preferenceName, newValue); om.writerWithDefaultPrettyPrinter().writeValue(preferenceFileTmp.toFile(), prefs); // Move tmp to normal Files.move(preferenceFileTmp, preferenceFile, REPLACE_EXISTING); } } catch (IOException e) { e.printStackTrace(); } }
8,420
0
// TODO, assume the url is a file path for now.
private void resetConfig() { final String configFileUrl = this.bkConfig.getConfigFileUrl(); final String preferenceFileUrl = this.bkConfig.getPreferenceFileUrl(); // TODO, assume the url is a file path for now. java.nio.file.Path configFile = Paths.get(configFileUrl); java.nio.file.Path preferenceFile = Paths.get(preferenceFileUrl); try { JSONParser parser = new JSONParser(); JSONObject configJsonObject = (JSONObject) parser.parse(this.utils.readFile(configFile)); JSONObject preferenceJsonObject = (JSONObject) parser.parse(this.utils.readFile(preferenceFile)); String isAllowTracking = mergeBooleanSetting( "allow-anonymous-usage-tracking", configJsonObject, preferenceJsonObject); setPreference("allow-anonymous-usage-tracking", isAllowTracking); String isUseAdvancedMode = mergeBooleanSetting( "advanced-mode", configJsonObject, preferenceJsonObject); setPreference("advanced-mode", isUseAdvancedMode); String mergedEditMode = mergeStringSetting( "edit-mode", configJsonObject, preferenceJsonObject); setPreference("edit-mode", mergedEditMode); this.initPlugins.addAll( mergeListSetting("init", configJsonObject, preferenceJsonObject)); this.controlPanelMenuPlugins.addAll( mergeListSetting("control-panel-menu-plugins", configJsonObject, preferenceJsonObject)); this.menuPlugins.addAll( mergeListSetting("notebook-app-menu-plugins", configJsonObject, preferenceJsonObject)); this.cellMenuPlugins.addAll( mergeListSetting("notebook-cell-menu-plugins", configJsonObject, preferenceJsonObject)); } catch (ParseException e) { throw new RuntimeException("failed getting beaker configurations from config file", e); } }
DESIGN
true
final String configFileUrl = this.bkConfig.getConfigFileUrl(); final String preferenceFileUrl = this.bkConfig.getPreferenceFileUrl(); // TODO, assume the url is a file path for now. java.nio.file.Path configFile = Paths.get(configFileUrl); java.nio.file.Path preferenceFile = Paths.get(preferenceFileUrl);
private void resetConfig() { final String configFileUrl = this.bkConfig.getConfigFileUrl(); final String preferenceFileUrl = this.bkConfig.getPreferenceFileUrl(); // TODO, assume the url is a file path for now. java.nio.file.Path configFile = Paths.get(configFileUrl); java.nio.file.Path preferenceFile = Paths.get(preferenceFileUrl); try { JSONParser parser = new JSONParser(); JSONObject configJsonObject = (JSONObject) parser.parse(this.utils.readFile(configFile)); JSONObject preferenceJsonObject = (JSONObject) parser.parse(this.utils.readFile(preferenceFile)); String isAllowTracking = mergeBooleanSetting( "allow-anonymous-usage-tracking",
private void resetConfig() { final String configFileUrl = this.bkConfig.getConfigFileUrl(); final String preferenceFileUrl = this.bkConfig.getPreferenceFileUrl(); // TODO, assume the url is a file path for now. java.nio.file.Path configFile = Paths.get(configFileUrl); java.nio.file.Path preferenceFile = Paths.get(preferenceFileUrl); try { JSONParser parser = new JSONParser(); JSONObject configJsonObject = (JSONObject) parser.parse(this.utils.readFile(configFile)); JSONObject preferenceJsonObject = (JSONObject) parser.parse(this.utils.readFile(preferenceFile)); String isAllowTracking = mergeBooleanSetting( "allow-anonymous-usage-tracking", configJsonObject, preferenceJsonObject); setPreference("allow-anonymous-usage-tracking", isAllowTracking); String isUseAdvancedMode = mergeBooleanSetting( "advanced-mode", configJsonObject, preferenceJsonObject); setPreference("advanced-mode", isUseAdvancedMode); String mergedEditMode = mergeStringSetting( "edit-mode",
24,810
0
// TODO: use sane arg parsing
public static void main(String args[]) throws FileNotFoundException { // TODO: use sane arg parsing if (args.length != 2) { throw new RuntimeException("usage: AnalyzeMethodEntry trace-in trace-out"); } String inFileName = args[0]; String outFileName = args[1]; Deserializer<TraceEvent> d = Deserializer.getDeserializer(new FileInputStream(inFileName), TraceEvent.class); Serializer<TraceEvent> s = Serializer.getSerializer(new FileOutputStream(outFileName)); new AnalyzeMethodEntry(d, s).analyze(); }
IMPLEMENTATION
true
public static void main(String args[]) throws FileNotFoundException { // TODO: use sane arg parsing if (args.length != 2) { throw new RuntimeException("usage: AnalyzeMethodEntry trace-in trace-out");
public static void main(String args[]) throws FileNotFoundException { // TODO: use sane arg parsing if (args.length != 2) { throw new RuntimeException("usage: AnalyzeMethodEntry trace-in trace-out"); } String inFileName = args[0]; String outFileName = args[1]; Deserializer<TraceEvent> d = Deserializer.getDeserializer(new FileInputStream(inFileName), TraceEvent.class); Serializer<TraceEvent> s = Serializer.getSerializer(new FileOutputStream(outFileName));
public static void main(String args[]) throws FileNotFoundException { // TODO: use sane arg parsing if (args.length != 2) { throw new RuntimeException("usage: AnalyzeMethodEntry trace-in trace-out"); } String inFileName = args[0]; String outFileName = args[1]; Deserializer<TraceEvent> d = Deserializer.getDeserializer(new FileInputStream(inFileName), TraceEvent.class); Serializer<TraceEvent> s = Serializer.getSerializer(new FileOutputStream(outFileName)); new AnalyzeMethodEntry(d, s).analyze(); }
8,431
0
/** GETTER * TODO: Write general description for this method */
@JsonGetter("amount") public int getAmount ( ) { return this.amount; }
DOCUMENTATION
true
@JsonGetter("amount") public int getAmount ( ) { return this.amount; }
@JsonGetter("amount") public int getAmount ( ) { return this.amount; }
@JsonGetter("amount") public int getAmount ( ) { return this.amount; }
8,432
0
/** SETTER * TODO: Write general description for this method */
@JsonSetter("amount") public void setAmount (int value) { this.amount = value; }
DOCUMENTATION
true
@JsonSetter("amount") public void setAmount (int value) { this.amount = value; }
@JsonSetter("amount") public void setAmount (int value) { this.amount = value; }
@JsonSetter("amount") public void setAmount (int value) { this.amount = value; }
8,433
0
/** GETTER * TODO: Write general description for this method */
@JsonGetter("description") public String getDescription ( ) { return this.description; }
DOCUMENTATION
true
@JsonGetter("description") public String getDescription ( ) { return this.description; }
@JsonGetter("description") public String getDescription ( ) { return this.description; }
@JsonGetter("description") public String getDescription ( ) { return this.description; }
8,434
0
/** SETTER * TODO: Write general description for this method */
@JsonSetter("description") public void setDescription (String value) { this.description = value; }
DOCUMENTATION
true
@JsonSetter("description") public void setDescription (String value) { this.description = value; }
@JsonSetter("description") public void setDescription (String value) { this.description = value; }
@JsonSetter("description") public void setDescription (String value) { this.description = value; }
8,435
0
/** GETTER * TODO: Write general description for this method */
@JsonGetter("quantity") public int getQuantity ( ) { return this.quantity; }
DOCUMENTATION
true
@JsonGetter("quantity") public int getQuantity ( ) { return this.quantity; }
@JsonGetter("quantity") public int getQuantity ( ) { return this.quantity; }
@JsonGetter("quantity") public int getQuantity ( ) { return this.quantity; }
8,436
0
/** SETTER * TODO: Write general description for this method */
@JsonSetter("quantity") public void setQuantity (int value) { this.quantity = value; }
DOCUMENTATION
true
@JsonSetter("quantity") public void setQuantity (int value) { this.quantity = value; }
@JsonSetter("quantity") public void setQuantity (int value) { this.quantity = value; }
@JsonSetter("quantity") public void setQuantity (int value) { this.quantity = value; }
8,437
0
/** GETTER * TODO: Write general description for this method */
@JsonGetter("category") public String getCategory ( ) { return this.category; }
DOCUMENTATION
true
@JsonGetter("category") public String getCategory ( ) { return this.category; }
@JsonGetter("category") public String getCategory ( ) { return this.category; }
@JsonGetter("category") public String getCategory ( ) { return this.category; }
8,438
0
/** SETTER * TODO: Write general description for this method */
@JsonSetter("category") public void setCategory (String value) { this.category = value; }
DOCUMENTATION
true
@JsonSetter("category") public void setCategory (String value) { this.category = value; }
@JsonSetter("category") public void setCategory (String value) { this.category = value; }
@JsonSetter("category") public void setCategory (String value) { this.category = value; }
16,627
0
//TODO: This could fail if an equals number of additions and removals happened within one second.
public void checkList() { if(observed.size() != cachedSize) { cachedSize = observed.size(); listUpdated(); } }
DEFECT
true
public void checkList() { if(observed.size() != cachedSize) { cachedSize = observed.size(); listUpdated(); } }
public void checkList() { if(observed.size() != cachedSize) { cachedSize = observed.size(); listUpdated(); } }
public void checkList() { if(observed.size() != cachedSize) { cachedSize = observed.size(); listUpdated(); } }
24,825
0
/************************************************************************** * Drawing the image of the world and assign on the ImageViewer in the GUI * not very fast, can be improved... **************************************************************************/
public synchronized void draw_World(){ //for each cells ant1nbCells=0; ant2nbCells=0; ant3nbCells=0; ant4nbCells=0; for (int x=0;x<WIDTH;x++){ for (int y=0;y<HEIGHT;y++){ //test is colorized if (world.getLocation().get((WIDTH*y)+x).isColorized()){ //System.out.print("(x,y)=("+x+","+y+")&"); //yes draw a point with this color wimgWorld.getPixelWriter().setColor(x, y, world.getLocation().get((WIDTH*y)+x).getColorS()); if (world.getLocation().get((WIDTH*y)+x).getName().compareTo(ANT1)==0){ant1nbCells++;} if (world.getLocation().get((WIDTH*y)+x).getName().compareTo(ANT2)==0){ant2nbCells++;} if (world.getLocation().get((WIDTH*y)+x).getName().compareTo(ANT3)==0){ant3nbCells++;} if (world.getLocation().get((WIDTH*y)+x).getName().compareTo(ANT4)==0){ant4nbCells++;} } else { //no draw a black point wimgWorld.getPixelWriter().setColor(x, y, javafx.scene.paint.Color.BLACK); } } } imgWorld.setImage(wimgWorld); //show me the result on scsreen //refresh counters lbTotalCellsNb.setText(nbTotalCells+" cells"); lbAnt1CellsNb.setText(ant1nbCells+" cells ("+formatter.format(((double)ant1nbCells/nbTotalCells)*100)+"%)"); lbAnt2CellsNb.setText(ant2nbCells+" cells ("+formatter.format(((double)ant2nbCells/nbTotalCells)*100)+"%)"); lbAnt3CellsNb.setText(ant3nbCells+" cells ("+formatter.format(((double)ant3nbCells/nbTotalCells)*100)+"%)"); lbAnt4CellsNb.setText(ant4nbCells+" cells ("+formatter.format(((double)ant4nbCells/nbTotalCells)*100)+"%)"); }
DESIGN
true
public synchronized void draw_World(){ //for each cells ant1nbCells=0; ant2nbCells=0; ant3nbCells=0; ant4nbCells=0; for (int x=0;x<WIDTH;x++){ for (int y=0;y<HEIGHT;y++){ //test is colorized if (world.getLocation().get((WIDTH*y)+x).isColorized()){ //System.out.print("(x,y)=("+x+","+y+")&"); //yes draw a point with this color wimgWorld.getPixelWriter().setColor(x, y, world.getLocation().get((WIDTH*y)+x).getColorS()); if (world.getLocation().get((WIDTH*y)+x).getName().compareTo(ANT1)==0){ant1nbCells++;} if (world.getLocation().get((WIDTH*y)+x).getName().compareTo(ANT2)==0){ant2nbCells++;} if (world.getLocation().get((WIDTH*y)+x).getName().compareTo(ANT3)==0){ant3nbCells++;} if (world.getLocation().get((WIDTH*y)+x).getName().compareTo(ANT4)==0){ant4nbCells++;} } else { //no draw a black point wimgWorld.getPixelWriter().setColor(x, y, javafx.scene.paint.Color.BLACK); } } } imgWorld.setImage(wimgWorld); //show me the result on scsreen //refresh counters lbTotalCellsNb.setText(nbTotalCells+" cells"); lbAnt1CellsNb.setText(ant1nbCells+" cells ("+formatter.format(((double)ant1nbCells/nbTotalCells)*100)+"%)"); lbAnt2CellsNb.setText(ant2nbCells+" cells ("+formatter.format(((double)ant2nbCells/nbTotalCells)*100)+"%)"); lbAnt3CellsNb.setText(ant3nbCells+" cells ("+formatter.format(((double)ant3nbCells/nbTotalCells)*100)+"%)"); lbAnt4CellsNb.setText(ant4nbCells+" cells ("+formatter.format(((double)ant4nbCells/nbTotalCells)*100)+"%)"); }
public synchronized void draw_World(){ //for each cells ant1nbCells=0; ant2nbCells=0; ant3nbCells=0; ant4nbCells=0; for (int x=0;x<WIDTH;x++){ for (int y=0;y<HEIGHT;y++){ //test is colorized if (world.getLocation().get((WIDTH*y)+x).isColorized()){ //System.out.print("(x,y)=("+x+","+y+")&"); //yes draw a point with this color wimgWorld.getPixelWriter().setColor(x, y, world.getLocation().get((WIDTH*y)+x).getColorS()); if (world.getLocation().get((WIDTH*y)+x).getName().compareTo(ANT1)==0){ant1nbCells++;} if (world.getLocation().get((WIDTH*y)+x).getName().compareTo(ANT2)==0){ant2nbCells++;} if (world.getLocation().get((WIDTH*y)+x).getName().compareTo(ANT3)==0){ant3nbCells++;} if (world.getLocation().get((WIDTH*y)+x).getName().compareTo(ANT4)==0){ant4nbCells++;} } else { //no draw a black point wimgWorld.getPixelWriter().setColor(x, y, javafx.scene.paint.Color.BLACK); } } } imgWorld.setImage(wimgWorld); //show me the result on scsreen //refresh counters lbTotalCellsNb.setText(nbTotalCells+" cells"); lbAnt1CellsNb.setText(ant1nbCells+" cells ("+formatter.format(((double)ant1nbCells/nbTotalCells)*100)+"%)"); lbAnt2CellsNb.setText(ant2nbCells+" cells ("+formatter.format(((double)ant2nbCells/nbTotalCells)*100)+"%)"); lbAnt3CellsNb.setText(ant3nbCells+" cells ("+formatter.format(((double)ant3nbCells/nbTotalCells)*100)+"%)"); lbAnt4CellsNb.setText(ant4nbCells+" cells ("+formatter.format(((double)ant4nbCells/nbTotalCells)*100)+"%)"); }
public synchronized void draw_World(){ //for each cells ant1nbCells=0; ant2nbCells=0; ant3nbCells=0; ant4nbCells=0; for (int x=0;x<WIDTH;x++){ for (int y=0;y<HEIGHT;y++){ //test is colorized if (world.getLocation().get((WIDTH*y)+x).isColorized()){ //System.out.print("(x,y)=("+x+","+y+")&"); //yes draw a point with this color wimgWorld.getPixelWriter().setColor(x, y, world.getLocation().get((WIDTH*y)+x).getColorS()); if (world.getLocation().get((WIDTH*y)+x).getName().compareTo(ANT1)==0){ant1nbCells++;} if (world.getLocation().get((WIDTH*y)+x).getName().compareTo(ANT2)==0){ant2nbCells++;} if (world.getLocation().get((WIDTH*y)+x).getName().compareTo(ANT3)==0){ant3nbCells++;} if (world.getLocation().get((WIDTH*y)+x).getName().compareTo(ANT4)==0){ant4nbCells++;} } else { //no draw a black point wimgWorld.getPixelWriter().setColor(x, y, javafx.scene.paint.Color.BLACK); } } } imgWorld.setImage(wimgWorld); //show me the result on scsreen //refresh counters lbTotalCellsNb.setText(nbTotalCells+" cells"); lbAnt1CellsNb.setText(ant1nbCells+" cells ("+formatter.format(((double)ant1nbCells/nbTotalCells)*100)+"%)"); lbAnt2CellsNb.setText(ant2nbCells+" cells ("+formatter.format(((double)ant2nbCells/nbTotalCells)*100)+"%)"); lbAnt3CellsNb.setText(ant3nbCells+" cells ("+formatter.format(((double)ant3nbCells/nbTotalCells)*100)+"%)"); lbAnt4CellsNb.setText(ant4nbCells+" cells ("+formatter.format(((double)ant4nbCells/nbTotalCells)*100)+"%)"); }
24,825
1
//for each cells
public synchronized void draw_World(){ //for each cells ant1nbCells=0; ant2nbCells=0; ant3nbCells=0; ant4nbCells=0; for (int x=0;x<WIDTH;x++){ for (int y=0;y<HEIGHT;y++){ //test is colorized if (world.getLocation().get((WIDTH*y)+x).isColorized()){ //System.out.print("(x,y)=("+x+","+y+")&"); //yes draw a point with this color wimgWorld.getPixelWriter().setColor(x, y, world.getLocation().get((WIDTH*y)+x).getColorS()); if (world.getLocation().get((WIDTH*y)+x).getName().compareTo(ANT1)==0){ant1nbCells++;} if (world.getLocation().get((WIDTH*y)+x).getName().compareTo(ANT2)==0){ant2nbCells++;} if (world.getLocation().get((WIDTH*y)+x).getName().compareTo(ANT3)==0){ant3nbCells++;} if (world.getLocation().get((WIDTH*y)+x).getName().compareTo(ANT4)==0){ant4nbCells++;} } else { //no draw a black point wimgWorld.getPixelWriter().setColor(x, y, javafx.scene.paint.Color.BLACK); } } } imgWorld.setImage(wimgWorld); //show me the result on scsreen //refresh counters lbTotalCellsNb.setText(nbTotalCells+" cells"); lbAnt1CellsNb.setText(ant1nbCells+" cells ("+formatter.format(((double)ant1nbCells/nbTotalCells)*100)+"%)"); lbAnt2CellsNb.setText(ant2nbCells+" cells ("+formatter.format(((double)ant2nbCells/nbTotalCells)*100)+"%)"); lbAnt3CellsNb.setText(ant3nbCells+" cells ("+formatter.format(((double)ant3nbCells/nbTotalCells)*100)+"%)"); lbAnt4CellsNb.setText(ant4nbCells+" cells ("+formatter.format(((double)ant4nbCells/nbTotalCells)*100)+"%)"); }
NONSATD
true
public synchronized void draw_World(){ //for each cells ant1nbCells=0; ant2nbCells=0;
public synchronized void draw_World(){ //for each cells ant1nbCells=0; ant2nbCells=0; ant3nbCells=0; ant4nbCells=0; for (int x=0;x<WIDTH;x++){ for (int y=0;y<HEIGHT;y++){ //test is colorized if (world.getLocation().get((WIDTH*y)+x).isColorized()){ //System.out.print("(x,y)=("+x+","+y+")&"); //yes draw a point with this color
public synchronized void draw_World(){ //for each cells ant1nbCells=0; ant2nbCells=0; ant3nbCells=0; ant4nbCells=0; for (int x=0;x<WIDTH;x++){ for (int y=0;y<HEIGHT;y++){ //test is colorized if (world.getLocation().get((WIDTH*y)+x).isColorized()){ //System.out.print("(x,y)=("+x+","+y+")&"); //yes draw a point with this color wimgWorld.getPixelWriter().setColor(x, y, world.getLocation().get((WIDTH*y)+x).getColorS()); if (world.getLocation().get((WIDTH*y)+x).getName().compareTo(ANT1)==0){ant1nbCells++;} if (world.getLocation().get((WIDTH*y)+x).getName().compareTo(ANT2)==0){ant2nbCells++;} if (world.getLocation().get((WIDTH*y)+x).getName().compareTo(ANT3)==0){ant3nbCells++;} if (world.getLocation().get((WIDTH*y)+x).getName().compareTo(ANT4)==0){ant4nbCells++;} } else { //no draw a black point wimgWorld.getPixelWriter().setColor(x, y, javafx.scene.paint.Color.BLACK);
24,825
2
//test is colorized
public synchronized void draw_World(){ //for each cells ant1nbCells=0; ant2nbCells=0; ant3nbCells=0; ant4nbCells=0; for (int x=0;x<WIDTH;x++){ for (int y=0;y<HEIGHT;y++){ //test is colorized if (world.getLocation().get((WIDTH*y)+x).isColorized()){ //System.out.print("(x,y)=("+x+","+y+")&"); //yes draw a point with this color wimgWorld.getPixelWriter().setColor(x, y, world.getLocation().get((WIDTH*y)+x).getColorS()); if (world.getLocation().get((WIDTH*y)+x).getName().compareTo(ANT1)==0){ant1nbCells++;} if (world.getLocation().get((WIDTH*y)+x).getName().compareTo(ANT2)==0){ant2nbCells++;} if (world.getLocation().get((WIDTH*y)+x).getName().compareTo(ANT3)==0){ant3nbCells++;} if (world.getLocation().get((WIDTH*y)+x).getName().compareTo(ANT4)==0){ant4nbCells++;} } else { //no draw a black point wimgWorld.getPixelWriter().setColor(x, y, javafx.scene.paint.Color.BLACK); } } } imgWorld.setImage(wimgWorld); //show me the result on scsreen //refresh counters lbTotalCellsNb.setText(nbTotalCells+" cells"); lbAnt1CellsNb.setText(ant1nbCells+" cells ("+formatter.format(((double)ant1nbCells/nbTotalCells)*100)+"%)"); lbAnt2CellsNb.setText(ant2nbCells+" cells ("+formatter.format(((double)ant2nbCells/nbTotalCells)*100)+"%)"); lbAnt3CellsNb.setText(ant3nbCells+" cells ("+formatter.format(((double)ant3nbCells/nbTotalCells)*100)+"%)"); lbAnt4CellsNb.setText(ant4nbCells+" cells ("+formatter.format(((double)ant4nbCells/nbTotalCells)*100)+"%)"); }
NONSATD
true
for (int x=0;x<WIDTH;x++){ for (int y=0;y<HEIGHT;y++){ //test is colorized if (world.getLocation().get((WIDTH*y)+x).isColorized()){ //System.out.print("(x,y)=("+x+","+y+")&");
public synchronized void draw_World(){ //for each cells ant1nbCells=0; ant2nbCells=0; ant3nbCells=0; ant4nbCells=0; for (int x=0;x<WIDTH;x++){ for (int y=0;y<HEIGHT;y++){ //test is colorized if (world.getLocation().get((WIDTH*y)+x).isColorized()){ //System.out.print("(x,y)=("+x+","+y+")&"); //yes draw a point with this color wimgWorld.getPixelWriter().setColor(x, y, world.getLocation().get((WIDTH*y)+x).getColorS()); if (world.getLocation().get((WIDTH*y)+x).getName().compareTo(ANT1)==0){ant1nbCells++;} if (world.getLocation().get((WIDTH*y)+x).getName().compareTo(ANT2)==0){ant2nbCells++;} if (world.getLocation().get((WIDTH*y)+x).getName().compareTo(ANT3)==0){ant3nbCells++;} if (world.getLocation().get((WIDTH*y)+x).getName().compareTo(ANT4)==0){ant4nbCells++;} } else
public synchronized void draw_World(){ //for each cells ant1nbCells=0; ant2nbCells=0; ant3nbCells=0; ant4nbCells=0; for (int x=0;x<WIDTH;x++){ for (int y=0;y<HEIGHT;y++){ //test is colorized if (world.getLocation().get((WIDTH*y)+x).isColorized()){ //System.out.print("(x,y)=("+x+","+y+")&"); //yes draw a point with this color wimgWorld.getPixelWriter().setColor(x, y, world.getLocation().get((WIDTH*y)+x).getColorS()); if (world.getLocation().get((WIDTH*y)+x).getName().compareTo(ANT1)==0){ant1nbCells++;} if (world.getLocation().get((WIDTH*y)+x).getName().compareTo(ANT2)==0){ant2nbCells++;} if (world.getLocation().get((WIDTH*y)+x).getName().compareTo(ANT3)==0){ant3nbCells++;} if (world.getLocation().get((WIDTH*y)+x).getName().compareTo(ANT4)==0){ant4nbCells++;} } else { //no draw a black point wimgWorld.getPixelWriter().setColor(x, y, javafx.scene.paint.Color.BLACK); } } } imgWorld.setImage(wimgWorld); //show me the result on scsreen //refresh counters lbTotalCellsNb.setText(nbTotalCells+" cells"); lbAnt1CellsNb.setText(ant1nbCells+" cells ("+formatter.format(((double)ant1nbCells/nbTotalCells)*100)+"%)");
24,825
3
//System.out.print("(x,y)=("+x+","+y+")&"); //yes draw a point with this color
public synchronized void draw_World(){ //for each cells ant1nbCells=0; ant2nbCells=0; ant3nbCells=0; ant4nbCells=0; for (int x=0;x<WIDTH;x++){ for (int y=0;y<HEIGHT;y++){ //test is colorized if (world.getLocation().get((WIDTH*y)+x).isColorized()){ //System.out.print("(x,y)=("+x+","+y+")&"); //yes draw a point with this color wimgWorld.getPixelWriter().setColor(x, y, world.getLocation().get((WIDTH*y)+x).getColorS()); if (world.getLocation().get((WIDTH*y)+x).getName().compareTo(ANT1)==0){ant1nbCells++;} if (world.getLocation().get((WIDTH*y)+x).getName().compareTo(ANT2)==0){ant2nbCells++;} if (world.getLocation().get((WIDTH*y)+x).getName().compareTo(ANT3)==0){ant3nbCells++;} if (world.getLocation().get((WIDTH*y)+x).getName().compareTo(ANT4)==0){ant4nbCells++;} } else { //no draw a black point wimgWorld.getPixelWriter().setColor(x, y, javafx.scene.paint.Color.BLACK); } } } imgWorld.setImage(wimgWorld); //show me the result on scsreen //refresh counters lbTotalCellsNb.setText(nbTotalCells+" cells"); lbAnt1CellsNb.setText(ant1nbCells+" cells ("+formatter.format(((double)ant1nbCells/nbTotalCells)*100)+"%)"); lbAnt2CellsNb.setText(ant2nbCells+" cells ("+formatter.format(((double)ant2nbCells/nbTotalCells)*100)+"%)"); lbAnt3CellsNb.setText(ant3nbCells+" cells ("+formatter.format(((double)ant3nbCells/nbTotalCells)*100)+"%)"); lbAnt4CellsNb.setText(ant4nbCells+" cells ("+formatter.format(((double)ant4nbCells/nbTotalCells)*100)+"%)"); }
NONSATD
true
//test is colorized if (world.getLocation().get((WIDTH*y)+x).isColorized()){ //System.out.print("(x,y)=("+x+","+y+")&"); //yes draw a point with this color wimgWorld.getPixelWriter().setColor(x, y, world.getLocation().get((WIDTH*y)+x).getColorS()); if (world.getLocation().get((WIDTH*y)+x).getName().compareTo(ANT1)==0){ant1nbCells++;}
public synchronized void draw_World(){ //for each cells ant1nbCells=0; ant2nbCells=0; ant3nbCells=0; ant4nbCells=0; for (int x=0;x<WIDTH;x++){ for (int y=0;y<HEIGHT;y++){ //test is colorized if (world.getLocation().get((WIDTH*y)+x).isColorized()){ //System.out.print("(x,y)=("+x+","+y+")&"); //yes draw a point with this color wimgWorld.getPixelWriter().setColor(x, y, world.getLocation().get((WIDTH*y)+x).getColorS()); if (world.getLocation().get((WIDTH*y)+x).getName().compareTo(ANT1)==0){ant1nbCells++;} if (world.getLocation().get((WIDTH*y)+x).getName().compareTo(ANT2)==0){ant2nbCells++;} if (world.getLocation().get((WIDTH*y)+x).getName().compareTo(ANT3)==0){ant3nbCells++;} if (world.getLocation().get((WIDTH*y)+x).getName().compareTo(ANT4)==0){ant4nbCells++;} } else { //no draw a black point wimgWorld.getPixelWriter().setColor(x, y, javafx.scene.paint.Color.BLACK);
public synchronized void draw_World(){ //for each cells ant1nbCells=0; ant2nbCells=0; ant3nbCells=0; ant4nbCells=0; for (int x=0;x<WIDTH;x++){ for (int y=0;y<HEIGHT;y++){ //test is colorized if (world.getLocation().get((WIDTH*y)+x).isColorized()){ //System.out.print("(x,y)=("+x+","+y+")&"); //yes draw a point with this color wimgWorld.getPixelWriter().setColor(x, y, world.getLocation().get((WIDTH*y)+x).getColorS()); if (world.getLocation().get((WIDTH*y)+x).getName().compareTo(ANT1)==0){ant1nbCells++;} if (world.getLocation().get((WIDTH*y)+x).getName().compareTo(ANT2)==0){ant2nbCells++;} if (world.getLocation().get((WIDTH*y)+x).getName().compareTo(ANT3)==0){ant3nbCells++;} if (world.getLocation().get((WIDTH*y)+x).getName().compareTo(ANT4)==0){ant4nbCells++;} } else { //no draw a black point wimgWorld.getPixelWriter().setColor(x, y, javafx.scene.paint.Color.BLACK); } } } imgWorld.setImage(wimgWorld); //show me the result on scsreen //refresh counters lbTotalCellsNb.setText(nbTotalCells+" cells"); lbAnt1CellsNb.setText(ant1nbCells+" cells ("+formatter.format(((double)ant1nbCells/nbTotalCells)*100)+"%)"); lbAnt2CellsNb.setText(ant2nbCells+" cells ("+formatter.format(((double)ant2nbCells/nbTotalCells)*100)+"%)"); lbAnt3CellsNb.setText(ant3nbCells+" cells ("+formatter.format(((double)ant3nbCells/nbTotalCells)*100)+"%)"); lbAnt4CellsNb.setText(ant4nbCells+" cells ("+formatter.format(((double)ant4nbCells/nbTotalCells)*100)+"%)");
24,825
4
//no draw a black point
public synchronized void draw_World(){ //for each cells ant1nbCells=0; ant2nbCells=0; ant3nbCells=0; ant4nbCells=0; for (int x=0;x<WIDTH;x++){ for (int y=0;y<HEIGHT;y++){ //test is colorized if (world.getLocation().get((WIDTH*y)+x).isColorized()){ //System.out.print("(x,y)=("+x+","+y+")&"); //yes draw a point with this color wimgWorld.getPixelWriter().setColor(x, y, world.getLocation().get((WIDTH*y)+x).getColorS()); if (world.getLocation().get((WIDTH*y)+x).getName().compareTo(ANT1)==0){ant1nbCells++;} if (world.getLocation().get((WIDTH*y)+x).getName().compareTo(ANT2)==0){ant2nbCells++;} if (world.getLocation().get((WIDTH*y)+x).getName().compareTo(ANT3)==0){ant3nbCells++;} if (world.getLocation().get((WIDTH*y)+x).getName().compareTo(ANT4)==0){ant4nbCells++;} } else { //no draw a black point wimgWorld.getPixelWriter().setColor(x, y, javafx.scene.paint.Color.BLACK); } } } imgWorld.setImage(wimgWorld); //show me the result on scsreen //refresh counters lbTotalCellsNb.setText(nbTotalCells+" cells"); lbAnt1CellsNb.setText(ant1nbCells+" cells ("+formatter.format(((double)ant1nbCells/nbTotalCells)*100)+"%)"); lbAnt2CellsNb.setText(ant2nbCells+" cells ("+formatter.format(((double)ant2nbCells/nbTotalCells)*100)+"%)"); lbAnt3CellsNb.setText(ant3nbCells+" cells ("+formatter.format(((double)ant3nbCells/nbTotalCells)*100)+"%)"); lbAnt4CellsNb.setText(ant4nbCells+" cells ("+formatter.format(((double)ant4nbCells/nbTotalCells)*100)+"%)"); }
NONSATD
true
else { //no draw a black point wimgWorld.getPixelWriter().setColor(x, y, javafx.scene.paint.Color.BLACK); }
//System.out.print("(x,y)=("+x+","+y+")&"); //yes draw a point with this color wimgWorld.getPixelWriter().setColor(x, y, world.getLocation().get((WIDTH*y)+x).getColorS()); if (world.getLocation().get((WIDTH*y)+x).getName().compareTo(ANT1)==0){ant1nbCells++;} if (world.getLocation().get((WIDTH*y)+x).getName().compareTo(ANT2)==0){ant2nbCells++;} if (world.getLocation().get((WIDTH*y)+x).getName().compareTo(ANT3)==0){ant3nbCells++;} if (world.getLocation().get((WIDTH*y)+x).getName().compareTo(ANT4)==0){ant4nbCells++;} } else { //no draw a black point wimgWorld.getPixelWriter().setColor(x, y, javafx.scene.paint.Color.BLACK); } } } imgWorld.setImage(wimgWorld); //show me the result on scsreen //refresh counters lbTotalCellsNb.setText(nbTotalCells+" cells"); lbAnt1CellsNb.setText(ant1nbCells+" cells ("+formatter.format(((double)ant1nbCells/nbTotalCells)*100)+"%)"); lbAnt2CellsNb.setText(ant2nbCells+" cells ("+formatter.format(((double)ant2nbCells/nbTotalCells)*100)+"%)"); lbAnt3CellsNb.setText(ant3nbCells+" cells ("+formatter.format(((double)ant3nbCells/nbTotalCells)*100)+"%)");
public synchronized void draw_World(){ //for each cells ant1nbCells=0; ant2nbCells=0; ant3nbCells=0; ant4nbCells=0; for (int x=0;x<WIDTH;x++){ for (int y=0;y<HEIGHT;y++){ //test is colorized if (world.getLocation().get((WIDTH*y)+x).isColorized()){ //System.out.print("(x,y)=("+x+","+y+")&"); //yes draw a point with this color wimgWorld.getPixelWriter().setColor(x, y, world.getLocation().get((WIDTH*y)+x).getColorS()); if (world.getLocation().get((WIDTH*y)+x).getName().compareTo(ANT1)==0){ant1nbCells++;} if (world.getLocation().get((WIDTH*y)+x).getName().compareTo(ANT2)==0){ant2nbCells++;} if (world.getLocation().get((WIDTH*y)+x).getName().compareTo(ANT3)==0){ant3nbCells++;} if (world.getLocation().get((WIDTH*y)+x).getName().compareTo(ANT4)==0){ant4nbCells++;} } else { //no draw a black point wimgWorld.getPixelWriter().setColor(x, y, javafx.scene.paint.Color.BLACK); } } } imgWorld.setImage(wimgWorld); //show me the result on scsreen //refresh counters lbTotalCellsNb.setText(nbTotalCells+" cells"); lbAnt1CellsNb.setText(ant1nbCells+" cells ("+formatter.format(((double)ant1nbCells/nbTotalCells)*100)+"%)"); lbAnt2CellsNb.setText(ant2nbCells+" cells ("+formatter.format(((double)ant2nbCells/nbTotalCells)*100)+"%)"); lbAnt3CellsNb.setText(ant3nbCells+" cells ("+formatter.format(((double)ant3nbCells/nbTotalCells)*100)+"%)"); lbAnt4CellsNb.setText(ant4nbCells+" cells ("+formatter.format(((double)ant4nbCells/nbTotalCells)*100)+"%)"); }
24,825
5
//show me the result on scsreen
public synchronized void draw_World(){ //for each cells ant1nbCells=0; ant2nbCells=0; ant3nbCells=0; ant4nbCells=0; for (int x=0;x<WIDTH;x++){ for (int y=0;y<HEIGHT;y++){ //test is colorized if (world.getLocation().get((WIDTH*y)+x).isColorized()){ //System.out.print("(x,y)=("+x+","+y+")&"); //yes draw a point with this color wimgWorld.getPixelWriter().setColor(x, y, world.getLocation().get((WIDTH*y)+x).getColorS()); if (world.getLocation().get((WIDTH*y)+x).getName().compareTo(ANT1)==0){ant1nbCells++;} if (world.getLocation().get((WIDTH*y)+x).getName().compareTo(ANT2)==0){ant2nbCells++;} if (world.getLocation().get((WIDTH*y)+x).getName().compareTo(ANT3)==0){ant3nbCells++;} if (world.getLocation().get((WIDTH*y)+x).getName().compareTo(ANT4)==0){ant4nbCells++;} } else { //no draw a black point wimgWorld.getPixelWriter().setColor(x, y, javafx.scene.paint.Color.BLACK); } } } imgWorld.setImage(wimgWorld); //show me the result on scsreen //refresh counters lbTotalCellsNb.setText(nbTotalCells+" cells"); lbAnt1CellsNb.setText(ant1nbCells+" cells ("+formatter.format(((double)ant1nbCells/nbTotalCells)*100)+"%)"); lbAnt2CellsNb.setText(ant2nbCells+" cells ("+formatter.format(((double)ant2nbCells/nbTotalCells)*100)+"%)"); lbAnt3CellsNb.setText(ant3nbCells+" cells ("+formatter.format(((double)ant3nbCells/nbTotalCells)*100)+"%)"); lbAnt4CellsNb.setText(ant4nbCells+" cells ("+formatter.format(((double)ant4nbCells/nbTotalCells)*100)+"%)"); }
NONSATD
true
} } imgWorld.setImage(wimgWorld); //show me the result on scsreen //refresh counters lbTotalCellsNb.setText(nbTotalCells+" cells");
if (world.getLocation().get((WIDTH*y)+x).getName().compareTo(ANT3)==0){ant3nbCells++;} if (world.getLocation().get((WIDTH*y)+x).getName().compareTo(ANT4)==0){ant4nbCells++;} } else { //no draw a black point wimgWorld.getPixelWriter().setColor(x, y, javafx.scene.paint.Color.BLACK); } } } imgWorld.setImage(wimgWorld); //show me the result on scsreen //refresh counters lbTotalCellsNb.setText(nbTotalCells+" cells"); lbAnt1CellsNb.setText(ant1nbCells+" cells ("+formatter.format(((double)ant1nbCells/nbTotalCells)*100)+"%)"); lbAnt2CellsNb.setText(ant2nbCells+" cells ("+formatter.format(((double)ant2nbCells/nbTotalCells)*100)+"%)"); lbAnt3CellsNb.setText(ant3nbCells+" cells ("+formatter.format(((double)ant3nbCells/nbTotalCells)*100)+"%)"); lbAnt4CellsNb.setText(ant4nbCells+" cells ("+formatter.format(((double)ant4nbCells/nbTotalCells)*100)+"%)"); }
ant4nbCells=0; for (int x=0;x<WIDTH;x++){ for (int y=0;y<HEIGHT;y++){ //test is colorized if (world.getLocation().get((WIDTH*y)+x).isColorized()){ //System.out.print("(x,y)=("+x+","+y+")&"); //yes draw a point with this color wimgWorld.getPixelWriter().setColor(x, y, world.getLocation().get((WIDTH*y)+x).getColorS()); if (world.getLocation().get((WIDTH*y)+x).getName().compareTo(ANT1)==0){ant1nbCells++;} if (world.getLocation().get((WIDTH*y)+x).getName().compareTo(ANT2)==0){ant2nbCells++;} if (world.getLocation().get((WIDTH*y)+x).getName().compareTo(ANT3)==0){ant3nbCells++;} if (world.getLocation().get((WIDTH*y)+x).getName().compareTo(ANT4)==0){ant4nbCells++;} } else { //no draw a black point wimgWorld.getPixelWriter().setColor(x, y, javafx.scene.paint.Color.BLACK); } } } imgWorld.setImage(wimgWorld); //show me the result on scsreen //refresh counters lbTotalCellsNb.setText(nbTotalCells+" cells"); lbAnt1CellsNb.setText(ant1nbCells+" cells ("+formatter.format(((double)ant1nbCells/nbTotalCells)*100)+"%)"); lbAnt2CellsNb.setText(ant2nbCells+" cells ("+formatter.format(((double)ant2nbCells/nbTotalCells)*100)+"%)"); lbAnt3CellsNb.setText(ant3nbCells+" cells ("+formatter.format(((double)ant3nbCells/nbTotalCells)*100)+"%)"); lbAnt4CellsNb.setText(ant4nbCells+" cells ("+formatter.format(((double)ant4nbCells/nbTotalCells)*100)+"%)"); }
24,825
6
//refresh counters
public synchronized void draw_World(){ //for each cells ant1nbCells=0; ant2nbCells=0; ant3nbCells=0; ant4nbCells=0; for (int x=0;x<WIDTH;x++){ for (int y=0;y<HEIGHT;y++){ //test is colorized if (world.getLocation().get((WIDTH*y)+x).isColorized()){ //System.out.print("(x,y)=("+x+","+y+")&"); //yes draw a point with this color wimgWorld.getPixelWriter().setColor(x, y, world.getLocation().get((WIDTH*y)+x).getColorS()); if (world.getLocation().get((WIDTH*y)+x).getName().compareTo(ANT1)==0){ant1nbCells++;} if (world.getLocation().get((WIDTH*y)+x).getName().compareTo(ANT2)==0){ant2nbCells++;} if (world.getLocation().get((WIDTH*y)+x).getName().compareTo(ANT3)==0){ant3nbCells++;} if (world.getLocation().get((WIDTH*y)+x).getName().compareTo(ANT4)==0){ant4nbCells++;} } else { //no draw a black point wimgWorld.getPixelWriter().setColor(x, y, javafx.scene.paint.Color.BLACK); } } } imgWorld.setImage(wimgWorld); //show me the result on scsreen //refresh counters lbTotalCellsNb.setText(nbTotalCells+" cells"); lbAnt1CellsNb.setText(ant1nbCells+" cells ("+formatter.format(((double)ant1nbCells/nbTotalCells)*100)+"%)"); lbAnt2CellsNb.setText(ant2nbCells+" cells ("+formatter.format(((double)ant2nbCells/nbTotalCells)*100)+"%)"); lbAnt3CellsNb.setText(ant3nbCells+" cells ("+formatter.format(((double)ant3nbCells/nbTotalCells)*100)+"%)"); lbAnt4CellsNb.setText(ant4nbCells+" cells ("+formatter.format(((double)ant4nbCells/nbTotalCells)*100)+"%)"); }
NONSATD
true
} imgWorld.setImage(wimgWorld); //show me the result on scsreen //refresh counters lbTotalCellsNb.setText(nbTotalCells+" cells"); lbAnt1CellsNb.setText(ant1nbCells+" cells ("+formatter.format(((double)ant1nbCells/nbTotalCells)*100)+"%)");
if (world.getLocation().get((WIDTH*y)+x).getName().compareTo(ANT4)==0){ant4nbCells++;} } else { //no draw a black point wimgWorld.getPixelWriter().setColor(x, y, javafx.scene.paint.Color.BLACK); } } } imgWorld.setImage(wimgWorld); //show me the result on scsreen //refresh counters lbTotalCellsNb.setText(nbTotalCells+" cells"); lbAnt1CellsNb.setText(ant1nbCells+" cells ("+formatter.format(((double)ant1nbCells/nbTotalCells)*100)+"%)"); lbAnt2CellsNb.setText(ant2nbCells+" cells ("+formatter.format(((double)ant2nbCells/nbTotalCells)*100)+"%)"); lbAnt3CellsNb.setText(ant3nbCells+" cells ("+formatter.format(((double)ant3nbCells/nbTotalCells)*100)+"%)"); lbAnt4CellsNb.setText(ant4nbCells+" cells ("+formatter.format(((double)ant4nbCells/nbTotalCells)*100)+"%)"); }
for (int x=0;x<WIDTH;x++){ for (int y=0;y<HEIGHT;y++){ //test is colorized if (world.getLocation().get((WIDTH*y)+x).isColorized()){ //System.out.print("(x,y)=("+x+","+y+")&"); //yes draw a point with this color wimgWorld.getPixelWriter().setColor(x, y, world.getLocation().get((WIDTH*y)+x).getColorS()); if (world.getLocation().get((WIDTH*y)+x).getName().compareTo(ANT1)==0){ant1nbCells++;} if (world.getLocation().get((WIDTH*y)+x).getName().compareTo(ANT2)==0){ant2nbCells++;} if (world.getLocation().get((WIDTH*y)+x).getName().compareTo(ANT3)==0){ant3nbCells++;} if (world.getLocation().get((WIDTH*y)+x).getName().compareTo(ANT4)==0){ant4nbCells++;} } else { //no draw a black point wimgWorld.getPixelWriter().setColor(x, y, javafx.scene.paint.Color.BLACK); } } } imgWorld.setImage(wimgWorld); //show me the result on scsreen //refresh counters lbTotalCellsNb.setText(nbTotalCells+" cells"); lbAnt1CellsNb.setText(ant1nbCells+" cells ("+formatter.format(((double)ant1nbCells/nbTotalCells)*100)+"%)"); lbAnt2CellsNb.setText(ant2nbCells+" cells ("+formatter.format(((double)ant2nbCells/nbTotalCells)*100)+"%)"); lbAnt3CellsNb.setText(ant3nbCells+" cells ("+formatter.format(((double)ant3nbCells/nbTotalCells)*100)+"%)"); lbAnt4CellsNb.setText(ant4nbCells+" cells ("+formatter.format(((double)ant4nbCells/nbTotalCells)*100)+"%)"); }
33,024
0
// TODO All following Node inherited methods will be apply under full versioning
public Node addNode(String s) throws ItemExistsException, PathNotFoundException, VersionException, ConstraintViolationException, LockException, RepositoryException { return null; }
IMPLEMENTATION
true
public Node addNode(String s) throws ItemExistsException, PathNotFoundException, VersionException, ConstraintViolationException, LockException, RepositoryException { return null; }
public Node addNode(String s) throws ItemExistsException, PathNotFoundException, VersionException, ConstraintViolationException, LockException, RepositoryException { return null; }
public Node addNode(String s) throws ItemExistsException, PathNotFoundException, VersionException, ConstraintViolationException, LockException, RepositoryException { return null; }
8,457
0
/** * Start this processor. The processor will open an event stream on its message source in a new thread using {@link * StreamableMessageSource#openStream(TrackingToken)}. The {@link TrackingToken} used to open the stream will be * fetched from the {@link TokenStore}. * <p> * Upon start up of an application, this method will be invoked in the {@link Phase#INBOUND_EVENT_CONNECTORS} * phase. */
@Override @StartHandler(phase = Phase.INBOUND_EVENT_CONNECTORS) public void start() { if (activeProcessorThreads() > 0 || workLauncherRunning.get()) { if (state.get().isRunning()) { // then it's ok. It's already running return; } else { // this is problematic. There are still active threads pending a shutdown. throw new IllegalStateException("Cannot start this processor. It is pending shutdown..."); } } State previousState = state.getAndSet(State.STARTED); if (!previousState.isRunning()) { startSegmentWorkers(); } }
NONSATD
true
@Override @StartHandler(phase = Phase.INBOUND_EVENT_CONNECTORS) public void start() { if (activeProcessorThreads() > 0 || workLauncherRunning.get()) { if (state.get().isRunning()) { // then it's ok. It's already running return; } else { // this is problematic. There are still active threads pending a shutdown. throw new IllegalStateException("Cannot start this processor. It is pending shutdown..."); } } State previousState = state.getAndSet(State.STARTED); if (!previousState.isRunning()) { startSegmentWorkers(); } }
@Override @StartHandler(phase = Phase.INBOUND_EVENT_CONNECTORS) public void start() { if (activeProcessorThreads() > 0 || workLauncherRunning.get()) { if (state.get().isRunning()) { // then it's ok. It's already running return; } else { // this is problematic. There are still active threads pending a shutdown. throw new IllegalStateException("Cannot start this processor. It is pending shutdown..."); } } State previousState = state.getAndSet(State.STARTED); if (!previousState.isRunning()) { startSegmentWorkers(); } }
@Override @StartHandler(phase = Phase.INBOUND_EVENT_CONNECTORS) public void start() { if (activeProcessorThreads() > 0 || workLauncherRunning.get()) { if (state.get().isRunning()) { // then it's ok. It's already running return; } else { // this is problematic. There are still active threads pending a shutdown. throw new IllegalStateException("Cannot start this processor. It is pending shutdown..."); } } State previousState = state.getAndSet(State.STARTED); if (!previousState.isRunning()) { startSegmentWorkers(); } }
8,457
1
// then it's ok. It's already running
@Override @StartHandler(phase = Phase.INBOUND_EVENT_CONNECTORS) public void start() { if (activeProcessorThreads() > 0 || workLauncherRunning.get()) { if (state.get().isRunning()) { // then it's ok. It's already running return; } else { // this is problematic. There are still active threads pending a shutdown. throw new IllegalStateException("Cannot start this processor. It is pending shutdown..."); } } State previousState = state.getAndSet(State.STARTED); if (!previousState.isRunning()) { startSegmentWorkers(); } }
NONSATD
true
if (activeProcessorThreads() > 0 || workLauncherRunning.get()) { if (state.get().isRunning()) { // then it's ok. It's already running return; } else {
@Override @StartHandler(phase = Phase.INBOUND_EVENT_CONNECTORS) public void start() { if (activeProcessorThreads() > 0 || workLauncherRunning.get()) { if (state.get().isRunning()) { // then it's ok. It's already running return; } else { // this is problematic. There are still active threads pending a shutdown. throw new IllegalStateException("Cannot start this processor. It is pending shutdown..."); } } State previousState = state.getAndSet(State.STARTED); if (!previousState.isRunning()) { startSegmentWorkers(); }
@Override @StartHandler(phase = Phase.INBOUND_EVENT_CONNECTORS) public void start() { if (activeProcessorThreads() > 0 || workLauncherRunning.get()) { if (state.get().isRunning()) { // then it's ok. It's already running return; } else { // this is problematic. There are still active threads pending a shutdown. throw new IllegalStateException("Cannot start this processor. It is pending shutdown..."); } } State previousState = state.getAndSet(State.STARTED); if (!previousState.isRunning()) { startSegmentWorkers(); } }
8,457
2
// this is problematic. There are still active threads pending a shutdown.
@Override @StartHandler(phase = Phase.INBOUND_EVENT_CONNECTORS) public void start() { if (activeProcessorThreads() > 0 || workLauncherRunning.get()) { if (state.get().isRunning()) { // then it's ok. It's already running return; } else { // this is problematic. There are still active threads pending a shutdown. throw new IllegalStateException("Cannot start this processor. It is pending shutdown..."); } } State previousState = state.getAndSet(State.STARTED); if (!previousState.isRunning()) { startSegmentWorkers(); } }
DEFECT
true
return; } else { // this is problematic. There are still active threads pending a shutdown. throw new IllegalStateException("Cannot start this processor. It is pending shutdown..."); }
@Override @StartHandler(phase = Phase.INBOUND_EVENT_CONNECTORS) public void start() { if (activeProcessorThreads() > 0 || workLauncherRunning.get()) { if (state.get().isRunning()) { // then it's ok. It's already running return; } else { // this is problematic. There are still active threads pending a shutdown. throw new IllegalStateException("Cannot start this processor. It is pending shutdown..."); } } State previousState = state.getAndSet(State.STARTED); if (!previousState.isRunning()) { startSegmentWorkers(); } }
@Override @StartHandler(phase = Phase.INBOUND_EVENT_CONNECTORS) public void start() { if (activeProcessorThreads() > 0 || workLauncherRunning.get()) { if (state.get().isRunning()) { // then it's ok. It's already running return; } else { // this is problematic. There are still active threads pending a shutdown. throw new IllegalStateException("Cannot start this processor. It is pending shutdown..."); } } State previousState = state.getAndSet(State.STARTED); if (!previousState.isRunning()) { startSegmentWorkers(); } }
275
0
// arg is Event
public void update(Observable arg0, Object arg) { // arg is Event if (!(arg instanceof Event)) return; Event event = (Event) arg; // check the event function against the functions we have notifications watching for String function = event.getEvent(); //we err on the side of caution here in checking all events that might invalidate the data in the cache -DH if (UserDirectoryService.SECURE_ADD_USER.equals(function) || UserDirectoryService.SECURE_UPDATE_USER_OWN_PASSWORD.equals(function) || UserDirectoryService.SECURE_UPDATE_USER_ANY.equals(function) || UserDirectoryService.SECURE_UPDATE_USER_OWN.equals(function)) { //we need the userId Reference ref = entityManager.newReference(event.getResource()); // look for group reference. Need to replace it with parent site reference String refId = ref.getId(); try { String eid = userDirectoryService.getUserEid(refId); log.debug("removing " + eid + " from cache"); authenticationCache.removeAuthentification(eid); userCache.remove(UserDirectoryService.IDCACHE + eid); userCache.remove(UserDirectoryService.EIDCACHE + refId); } catch (UserNotDefinedException e) { //not sure how we'd end up here log.warn(e.getMessage(), e); } } }
NONSATD
true
public void update(Observable arg0, Object arg) { // arg is Event if (!(arg instanceof Event)) return;
public void update(Observable arg0, Object arg) { // arg is Event if (!(arg instanceof Event)) return; Event event = (Event) arg; // check the event function against the functions we have notifications watching for String function = event.getEvent(); //we err on the side of caution here in checking all events that might invalidate the data in the cache -DH if (UserDirectoryService.SECURE_ADD_USER.equals(function) || UserDirectoryService.SECURE_UPDATE_USER_OWN_PASSWORD.equals(function) || UserDirectoryService.SECURE_UPDATE_USER_ANY.equals(function) || UserDirectoryService.SECURE_UPDATE_USER_OWN.equals(function)) { //we need the userId Reference ref = entityManager.newReference(event.getResource());
public void update(Observable arg0, Object arg) { // arg is Event if (!(arg instanceof Event)) return; Event event = (Event) arg; // check the event function against the functions we have notifications watching for String function = event.getEvent(); //we err on the side of caution here in checking all events that might invalidate the data in the cache -DH if (UserDirectoryService.SECURE_ADD_USER.equals(function) || UserDirectoryService.SECURE_UPDATE_USER_OWN_PASSWORD.equals(function) || UserDirectoryService.SECURE_UPDATE_USER_ANY.equals(function) || UserDirectoryService.SECURE_UPDATE_USER_OWN.equals(function)) { //we need the userId Reference ref = entityManager.newReference(event.getResource()); // look for group reference. Need to replace it with parent site reference String refId = ref.getId(); try { String eid = userDirectoryService.getUserEid(refId); log.debug("removing " + eid + " from cache"); authenticationCache.removeAuthentification(eid); userCache.remove(UserDirectoryService.IDCACHE + eid); userCache.remove(UserDirectoryService.EIDCACHE + refId); } catch (UserNotDefinedException e) { //not sure how we'd end up here
275
1
// check the event function against the functions we have notifications watching for
public void update(Observable arg0, Object arg) { // arg is Event if (!(arg instanceof Event)) return; Event event = (Event) arg; // check the event function against the functions we have notifications watching for String function = event.getEvent(); //we err on the side of caution here in checking all events that might invalidate the data in the cache -DH if (UserDirectoryService.SECURE_ADD_USER.equals(function) || UserDirectoryService.SECURE_UPDATE_USER_OWN_PASSWORD.equals(function) || UserDirectoryService.SECURE_UPDATE_USER_ANY.equals(function) || UserDirectoryService.SECURE_UPDATE_USER_OWN.equals(function)) { //we need the userId Reference ref = entityManager.newReference(event.getResource()); // look for group reference. Need to replace it with parent site reference String refId = ref.getId(); try { String eid = userDirectoryService.getUserEid(refId); log.debug("removing " + eid + " from cache"); authenticationCache.removeAuthentification(eid); userCache.remove(UserDirectoryService.IDCACHE + eid); userCache.remove(UserDirectoryService.EIDCACHE + refId); } catch (UserNotDefinedException e) { //not sure how we'd end up here log.warn(e.getMessage(), e); } } }
NONSATD
true
return; Event event = (Event) arg; // check the event function against the functions we have notifications watching for String function = event.getEvent(); //we err on the side of caution here in checking all events that might invalidate the data in the cache -DH
public void update(Observable arg0, Object arg) { // arg is Event if (!(arg instanceof Event)) return; Event event = (Event) arg; // check the event function against the functions we have notifications watching for String function = event.getEvent(); //we err on the side of caution here in checking all events that might invalidate the data in the cache -DH if (UserDirectoryService.SECURE_ADD_USER.equals(function) || UserDirectoryService.SECURE_UPDATE_USER_OWN_PASSWORD.equals(function) || UserDirectoryService.SECURE_UPDATE_USER_ANY.equals(function) || UserDirectoryService.SECURE_UPDATE_USER_OWN.equals(function)) { //we need the userId Reference ref = entityManager.newReference(event.getResource()); // look for group reference. Need to replace it with parent site reference String refId = ref.getId(); try { String eid = userDirectoryService.getUserEid(refId);
public void update(Observable arg0, Object arg) { // arg is Event if (!(arg instanceof Event)) return; Event event = (Event) arg; // check the event function against the functions we have notifications watching for String function = event.getEvent(); //we err on the side of caution here in checking all events that might invalidate the data in the cache -DH if (UserDirectoryService.SECURE_ADD_USER.equals(function) || UserDirectoryService.SECURE_UPDATE_USER_OWN_PASSWORD.equals(function) || UserDirectoryService.SECURE_UPDATE_USER_ANY.equals(function) || UserDirectoryService.SECURE_UPDATE_USER_OWN.equals(function)) { //we need the userId Reference ref = entityManager.newReference(event.getResource()); // look for group reference. Need to replace it with parent site reference String refId = ref.getId(); try { String eid = userDirectoryService.getUserEid(refId); log.debug("removing " + eid + " from cache"); authenticationCache.removeAuthentification(eid); userCache.remove(UserDirectoryService.IDCACHE + eid); userCache.remove(UserDirectoryService.EIDCACHE + refId); } catch (UserNotDefinedException e) { //not sure how we'd end up here log.warn(e.getMessage(), e); } } }
275
2
//we err on the side of caution here in checking all events that might invalidate the data in the cache -DH
public void update(Observable arg0, Object arg) { // arg is Event if (!(arg instanceof Event)) return; Event event = (Event) arg; // check the event function against the functions we have notifications watching for String function = event.getEvent(); //we err on the side of caution here in checking all events that might invalidate the data in the cache -DH if (UserDirectoryService.SECURE_ADD_USER.equals(function) || UserDirectoryService.SECURE_UPDATE_USER_OWN_PASSWORD.equals(function) || UserDirectoryService.SECURE_UPDATE_USER_ANY.equals(function) || UserDirectoryService.SECURE_UPDATE_USER_OWN.equals(function)) { //we need the userId Reference ref = entityManager.newReference(event.getResource()); // look for group reference. Need to replace it with parent site reference String refId = ref.getId(); try { String eid = userDirectoryService.getUserEid(refId); log.debug("removing " + eid + " from cache"); authenticationCache.removeAuthentification(eid); userCache.remove(UserDirectoryService.IDCACHE + eid); userCache.remove(UserDirectoryService.EIDCACHE + refId); } catch (UserNotDefinedException e) { //not sure how we'd end up here log.warn(e.getMessage(), e); } } }
NONSATD
true
// check the event function against the functions we have notifications watching for String function = event.getEvent(); //we err on the side of caution here in checking all events that might invalidate the data in the cache -DH if (UserDirectoryService.SECURE_ADD_USER.equals(function) || UserDirectoryService.SECURE_UPDATE_USER_OWN_PASSWORD.equals(function) || UserDirectoryService.SECURE_UPDATE_USER_ANY.equals(function) || UserDirectoryService.SECURE_UPDATE_USER_OWN.equals(function)) {
public void update(Observable arg0, Object arg) { // arg is Event if (!(arg instanceof Event)) return; Event event = (Event) arg; // check the event function against the functions we have notifications watching for String function = event.getEvent(); //we err on the side of caution here in checking all events that might invalidate the data in the cache -DH if (UserDirectoryService.SECURE_ADD_USER.equals(function) || UserDirectoryService.SECURE_UPDATE_USER_OWN_PASSWORD.equals(function) || UserDirectoryService.SECURE_UPDATE_USER_ANY.equals(function) || UserDirectoryService.SECURE_UPDATE_USER_OWN.equals(function)) { //we need the userId Reference ref = entityManager.newReference(event.getResource()); // look for group reference. Need to replace it with parent site reference String refId = ref.getId(); try { String eid = userDirectoryService.getUserEid(refId); log.debug("removing " + eid + " from cache"); authenticationCache.removeAuthentification(eid);
public void update(Observable arg0, Object arg) { // arg is Event if (!(arg instanceof Event)) return; Event event = (Event) arg; // check the event function against the functions we have notifications watching for String function = event.getEvent(); //we err on the side of caution here in checking all events that might invalidate the data in the cache -DH if (UserDirectoryService.SECURE_ADD_USER.equals(function) || UserDirectoryService.SECURE_UPDATE_USER_OWN_PASSWORD.equals(function) || UserDirectoryService.SECURE_UPDATE_USER_ANY.equals(function) || UserDirectoryService.SECURE_UPDATE_USER_OWN.equals(function)) { //we need the userId Reference ref = entityManager.newReference(event.getResource()); // look for group reference. Need to replace it with parent site reference String refId = ref.getId(); try { String eid = userDirectoryService.getUserEid(refId); log.debug("removing " + eid + " from cache"); authenticationCache.removeAuthentification(eid); userCache.remove(UserDirectoryService.IDCACHE + eid); userCache.remove(UserDirectoryService.EIDCACHE + refId); } catch (UserNotDefinedException e) { //not sure how we'd end up here log.warn(e.getMessage(), e); } } }
275
3
//we need the userId
public void update(Observable arg0, Object arg) { // arg is Event if (!(arg instanceof Event)) return; Event event = (Event) arg; // check the event function against the functions we have notifications watching for String function = event.getEvent(); //we err on the side of caution here in checking all events that might invalidate the data in the cache -DH if (UserDirectoryService.SECURE_ADD_USER.equals(function) || UserDirectoryService.SECURE_UPDATE_USER_OWN_PASSWORD.equals(function) || UserDirectoryService.SECURE_UPDATE_USER_ANY.equals(function) || UserDirectoryService.SECURE_UPDATE_USER_OWN.equals(function)) { //we need the userId Reference ref = entityManager.newReference(event.getResource()); // look for group reference. Need to replace it with parent site reference String refId = ref.getId(); try { String eid = userDirectoryService.getUserEid(refId); log.debug("removing " + eid + " from cache"); authenticationCache.removeAuthentification(eid); userCache.remove(UserDirectoryService.IDCACHE + eid); userCache.remove(UserDirectoryService.EIDCACHE + refId); } catch (UserNotDefinedException e) { //not sure how we'd end up here log.warn(e.getMessage(), e); } } }
NONSATD
true
if (UserDirectoryService.SECURE_ADD_USER.equals(function) || UserDirectoryService.SECURE_UPDATE_USER_OWN_PASSWORD.equals(function) || UserDirectoryService.SECURE_UPDATE_USER_ANY.equals(function) || UserDirectoryService.SECURE_UPDATE_USER_OWN.equals(function)) { //we need the userId Reference ref = entityManager.newReference(event.getResource()); // look for group reference. Need to replace it with parent site reference
public void update(Observable arg0, Object arg) { // arg is Event if (!(arg instanceof Event)) return; Event event = (Event) arg; // check the event function against the functions we have notifications watching for String function = event.getEvent(); //we err on the side of caution here in checking all events that might invalidate the data in the cache -DH if (UserDirectoryService.SECURE_ADD_USER.equals(function) || UserDirectoryService.SECURE_UPDATE_USER_OWN_PASSWORD.equals(function) || UserDirectoryService.SECURE_UPDATE_USER_ANY.equals(function) || UserDirectoryService.SECURE_UPDATE_USER_OWN.equals(function)) { //we need the userId Reference ref = entityManager.newReference(event.getResource()); // look for group reference. Need to replace it with parent site reference String refId = ref.getId(); try { String eid = userDirectoryService.getUserEid(refId); log.debug("removing " + eid + " from cache"); authenticationCache.removeAuthentification(eid); userCache.remove(UserDirectoryService.IDCACHE + eid); userCache.remove(UserDirectoryService.EIDCACHE + refId); } catch (UserNotDefinedException e) {
public void update(Observable arg0, Object arg) { // arg is Event if (!(arg instanceof Event)) return; Event event = (Event) arg; // check the event function against the functions we have notifications watching for String function = event.getEvent(); //we err on the side of caution here in checking all events that might invalidate the data in the cache -DH if (UserDirectoryService.SECURE_ADD_USER.equals(function) || UserDirectoryService.SECURE_UPDATE_USER_OWN_PASSWORD.equals(function) || UserDirectoryService.SECURE_UPDATE_USER_ANY.equals(function) || UserDirectoryService.SECURE_UPDATE_USER_OWN.equals(function)) { //we need the userId Reference ref = entityManager.newReference(event.getResource()); // look for group reference. Need to replace it with parent site reference String refId = ref.getId(); try { String eid = userDirectoryService.getUserEid(refId); log.debug("removing " + eid + " from cache"); authenticationCache.removeAuthentification(eid); userCache.remove(UserDirectoryService.IDCACHE + eid); userCache.remove(UserDirectoryService.EIDCACHE + refId); } catch (UserNotDefinedException e) { //not sure how we'd end up here log.warn(e.getMessage(), e); } } }
275
4
// look for group reference. Need to replace it with parent site reference
public void update(Observable arg0, Object arg) { // arg is Event if (!(arg instanceof Event)) return; Event event = (Event) arg; // check the event function against the functions we have notifications watching for String function = event.getEvent(); //we err on the side of caution here in checking all events that might invalidate the data in the cache -DH if (UserDirectoryService.SECURE_ADD_USER.equals(function) || UserDirectoryService.SECURE_UPDATE_USER_OWN_PASSWORD.equals(function) || UserDirectoryService.SECURE_UPDATE_USER_ANY.equals(function) || UserDirectoryService.SECURE_UPDATE_USER_OWN.equals(function)) { //we need the userId Reference ref = entityManager.newReference(event.getResource()); // look for group reference. Need to replace it with parent site reference String refId = ref.getId(); try { String eid = userDirectoryService.getUserEid(refId); log.debug("removing " + eid + " from cache"); authenticationCache.removeAuthentification(eid); userCache.remove(UserDirectoryService.IDCACHE + eid); userCache.remove(UserDirectoryService.EIDCACHE + refId); } catch (UserNotDefinedException e) { //not sure how we'd end up here log.warn(e.getMessage(), e); } } }
NONSATD
true
//we need the userId Reference ref = entityManager.newReference(event.getResource()); // look for group reference. Need to replace it with parent site reference String refId = ref.getId(); try {
if (!(arg instanceof Event)) return; Event event = (Event) arg; // check the event function against the functions we have notifications watching for String function = event.getEvent(); //we err on the side of caution here in checking all events that might invalidate the data in the cache -DH if (UserDirectoryService.SECURE_ADD_USER.equals(function) || UserDirectoryService.SECURE_UPDATE_USER_OWN_PASSWORD.equals(function) || UserDirectoryService.SECURE_UPDATE_USER_ANY.equals(function) || UserDirectoryService.SECURE_UPDATE_USER_OWN.equals(function)) { //we need the userId Reference ref = entityManager.newReference(event.getResource()); // look for group reference. Need to replace it with parent site reference String refId = ref.getId(); try { String eid = userDirectoryService.getUserEid(refId); log.debug("removing " + eid + " from cache"); authenticationCache.removeAuthentification(eid); userCache.remove(UserDirectoryService.IDCACHE + eid); userCache.remove(UserDirectoryService.EIDCACHE + refId); } catch (UserNotDefinedException e) { //not sure how we'd end up here log.warn(e.getMessage(), e);
public void update(Observable arg0, Object arg) { // arg is Event if (!(arg instanceof Event)) return; Event event = (Event) arg; // check the event function against the functions we have notifications watching for String function = event.getEvent(); //we err on the side of caution here in checking all events that might invalidate the data in the cache -DH if (UserDirectoryService.SECURE_ADD_USER.equals(function) || UserDirectoryService.SECURE_UPDATE_USER_OWN_PASSWORD.equals(function) || UserDirectoryService.SECURE_UPDATE_USER_ANY.equals(function) || UserDirectoryService.SECURE_UPDATE_USER_OWN.equals(function)) { //we need the userId Reference ref = entityManager.newReference(event.getResource()); // look for group reference. Need to replace it with parent site reference String refId = ref.getId(); try { String eid = userDirectoryService.getUserEid(refId); log.debug("removing " + eid + " from cache"); authenticationCache.removeAuthentification(eid); userCache.remove(UserDirectoryService.IDCACHE + eid); userCache.remove(UserDirectoryService.EIDCACHE + refId); } catch (UserNotDefinedException e) { //not sure how we'd end up here log.warn(e.getMessage(), e); } } }
275
5
//not sure how we'd end up here
public void update(Observable arg0, Object arg) { // arg is Event if (!(arg instanceof Event)) return; Event event = (Event) arg; // check the event function against the functions we have notifications watching for String function = event.getEvent(); //we err on the side of caution here in checking all events that might invalidate the data in the cache -DH if (UserDirectoryService.SECURE_ADD_USER.equals(function) || UserDirectoryService.SECURE_UPDATE_USER_OWN_PASSWORD.equals(function) || UserDirectoryService.SECURE_UPDATE_USER_ANY.equals(function) || UserDirectoryService.SECURE_UPDATE_USER_OWN.equals(function)) { //we need the userId Reference ref = entityManager.newReference(event.getResource()); // look for group reference. Need to replace it with parent site reference String refId = ref.getId(); try { String eid = userDirectoryService.getUserEid(refId); log.debug("removing " + eid + " from cache"); authenticationCache.removeAuthentification(eid); userCache.remove(UserDirectoryService.IDCACHE + eid); userCache.remove(UserDirectoryService.EIDCACHE + refId); } catch (UserNotDefinedException e) { //not sure how we'd end up here log.warn(e.getMessage(), e); } } }
DESIGN
true
userCache.remove(UserDirectoryService.EIDCACHE + refId); } catch (UserNotDefinedException e) { //not sure how we'd end up here log.warn(e.getMessage(), e); }
Reference ref = entityManager.newReference(event.getResource()); // look for group reference. Need to replace it with parent site reference String refId = ref.getId(); try { String eid = userDirectoryService.getUserEid(refId); log.debug("removing " + eid + " from cache"); authenticationCache.removeAuthentification(eid); userCache.remove(UserDirectoryService.IDCACHE + eid); userCache.remove(UserDirectoryService.EIDCACHE + refId); } catch (UserNotDefinedException e) { //not sure how we'd end up here log.warn(e.getMessage(), e); } } }
// arg is Event if (!(arg instanceof Event)) return; Event event = (Event) arg; // check the event function against the functions we have notifications watching for String function = event.getEvent(); //we err on the side of caution here in checking all events that might invalidate the data in the cache -DH if (UserDirectoryService.SECURE_ADD_USER.equals(function) || UserDirectoryService.SECURE_UPDATE_USER_OWN_PASSWORD.equals(function) || UserDirectoryService.SECURE_UPDATE_USER_ANY.equals(function) || UserDirectoryService.SECURE_UPDATE_USER_OWN.equals(function)) { //we need the userId Reference ref = entityManager.newReference(event.getResource()); // look for group reference. Need to replace it with parent site reference String refId = ref.getId(); try { String eid = userDirectoryService.getUserEid(refId); log.debug("removing " + eid + " from cache"); authenticationCache.removeAuthentification(eid); userCache.remove(UserDirectoryService.IDCACHE + eid); userCache.remove(UserDirectoryService.EIDCACHE + refId); } catch (UserNotDefinedException e) { //not sure how we'd end up here log.warn(e.getMessage(), e); } } }
8,468
0
// If there is a exactly one of each of RemoteGrpcPortWriteOperation and // RegisterAndProcessBundleOperation we know they have the right topology.
private ProgressTracker createProgressTracker() { ReadOperation readOperation; RemoteGrpcPortWriteOperation grpcWriteOperation; RegisterAndProcessBundleOperation bundleProcessOperation; try { readOperation = getReadOperation(); } catch (Exception exn) { readOperation = null; LOG.info("Unable to get read operation.", exn); return new NullProgressTracker(); } // If there is a exactly one of each of RemoteGrpcPortWriteOperation and // RegisterAndProcessBundleOperation we know they have the right topology. try { grpcWriteOperation = Iterables.getOnlyElement( Iterables.filter(operations, RemoteGrpcPortWriteOperation.class)); bundleProcessOperation = Iterables.getOnlyElement( Iterables.filter(operations, RegisterAndProcessBundleOperation.class)); } catch (IllegalArgumentException | NoSuchElementException exn) { // TODO: Handle more than one sdk worker processing a single bundle. grpcWriteOperation = null; bundleProcessOperation = null; LOG.debug("Does not have exactly one grpcWRite and bundleProcess operation.", exn); } if (grpcWriteOperation != null && bundleProcessOperation != null) { return new SingularProcessBundleProgressTracker( readOperation, grpcWriteOperation, bundleProcessOperation); } else { return new ReadOperationProgressTracker(readOperation); } }
NONSATD
true
return new NullProgressTracker(); } // If there is a exactly one of each of RemoteGrpcPortWriteOperation and // RegisterAndProcessBundleOperation we know they have the right topology. try { grpcWriteOperation =
ReadOperation readOperation; RemoteGrpcPortWriteOperation grpcWriteOperation; RegisterAndProcessBundleOperation bundleProcessOperation; try { readOperation = getReadOperation(); } catch (Exception exn) { readOperation = null; LOG.info("Unable to get read operation.", exn); return new NullProgressTracker(); } // If there is a exactly one of each of RemoteGrpcPortWriteOperation and // RegisterAndProcessBundleOperation we know they have the right topology. try { grpcWriteOperation = Iterables.getOnlyElement( Iterables.filter(operations, RemoteGrpcPortWriteOperation.class)); bundleProcessOperation = Iterables.getOnlyElement( Iterables.filter(operations, RegisterAndProcessBundleOperation.class)); } catch (IllegalArgumentException | NoSuchElementException exn) { // TODO: Handle more than one sdk worker processing a single bundle. grpcWriteOperation = null;
private ProgressTracker createProgressTracker() { ReadOperation readOperation; RemoteGrpcPortWriteOperation grpcWriteOperation; RegisterAndProcessBundleOperation bundleProcessOperation; try { readOperation = getReadOperation(); } catch (Exception exn) { readOperation = null; LOG.info("Unable to get read operation.", exn); return new NullProgressTracker(); } // If there is a exactly one of each of RemoteGrpcPortWriteOperation and // RegisterAndProcessBundleOperation we know they have the right topology. try { grpcWriteOperation = Iterables.getOnlyElement( Iterables.filter(operations, RemoteGrpcPortWriteOperation.class)); bundleProcessOperation = Iterables.getOnlyElement( Iterables.filter(operations, RegisterAndProcessBundleOperation.class)); } catch (IllegalArgumentException | NoSuchElementException exn) { // TODO: Handle more than one sdk worker processing a single bundle. grpcWriteOperation = null; bundleProcessOperation = null; LOG.debug("Does not have exactly one grpcWRite and bundleProcess operation.", exn); } if (grpcWriteOperation != null && bundleProcessOperation != null) { return new SingularProcessBundleProgressTracker( readOperation, grpcWriteOperation, bundleProcessOperation); } else { return new ReadOperationProgressTracker(readOperation); } }
8,468
1
// TODO: Handle more than one sdk worker processing a single bundle.
private ProgressTracker createProgressTracker() { ReadOperation readOperation; RemoteGrpcPortWriteOperation grpcWriteOperation; RegisterAndProcessBundleOperation bundleProcessOperation; try { readOperation = getReadOperation(); } catch (Exception exn) { readOperation = null; LOG.info("Unable to get read operation.", exn); return new NullProgressTracker(); } // If there is a exactly one of each of RemoteGrpcPortWriteOperation and // RegisterAndProcessBundleOperation we know they have the right topology. try { grpcWriteOperation = Iterables.getOnlyElement( Iterables.filter(operations, RemoteGrpcPortWriteOperation.class)); bundleProcessOperation = Iterables.getOnlyElement( Iterables.filter(operations, RegisterAndProcessBundleOperation.class)); } catch (IllegalArgumentException | NoSuchElementException exn) { // TODO: Handle more than one sdk worker processing a single bundle. grpcWriteOperation = null; bundleProcessOperation = null; LOG.debug("Does not have exactly one grpcWRite and bundleProcess operation.", exn); } if (grpcWriteOperation != null && bundleProcessOperation != null) { return new SingularProcessBundleProgressTracker( readOperation, grpcWriteOperation, bundleProcessOperation); } else { return new ReadOperationProgressTracker(readOperation); } }
IMPLEMENTATION
true
Iterables.filter(operations, RegisterAndProcessBundleOperation.class)); } catch (IllegalArgumentException | NoSuchElementException exn) { // TODO: Handle more than one sdk worker processing a single bundle. grpcWriteOperation = null; bundleProcessOperation = null;
// If there is a exactly one of each of RemoteGrpcPortWriteOperation and // RegisterAndProcessBundleOperation we know they have the right topology. try { grpcWriteOperation = Iterables.getOnlyElement( Iterables.filter(operations, RemoteGrpcPortWriteOperation.class)); bundleProcessOperation = Iterables.getOnlyElement( Iterables.filter(operations, RegisterAndProcessBundleOperation.class)); } catch (IllegalArgumentException | NoSuchElementException exn) { // TODO: Handle more than one sdk worker processing a single bundle. grpcWriteOperation = null; bundleProcessOperation = null; LOG.debug("Does not have exactly one grpcWRite and bundleProcess operation.", exn); } if (grpcWriteOperation != null && bundleProcessOperation != null) { return new SingularProcessBundleProgressTracker( readOperation, grpcWriteOperation, bundleProcessOperation); } else { return new ReadOperationProgressTracker(readOperation); }
ReadOperation readOperation; RemoteGrpcPortWriteOperation grpcWriteOperation; RegisterAndProcessBundleOperation bundleProcessOperation; try { readOperation = getReadOperation(); } catch (Exception exn) { readOperation = null; LOG.info("Unable to get read operation.", exn); return new NullProgressTracker(); } // If there is a exactly one of each of RemoteGrpcPortWriteOperation and // RegisterAndProcessBundleOperation we know they have the right topology. try { grpcWriteOperation = Iterables.getOnlyElement( Iterables.filter(operations, RemoteGrpcPortWriteOperation.class)); bundleProcessOperation = Iterables.getOnlyElement( Iterables.filter(operations, RegisterAndProcessBundleOperation.class)); } catch (IllegalArgumentException | NoSuchElementException exn) { // TODO: Handle more than one sdk worker processing a single bundle. grpcWriteOperation = null; bundleProcessOperation = null; LOG.debug("Does not have exactly one grpcWRite and bundleProcess operation.", exn); } if (grpcWriteOperation != null && bundleProcessOperation != null) { return new SingularProcessBundleProgressTracker( readOperation, grpcWriteOperation, bundleProcessOperation); } else { return new ReadOperationProgressTracker(readOperation); } }
16,664
0
//TODO: Make Firefox subclass
private NiceWebDriver getNiceWebDriverInstance(DriverType driverType, Object[] oArgs){ switch(driverType) { case Chrome: return new NiceChrome().UnderloadedNiceWebDriverConstructor(oArgs).getThisWithVerbositySetTo(outputIsVerbose); case Firefox: return null; //TODO: Make Firefox subclass case IE: return null; //TODO: Make IE subclass case Edge: return null; //TODO: Make Edge subclass case Opera: return null; //TODO: Make Opera subclass case Safari: return null; //TODO: Make Safari subclass case iOS_iPhone: return null; //TODO: Make iOS_iPhone subclass case iOS_iPad: return null; //TODO: Make iOS_iPad subclass case Android: return null; //TODO: Make Android subclass case HtmlUnit: return null; //TODO: Make HtmlUnit subclass default: return null; } }
IMPLEMENTATION
true
return new NiceChrome().UnderloadedNiceWebDriverConstructor(oArgs).getThisWithVerbositySetTo(outputIsVerbose); case Firefox: return null; //TODO: Make Firefox subclass case IE: return null; //TODO: Make IE subclass
private NiceWebDriver getNiceWebDriverInstance(DriverType driverType, Object[] oArgs){ switch(driverType) { case Chrome: return new NiceChrome().UnderloadedNiceWebDriverConstructor(oArgs).getThisWithVerbositySetTo(outputIsVerbose); case Firefox: return null; //TODO: Make Firefox subclass case IE: return null; //TODO: Make IE subclass case Edge: return null; //TODO: Make Edge subclass case Opera: return null; //TODO: Make Opera subclass case Safari: return null; //TODO: Make Safari subclass case iOS_iPhone: return null; //TODO: Make iOS_iPhone subclass
private NiceWebDriver getNiceWebDriverInstance(DriverType driverType, Object[] oArgs){ switch(driverType) { case Chrome: return new NiceChrome().UnderloadedNiceWebDriverConstructor(oArgs).getThisWithVerbositySetTo(outputIsVerbose); case Firefox: return null; //TODO: Make Firefox subclass case IE: return null; //TODO: Make IE subclass case Edge: return null; //TODO: Make Edge subclass case Opera: return null; //TODO: Make Opera subclass case Safari: return null; //TODO: Make Safari subclass case iOS_iPhone: return null; //TODO: Make iOS_iPhone subclass case iOS_iPad: return null; //TODO: Make iOS_iPad subclass case Android: return null; //TODO: Make Android subclass case HtmlUnit: return null; //TODO: Make HtmlUnit subclass default: return null; } }
16,664
1
//TODO: Make IE subclass
private NiceWebDriver getNiceWebDriverInstance(DriverType driverType, Object[] oArgs){ switch(driverType) { case Chrome: return new NiceChrome().UnderloadedNiceWebDriverConstructor(oArgs).getThisWithVerbositySetTo(outputIsVerbose); case Firefox: return null; //TODO: Make Firefox subclass case IE: return null; //TODO: Make IE subclass case Edge: return null; //TODO: Make Edge subclass case Opera: return null; //TODO: Make Opera subclass case Safari: return null; //TODO: Make Safari subclass case iOS_iPhone: return null; //TODO: Make iOS_iPhone subclass case iOS_iPad: return null; //TODO: Make iOS_iPad subclass case Android: return null; //TODO: Make Android subclass case HtmlUnit: return null; //TODO: Make HtmlUnit subclass default: return null; } }
IMPLEMENTATION
true
return null; //TODO: Make Firefox subclass case IE: return null; //TODO: Make IE subclass case Edge: return null; //TODO: Make Edge subclass
private NiceWebDriver getNiceWebDriverInstance(DriverType driverType, Object[] oArgs){ switch(driverType) { case Chrome: return new NiceChrome().UnderloadedNiceWebDriverConstructor(oArgs).getThisWithVerbositySetTo(outputIsVerbose); case Firefox: return null; //TODO: Make Firefox subclass case IE: return null; //TODO: Make IE subclass case Edge: return null; //TODO: Make Edge subclass case Opera: return null; //TODO: Make Opera subclass case Safari: return null; //TODO: Make Safari subclass case iOS_iPhone: return null; //TODO: Make iOS_iPhone subclass case iOS_iPad: return null; //TODO: Make iOS_iPad subclass
private NiceWebDriver getNiceWebDriverInstance(DriverType driverType, Object[] oArgs){ switch(driverType) { case Chrome: return new NiceChrome().UnderloadedNiceWebDriverConstructor(oArgs).getThisWithVerbositySetTo(outputIsVerbose); case Firefox: return null; //TODO: Make Firefox subclass case IE: return null; //TODO: Make IE subclass case Edge: return null; //TODO: Make Edge subclass case Opera: return null; //TODO: Make Opera subclass case Safari: return null; //TODO: Make Safari subclass case iOS_iPhone: return null; //TODO: Make iOS_iPhone subclass case iOS_iPad: return null; //TODO: Make iOS_iPad subclass case Android: return null; //TODO: Make Android subclass case HtmlUnit: return null; //TODO: Make HtmlUnit subclass default: return null; } }
16,664
2
//TODO: Make Edge subclass
private NiceWebDriver getNiceWebDriverInstance(DriverType driverType, Object[] oArgs){ switch(driverType) { case Chrome: return new NiceChrome().UnderloadedNiceWebDriverConstructor(oArgs).getThisWithVerbositySetTo(outputIsVerbose); case Firefox: return null; //TODO: Make Firefox subclass case IE: return null; //TODO: Make IE subclass case Edge: return null; //TODO: Make Edge subclass case Opera: return null; //TODO: Make Opera subclass case Safari: return null; //TODO: Make Safari subclass case iOS_iPhone: return null; //TODO: Make iOS_iPhone subclass case iOS_iPad: return null; //TODO: Make iOS_iPad subclass case Android: return null; //TODO: Make Android subclass case HtmlUnit: return null; //TODO: Make HtmlUnit subclass default: return null; } }
IMPLEMENTATION
true
return null; //TODO: Make IE subclass case Edge: return null; //TODO: Make Edge subclass case Opera: return null; //TODO: Make Opera subclass
private NiceWebDriver getNiceWebDriverInstance(DriverType driverType, Object[] oArgs){ switch(driverType) { case Chrome: return new NiceChrome().UnderloadedNiceWebDriverConstructor(oArgs).getThisWithVerbositySetTo(outputIsVerbose); case Firefox: return null; //TODO: Make Firefox subclass case IE: return null; //TODO: Make IE subclass case Edge: return null; //TODO: Make Edge subclass case Opera: return null; //TODO: Make Opera subclass case Safari: return null; //TODO: Make Safari subclass case iOS_iPhone: return null; //TODO: Make iOS_iPhone subclass case iOS_iPad: return null; //TODO: Make iOS_iPad subclass case Android: return null; //TODO: Make Android subclass
private NiceWebDriver getNiceWebDriverInstance(DriverType driverType, Object[] oArgs){ switch(driverType) { case Chrome: return new NiceChrome().UnderloadedNiceWebDriverConstructor(oArgs).getThisWithVerbositySetTo(outputIsVerbose); case Firefox: return null; //TODO: Make Firefox subclass case IE: return null; //TODO: Make IE subclass case Edge: return null; //TODO: Make Edge subclass case Opera: return null; //TODO: Make Opera subclass case Safari: return null; //TODO: Make Safari subclass case iOS_iPhone: return null; //TODO: Make iOS_iPhone subclass case iOS_iPad: return null; //TODO: Make iOS_iPad subclass case Android: return null; //TODO: Make Android subclass case HtmlUnit: return null; //TODO: Make HtmlUnit subclass default: return null; } }
16,664
3
//TODO: Make Opera subclass
private NiceWebDriver getNiceWebDriverInstance(DriverType driverType, Object[] oArgs){ switch(driverType) { case Chrome: return new NiceChrome().UnderloadedNiceWebDriverConstructor(oArgs).getThisWithVerbositySetTo(outputIsVerbose); case Firefox: return null; //TODO: Make Firefox subclass case IE: return null; //TODO: Make IE subclass case Edge: return null; //TODO: Make Edge subclass case Opera: return null; //TODO: Make Opera subclass case Safari: return null; //TODO: Make Safari subclass case iOS_iPhone: return null; //TODO: Make iOS_iPhone subclass case iOS_iPad: return null; //TODO: Make iOS_iPad subclass case Android: return null; //TODO: Make Android subclass case HtmlUnit: return null; //TODO: Make HtmlUnit subclass default: return null; } }
IMPLEMENTATION
true
return null; //TODO: Make Edge subclass case Opera: return null; //TODO: Make Opera subclass case Safari: return null; //TODO: Make Safari subclass
switch(driverType) { case Chrome: return new NiceChrome().UnderloadedNiceWebDriverConstructor(oArgs).getThisWithVerbositySetTo(outputIsVerbose); case Firefox: return null; //TODO: Make Firefox subclass case IE: return null; //TODO: Make IE subclass case Edge: return null; //TODO: Make Edge subclass case Opera: return null; //TODO: Make Opera subclass case Safari: return null; //TODO: Make Safari subclass case iOS_iPhone: return null; //TODO: Make iOS_iPhone subclass case iOS_iPad: return null; //TODO: Make iOS_iPad subclass case Android: return null; //TODO: Make Android subclass case HtmlUnit: return null; //TODO: Make HtmlUnit subclass
private NiceWebDriver getNiceWebDriverInstance(DriverType driverType, Object[] oArgs){ switch(driverType) { case Chrome: return new NiceChrome().UnderloadedNiceWebDriverConstructor(oArgs).getThisWithVerbositySetTo(outputIsVerbose); case Firefox: return null; //TODO: Make Firefox subclass case IE: return null; //TODO: Make IE subclass case Edge: return null; //TODO: Make Edge subclass case Opera: return null; //TODO: Make Opera subclass case Safari: return null; //TODO: Make Safari subclass case iOS_iPhone: return null; //TODO: Make iOS_iPhone subclass case iOS_iPad: return null; //TODO: Make iOS_iPad subclass case Android: return null; //TODO: Make Android subclass case HtmlUnit: return null; //TODO: Make HtmlUnit subclass default: return null; } }
16,664
4
//TODO: Make Safari subclass
private NiceWebDriver getNiceWebDriverInstance(DriverType driverType, Object[] oArgs){ switch(driverType) { case Chrome: return new NiceChrome().UnderloadedNiceWebDriverConstructor(oArgs).getThisWithVerbositySetTo(outputIsVerbose); case Firefox: return null; //TODO: Make Firefox subclass case IE: return null; //TODO: Make IE subclass case Edge: return null; //TODO: Make Edge subclass case Opera: return null; //TODO: Make Opera subclass case Safari: return null; //TODO: Make Safari subclass case iOS_iPhone: return null; //TODO: Make iOS_iPhone subclass case iOS_iPad: return null; //TODO: Make iOS_iPad subclass case Android: return null; //TODO: Make Android subclass case HtmlUnit: return null; //TODO: Make HtmlUnit subclass default: return null; } }
IMPLEMENTATION
true
return null; //TODO: Make Opera subclass case Safari: return null; //TODO: Make Safari subclass case iOS_iPhone: return null; //TODO: Make iOS_iPhone subclass
return new NiceChrome().UnderloadedNiceWebDriverConstructor(oArgs).getThisWithVerbositySetTo(outputIsVerbose); case Firefox: return null; //TODO: Make Firefox subclass case IE: return null; //TODO: Make IE subclass case Edge: return null; //TODO: Make Edge subclass case Opera: return null; //TODO: Make Opera subclass case Safari: return null; //TODO: Make Safari subclass case iOS_iPhone: return null; //TODO: Make iOS_iPhone subclass case iOS_iPad: return null; //TODO: Make iOS_iPad subclass case Android: return null; //TODO: Make Android subclass case HtmlUnit: return null; //TODO: Make HtmlUnit subclass default: return null;
private NiceWebDriver getNiceWebDriverInstance(DriverType driverType, Object[] oArgs){ switch(driverType) { case Chrome: return new NiceChrome().UnderloadedNiceWebDriverConstructor(oArgs).getThisWithVerbositySetTo(outputIsVerbose); case Firefox: return null; //TODO: Make Firefox subclass case IE: return null; //TODO: Make IE subclass case Edge: return null; //TODO: Make Edge subclass case Opera: return null; //TODO: Make Opera subclass case Safari: return null; //TODO: Make Safari subclass case iOS_iPhone: return null; //TODO: Make iOS_iPhone subclass case iOS_iPad: return null; //TODO: Make iOS_iPad subclass case Android: return null; //TODO: Make Android subclass case HtmlUnit: return null; //TODO: Make HtmlUnit subclass default: return null; } }
16,664
5
//TODO: Make iOS_iPhone subclass
private NiceWebDriver getNiceWebDriverInstance(DriverType driverType, Object[] oArgs){ switch(driverType) { case Chrome: return new NiceChrome().UnderloadedNiceWebDriverConstructor(oArgs).getThisWithVerbositySetTo(outputIsVerbose); case Firefox: return null; //TODO: Make Firefox subclass case IE: return null; //TODO: Make IE subclass case Edge: return null; //TODO: Make Edge subclass case Opera: return null; //TODO: Make Opera subclass case Safari: return null; //TODO: Make Safari subclass case iOS_iPhone: return null; //TODO: Make iOS_iPhone subclass case iOS_iPad: return null; //TODO: Make iOS_iPad subclass case Android: return null; //TODO: Make Android subclass case HtmlUnit: return null; //TODO: Make HtmlUnit subclass default: return null; } }
IMPLEMENTATION
true
return null; //TODO: Make Safari subclass case iOS_iPhone: return null; //TODO: Make iOS_iPhone subclass case iOS_iPad: return null; //TODO: Make iOS_iPad subclass
return null; //TODO: Make Firefox subclass case IE: return null; //TODO: Make IE subclass case Edge: return null; //TODO: Make Edge subclass case Opera: return null; //TODO: Make Opera subclass case Safari: return null; //TODO: Make Safari subclass case iOS_iPhone: return null; //TODO: Make iOS_iPhone subclass case iOS_iPad: return null; //TODO: Make iOS_iPad subclass case Android: return null; //TODO: Make Android subclass case HtmlUnit: return null; //TODO: Make HtmlUnit subclass default: return null; } }
private NiceWebDriver getNiceWebDriverInstance(DriverType driverType, Object[] oArgs){ switch(driverType) { case Chrome: return new NiceChrome().UnderloadedNiceWebDriverConstructor(oArgs).getThisWithVerbositySetTo(outputIsVerbose); case Firefox: return null; //TODO: Make Firefox subclass case IE: return null; //TODO: Make IE subclass case Edge: return null; //TODO: Make Edge subclass case Opera: return null; //TODO: Make Opera subclass case Safari: return null; //TODO: Make Safari subclass case iOS_iPhone: return null; //TODO: Make iOS_iPhone subclass case iOS_iPad: return null; //TODO: Make iOS_iPad subclass case Android: return null; //TODO: Make Android subclass case HtmlUnit: return null; //TODO: Make HtmlUnit subclass default: return null; } }
16,664
6
//TODO: Make iOS_iPad subclass
private NiceWebDriver getNiceWebDriverInstance(DriverType driverType, Object[] oArgs){ switch(driverType) { case Chrome: return new NiceChrome().UnderloadedNiceWebDriverConstructor(oArgs).getThisWithVerbositySetTo(outputIsVerbose); case Firefox: return null; //TODO: Make Firefox subclass case IE: return null; //TODO: Make IE subclass case Edge: return null; //TODO: Make Edge subclass case Opera: return null; //TODO: Make Opera subclass case Safari: return null; //TODO: Make Safari subclass case iOS_iPhone: return null; //TODO: Make iOS_iPhone subclass case iOS_iPad: return null; //TODO: Make iOS_iPad subclass case Android: return null; //TODO: Make Android subclass case HtmlUnit: return null; //TODO: Make HtmlUnit subclass default: return null; } }
IMPLEMENTATION
true
return null; //TODO: Make iOS_iPhone subclass case iOS_iPad: return null; //TODO: Make iOS_iPad subclass case Android: return null; //TODO: Make Android subclass
return null; //TODO: Make IE subclass case Edge: return null; //TODO: Make Edge subclass case Opera: return null; //TODO: Make Opera subclass case Safari: return null; //TODO: Make Safari subclass case iOS_iPhone: return null; //TODO: Make iOS_iPhone subclass case iOS_iPad: return null; //TODO: Make iOS_iPad subclass case Android: return null; //TODO: Make Android subclass case HtmlUnit: return null; //TODO: Make HtmlUnit subclass default: return null; } }
private NiceWebDriver getNiceWebDriverInstance(DriverType driverType, Object[] oArgs){ switch(driverType) { case Chrome: return new NiceChrome().UnderloadedNiceWebDriverConstructor(oArgs).getThisWithVerbositySetTo(outputIsVerbose); case Firefox: return null; //TODO: Make Firefox subclass case IE: return null; //TODO: Make IE subclass case Edge: return null; //TODO: Make Edge subclass case Opera: return null; //TODO: Make Opera subclass case Safari: return null; //TODO: Make Safari subclass case iOS_iPhone: return null; //TODO: Make iOS_iPhone subclass case iOS_iPad: return null; //TODO: Make iOS_iPad subclass case Android: return null; //TODO: Make Android subclass case HtmlUnit: return null; //TODO: Make HtmlUnit subclass default: return null; } }
16,664
7
//TODO: Make Android subclass
private NiceWebDriver getNiceWebDriverInstance(DriverType driverType, Object[] oArgs){ switch(driverType) { case Chrome: return new NiceChrome().UnderloadedNiceWebDriverConstructor(oArgs).getThisWithVerbositySetTo(outputIsVerbose); case Firefox: return null; //TODO: Make Firefox subclass case IE: return null; //TODO: Make IE subclass case Edge: return null; //TODO: Make Edge subclass case Opera: return null; //TODO: Make Opera subclass case Safari: return null; //TODO: Make Safari subclass case iOS_iPhone: return null; //TODO: Make iOS_iPhone subclass case iOS_iPad: return null; //TODO: Make iOS_iPad subclass case Android: return null; //TODO: Make Android subclass case HtmlUnit: return null; //TODO: Make HtmlUnit subclass default: return null; } }
IMPLEMENTATION
true
return null; //TODO: Make iOS_iPad subclass case Android: return null; //TODO: Make Android subclass case HtmlUnit: return null; //TODO: Make HtmlUnit subclass
return null; //TODO: Make Edge subclass case Opera: return null; //TODO: Make Opera subclass case Safari: return null; //TODO: Make Safari subclass case iOS_iPhone: return null; //TODO: Make iOS_iPhone subclass case iOS_iPad: return null; //TODO: Make iOS_iPad subclass case Android: return null; //TODO: Make Android subclass case HtmlUnit: return null; //TODO: Make HtmlUnit subclass default: return null; } }
private NiceWebDriver getNiceWebDriverInstance(DriverType driverType, Object[] oArgs){ switch(driverType) { case Chrome: return new NiceChrome().UnderloadedNiceWebDriverConstructor(oArgs).getThisWithVerbositySetTo(outputIsVerbose); case Firefox: return null; //TODO: Make Firefox subclass case IE: return null; //TODO: Make IE subclass case Edge: return null; //TODO: Make Edge subclass case Opera: return null; //TODO: Make Opera subclass case Safari: return null; //TODO: Make Safari subclass case iOS_iPhone: return null; //TODO: Make iOS_iPhone subclass case iOS_iPad: return null; //TODO: Make iOS_iPad subclass case Android: return null; //TODO: Make Android subclass case HtmlUnit: return null; //TODO: Make HtmlUnit subclass default: return null; } }
16,664
8
//TODO: Make HtmlUnit subclass
private NiceWebDriver getNiceWebDriverInstance(DriverType driverType, Object[] oArgs){ switch(driverType) { case Chrome: return new NiceChrome().UnderloadedNiceWebDriverConstructor(oArgs).getThisWithVerbositySetTo(outputIsVerbose); case Firefox: return null; //TODO: Make Firefox subclass case IE: return null; //TODO: Make IE subclass case Edge: return null; //TODO: Make Edge subclass case Opera: return null; //TODO: Make Opera subclass case Safari: return null; //TODO: Make Safari subclass case iOS_iPhone: return null; //TODO: Make iOS_iPhone subclass case iOS_iPad: return null; //TODO: Make iOS_iPad subclass case Android: return null; //TODO: Make Android subclass case HtmlUnit: return null; //TODO: Make HtmlUnit subclass default: return null; } }
IMPLEMENTATION
true
return null; //TODO: Make Android subclass case HtmlUnit: return null; //TODO: Make HtmlUnit subclass default: return null;
return null; //TODO: Make Opera subclass case Safari: return null; //TODO: Make Safari subclass case iOS_iPhone: return null; //TODO: Make iOS_iPhone subclass case iOS_iPad: return null; //TODO: Make iOS_iPad subclass case Android: return null; //TODO: Make Android subclass case HtmlUnit: return null; //TODO: Make HtmlUnit subclass default: return null; } }
switch(driverType) { case Chrome: return new NiceChrome().UnderloadedNiceWebDriverConstructor(oArgs).getThisWithVerbositySetTo(outputIsVerbose); case Firefox: return null; //TODO: Make Firefox subclass case IE: return null; //TODO: Make IE subclass case Edge: return null; //TODO: Make Edge subclass case Opera: return null; //TODO: Make Opera subclass case Safari: return null; //TODO: Make Safari subclass case iOS_iPhone: return null; //TODO: Make iOS_iPhone subclass case iOS_iPad: return null; //TODO: Make iOS_iPad subclass case Android: return null; //TODO: Make Android subclass case HtmlUnit: return null; //TODO: Make HtmlUnit subclass default: return null; } }
16,665
0
/** * Use the 'nzsession' program to clear out any persistent sessions. * This is a hack; somehow, the Connection.close() call occurring in * tearDown() is not actually closing the open netezza sessions. After * 32 connections open like this, subsequent tests will deadlock. * This method terminates the sessions forcefully. */
public void clearNzSessions() throws IOException, InterruptedException { String pathToNzSession = System.getProperty( NZ_SESSION_PATH_KEY, DEFAULT_NZ_SESSION_PATH); // Run nzsession and capture a list of open transactions. ArrayList<String> args = new ArrayList<String>(); args.add(pathToNzSession); args.add("-host"); args.add(NETEZZA_HOST); args.add("-u"); args.add(ADMIN_USER); args.add("-pw"); args.add(ADMIN_PASS); Process p = Runtime.getRuntime().exec(args.toArray(new String[0])); InputStream is = p.getInputStream(); LineBufferingAsyncSink sink = new LineBufferingAsyncSink(); sink.processStream(is); // Wait for the process to end. int result = p.waitFor(); if (0 != result) { throw new IOException("Session list command terminated with " + result); } // Collect all the stdout, and parse the output. // If the third whitespace-delimited token is the sqooptest user, // the the first token is the nzsession id. We should kill that id. sink.join(); List<String> processList = sink.getLines(); for (String processLine : processList) { if (null == processLine || processLine.length() == 0) { continue; // Ignore empty lines. } String [] tokens = processLine.split(" +"); if (tokens.length < 3) { continue; // Not enough tokens on this line. } if (tokens[2].equalsIgnoreCase(NETEZZA_USER)) { // Found a match. killSession(tokens[0]); } } }
DESIGN
true
public void clearNzSessions() throws IOException, InterruptedException { String pathToNzSession = System.getProperty( NZ_SESSION_PATH_KEY, DEFAULT_NZ_SESSION_PATH); // Run nzsession and capture a list of open transactions. ArrayList<String> args = new ArrayList<String>(); args.add(pathToNzSession); args.add("-host"); args.add(NETEZZA_HOST); args.add("-u"); args.add(ADMIN_USER); args.add("-pw"); args.add(ADMIN_PASS); Process p = Runtime.getRuntime().exec(args.toArray(new String[0])); InputStream is = p.getInputStream(); LineBufferingAsyncSink sink = new LineBufferingAsyncSink(); sink.processStream(is); // Wait for the process to end. int result = p.waitFor(); if (0 != result) { throw new IOException("Session list command terminated with " + result); } // Collect all the stdout, and parse the output. // If the third whitespace-delimited token is the sqooptest user, // the the first token is the nzsession id. We should kill that id. sink.join(); List<String> processList = sink.getLines(); for (String processLine : processList) { if (null == processLine || processLine.length() == 0) { continue; // Ignore empty lines. } String [] tokens = processLine.split(" +"); if (tokens.length < 3) { continue; // Not enough tokens on this line. } if (tokens[2].equalsIgnoreCase(NETEZZA_USER)) { // Found a match. killSession(tokens[0]); } } }
public void clearNzSessions() throws IOException, InterruptedException { String pathToNzSession = System.getProperty( NZ_SESSION_PATH_KEY, DEFAULT_NZ_SESSION_PATH); // Run nzsession and capture a list of open transactions. ArrayList<String> args = new ArrayList<String>(); args.add(pathToNzSession); args.add("-host"); args.add(NETEZZA_HOST); args.add("-u"); args.add(ADMIN_USER); args.add("-pw"); args.add(ADMIN_PASS); Process p = Runtime.getRuntime().exec(args.toArray(new String[0])); InputStream is = p.getInputStream(); LineBufferingAsyncSink sink = new LineBufferingAsyncSink(); sink.processStream(is); // Wait for the process to end. int result = p.waitFor(); if (0 != result) { throw new IOException("Session list command terminated with " + result); } // Collect all the stdout, and parse the output. // If the third whitespace-delimited token is the sqooptest user, // the the first token is the nzsession id. We should kill that id. sink.join(); List<String> processList = sink.getLines(); for (String processLine : processList) { if (null == processLine || processLine.length() == 0) { continue; // Ignore empty lines. } String [] tokens = processLine.split(" +"); if (tokens.length < 3) { continue; // Not enough tokens on this line. } if (tokens[2].equalsIgnoreCase(NETEZZA_USER)) { // Found a match. killSession(tokens[0]); } } }
public void clearNzSessions() throws IOException, InterruptedException { String pathToNzSession = System.getProperty( NZ_SESSION_PATH_KEY, DEFAULT_NZ_SESSION_PATH); // Run nzsession and capture a list of open transactions. ArrayList<String> args = new ArrayList<String>(); args.add(pathToNzSession); args.add("-host"); args.add(NETEZZA_HOST); args.add("-u"); args.add(ADMIN_USER); args.add("-pw"); args.add(ADMIN_PASS); Process p = Runtime.getRuntime().exec(args.toArray(new String[0])); InputStream is = p.getInputStream(); LineBufferingAsyncSink sink = new LineBufferingAsyncSink(); sink.processStream(is); // Wait for the process to end. int result = p.waitFor(); if (0 != result) { throw new IOException("Session list command terminated with " + result); } // Collect all the stdout, and parse the output. // If the third whitespace-delimited token is the sqooptest user, // the the first token is the nzsession id. We should kill that id. sink.join(); List<String> processList = sink.getLines(); for (String processLine : processList) { if (null == processLine || processLine.length() == 0) { continue; // Ignore empty lines. } String [] tokens = processLine.split(" +"); if (tokens.length < 3) { continue; // Not enough tokens on this line. } if (tokens[2].equalsIgnoreCase(NETEZZA_USER)) { // Found a match. killSession(tokens[0]); } } }
16,665
1
// Run nzsession and capture a list of open transactions.
public void clearNzSessions() throws IOException, InterruptedException { String pathToNzSession = System.getProperty( NZ_SESSION_PATH_KEY, DEFAULT_NZ_SESSION_PATH); // Run nzsession and capture a list of open transactions. ArrayList<String> args = new ArrayList<String>(); args.add(pathToNzSession); args.add("-host"); args.add(NETEZZA_HOST); args.add("-u"); args.add(ADMIN_USER); args.add("-pw"); args.add(ADMIN_PASS); Process p = Runtime.getRuntime().exec(args.toArray(new String[0])); InputStream is = p.getInputStream(); LineBufferingAsyncSink sink = new LineBufferingAsyncSink(); sink.processStream(is); // Wait for the process to end. int result = p.waitFor(); if (0 != result) { throw new IOException("Session list command terminated with " + result); } // Collect all the stdout, and parse the output. // If the third whitespace-delimited token is the sqooptest user, // the the first token is the nzsession id. We should kill that id. sink.join(); List<String> processList = sink.getLines(); for (String processLine : processList) { if (null == processLine || processLine.length() == 0) { continue; // Ignore empty lines. } String [] tokens = processLine.split(" +"); if (tokens.length < 3) { continue; // Not enough tokens on this line. } if (tokens[2].equalsIgnoreCase(NETEZZA_USER)) { // Found a match. killSession(tokens[0]); } } }
NONSATD
true
String pathToNzSession = System.getProperty( NZ_SESSION_PATH_KEY, DEFAULT_NZ_SESSION_PATH); // Run nzsession and capture a list of open transactions. ArrayList<String> args = new ArrayList<String>(); args.add(pathToNzSession);
public void clearNzSessions() throws IOException, InterruptedException { String pathToNzSession = System.getProperty( NZ_SESSION_PATH_KEY, DEFAULT_NZ_SESSION_PATH); // Run nzsession and capture a list of open transactions. ArrayList<String> args = new ArrayList<String>(); args.add(pathToNzSession); args.add("-host"); args.add(NETEZZA_HOST); args.add("-u"); args.add(ADMIN_USER); args.add("-pw"); args.add(ADMIN_PASS); Process p = Runtime.getRuntime().exec(args.toArray(new String[0])); InputStream is = p.getInputStream();
public void clearNzSessions() throws IOException, InterruptedException { String pathToNzSession = System.getProperty( NZ_SESSION_PATH_KEY, DEFAULT_NZ_SESSION_PATH); // Run nzsession and capture a list of open transactions. ArrayList<String> args = new ArrayList<String>(); args.add(pathToNzSession); args.add("-host"); args.add(NETEZZA_HOST); args.add("-u"); args.add(ADMIN_USER); args.add("-pw"); args.add(ADMIN_PASS); Process p = Runtime.getRuntime().exec(args.toArray(new String[0])); InputStream is = p.getInputStream(); LineBufferingAsyncSink sink = new LineBufferingAsyncSink(); sink.processStream(is); // Wait for the process to end. int result = p.waitFor(); if (0 != result) { throw new IOException("Session list command terminated with " + result); } // Collect all the stdout, and parse the output. // If the third whitespace-delimited token is the sqooptest user, // the the first token is the nzsession id. We should kill that id.
16,665
2
// Wait for the process to end.
public void clearNzSessions() throws IOException, InterruptedException { String pathToNzSession = System.getProperty( NZ_SESSION_PATH_KEY, DEFAULT_NZ_SESSION_PATH); // Run nzsession and capture a list of open transactions. ArrayList<String> args = new ArrayList<String>(); args.add(pathToNzSession); args.add("-host"); args.add(NETEZZA_HOST); args.add("-u"); args.add(ADMIN_USER); args.add("-pw"); args.add(ADMIN_PASS); Process p = Runtime.getRuntime().exec(args.toArray(new String[0])); InputStream is = p.getInputStream(); LineBufferingAsyncSink sink = new LineBufferingAsyncSink(); sink.processStream(is); // Wait for the process to end. int result = p.waitFor(); if (0 != result) { throw new IOException("Session list command terminated with " + result); } // Collect all the stdout, and parse the output. // If the third whitespace-delimited token is the sqooptest user, // the the first token is the nzsession id. We should kill that id. sink.join(); List<String> processList = sink.getLines(); for (String processLine : processList) { if (null == processLine || processLine.length() == 0) { continue; // Ignore empty lines. } String [] tokens = processLine.split(" +"); if (tokens.length < 3) { continue; // Not enough tokens on this line. } if (tokens[2].equalsIgnoreCase(NETEZZA_USER)) { // Found a match. killSession(tokens[0]); } } }
NONSATD
true
LineBufferingAsyncSink sink = new LineBufferingAsyncSink(); sink.processStream(is); // Wait for the process to end. int result = p.waitFor(); if (0 != result) {
args.add("-host"); args.add(NETEZZA_HOST); args.add("-u"); args.add(ADMIN_USER); args.add("-pw"); args.add(ADMIN_PASS); Process p = Runtime.getRuntime().exec(args.toArray(new String[0])); InputStream is = p.getInputStream(); LineBufferingAsyncSink sink = new LineBufferingAsyncSink(); sink.processStream(is); // Wait for the process to end. int result = p.waitFor(); if (0 != result) { throw new IOException("Session list command terminated with " + result); } // Collect all the stdout, and parse the output. // If the third whitespace-delimited token is the sqooptest user, // the the first token is the nzsession id. We should kill that id. sink.join(); List<String> processList = sink.getLines(); for (String processLine : processList) {
public void clearNzSessions() throws IOException, InterruptedException { String pathToNzSession = System.getProperty( NZ_SESSION_PATH_KEY, DEFAULT_NZ_SESSION_PATH); // Run nzsession and capture a list of open transactions. ArrayList<String> args = new ArrayList<String>(); args.add(pathToNzSession); args.add("-host"); args.add(NETEZZA_HOST); args.add("-u"); args.add(ADMIN_USER); args.add("-pw"); args.add(ADMIN_PASS); Process p = Runtime.getRuntime().exec(args.toArray(new String[0])); InputStream is = p.getInputStream(); LineBufferingAsyncSink sink = new LineBufferingAsyncSink(); sink.processStream(is); // Wait for the process to end. int result = p.waitFor(); if (0 != result) { throw new IOException("Session list command terminated with " + result); } // Collect all the stdout, and parse the output. // If the third whitespace-delimited token is the sqooptest user, // the the first token is the nzsession id. We should kill that id. sink.join(); List<String> processList = sink.getLines(); for (String processLine : processList) { if (null == processLine || processLine.length() == 0) { continue; // Ignore empty lines. } String [] tokens = processLine.split(" +"); if (tokens.length < 3) { continue; // Not enough tokens on this line. } if (tokens[2].equalsIgnoreCase(NETEZZA_USER)) { // Found a match. killSession(tokens[0]);
16,665
3
// Collect all the stdout, and parse the output. // If the third whitespace-delimited token is the sqooptest user, // the the first token is the nzsession id. We should kill that id.
public void clearNzSessions() throws IOException, InterruptedException { String pathToNzSession = System.getProperty( NZ_SESSION_PATH_KEY, DEFAULT_NZ_SESSION_PATH); // Run nzsession and capture a list of open transactions. ArrayList<String> args = new ArrayList<String>(); args.add(pathToNzSession); args.add("-host"); args.add(NETEZZA_HOST); args.add("-u"); args.add(ADMIN_USER); args.add("-pw"); args.add(ADMIN_PASS); Process p = Runtime.getRuntime().exec(args.toArray(new String[0])); InputStream is = p.getInputStream(); LineBufferingAsyncSink sink = new LineBufferingAsyncSink(); sink.processStream(is); // Wait for the process to end. int result = p.waitFor(); if (0 != result) { throw new IOException("Session list command terminated with " + result); } // Collect all the stdout, and parse the output. // If the third whitespace-delimited token is the sqooptest user, // the the first token is the nzsession id. We should kill that id. sink.join(); List<String> processList = sink.getLines(); for (String processLine : processList) { if (null == processLine || processLine.length() == 0) { continue; // Ignore empty lines. } String [] tokens = processLine.split(" +"); if (tokens.length < 3) { continue; // Not enough tokens on this line. } if (tokens[2].equalsIgnoreCase(NETEZZA_USER)) { // Found a match. killSession(tokens[0]); } } }
NONSATD
true
throw new IOException("Session list command terminated with " + result); } // Collect all the stdout, and parse the output. // If the third whitespace-delimited token is the sqooptest user, // the the first token is the nzsession id. We should kill that id. sink.join(); List<String> processList = sink.getLines();
args.add(ADMIN_PASS); Process p = Runtime.getRuntime().exec(args.toArray(new String[0])); InputStream is = p.getInputStream(); LineBufferingAsyncSink sink = new LineBufferingAsyncSink(); sink.processStream(is); // Wait for the process to end. int result = p.waitFor(); if (0 != result) { throw new IOException("Session list command terminated with " + result); } // Collect all the stdout, and parse the output. // If the third whitespace-delimited token is the sqooptest user, // the the first token is the nzsession id. We should kill that id. sink.join(); List<String> processList = sink.getLines(); for (String processLine : processList) { if (null == processLine || processLine.length() == 0) { continue; // Ignore empty lines. } String [] tokens = processLine.split(" +"); if (tokens.length < 3) { continue; // Not enough tokens on this line. }
String pathToNzSession = System.getProperty( NZ_SESSION_PATH_KEY, DEFAULT_NZ_SESSION_PATH); // Run nzsession and capture a list of open transactions. ArrayList<String> args = new ArrayList<String>(); args.add(pathToNzSession); args.add("-host"); args.add(NETEZZA_HOST); args.add("-u"); args.add(ADMIN_USER); args.add("-pw"); args.add(ADMIN_PASS); Process p = Runtime.getRuntime().exec(args.toArray(new String[0])); InputStream is = p.getInputStream(); LineBufferingAsyncSink sink = new LineBufferingAsyncSink(); sink.processStream(is); // Wait for the process to end. int result = p.waitFor(); if (0 != result) { throw new IOException("Session list command terminated with " + result); } // Collect all the stdout, and parse the output. // If the third whitespace-delimited token is the sqooptest user, // the the first token is the nzsession id. We should kill that id. sink.join(); List<String> processList = sink.getLines(); for (String processLine : processList) { if (null == processLine || processLine.length() == 0) { continue; // Ignore empty lines. } String [] tokens = processLine.split(" +"); if (tokens.length < 3) { continue; // Not enough tokens on this line. } if (tokens[2].equalsIgnoreCase(NETEZZA_USER)) { // Found a match. killSession(tokens[0]); } } }
16,665
4
// Ignore empty lines.
public void clearNzSessions() throws IOException, InterruptedException { String pathToNzSession = System.getProperty( NZ_SESSION_PATH_KEY, DEFAULT_NZ_SESSION_PATH); // Run nzsession and capture a list of open transactions. ArrayList<String> args = new ArrayList<String>(); args.add(pathToNzSession); args.add("-host"); args.add(NETEZZA_HOST); args.add("-u"); args.add(ADMIN_USER); args.add("-pw"); args.add(ADMIN_PASS); Process p = Runtime.getRuntime().exec(args.toArray(new String[0])); InputStream is = p.getInputStream(); LineBufferingAsyncSink sink = new LineBufferingAsyncSink(); sink.processStream(is); // Wait for the process to end. int result = p.waitFor(); if (0 != result) { throw new IOException("Session list command terminated with " + result); } // Collect all the stdout, and parse the output. // If the third whitespace-delimited token is the sqooptest user, // the the first token is the nzsession id. We should kill that id. sink.join(); List<String> processList = sink.getLines(); for (String processLine : processList) { if (null == processLine || processLine.length() == 0) { continue; // Ignore empty lines. } String [] tokens = processLine.split(" +"); if (tokens.length < 3) { continue; // Not enough tokens on this line. } if (tokens[2].equalsIgnoreCase(NETEZZA_USER)) { // Found a match. killSession(tokens[0]); } } }
NONSATD
true
for (String processLine : processList) { if (null == processLine || processLine.length() == 0) { continue; // Ignore empty lines. } String [] tokens = processLine.split(" +");
if (0 != result) { throw new IOException("Session list command terminated with " + result); } // Collect all the stdout, and parse the output. // If the third whitespace-delimited token is the sqooptest user, // the the first token is the nzsession id. We should kill that id. sink.join(); List<String> processList = sink.getLines(); for (String processLine : processList) { if (null == processLine || processLine.length() == 0) { continue; // Ignore empty lines. } String [] tokens = processLine.split(" +"); if (tokens.length < 3) { continue; // Not enough tokens on this line. } if (tokens[2].equalsIgnoreCase(NETEZZA_USER)) { // Found a match. killSession(tokens[0]); } }
args.add("-u"); args.add(ADMIN_USER); args.add("-pw"); args.add(ADMIN_PASS); Process p = Runtime.getRuntime().exec(args.toArray(new String[0])); InputStream is = p.getInputStream(); LineBufferingAsyncSink sink = new LineBufferingAsyncSink(); sink.processStream(is); // Wait for the process to end. int result = p.waitFor(); if (0 != result) { throw new IOException("Session list command terminated with " + result); } // Collect all the stdout, and parse the output. // If the third whitespace-delimited token is the sqooptest user, // the the first token is the nzsession id. We should kill that id. sink.join(); List<String> processList = sink.getLines(); for (String processLine : processList) { if (null == processLine || processLine.length() == 0) { continue; // Ignore empty lines. } String [] tokens = processLine.split(" +"); if (tokens.length < 3) { continue; // Not enough tokens on this line. } if (tokens[2].equalsIgnoreCase(NETEZZA_USER)) { // Found a match. killSession(tokens[0]); } } }
16,665
5
// Not enough tokens on this line.
public void clearNzSessions() throws IOException, InterruptedException { String pathToNzSession = System.getProperty( NZ_SESSION_PATH_KEY, DEFAULT_NZ_SESSION_PATH); // Run nzsession and capture a list of open transactions. ArrayList<String> args = new ArrayList<String>(); args.add(pathToNzSession); args.add("-host"); args.add(NETEZZA_HOST); args.add("-u"); args.add(ADMIN_USER); args.add("-pw"); args.add(ADMIN_PASS); Process p = Runtime.getRuntime().exec(args.toArray(new String[0])); InputStream is = p.getInputStream(); LineBufferingAsyncSink sink = new LineBufferingAsyncSink(); sink.processStream(is); // Wait for the process to end. int result = p.waitFor(); if (0 != result) { throw new IOException("Session list command terminated with " + result); } // Collect all the stdout, and parse the output. // If the third whitespace-delimited token is the sqooptest user, // the the first token is the nzsession id. We should kill that id. sink.join(); List<String> processList = sink.getLines(); for (String processLine : processList) { if (null == processLine || processLine.length() == 0) { continue; // Ignore empty lines. } String [] tokens = processLine.split(" +"); if (tokens.length < 3) { continue; // Not enough tokens on this line. } if (tokens[2].equalsIgnoreCase(NETEZZA_USER)) { // Found a match. killSession(tokens[0]); } } }
NONSATD
true
String [] tokens = processLine.split(" +"); if (tokens.length < 3) { continue; // Not enough tokens on this line. } if (tokens[2].equalsIgnoreCase(NETEZZA_USER)) {
// If the third whitespace-delimited token is the sqooptest user, // the the first token is the nzsession id. We should kill that id. sink.join(); List<String> processList = sink.getLines(); for (String processLine : processList) { if (null == processLine || processLine.length() == 0) { continue; // Ignore empty lines. } String [] tokens = processLine.split(" +"); if (tokens.length < 3) { continue; // Not enough tokens on this line. } if (tokens[2].equalsIgnoreCase(NETEZZA_USER)) { // Found a match. killSession(tokens[0]); } } }
Process p = Runtime.getRuntime().exec(args.toArray(new String[0])); InputStream is = p.getInputStream(); LineBufferingAsyncSink sink = new LineBufferingAsyncSink(); sink.processStream(is); // Wait for the process to end. int result = p.waitFor(); if (0 != result) { throw new IOException("Session list command terminated with " + result); } // Collect all the stdout, and parse the output. // If the third whitespace-delimited token is the sqooptest user, // the the first token is the nzsession id. We should kill that id. sink.join(); List<String> processList = sink.getLines(); for (String processLine : processList) { if (null == processLine || processLine.length() == 0) { continue; // Ignore empty lines. } String [] tokens = processLine.split(" +"); if (tokens.length < 3) { continue; // Not enough tokens on this line. } if (tokens[2].equalsIgnoreCase(NETEZZA_USER)) { // Found a match. killSession(tokens[0]); } } }
16,665
6
// Found a match.
public void clearNzSessions() throws IOException, InterruptedException { String pathToNzSession = System.getProperty( NZ_SESSION_PATH_KEY, DEFAULT_NZ_SESSION_PATH); // Run nzsession and capture a list of open transactions. ArrayList<String> args = new ArrayList<String>(); args.add(pathToNzSession); args.add("-host"); args.add(NETEZZA_HOST); args.add("-u"); args.add(ADMIN_USER); args.add("-pw"); args.add(ADMIN_PASS); Process p = Runtime.getRuntime().exec(args.toArray(new String[0])); InputStream is = p.getInputStream(); LineBufferingAsyncSink sink = new LineBufferingAsyncSink(); sink.processStream(is); // Wait for the process to end. int result = p.waitFor(); if (0 != result) { throw new IOException("Session list command terminated with " + result); } // Collect all the stdout, and parse the output. // If the third whitespace-delimited token is the sqooptest user, // the the first token is the nzsession id. We should kill that id. sink.join(); List<String> processList = sink.getLines(); for (String processLine : processList) { if (null == processLine || processLine.length() == 0) { continue; // Ignore empty lines. } String [] tokens = processLine.split(" +"); if (tokens.length < 3) { continue; // Not enough tokens on this line. } if (tokens[2].equalsIgnoreCase(NETEZZA_USER)) { // Found a match. killSession(tokens[0]); } } }
NONSATD
true
} if (tokens[2].equalsIgnoreCase(NETEZZA_USER)) { // Found a match. killSession(tokens[0]); }
List<String> processList = sink.getLines(); for (String processLine : processList) { if (null == processLine || processLine.length() == 0) { continue; // Ignore empty lines. } String [] tokens = processLine.split(" +"); if (tokens.length < 3) { continue; // Not enough tokens on this line. } if (tokens[2].equalsIgnoreCase(NETEZZA_USER)) { // Found a match. killSession(tokens[0]); } } }
sink.processStream(is); // Wait for the process to end. int result = p.waitFor(); if (0 != result) { throw new IOException("Session list command terminated with " + result); } // Collect all the stdout, and parse the output. // If the third whitespace-delimited token is the sqooptest user, // the the first token is the nzsession id. We should kill that id. sink.join(); List<String> processList = sink.getLines(); for (String processLine : processList) { if (null == processLine || processLine.length() == 0) { continue; // Ignore empty lines. } String [] tokens = processLine.split(" +"); if (tokens.length < 3) { continue; // Not enough tokens on this line. } if (tokens[2].equalsIgnoreCase(NETEZZA_USER)) { // Found a match. killSession(tokens[0]); } } }
286
0
/** * Get the path to the 32-bit app_process binary.<br> * <br> * It is unlikely you will need to call this method. * * @see #getAppProcess() * @see #getAppProcess32Bit(boolean) * * @return Path to 32-bit app_process or app_process with unspecified bits or null */
public static String getAppProcess32Bit() { return getAppProcess32Bit(true); }
NONSATD
true
public static String getAppProcess32Bit() { return getAppProcess32Bit(true); }
public static String getAppProcess32Bit() { return getAppProcess32Bit(true); }
public static String getAppProcess32Bit() { return getAppProcess32Bit(true); }
16,671
0
//TODO - Could we also check if the elevator is up and limit speed?
@Override public void execute() { double y = -Constants.joystick.getY(); double z = Constants.joystick.getZ(); //TODO - Could we also check if the elevator is up and limit speed? if(y < Constants.REVERSE_MAX_SPEED) { y = Constants.REVERSE_MAX_SPEED; } if(z < Constants.LEFT_MAX_SPEED ) { z = Constants.LEFT_MAX_SPEED; } else if(z > Constants.RIGHT_MAX_SPEED){ z = Constants.RIGHT_MAX_SPEED; } driveSubsystem.getDiffDrive().arcadeDrive(y, z); }
IMPLEMENTATION
true
double y = -Constants.joystick.getY(); double z = Constants.joystick.getZ(); //TODO - Could we also check if the elevator is up and limit speed? if(y < Constants.REVERSE_MAX_SPEED) { y = Constants.REVERSE_MAX_SPEED;
@Override public void execute() { double y = -Constants.joystick.getY(); double z = Constants.joystick.getZ(); //TODO - Could we also check if the elevator is up and limit speed? if(y < Constants.REVERSE_MAX_SPEED) { y = Constants.REVERSE_MAX_SPEED; } if(z < Constants.LEFT_MAX_SPEED ) { z = Constants.LEFT_MAX_SPEED; } else if(z > Constants.RIGHT_MAX_SPEED){ z = Constants.RIGHT_MAX_SPEED; } driveSubsystem.getDiffDrive().arcadeDrive(y, z); }
@Override public void execute() { double y = -Constants.joystick.getY(); double z = Constants.joystick.getZ(); //TODO - Could we also check if the elevator is up and limit speed? if(y < Constants.REVERSE_MAX_SPEED) { y = Constants.REVERSE_MAX_SPEED; } if(z < Constants.LEFT_MAX_SPEED ) { z = Constants.LEFT_MAX_SPEED; } else if(z > Constants.RIGHT_MAX_SPEED){ z = Constants.RIGHT_MAX_SPEED; } driveSubsystem.getDiffDrive().arcadeDrive(y, z); }
8,485
0
// not called
private void updateCartCount(int count){ if (txtItemCount != null) { txtItemCount.setText(String.valueOf(count)); } }
DESIGN
true
private void updateCartCount(int count){ if (txtItemCount != null) { txtItemCount.setText(String.valueOf(count)); } }
private void updateCartCount(int count){ if (txtItemCount != null) { txtItemCount.setText(String.valueOf(count)); } }
private void updateCartCount(int count){ if (txtItemCount != null) { txtItemCount.setText(String.valueOf(count)); } }
33,065
0
/** * TODO implement me */
private List<DataPoint> getIntersectedSetUsingQuadTree(List<DataPoint> dataset, Rectangle rect) { throw new UnsupportedOperationException("Not Yet Implemented"); }
IMPLEMENTATION
true
private List<DataPoint> getIntersectedSetUsingQuadTree(List<DataPoint> dataset, Rectangle rect) { throw new UnsupportedOperationException("Not Yet Implemented"); }
private List<DataPoint> getIntersectedSetUsingQuadTree(List<DataPoint> dataset, Rectangle rect) { throw new UnsupportedOperationException("Not Yet Implemented"); }
private List<DataPoint> getIntersectedSetUsingQuadTree(List<DataPoint> dataset, Rectangle rect) { throw new UnsupportedOperationException("Not Yet Implemented"); }
8,490
0
//FIXME this line break is doubled - is this correct??
private static String getSampleWithLineBreak(){ StringBuilder sb = new StringBuilder(); sb.append("["); for(int i = 1; i < 4; i++){ sb.append(getTypicalElement(i)); sb.append(","); } sb.append("{\"id\" : 4," + "\"author\" : \"With line\\n break\"," + //FIXME this line break is doubled - is this correct?? "\"title\" : \"Book title 4\"," + "\"publish_date\" : \"2010-05-26\"" + "},"); sb.append(getTypicalElement(5)); sb.append(","); sb.append(getTypicalElement(6)); sb.append("]"); return sb.toString(); }
DEFECT
true
} sb.append("{\"id\" : 4," + "\"author\" : \"With line\\n break\"," + //FIXME this line break is doubled - is this correct?? "\"title\" : \"Book title 4\"," + "\"publish_date\" : \"2010-05-26\"" +
private static String getSampleWithLineBreak(){ StringBuilder sb = new StringBuilder(); sb.append("["); for(int i = 1; i < 4; i++){ sb.append(getTypicalElement(i)); sb.append(","); } sb.append("{\"id\" : 4," + "\"author\" : \"With line\\n break\"," + //FIXME this line break is doubled - is this correct?? "\"title\" : \"Book title 4\"," + "\"publish_date\" : \"2010-05-26\"" + "},"); sb.append(getTypicalElement(5)); sb.append(","); sb.append(getTypicalElement(6)); sb.append("]"); return sb.toString(); }
private static String getSampleWithLineBreak(){ StringBuilder sb = new StringBuilder(); sb.append("["); for(int i = 1; i < 4; i++){ sb.append(getTypicalElement(i)); sb.append(","); } sb.append("{\"id\" : 4," + "\"author\" : \"With line\\n break\"," + //FIXME this line break is doubled - is this correct?? "\"title\" : \"Book title 4\"," + "\"publish_date\" : \"2010-05-26\"" + "},"); sb.append(getTypicalElement(5)); sb.append(","); sb.append(getTypicalElement(6)); sb.append("]"); return sb.toString(); }
8,492
0
/* A WeakKey is equal to another WeakKey iff they both refer to objects that are, in turn, equal according to their own equals methods */
@Pure @Override public boolean equals(@Nullable Object o) { if (o == null) return false; // never happens if (this == o) return true; // This test is illegal because WeakKey is a generic type, // so use the getClass hack below instead. // if (!(o instanceof WeakKey)) return false; if (!(o.getClass().equals(WeakKey.class))) return false; Object t = this.get(); @SuppressWarnings("unchecked") Object u = ((WeakKey) o).get(); if ((t == null) || (u == null)) return false; if (t == u) return true; return keyEquals(t, u); }
NONSATD
true
@Pure @Override public boolean equals(@Nullable Object o) { if (o == null) return false; // never happens if (this == o) return true; // This test is illegal because WeakKey is a generic type, // so use the getClass hack below instead. // if (!(o instanceof WeakKey)) return false; if (!(o.getClass().equals(WeakKey.class))) return false; Object t = this.get(); @SuppressWarnings("unchecked") Object u = ((WeakKey) o).get(); if ((t == null) || (u == null)) return false; if (t == u) return true; return keyEquals(t, u); }
@Pure @Override public boolean equals(@Nullable Object o) { if (o == null) return false; // never happens if (this == o) return true; // This test is illegal because WeakKey is a generic type, // so use the getClass hack below instead. // if (!(o instanceof WeakKey)) return false; if (!(o.getClass().equals(WeakKey.class))) return false; Object t = this.get(); @SuppressWarnings("unchecked") Object u = ((WeakKey) o).get(); if ((t == null) || (u == null)) return false; if (t == u) return true; return keyEquals(t, u); }
@Pure @Override public boolean equals(@Nullable Object o) { if (o == null) return false; // never happens if (this == o) return true; // This test is illegal because WeakKey is a generic type, // so use the getClass hack below instead. // if (!(o instanceof WeakKey)) return false; if (!(o.getClass().equals(WeakKey.class))) return false; Object t = this.get(); @SuppressWarnings("unchecked") Object u = ((WeakKey) o).get(); if ((t == null) || (u == null)) return false; if (t == u) return true; return keyEquals(t, u); }
8,492
1
// never happens
@Pure @Override public boolean equals(@Nullable Object o) { if (o == null) return false; // never happens if (this == o) return true; // This test is illegal because WeakKey is a generic type, // so use the getClass hack below instead. // if (!(o instanceof WeakKey)) return false; if (!(o.getClass().equals(WeakKey.class))) return false; Object t = this.get(); @SuppressWarnings("unchecked") Object u = ((WeakKey) o).get(); if ((t == null) || (u == null)) return false; if (t == u) return true; return keyEquals(t, u); }
NONSATD
true
@Override public boolean equals(@Nullable Object o) { if (o == null) return false; // never happens if (this == o) return true; // This test is illegal because WeakKey is a generic type,
@Pure @Override public boolean equals(@Nullable Object o) { if (o == null) return false; // never happens if (this == o) return true; // This test is illegal because WeakKey is a generic type, // so use the getClass hack below instead. // if (!(o instanceof WeakKey)) return false; if (!(o.getClass().equals(WeakKey.class))) return false; Object t = this.get(); @SuppressWarnings("unchecked") Object u = ((WeakKey) o).get(); if ((t == null) || (u == null)) return false; if (t == u) return true;
@Pure @Override public boolean equals(@Nullable Object o) { if (o == null) return false; // never happens if (this == o) return true; // This test is illegal because WeakKey is a generic type, // so use the getClass hack below instead. // if (!(o instanceof WeakKey)) return false; if (!(o.getClass().equals(WeakKey.class))) return false; Object t = this.get(); @SuppressWarnings("unchecked") Object u = ((WeakKey) o).get(); if ((t == null) || (u == null)) return false; if (t == u) return true; return keyEquals(t, u); }
8,492
2
// This test is illegal because WeakKey is a generic type, // so use the getClass hack below instead. // if (!(o instanceof WeakKey)) return false;
@Pure @Override public boolean equals(@Nullable Object o) { if (o == null) return false; // never happens if (this == o) return true; // This test is illegal because WeakKey is a generic type, // so use the getClass hack below instead. // if (!(o instanceof WeakKey)) return false; if (!(o.getClass().equals(WeakKey.class))) return false; Object t = this.get(); @SuppressWarnings("unchecked") Object u = ((WeakKey) o).get(); if ((t == null) || (u == null)) return false; if (t == u) return true; return keyEquals(t, u); }
DESIGN
true
if (o == null) return false; // never happens if (this == o) return true; // This test is illegal because WeakKey is a generic type, // so use the getClass hack below instead. // if (!(o instanceof WeakKey)) return false; if (!(o.getClass().equals(WeakKey.class))) return false; Object t = this.get();
@Pure @Override public boolean equals(@Nullable Object o) { if (o == null) return false; // never happens if (this == o) return true; // This test is illegal because WeakKey is a generic type, // so use the getClass hack below instead. // if (!(o instanceof WeakKey)) return false; if (!(o.getClass().equals(WeakKey.class))) return false; Object t = this.get(); @SuppressWarnings("unchecked") Object u = ((WeakKey) o).get(); if ((t == null) || (u == null)) return false; if (t == u) return true; return keyEquals(t, u); }
@Pure @Override public boolean equals(@Nullable Object o) { if (o == null) return false; // never happens if (this == o) return true; // This test is illegal because WeakKey is a generic type, // so use the getClass hack below instead. // if (!(o instanceof WeakKey)) return false; if (!(o.getClass().equals(WeakKey.class))) return false; Object t = this.get(); @SuppressWarnings("unchecked") Object u = ((WeakKey) o).get(); if ((t == null) || (u == null)) return false; if (t == u) return true; return keyEquals(t, u); }
16,687
0
/** * Reads the GPS configuration and inserts GPS overlay on map, if it is enabled. */
public void applyGPSSetting() { // verify if GPS enable on device if(GPSService.isGPSProviderEnable(context) || GPSService.isNetworkProviderEnable(context)) { GPSSettingController gpsSettingController = new GPSSettingController(mMapView.getContext()); Boolean showGPSLocation = gpsSettingController.getGPSLocationState(); Boolean showGPSLocationOnCenter = gpsSettingController.getGPSCenterState(); if (showGPSLocation != null) if (showGPSLocation) { MainActivity mainActivity = (MainActivity) context; GPSOverlayController gpsOverlayController = mainActivity.getMainController().getGpsOverlayController(); gpsOverlayController.addGPSTrackerLayer(); gpsOverlayController.setKeepOnCenter( ((showGPSLocationOnCenter != null)?(showGPSLocationOnCenter):(false)) ); } }else { // TODO: notify user when the state of the GPS resource is disabled. use one icon on action bar? } }
NONSATD
true
public void applyGPSSetting() { // verify if GPS enable on device if(GPSService.isGPSProviderEnable(context) || GPSService.isNetworkProviderEnable(context)) { GPSSettingController gpsSettingController = new GPSSettingController(mMapView.getContext()); Boolean showGPSLocation = gpsSettingController.getGPSLocationState(); Boolean showGPSLocationOnCenter = gpsSettingController.getGPSCenterState(); if (showGPSLocation != null) if (showGPSLocation) { MainActivity mainActivity = (MainActivity) context; GPSOverlayController gpsOverlayController = mainActivity.getMainController().getGpsOverlayController(); gpsOverlayController.addGPSTrackerLayer(); gpsOverlayController.setKeepOnCenter( ((showGPSLocationOnCenter != null)?(showGPSLocationOnCenter):(false)) ); } }else { // TODO: notify user when the state of the GPS resource is disabled. use one icon on action bar? } }
public void applyGPSSetting() { // verify if GPS enable on device if(GPSService.isGPSProviderEnable(context) || GPSService.isNetworkProviderEnable(context)) { GPSSettingController gpsSettingController = new GPSSettingController(mMapView.getContext()); Boolean showGPSLocation = gpsSettingController.getGPSLocationState(); Boolean showGPSLocationOnCenter = gpsSettingController.getGPSCenterState(); if (showGPSLocation != null) if (showGPSLocation) { MainActivity mainActivity = (MainActivity) context; GPSOverlayController gpsOverlayController = mainActivity.getMainController().getGpsOverlayController(); gpsOverlayController.addGPSTrackerLayer(); gpsOverlayController.setKeepOnCenter( ((showGPSLocationOnCenter != null)?(showGPSLocationOnCenter):(false)) ); } }else { // TODO: notify user when the state of the GPS resource is disabled. use one icon on action bar? } }
public void applyGPSSetting() { // verify if GPS enable on device if(GPSService.isGPSProviderEnable(context) || GPSService.isNetworkProviderEnable(context)) { GPSSettingController gpsSettingController = new GPSSettingController(mMapView.getContext()); Boolean showGPSLocation = gpsSettingController.getGPSLocationState(); Boolean showGPSLocationOnCenter = gpsSettingController.getGPSCenterState(); if (showGPSLocation != null) if (showGPSLocation) { MainActivity mainActivity = (MainActivity) context; GPSOverlayController gpsOverlayController = mainActivity.getMainController().getGpsOverlayController(); gpsOverlayController.addGPSTrackerLayer(); gpsOverlayController.setKeepOnCenter( ((showGPSLocationOnCenter != null)?(showGPSLocationOnCenter):(false)) ); } }else { // TODO: notify user when the state of the GPS resource is disabled. use one icon on action bar? } }
16,687
1
// verify if GPS enable on device
public void applyGPSSetting() { // verify if GPS enable on device if(GPSService.isGPSProviderEnable(context) || GPSService.isNetworkProviderEnable(context)) { GPSSettingController gpsSettingController = new GPSSettingController(mMapView.getContext()); Boolean showGPSLocation = gpsSettingController.getGPSLocationState(); Boolean showGPSLocationOnCenter = gpsSettingController.getGPSCenterState(); if (showGPSLocation != null) if (showGPSLocation) { MainActivity mainActivity = (MainActivity) context; GPSOverlayController gpsOverlayController = mainActivity.getMainController().getGpsOverlayController(); gpsOverlayController.addGPSTrackerLayer(); gpsOverlayController.setKeepOnCenter( ((showGPSLocationOnCenter != null)?(showGPSLocationOnCenter):(false)) ); } }else { // TODO: notify user when the state of the GPS resource is disabled. use one icon on action bar? } }
NONSATD
true
public void applyGPSSetting() { // verify if GPS enable on device if(GPSService.isGPSProviderEnable(context) || GPSService.isNetworkProviderEnable(context)) { GPSSettingController gpsSettingController = new GPSSettingController(mMapView.getContext());
public void applyGPSSetting() { // verify if GPS enable on device if(GPSService.isGPSProviderEnable(context) || GPSService.isNetworkProviderEnable(context)) { GPSSettingController gpsSettingController = new GPSSettingController(mMapView.getContext()); Boolean showGPSLocation = gpsSettingController.getGPSLocationState(); Boolean showGPSLocationOnCenter = gpsSettingController.getGPSCenterState(); if (showGPSLocation != null) if (showGPSLocation) { MainActivity mainActivity = (MainActivity) context; GPSOverlayController gpsOverlayController = mainActivity.getMainController().getGpsOverlayController(); gpsOverlayController.addGPSTrackerLayer(); gpsOverlayController.setKeepOnCenter( ((showGPSLocationOnCenter != null)?(showGPSLocationOnCenter):(false)) );
public void applyGPSSetting() { // verify if GPS enable on device if(GPSService.isGPSProviderEnable(context) || GPSService.isNetworkProviderEnable(context)) { GPSSettingController gpsSettingController = new GPSSettingController(mMapView.getContext()); Boolean showGPSLocation = gpsSettingController.getGPSLocationState(); Boolean showGPSLocationOnCenter = gpsSettingController.getGPSCenterState(); if (showGPSLocation != null) if (showGPSLocation) { MainActivity mainActivity = (MainActivity) context; GPSOverlayController gpsOverlayController = mainActivity.getMainController().getGpsOverlayController(); gpsOverlayController.addGPSTrackerLayer(); gpsOverlayController.setKeepOnCenter( ((showGPSLocationOnCenter != null)?(showGPSLocationOnCenter):(false)) ); } }else { // TODO: notify user when the state of the GPS resource is disabled. use one icon on action bar? } }
16,687
2
// TODO: notify user when the state of the GPS resource is disabled. use one icon on action bar?
public void applyGPSSetting() { // verify if GPS enable on device if(GPSService.isGPSProviderEnable(context) || GPSService.isNetworkProviderEnable(context)) { GPSSettingController gpsSettingController = new GPSSettingController(mMapView.getContext()); Boolean showGPSLocation = gpsSettingController.getGPSLocationState(); Boolean showGPSLocationOnCenter = gpsSettingController.getGPSCenterState(); if (showGPSLocation != null) if (showGPSLocation) { MainActivity mainActivity = (MainActivity) context; GPSOverlayController gpsOverlayController = mainActivity.getMainController().getGpsOverlayController(); gpsOverlayController.addGPSTrackerLayer(); gpsOverlayController.setKeepOnCenter( ((showGPSLocationOnCenter != null)?(showGPSLocationOnCenter):(false)) ); } }else { // TODO: notify user when the state of the GPS resource is disabled. use one icon on action bar? } }
IMPLEMENTATION
true
} }else { // TODO: notify user when the state of the GPS resource is disabled. use one icon on action bar? } }
Boolean showGPSLocation = gpsSettingController.getGPSLocationState(); Boolean showGPSLocationOnCenter = gpsSettingController.getGPSCenterState(); if (showGPSLocation != null) if (showGPSLocation) { MainActivity mainActivity = (MainActivity) context; GPSOverlayController gpsOverlayController = mainActivity.getMainController().getGpsOverlayController(); gpsOverlayController.addGPSTrackerLayer(); gpsOverlayController.setKeepOnCenter( ((showGPSLocationOnCenter != null)?(showGPSLocationOnCenter):(false)) ); } }else { // TODO: notify user when the state of the GPS resource is disabled. use one icon on action bar? } }
public void applyGPSSetting() { // verify if GPS enable on device if(GPSService.isGPSProviderEnable(context) || GPSService.isNetworkProviderEnable(context)) { GPSSettingController gpsSettingController = new GPSSettingController(mMapView.getContext()); Boolean showGPSLocation = gpsSettingController.getGPSLocationState(); Boolean showGPSLocationOnCenter = gpsSettingController.getGPSCenterState(); if (showGPSLocation != null) if (showGPSLocation) { MainActivity mainActivity = (MainActivity) context; GPSOverlayController gpsOverlayController = mainActivity.getMainController().getGpsOverlayController(); gpsOverlayController.addGPSTrackerLayer(); gpsOverlayController.setKeepOnCenter( ((showGPSLocationOnCenter != null)?(showGPSLocationOnCenter):(false)) ); } }else { // TODO: notify user when the state of the GPS resource is disabled. use one icon on action bar? } }
33,071
0
/** Tests matching of built-in operator names. */
@Test void testUnquotedBuiltInFunctionNames() { // TODO: Once Oracle is an officially supported dialect, this test // should be moved to OracleValidatorTest.java. final Sql oracle = sql("?") .withUnquotedCasing(Casing.TO_UPPER) .withCaseSensitive(true); // Built-in functions are always case-insensitive. oracle.sql("select count(*), sum(deptno), floor(2.5) from dept").ok(); oracle.sql("select COUNT(*), FLOOR(2.5) from dept").ok(); oracle.sql("select cOuNt(*), FlOOr(2.5) from dept").ok(); oracle.sql("select cOuNt (*), FlOOr (2.5) from dept").ok(); oracle.sql("select current_time from dept").ok(); oracle.sql("select Current_Time from dept").ok(); oracle.sql("select CURRENT_TIME from dept").ok(); oracle.sql("select \"count\"(*) from dept").ok(); }
NONSATD
true
@Test void testUnquotedBuiltInFunctionNames() { // TODO: Once Oracle is an officially supported dialect, this test // should be moved to OracleValidatorTest.java. final Sql oracle = sql("?") .withUnquotedCasing(Casing.TO_UPPER) .withCaseSensitive(true); // Built-in functions are always case-insensitive. oracle.sql("select count(*), sum(deptno), floor(2.5) from dept").ok(); oracle.sql("select COUNT(*), FLOOR(2.5) from dept").ok(); oracle.sql("select cOuNt(*), FlOOr(2.5) from dept").ok(); oracle.sql("select cOuNt (*), FlOOr (2.5) from dept").ok(); oracle.sql("select current_time from dept").ok(); oracle.sql("select Current_Time from dept").ok(); oracle.sql("select CURRENT_TIME from dept").ok(); oracle.sql("select \"count\"(*) from dept").ok(); }
@Test void testUnquotedBuiltInFunctionNames() { // TODO: Once Oracle is an officially supported dialect, this test // should be moved to OracleValidatorTest.java. final Sql oracle = sql("?") .withUnquotedCasing(Casing.TO_UPPER) .withCaseSensitive(true); // Built-in functions are always case-insensitive. oracle.sql("select count(*), sum(deptno), floor(2.5) from dept").ok(); oracle.sql("select COUNT(*), FLOOR(2.5) from dept").ok(); oracle.sql("select cOuNt(*), FlOOr(2.5) from dept").ok(); oracle.sql("select cOuNt (*), FlOOr (2.5) from dept").ok(); oracle.sql("select current_time from dept").ok(); oracle.sql("select Current_Time from dept").ok(); oracle.sql("select CURRENT_TIME from dept").ok(); oracle.sql("select \"count\"(*) from dept").ok(); }
@Test void testUnquotedBuiltInFunctionNames() { // TODO: Once Oracle is an officially supported dialect, this test // should be moved to OracleValidatorTest.java. final Sql oracle = sql("?") .withUnquotedCasing(Casing.TO_UPPER) .withCaseSensitive(true); // Built-in functions are always case-insensitive. oracle.sql("select count(*), sum(deptno), floor(2.5) from dept").ok(); oracle.sql("select COUNT(*), FLOOR(2.5) from dept").ok(); oracle.sql("select cOuNt(*), FlOOr(2.5) from dept").ok(); oracle.sql("select cOuNt (*), FlOOr (2.5) from dept").ok(); oracle.sql("select current_time from dept").ok(); oracle.sql("select Current_Time from dept").ok(); oracle.sql("select CURRENT_TIME from dept").ok(); oracle.sql("select \"count\"(*) from dept").ok(); }
33,071
1
// TODO: Once Oracle is an officially supported dialect, this test // should be moved to OracleValidatorTest.java.
@Test void testUnquotedBuiltInFunctionNames() { // TODO: Once Oracle is an officially supported dialect, this test // should be moved to OracleValidatorTest.java. final Sql oracle = sql("?") .withUnquotedCasing(Casing.TO_UPPER) .withCaseSensitive(true); // Built-in functions are always case-insensitive. oracle.sql("select count(*), sum(deptno), floor(2.5) from dept").ok(); oracle.sql("select COUNT(*), FLOOR(2.5) from dept").ok(); oracle.sql("select cOuNt(*), FlOOr(2.5) from dept").ok(); oracle.sql("select cOuNt (*), FlOOr (2.5) from dept").ok(); oracle.sql("select current_time from dept").ok(); oracle.sql("select Current_Time from dept").ok(); oracle.sql("select CURRENT_TIME from dept").ok(); oracle.sql("select \"count\"(*) from dept").ok(); }
TEST
true
@Test void testUnquotedBuiltInFunctionNames() { // TODO: Once Oracle is an officially supported dialect, this test // should be moved to OracleValidatorTest.java. final Sql oracle = sql("?") .withUnquotedCasing(Casing.TO_UPPER)
@Test void testUnquotedBuiltInFunctionNames() { // TODO: Once Oracle is an officially supported dialect, this test // should be moved to OracleValidatorTest.java. final Sql oracle = sql("?") .withUnquotedCasing(Casing.TO_UPPER) .withCaseSensitive(true); // Built-in functions are always case-insensitive. oracle.sql("select count(*), sum(deptno), floor(2.5) from dept").ok(); oracle.sql("select COUNT(*), FLOOR(2.5) from dept").ok(); oracle.sql("select cOuNt(*), FlOOr(2.5) from dept").ok(); oracle.sql("select cOuNt (*), FlOOr (2.5) from dept").ok(); oracle.sql("select current_time from dept").ok(); oracle.sql("select Current_Time from dept").ok();
@Test void testUnquotedBuiltInFunctionNames() { // TODO: Once Oracle is an officially supported dialect, this test // should be moved to OracleValidatorTest.java. final Sql oracle = sql("?") .withUnquotedCasing(Casing.TO_UPPER) .withCaseSensitive(true); // Built-in functions are always case-insensitive. oracle.sql("select count(*), sum(deptno), floor(2.5) from dept").ok(); oracle.sql("select COUNT(*), FLOOR(2.5) from dept").ok(); oracle.sql("select cOuNt(*), FlOOr(2.5) from dept").ok(); oracle.sql("select cOuNt (*), FlOOr (2.5) from dept").ok(); oracle.sql("select current_time from dept").ok(); oracle.sql("select Current_Time from dept").ok(); oracle.sql("select CURRENT_TIME from dept").ok(); oracle.sql("select \"count\"(*) from dept").ok(); }
33,071
2
// Built-in functions are always case-insensitive.
@Test void testUnquotedBuiltInFunctionNames() { // TODO: Once Oracle is an officially supported dialect, this test // should be moved to OracleValidatorTest.java. final Sql oracle = sql("?") .withUnquotedCasing(Casing.TO_UPPER) .withCaseSensitive(true); // Built-in functions are always case-insensitive. oracle.sql("select count(*), sum(deptno), floor(2.5) from dept").ok(); oracle.sql("select COUNT(*), FLOOR(2.5) from dept").ok(); oracle.sql("select cOuNt(*), FlOOr(2.5) from dept").ok(); oracle.sql("select cOuNt (*), FlOOr (2.5) from dept").ok(); oracle.sql("select current_time from dept").ok(); oracle.sql("select Current_Time from dept").ok(); oracle.sql("select CURRENT_TIME from dept").ok(); oracle.sql("select \"count\"(*) from dept").ok(); }
NONSATD
true
.withUnquotedCasing(Casing.TO_UPPER) .withCaseSensitive(true); // Built-in functions are always case-insensitive. oracle.sql("select count(*), sum(deptno), floor(2.5) from dept").ok(); oracle.sql("select COUNT(*), FLOOR(2.5) from dept").ok();
@Test void testUnquotedBuiltInFunctionNames() { // TODO: Once Oracle is an officially supported dialect, this test // should be moved to OracleValidatorTest.java. final Sql oracle = sql("?") .withUnquotedCasing(Casing.TO_UPPER) .withCaseSensitive(true); // Built-in functions are always case-insensitive. oracle.sql("select count(*), sum(deptno), floor(2.5) from dept").ok(); oracle.sql("select COUNT(*), FLOOR(2.5) from dept").ok(); oracle.sql("select cOuNt(*), FlOOr(2.5) from dept").ok(); oracle.sql("select cOuNt (*), FlOOr (2.5) from dept").ok(); oracle.sql("select current_time from dept").ok(); oracle.sql("select Current_Time from dept").ok(); oracle.sql("select CURRENT_TIME from dept").ok(); oracle.sql("select \"count\"(*) from dept").ok(); }
@Test void testUnquotedBuiltInFunctionNames() { // TODO: Once Oracle is an officially supported dialect, this test // should be moved to OracleValidatorTest.java. final Sql oracle = sql("?") .withUnquotedCasing(Casing.TO_UPPER) .withCaseSensitive(true); // Built-in functions are always case-insensitive. oracle.sql("select count(*), sum(deptno), floor(2.5) from dept").ok(); oracle.sql("select COUNT(*), FLOOR(2.5) from dept").ok(); oracle.sql("select cOuNt(*), FlOOr(2.5) from dept").ok(); oracle.sql("select cOuNt (*), FlOOr (2.5) from dept").ok(); oracle.sql("select current_time from dept").ok(); oracle.sql("select Current_Time from dept").ok(); oracle.sql("select CURRENT_TIME from dept").ok(); oracle.sql("select \"count\"(*) from dept").ok(); }
24,886
0
//TODO this should return a list of what?
@Test public void testAuthRequest() throws IOException, MessageException, DiscoveryException, ConsumerException { DiscoveryInformation info = createMockInfo(); HttpSession session = createMockSession(info, false, false, true); HttpServletRequest req = createMockRequest(session); HttpServletResponse resp = createMockResponse(); AuthRequest authRequest = createMockAuthRequest(); //TODO this should return a list of what? expect(mockManager.discover(eq("discover"))).andReturn(Lists.newArrayList()); expect(mockManager.associate(anyObject(List.class))).andReturn(info); expect(mockManager.authenticate(eq(info), eq("http://example.com:80/openid/openidcallback"))).andReturn(authRequest); replay(mockManager); consumer = new OpenIDConsumer("%origin%/openid/openidcallback", mockManager, "mockContextRoot", mockAuthority); assertFalse(consumer.authRequest("discover", req, resp)); }
DESIGN
true
HttpServletResponse resp = createMockResponse(); AuthRequest authRequest = createMockAuthRequest(); //TODO this should return a list of what? expect(mockManager.discover(eq("discover"))).andReturn(Lists.newArrayList()); expect(mockManager.associate(anyObject(List.class))).andReturn(info);
@Test public void testAuthRequest() throws IOException, MessageException, DiscoveryException, ConsumerException { DiscoveryInformation info = createMockInfo(); HttpSession session = createMockSession(info, false, false, true); HttpServletRequest req = createMockRequest(session); HttpServletResponse resp = createMockResponse(); AuthRequest authRequest = createMockAuthRequest(); //TODO this should return a list of what? expect(mockManager.discover(eq("discover"))).andReturn(Lists.newArrayList()); expect(mockManager.associate(anyObject(List.class))).andReturn(info); expect(mockManager.authenticate(eq(info), eq("http://example.com:80/openid/openidcallback"))).andReturn(authRequest); replay(mockManager); consumer = new OpenIDConsumer("%origin%/openid/openidcallback", mockManager, "mockContextRoot", mockAuthority); assertFalse(consumer.authRequest("discover", req, resp)); }
@Test public void testAuthRequest() throws IOException, MessageException, DiscoveryException, ConsumerException { DiscoveryInformation info = createMockInfo(); HttpSession session = createMockSession(info, false, false, true); HttpServletRequest req = createMockRequest(session); HttpServletResponse resp = createMockResponse(); AuthRequest authRequest = createMockAuthRequest(); //TODO this should return a list of what? expect(mockManager.discover(eq("discover"))).andReturn(Lists.newArrayList()); expect(mockManager.associate(anyObject(List.class))).andReturn(info); expect(mockManager.authenticate(eq(info), eq("http://example.com:80/openid/openidcallback"))).andReturn(authRequest); replay(mockManager); consumer = new OpenIDConsumer("%origin%/openid/openidcallback", mockManager, "mockContextRoot", mockAuthority); assertFalse(consumer.authRequest("discover", req, resp)); }
24,887
0
//TODO this should return a list of what?
@Test(expected = RuntimeException.class) public void testAuthRequestIOException() throws IOException, MessageException, DiscoveryException, ConsumerException { DiscoveryInformation info = createMockInfo(); HttpSession session = createMockSession(info, false, false, true); HttpServletRequest req = createMockRequest(session); HttpServletResponse resp = createMockResponse(); AuthRequest authRequest = createMockAuthRequest(); //TODO this should return a list of what? expect(mockManager.discover(eq("discover"))).andThrow(new IOException()); expect(mockManager.associate(anyObject(List.class))).andReturn(info); expect(mockManager.authenticate(eq(info), eq("http://example.com:80/openid/openidcallback"))).andReturn(authRequest); replay(mockManager); consumer = new OpenIDConsumer("%origin%/openid/openidcallback", mockManager, "mockContextRoot", mockAuthority); assertFalse(consumer.authRequest("discover", req, resp)); }
DESIGN
true
HttpServletResponse resp = createMockResponse(); AuthRequest authRequest = createMockAuthRequest(); //TODO this should return a list of what? expect(mockManager.discover(eq("discover"))).andThrow(new IOException()); expect(mockManager.associate(anyObject(List.class))).andReturn(info);
@Test(expected = RuntimeException.class) public void testAuthRequestIOException() throws IOException, MessageException, DiscoveryException, ConsumerException { DiscoveryInformation info = createMockInfo(); HttpSession session = createMockSession(info, false, false, true); HttpServletRequest req = createMockRequest(session); HttpServletResponse resp = createMockResponse(); AuthRequest authRequest = createMockAuthRequest(); //TODO this should return a list of what? expect(mockManager.discover(eq("discover"))).andThrow(new IOException()); expect(mockManager.associate(anyObject(List.class))).andReturn(info); expect(mockManager.authenticate(eq(info), eq("http://example.com:80/openid/openidcallback"))).andReturn(authRequest); replay(mockManager); consumer = new OpenIDConsumer("%origin%/openid/openidcallback", mockManager, "mockContextRoot", mockAuthority); assertFalse(consumer.authRequest("discover", req, resp)); }
@Test(expected = RuntimeException.class) public void testAuthRequestIOException() throws IOException, MessageException, DiscoveryException, ConsumerException { DiscoveryInformation info = createMockInfo(); HttpSession session = createMockSession(info, false, false, true); HttpServletRequest req = createMockRequest(session); HttpServletResponse resp = createMockResponse(); AuthRequest authRequest = createMockAuthRequest(); //TODO this should return a list of what? expect(mockManager.discover(eq("discover"))).andThrow(new IOException()); expect(mockManager.associate(anyObject(List.class))).andReturn(info); expect(mockManager.authenticate(eq(info), eq("http://example.com:80/openid/openidcallback"))).andReturn(authRequest); replay(mockManager); consumer = new OpenIDConsumer("%origin%/openid/openidcallback", mockManager, "mockContextRoot", mockAuthority); assertFalse(consumer.authRequest("discover", req, resp)); }
24,888
0
//TODO this should return a list of what?
@Test public void testVerifyResponse() throws IOException, MessageException, DiscoveryException, ConsumerException, AssociationException { DiscoveryInformation info = createMockInfo(); HttpSession session = createMockSession(info, true, true, true); HttpServletRequest req = createMockRequest(session); AuthRequest authRequest = createMockAuthRequest(); AuthSuccess authSuccess = createMockAuthSuccess(createMockFetchResponse(), createRegResponse(), true, true); Identifier id = createMockIdentifier(); VerificationResult result = createMockVerificationResult(id, authSuccess); //TODO this should return a list of what? expect(mockManager.discover(eq("discover"))).andReturn(Lists.newArrayList()); expect(mockManager.associate(anyObject(List.class))).andReturn(info); expect(mockManager.authenticate(eq(info), eq("http://example.com:80/openid/openidcallback"))).andReturn(authRequest); expect(mockManager.verify(eq("http://example.com/request?query"), anyObject(ParameterList.class), anyObject(DiscoveryInformation.class))).andReturn(result); replay(mockManager); consumer = new OpenIDConsumer("%origin%/openid/openidcallback", mockManager, "mockContextRoot", mockAuthority); assertEquals(id, consumer.verifyResponse(req)); }
DESIGN
true
Identifier id = createMockIdentifier(); VerificationResult result = createMockVerificationResult(id, authSuccess); //TODO this should return a list of what? expect(mockManager.discover(eq("discover"))).andReturn(Lists.newArrayList()); expect(mockManager.associate(anyObject(List.class))).andReturn(info);
@Test public void testVerifyResponse() throws IOException, MessageException, DiscoveryException, ConsumerException, AssociationException { DiscoveryInformation info = createMockInfo(); HttpSession session = createMockSession(info, true, true, true); HttpServletRequest req = createMockRequest(session); AuthRequest authRequest = createMockAuthRequest(); AuthSuccess authSuccess = createMockAuthSuccess(createMockFetchResponse(), createRegResponse(), true, true); Identifier id = createMockIdentifier(); VerificationResult result = createMockVerificationResult(id, authSuccess); //TODO this should return a list of what? expect(mockManager.discover(eq("discover"))).andReturn(Lists.newArrayList()); expect(mockManager.associate(anyObject(List.class))).andReturn(info); expect(mockManager.authenticate(eq(info), eq("http://example.com:80/openid/openidcallback"))).andReturn(authRequest); expect(mockManager.verify(eq("http://example.com/request?query"), anyObject(ParameterList.class), anyObject(DiscoveryInformation.class))).andReturn(result); replay(mockManager); consumer = new OpenIDConsumer("%origin%/openid/openidcallback", mockManager, "mockContextRoot", mockAuthority); assertEquals(id, consumer.verifyResponse(req)); }
@Test public void testVerifyResponse() throws IOException, MessageException, DiscoveryException, ConsumerException, AssociationException { DiscoveryInformation info = createMockInfo(); HttpSession session = createMockSession(info, true, true, true); HttpServletRequest req = createMockRequest(session); AuthRequest authRequest = createMockAuthRequest(); AuthSuccess authSuccess = createMockAuthSuccess(createMockFetchResponse(), createRegResponse(), true, true); Identifier id = createMockIdentifier(); VerificationResult result = createMockVerificationResult(id, authSuccess); //TODO this should return a list of what? expect(mockManager.discover(eq("discover"))).andReturn(Lists.newArrayList()); expect(mockManager.associate(anyObject(List.class))).andReturn(info); expect(mockManager.authenticate(eq(info), eq("http://example.com:80/openid/openidcallback"))).andReturn(authRequest); expect(mockManager.verify(eq("http://example.com/request?query"), anyObject(ParameterList.class), anyObject(DiscoveryInformation.class))).andReturn(result); replay(mockManager); consumer = new OpenIDConsumer("%origin%/openid/openidcallback", mockManager, "mockContextRoot", mockAuthority); assertEquals(id, consumer.verifyResponse(req)); }
24,889
0
//TODO this should return a list of what?
@Test public void testVerifyResponseNullIdentifier() throws IOException, MessageException, DiscoveryException, ConsumerException, AssociationException { DiscoveryInformation info = createMockInfo(); HttpSession session = createMockSession(info, false, false, true); HttpServletRequest req = createMockRequest(session); AuthRequest authRequest = createMockAuthRequest(); AuthSuccess authSuccess = createMockAuthSuccess(createMockFetchResponse(), createRegResponse(), true, true); VerificationResult result = createMockVerificationResult(null, authSuccess); //TODO this should return a list of what? expect(mockManager.discover(eq("discover"))).andReturn(Lists.newArrayList()); expect(mockManager.associate(anyObject(List.class))).andReturn(info); expect(mockManager.authenticate(eq(info), eq("http://example.com:80/openid/openidcallback"))).andReturn(authRequest); expect(mockManager.verify(eq("http://example.com/request?query"), anyObject(ParameterList.class), anyObject(DiscoveryInformation.class))).andReturn(result); replay(mockManager); consumer = new OpenIDConsumer("%origin%/openid/openidcallback", mockManager, "mockContextRoot", mockAuthority); assertNull(consumer.verifyResponse(req)); }
DESIGN
true
true, true); VerificationResult result = createMockVerificationResult(null, authSuccess); //TODO this should return a list of what? expect(mockManager.discover(eq("discover"))).andReturn(Lists.newArrayList()); expect(mockManager.associate(anyObject(List.class))).andReturn(info);
@Test public void testVerifyResponseNullIdentifier() throws IOException, MessageException, DiscoveryException, ConsumerException, AssociationException { DiscoveryInformation info = createMockInfo(); HttpSession session = createMockSession(info, false, false, true); HttpServletRequest req = createMockRequest(session); AuthRequest authRequest = createMockAuthRequest(); AuthSuccess authSuccess = createMockAuthSuccess(createMockFetchResponse(), createRegResponse(), true, true); VerificationResult result = createMockVerificationResult(null, authSuccess); //TODO this should return a list of what? expect(mockManager.discover(eq("discover"))).andReturn(Lists.newArrayList()); expect(mockManager.associate(anyObject(List.class))).andReturn(info); expect(mockManager.authenticate(eq(info), eq("http://example.com:80/openid/openidcallback"))).andReturn(authRequest); expect(mockManager.verify(eq("http://example.com/request?query"), anyObject(ParameterList.class), anyObject(DiscoveryInformation.class))).andReturn(result); replay(mockManager); consumer = new OpenIDConsumer("%origin%/openid/openidcallback", mockManager, "mockContextRoot", mockAuthority); assertNull(consumer.verifyResponse(req)); }
@Test public void testVerifyResponseNullIdentifier() throws IOException, MessageException, DiscoveryException, ConsumerException, AssociationException { DiscoveryInformation info = createMockInfo(); HttpSession session = createMockSession(info, false, false, true); HttpServletRequest req = createMockRequest(session); AuthRequest authRequest = createMockAuthRequest(); AuthSuccess authSuccess = createMockAuthSuccess(createMockFetchResponse(), createRegResponse(), true, true); VerificationResult result = createMockVerificationResult(null, authSuccess); //TODO this should return a list of what? expect(mockManager.discover(eq("discover"))).andReturn(Lists.newArrayList()); expect(mockManager.associate(anyObject(List.class))).andReturn(info); expect(mockManager.authenticate(eq(info), eq("http://example.com:80/openid/openidcallback"))).andReturn(authRequest); expect(mockManager.verify(eq("http://example.com/request?query"), anyObject(ParameterList.class), anyObject(DiscoveryInformation.class))).andReturn(result); replay(mockManager); consumer = new OpenIDConsumer("%origin%/openid/openidcallback", mockManager, "mockContextRoot", mockAuthority); assertNull(consumer.verifyResponse(req)); }
24,890
0
//TODO this should return a list of what?
@Test public void testVerifyResponseNoEmail() throws IOException, MessageException, DiscoveryException, ConsumerException, AssociationException { DiscoveryInformation info = createMockInfo(); HttpSession session = createMockSession(info, false, false, false); HttpServletRequest req = createMockRequest(session); AuthRequest authRequest = createMockAuthRequest(); AuthSuccess authSuccess = createMockAuthSuccess(createMockFetchResponse(), createRegResponse(), false, false); Identifier id = createMockIdentifier(); VerificationResult result = createMockVerificationResult(id, authSuccess); //TODO this should return a list of what? expect(mockManager.discover(eq("discover"))).andReturn(Lists.newArrayList()); expect(mockManager.associate(anyObject(List.class))).andReturn(info); expect(mockManager.authenticate(eq(info), eq("http://example.com:80/openid/openidcallback"))).andReturn(authRequest); expect(mockManager.verify(eq("http://example.com/request?query"), anyObject(ParameterList.class), anyObject(DiscoveryInformation.class))).andReturn(result); replay(mockManager); consumer = new OpenIDConsumer("%origin%/openid/openidcallback", mockManager, "mockContextRoot", mockAuthority); assertEquals(id, consumer.verifyResponse(req)); verify(authSuccess); verify(session); }
DESIGN
true
Identifier id = createMockIdentifier(); VerificationResult result = createMockVerificationResult(id, authSuccess); //TODO this should return a list of what? expect(mockManager.discover(eq("discover"))).andReturn(Lists.newArrayList()); expect(mockManager.associate(anyObject(List.class))).andReturn(info);
@Test public void testVerifyResponseNoEmail() throws IOException, MessageException, DiscoveryException, ConsumerException, AssociationException { DiscoveryInformation info = createMockInfo(); HttpSession session = createMockSession(info, false, false, false); HttpServletRequest req = createMockRequest(session); AuthRequest authRequest = createMockAuthRequest(); AuthSuccess authSuccess = createMockAuthSuccess(createMockFetchResponse(), createRegResponse(), false, false); Identifier id = createMockIdentifier(); VerificationResult result = createMockVerificationResult(id, authSuccess); //TODO this should return a list of what? expect(mockManager.discover(eq("discover"))).andReturn(Lists.newArrayList()); expect(mockManager.associate(anyObject(List.class))).andReturn(info); expect(mockManager.authenticate(eq(info), eq("http://example.com:80/openid/openidcallback"))).andReturn(authRequest); expect(mockManager.verify(eq("http://example.com/request?query"), anyObject(ParameterList.class), anyObject(DiscoveryInformation.class))).andReturn(result); replay(mockManager); consumer = new OpenIDConsumer("%origin%/openid/openidcallback", mockManager, "mockContextRoot", mockAuthority); assertEquals(id, consumer.verifyResponse(req)); verify(authSuccess); verify(session); }
@Test public void testVerifyResponseNoEmail() throws IOException, MessageException, DiscoveryException, ConsumerException, AssociationException { DiscoveryInformation info = createMockInfo(); HttpSession session = createMockSession(info, false, false, false); HttpServletRequest req = createMockRequest(session); AuthRequest authRequest = createMockAuthRequest(); AuthSuccess authSuccess = createMockAuthSuccess(createMockFetchResponse(), createRegResponse(), false, false); Identifier id = createMockIdentifier(); VerificationResult result = createMockVerificationResult(id, authSuccess); //TODO this should return a list of what? expect(mockManager.discover(eq("discover"))).andReturn(Lists.newArrayList()); expect(mockManager.associate(anyObject(List.class))).andReturn(info); expect(mockManager.authenticate(eq(info), eq("http://example.com:80/openid/openidcallback"))).andReturn(authRequest); expect(mockManager.verify(eq("http://example.com/request?query"), anyObject(ParameterList.class), anyObject(DiscoveryInformation.class))).andReturn(result); replay(mockManager); consumer = new OpenIDConsumer("%origin%/openid/openidcallback", mockManager, "mockContextRoot", mockAuthority); assertEquals(id, consumer.verifyResponse(req)); verify(authSuccess); verify(session); }
8,514
0
// TODO SlaveComputer.doSlaveAgentJnlp; there should be an annotation to request unprotected access
public Object getTarget() { try { checkPermission(READ); } catch (AccessDeniedException e) { String rest = Stapler.getCurrentRequest().getRestOfPath(); for (String name : ALWAYS_READABLE_PATHS) { if (rest.startsWith(name)) { return this; } } for (String name : getUnprotectedRootActions()) { if (rest.startsWith("/" + name + "/") || rest.equals("/" + name)) { return this; } } // TODO SlaveComputer.doSlaveAgentJnlp; there should be an annotation to request unprotected access if (rest.matches("/computer/[^/]+/slave-agent[.]jnlp") && "true".equals(Stapler.getCurrentRequest().getParameter("encrypt"))) { return this; } throw e; } return this; }
DESIGN
true
} } // TODO SlaveComputer.doSlaveAgentJnlp; there should be an annotation to request unprotected access if (rest.matches("/computer/[^/]+/slave-agent[.]jnlp") && "true".equals(Stapler.getCurrentRequest().getParameter("encrypt"))) {
for (String name : ALWAYS_READABLE_PATHS) { if (rest.startsWith(name)) { return this; } } for (String name : getUnprotectedRootActions()) { if (rest.startsWith("/" + name + "/") || rest.equals("/" + name)) { return this; } } // TODO SlaveComputer.doSlaveAgentJnlp; there should be an annotation to request unprotected access if (rest.matches("/computer/[^/]+/slave-agent[.]jnlp") && "true".equals(Stapler.getCurrentRequest().getParameter("encrypt"))) { return this; } throw e; } return this; }
public Object getTarget() { try { checkPermission(READ); } catch (AccessDeniedException e) { String rest = Stapler.getCurrentRequest().getRestOfPath(); for (String name : ALWAYS_READABLE_PATHS) { if (rest.startsWith(name)) { return this; } } for (String name : getUnprotectedRootActions()) { if (rest.startsWith("/" + name + "/") || rest.equals("/" + name)) { return this; } } // TODO SlaveComputer.doSlaveAgentJnlp; there should be an annotation to request unprotected access if (rest.matches("/computer/[^/]+/slave-agent[.]jnlp") && "true".equals(Stapler.getCurrentRequest().getParameter("encrypt"))) { return this; } throw e; } return this; }
325
0
// This cast is horrid but we can't fix everything at once.
void tracksDropped(Point startPoint, Point dropPoint, List<Track> tracks) { // This cast is horrid but we can't fix everything at once. TrackPanel panel = ((TrackPanel) getParent()); List<MouseableRegion> regions = getMouseRegions(); if (regions.isEmpty()) { // empty panel, just add the tracks panel.addTracks(tracks); } else { // Find the regions containing the startPoint and point boolean before = true; MouseableRegion dropRegion = null; MouseableRegion startRegion = null; for (MouseableRegion region : regions) { if (region.containsPoint(dropPoint.x, dropPoint.y)) { dropRegion = region; Rectangle bnds = dropRegion.getBounds(); int dy1 = (dropPoint.y - bnds.y); int dy2 = bnds.height - dy1; before = dy1 < dy2; } if (region.containsPoint(startPoint.x, startPoint.y)) { startRegion = region; } if (dropRegion != null && startRegion != null) { break; } } Track dropTrack = null; if (dropRegion != null) { Iterator<Track> tmp = dropRegion.getTracks().iterator(); if (tmp.hasNext()) { dropTrack = tmp.next(); } } panel.moveSelectedTracksTo(tracks, dropTrack, before); } }
DESIGN
true
void tracksDropped(Point startPoint, Point dropPoint, List<Track> tracks) { // This cast is horrid but we can't fix everything at once. TrackPanel panel = ((TrackPanel) getParent()); List<MouseableRegion> regions = getMouseRegions();
void tracksDropped(Point startPoint, Point dropPoint, List<Track> tracks) { // This cast is horrid but we can't fix everything at once. TrackPanel panel = ((TrackPanel) getParent()); List<MouseableRegion> regions = getMouseRegions(); if (regions.isEmpty()) { // empty panel, just add the tracks panel.addTracks(tracks); } else { // Find the regions containing the startPoint and point boolean before = true; MouseableRegion dropRegion = null; MouseableRegion startRegion = null;
void tracksDropped(Point startPoint, Point dropPoint, List<Track> tracks) { // This cast is horrid but we can't fix everything at once. TrackPanel panel = ((TrackPanel) getParent()); List<MouseableRegion> regions = getMouseRegions(); if (regions.isEmpty()) { // empty panel, just add the tracks panel.addTracks(tracks); } else { // Find the regions containing the startPoint and point boolean before = true; MouseableRegion dropRegion = null; MouseableRegion startRegion = null; for (MouseableRegion region : regions) { if (region.containsPoint(dropPoint.x, dropPoint.y)) { dropRegion = region; Rectangle bnds = dropRegion.getBounds(); int dy1 = (dropPoint.y - bnds.y); int dy2 = bnds.height - dy1; before = dy1 < dy2; } if (region.containsPoint(startPoint.x, startPoint.y)) { startRegion = region;
325
1
// empty panel, just add the tracks
void tracksDropped(Point startPoint, Point dropPoint, List<Track> tracks) { // This cast is horrid but we can't fix everything at once. TrackPanel panel = ((TrackPanel) getParent()); List<MouseableRegion> regions = getMouseRegions(); if (regions.isEmpty()) { // empty panel, just add the tracks panel.addTracks(tracks); } else { // Find the regions containing the startPoint and point boolean before = true; MouseableRegion dropRegion = null; MouseableRegion startRegion = null; for (MouseableRegion region : regions) { if (region.containsPoint(dropPoint.x, dropPoint.y)) { dropRegion = region; Rectangle bnds = dropRegion.getBounds(); int dy1 = (dropPoint.y - bnds.y); int dy2 = bnds.height - dy1; before = dy1 < dy2; } if (region.containsPoint(startPoint.x, startPoint.y)) { startRegion = region; } if (dropRegion != null && startRegion != null) { break; } } Track dropTrack = null; if (dropRegion != null) { Iterator<Track> tmp = dropRegion.getTracks().iterator(); if (tmp.hasNext()) { dropTrack = tmp.next(); } } panel.moveSelectedTracksTo(tracks, dropTrack, before); } }
NONSATD
true
List<MouseableRegion> regions = getMouseRegions(); if (regions.isEmpty()) { // empty panel, just add the tracks panel.addTracks(tracks); } else {
void tracksDropped(Point startPoint, Point dropPoint, List<Track> tracks) { // This cast is horrid but we can't fix everything at once. TrackPanel panel = ((TrackPanel) getParent()); List<MouseableRegion> regions = getMouseRegions(); if (regions.isEmpty()) { // empty panel, just add the tracks panel.addTracks(tracks); } else { // Find the regions containing the startPoint and point boolean before = true; MouseableRegion dropRegion = null; MouseableRegion startRegion = null; for (MouseableRegion region : regions) { if (region.containsPoint(dropPoint.x, dropPoint.y)) { dropRegion = region; Rectangle bnds = dropRegion.getBounds();
void tracksDropped(Point startPoint, Point dropPoint, List<Track> tracks) { // This cast is horrid but we can't fix everything at once. TrackPanel panel = ((TrackPanel) getParent()); List<MouseableRegion> regions = getMouseRegions(); if (regions.isEmpty()) { // empty panel, just add the tracks panel.addTracks(tracks); } else { // Find the regions containing the startPoint and point boolean before = true; MouseableRegion dropRegion = null; MouseableRegion startRegion = null; for (MouseableRegion region : regions) { if (region.containsPoint(dropPoint.x, dropPoint.y)) { dropRegion = region; Rectangle bnds = dropRegion.getBounds(); int dy1 = (dropPoint.y - bnds.y); int dy2 = bnds.height - dy1; before = dy1 < dy2; } if (region.containsPoint(startPoint.x, startPoint.y)) { startRegion = region; } if (dropRegion != null && startRegion != null) { break; }
325
2
// Find the regions containing the startPoint and point
void tracksDropped(Point startPoint, Point dropPoint, List<Track> tracks) { // This cast is horrid but we can't fix everything at once. TrackPanel panel = ((TrackPanel) getParent()); List<MouseableRegion> regions = getMouseRegions(); if (regions.isEmpty()) { // empty panel, just add the tracks panel.addTracks(tracks); } else { // Find the regions containing the startPoint and point boolean before = true; MouseableRegion dropRegion = null; MouseableRegion startRegion = null; for (MouseableRegion region : regions) { if (region.containsPoint(dropPoint.x, dropPoint.y)) { dropRegion = region; Rectangle bnds = dropRegion.getBounds(); int dy1 = (dropPoint.y - bnds.y); int dy2 = bnds.height - dy1; before = dy1 < dy2; } if (region.containsPoint(startPoint.x, startPoint.y)) { startRegion = region; } if (dropRegion != null && startRegion != null) { break; } } Track dropTrack = null; if (dropRegion != null) { Iterator<Track> tmp = dropRegion.getTracks().iterator(); if (tmp.hasNext()) { dropTrack = tmp.next(); } } panel.moveSelectedTracksTo(tracks, dropTrack, before); } }
NONSATD
true
panel.addTracks(tracks); } else { // Find the regions containing the startPoint and point boolean before = true; MouseableRegion dropRegion = null;
void tracksDropped(Point startPoint, Point dropPoint, List<Track> tracks) { // This cast is horrid but we can't fix everything at once. TrackPanel panel = ((TrackPanel) getParent()); List<MouseableRegion> regions = getMouseRegions(); if (regions.isEmpty()) { // empty panel, just add the tracks panel.addTracks(tracks); } else { // Find the regions containing the startPoint and point boolean before = true; MouseableRegion dropRegion = null; MouseableRegion startRegion = null; for (MouseableRegion region : regions) { if (region.containsPoint(dropPoint.x, dropPoint.y)) { dropRegion = region; Rectangle bnds = dropRegion.getBounds(); int dy1 = (dropPoint.y - bnds.y); int dy2 = bnds.height - dy1; before = dy1 < dy2;
void tracksDropped(Point startPoint, Point dropPoint, List<Track> tracks) { // This cast is horrid but we can't fix everything at once. TrackPanel panel = ((TrackPanel) getParent()); List<MouseableRegion> regions = getMouseRegions(); if (regions.isEmpty()) { // empty panel, just add the tracks panel.addTracks(tracks); } else { // Find the regions containing the startPoint and point boolean before = true; MouseableRegion dropRegion = null; MouseableRegion startRegion = null; for (MouseableRegion region : regions) { if (region.containsPoint(dropPoint.x, dropPoint.y)) { dropRegion = region; Rectangle bnds = dropRegion.getBounds(); int dy1 = (dropPoint.y - bnds.y); int dy2 = bnds.height - dy1; before = dy1 < dy2; } if (region.containsPoint(startPoint.x, startPoint.y)) { startRegion = region; } if (dropRegion != null && startRegion != null) { break; } } Track dropTrack = null; if (dropRegion != null) {
24,911
0
// bug in junit csvsource parsing - it does a trim, using a manual parsing as workaround
@ParameterizedTest @MethodSource("data") // bug in junit csvsource parsing - it does a trim, using a manual parsing as workaround void parse(final String csv) { final String[] parts = csv.split(","); parse(parser, parts[0], parseInt(parts[1]), parseBoolean(parts[2]), null, parseInt(parts[3])); }
DEFECT
true
@ParameterizedTest @MethodSource("data") // bug in junit csvsource parsing - it does a trim, using a manual parsing as workaround void parse(final String csv) { final String[] parts = csv.split(",");
@ParameterizedTest @MethodSource("data") // bug in junit csvsource parsing - it does a trim, using a manual parsing as workaround void parse(final String csv) { final String[] parts = csv.split(","); parse(parser, parts[0], parseInt(parts[1]), parseBoolean(parts[2]), null, parseInt(parts[3])); }
@ParameterizedTest @MethodSource("data") // bug in junit csvsource parsing - it does a trim, using a manual parsing as workaround void parse(final String csv) { final String[] parts = csv.split(","); parse(parser, parts[0], parseInt(parts[1]), parseBoolean(parts[2]), null, parseInt(parts[3])); }
343
0
//todo issue #232 fix increment topic partition name for tests on multi jvm
@AfterMethod public void cleanupResources() throws SQLException { TEST_NUMBER++; //todo issue #232 fix increment topic partition name for tests on multi jvm ALL_RESOURCES.cleanUpClusters(); DB_RESOURCE.executeResource(JDBCUtil.DROP_TABLE_SQL_RESOURCE); }
DEFECT
true
public void cleanupResources() throws SQLException { TEST_NUMBER++; //todo issue #232 fix increment topic partition name for tests on multi jvm ALL_RESOURCES.cleanUpClusters(); DB_RESOURCE.executeResource(JDBCUtil.DROP_TABLE_SQL_RESOURCE);
@AfterMethod public void cleanupResources() throws SQLException { TEST_NUMBER++; //todo issue #232 fix increment topic partition name for tests on multi jvm ALL_RESOURCES.cleanUpClusters(); DB_RESOURCE.executeResource(JDBCUtil.DROP_TABLE_SQL_RESOURCE); }
@AfterMethod public void cleanupResources() throws SQLException { TEST_NUMBER++; //todo issue #232 fix increment topic partition name for tests on multi jvm ALL_RESOURCES.cleanUpClusters(); DB_RESOURCE.executeResource(JDBCUtil.DROP_TABLE_SQL_RESOURCE); }
24,924
0
/** * TODO implement any common functionality here so that your * heuristics can reuse them! * E.g. you may want to implement the swapping of two delivery locations here! */
public ObjectiveFunctionInterface getObjectiveFunction(){ return this.oObjectiveFunction; }
IMPLEMENTATION
true
public ObjectiveFunctionInterface getObjectiveFunction(){ return this.oObjectiveFunction; }
public ObjectiveFunctionInterface getObjectiveFunction(){ return this.oObjectiveFunction; }
public ObjectiveFunctionInterface getObjectiveFunction(){ return this.oObjectiveFunction; }
24,925
0
// Already scheduled
private void scheduleCleanup() { if (cleanupRegistration != null) { // Already scheduled return; } cleanupRegistration = ui.beforeClientResponse(ui, ignore -> { cleanupRegistration = null; pendingCleanup = false; // TODO Avoid copying by using Iterator.remove() properties.keySet().stream().filter(property -> !lastUsed.contains(property)).collect(Collectors.toList()) .forEach(unused -> properties.remove(unused).unregister()); }); }
NONSATD
true
private void scheduleCleanup() { if (cleanupRegistration != null) { // Already scheduled return; }
private void scheduleCleanup() { if (cleanupRegistration != null) { // Already scheduled return; } cleanupRegistration = ui.beforeClientResponse(ui, ignore -> { cleanupRegistration = null; pendingCleanup = false; // TODO Avoid copying by using Iterator.remove() properties.keySet().stream().filter(property -> !lastUsed.contains(property)).collect(Collectors.toList()) .forEach(unused -> properties.remove(unused).unregister()); }); }
private void scheduleCleanup() { if (cleanupRegistration != null) { // Already scheduled return; } cleanupRegistration = ui.beforeClientResponse(ui, ignore -> { cleanupRegistration = null; pendingCleanup = false; // TODO Avoid copying by using Iterator.remove() properties.keySet().stream().filter(property -> !lastUsed.contains(property)).collect(Collectors.toList()) .forEach(unused -> properties.remove(unused).unregister()); }); }
24,925
1
// TODO Avoid copying by using Iterator.remove()
private void scheduleCleanup() { if (cleanupRegistration != null) { // Already scheduled return; } cleanupRegistration = ui.beforeClientResponse(ui, ignore -> { cleanupRegistration = null; pendingCleanup = false; // TODO Avoid copying by using Iterator.remove() properties.keySet().stream().filter(property -> !lastUsed.contains(property)).collect(Collectors.toList()) .forEach(unused -> properties.remove(unused).unregister()); }); }
IMPLEMENTATION
true
cleanupRegistration = null; pendingCleanup = false; // TODO Avoid copying by using Iterator.remove() properties.keySet().stream().filter(property -> !lastUsed.contains(property)).collect(Collectors.toList()) .forEach(unused -> properties.remove(unused).unregister());
private void scheduleCleanup() { if (cleanupRegistration != null) { // Already scheduled return; } cleanupRegistration = ui.beforeClientResponse(ui, ignore -> { cleanupRegistration = null; pendingCleanup = false; // TODO Avoid copying by using Iterator.remove() properties.keySet().stream().filter(property -> !lastUsed.contains(property)).collect(Collectors.toList()) .forEach(unused -> properties.remove(unused).unregister()); }); }
private void scheduleCleanup() { if (cleanupRegistration != null) { // Already scheduled return; } cleanupRegistration = ui.beforeClientResponse(ui, ignore -> { cleanupRegistration = null; pendingCleanup = false; // TODO Avoid copying by using Iterator.remove() properties.keySet().stream().filter(property -> !lastUsed.contains(property)).collect(Collectors.toList()) .forEach(unused -> properties.remove(unused).unregister()); }); }
8,547
0
/** Deletes all items in the given path list followed by all bucket items. */
private void deleteInternal(List<FileInfo> itemsToDelete, List<FileInfo> bucketsToDelete) throws IOException { // TODO(user): We might need to separate out children into separate batches from parents to // avoid deleting a parent before somehow failing to delete a child. // Delete children before their parents. // // Note: we modify the input list, which is ok for current usage. // We should make a copy in case that changes in future. itemsToDelete.sort(FILE_INFO_PATH_COMPARATOR.reversed()); if (!itemsToDelete.isEmpty()) { List<StorageResourceId> objectsToDelete = new ArrayList<>(itemsToDelete.size()); for (FileInfo fileInfo : itemsToDelete) { // TODO(b/110833109): populate generation ID in StorageResourceId when listing infos? objectsToDelete.add( new StorageResourceId( fileInfo.getItemInfo().getBucketName(), fileInfo.getItemInfo().getObjectName(), fileInfo.getItemInfo().getContentGeneration())); } gcs.deleteObjects(objectsToDelete); } if (!bucketsToDelete.isEmpty()) { List<String> bucketNames = new ArrayList<>(bucketsToDelete.size()); for (FileInfo bucketInfo : bucketsToDelete) { bucketNames.add(bucketInfo.getItemInfo().getResourceId().getBucketName()); } if (options.isBucketDeleteEnabled()) { gcs.deleteBuckets(bucketNames); } else { logger.atInfo().log( "Skipping deletion of buckets because enableBucketDelete is false: %s", bucketNames); } } }
NONSATD
true
private void deleteInternal(List<FileInfo> itemsToDelete, List<FileInfo> bucketsToDelete) throws IOException { // TODO(user): We might need to separate out children into separate batches from parents to // avoid deleting a parent before somehow failing to delete a child. // Delete children before their parents. // // Note: we modify the input list, which is ok for current usage. // We should make a copy in case that changes in future. itemsToDelete.sort(FILE_INFO_PATH_COMPARATOR.reversed()); if (!itemsToDelete.isEmpty()) { List<StorageResourceId> objectsToDelete = new ArrayList<>(itemsToDelete.size()); for (FileInfo fileInfo : itemsToDelete) { // TODO(b/110833109): populate generation ID in StorageResourceId when listing infos? objectsToDelete.add( new StorageResourceId( fileInfo.getItemInfo().getBucketName(), fileInfo.getItemInfo().getObjectName(), fileInfo.getItemInfo().getContentGeneration())); } gcs.deleteObjects(objectsToDelete); } if (!bucketsToDelete.isEmpty()) { List<String> bucketNames = new ArrayList<>(bucketsToDelete.size()); for (FileInfo bucketInfo : bucketsToDelete) { bucketNames.add(bucketInfo.getItemInfo().getResourceId().getBucketName()); } if (options.isBucketDeleteEnabled()) { gcs.deleteBuckets(bucketNames); } else { logger.atInfo().log( "Skipping deletion of buckets because enableBucketDelete is false: %s", bucketNames); } } }
private void deleteInternal(List<FileInfo> itemsToDelete, List<FileInfo> bucketsToDelete) throws IOException { // TODO(user): We might need to separate out children into separate batches from parents to // avoid deleting a parent before somehow failing to delete a child. // Delete children before their parents. // // Note: we modify the input list, which is ok for current usage. // We should make a copy in case that changes in future. itemsToDelete.sort(FILE_INFO_PATH_COMPARATOR.reversed()); if (!itemsToDelete.isEmpty()) { List<StorageResourceId> objectsToDelete = new ArrayList<>(itemsToDelete.size()); for (FileInfo fileInfo : itemsToDelete) { // TODO(b/110833109): populate generation ID in StorageResourceId when listing infos? objectsToDelete.add( new StorageResourceId( fileInfo.getItemInfo().getBucketName(), fileInfo.getItemInfo().getObjectName(), fileInfo.getItemInfo().getContentGeneration())); } gcs.deleteObjects(objectsToDelete); } if (!bucketsToDelete.isEmpty()) { List<String> bucketNames = new ArrayList<>(bucketsToDelete.size()); for (FileInfo bucketInfo : bucketsToDelete) { bucketNames.add(bucketInfo.getItemInfo().getResourceId().getBucketName()); } if (options.isBucketDeleteEnabled()) { gcs.deleteBuckets(bucketNames); } else { logger.atInfo().log( "Skipping deletion of buckets because enableBucketDelete is false: %s", bucketNames); } } }
private void deleteInternal(List<FileInfo> itemsToDelete, List<FileInfo> bucketsToDelete) throws IOException { // TODO(user): We might need to separate out children into separate batches from parents to // avoid deleting a parent before somehow failing to delete a child. // Delete children before their parents. // // Note: we modify the input list, which is ok for current usage. // We should make a copy in case that changes in future. itemsToDelete.sort(FILE_INFO_PATH_COMPARATOR.reversed()); if (!itemsToDelete.isEmpty()) { List<StorageResourceId> objectsToDelete = new ArrayList<>(itemsToDelete.size()); for (FileInfo fileInfo : itemsToDelete) { // TODO(b/110833109): populate generation ID in StorageResourceId when listing infos? objectsToDelete.add( new StorageResourceId( fileInfo.getItemInfo().getBucketName(), fileInfo.getItemInfo().getObjectName(), fileInfo.getItemInfo().getContentGeneration())); } gcs.deleteObjects(objectsToDelete); } if (!bucketsToDelete.isEmpty()) { List<String> bucketNames = new ArrayList<>(bucketsToDelete.size()); for (FileInfo bucketInfo : bucketsToDelete) { bucketNames.add(bucketInfo.getItemInfo().getResourceId().getBucketName()); } if (options.isBucketDeleteEnabled()) { gcs.deleteBuckets(bucketNames); } else { logger.atInfo().log( "Skipping deletion of buckets because enableBucketDelete is false: %s", bucketNames); } } }
8,547
1
// TODO(user): We might need to separate out children into separate batches from parents to // avoid deleting a parent before somehow failing to delete a child. // Delete children before their parents. // // Note: we modify the input list, which is ok for current usage. // We should make a copy in case that changes in future.
private void deleteInternal(List<FileInfo> itemsToDelete, List<FileInfo> bucketsToDelete) throws IOException { // TODO(user): We might need to separate out children into separate batches from parents to // avoid deleting a parent before somehow failing to delete a child. // Delete children before their parents. // // Note: we modify the input list, which is ok for current usage. // We should make a copy in case that changes in future. itemsToDelete.sort(FILE_INFO_PATH_COMPARATOR.reversed()); if (!itemsToDelete.isEmpty()) { List<StorageResourceId> objectsToDelete = new ArrayList<>(itemsToDelete.size()); for (FileInfo fileInfo : itemsToDelete) { // TODO(b/110833109): populate generation ID in StorageResourceId when listing infos? objectsToDelete.add( new StorageResourceId( fileInfo.getItemInfo().getBucketName(), fileInfo.getItemInfo().getObjectName(), fileInfo.getItemInfo().getContentGeneration())); } gcs.deleteObjects(objectsToDelete); } if (!bucketsToDelete.isEmpty()) { List<String> bucketNames = new ArrayList<>(bucketsToDelete.size()); for (FileInfo bucketInfo : bucketsToDelete) { bucketNames.add(bucketInfo.getItemInfo().getResourceId().getBucketName()); } if (options.isBucketDeleteEnabled()) { gcs.deleteBuckets(bucketNames); } else { logger.atInfo().log( "Skipping deletion of buckets because enableBucketDelete is false: %s", bucketNames); } } }
DESIGN
true
private void deleteInternal(List<FileInfo> itemsToDelete, List<FileInfo> bucketsToDelete) throws IOException { // TODO(user): We might need to separate out children into separate batches from parents to // avoid deleting a parent before somehow failing to delete a child. // Delete children before their parents. // // Note: we modify the input list, which is ok for current usage. // We should make a copy in case that changes in future. itemsToDelete.sort(FILE_INFO_PATH_COMPARATOR.reversed()); if (!itemsToDelete.isEmpty()) {
private void deleteInternal(List<FileInfo> itemsToDelete, List<FileInfo> bucketsToDelete) throws IOException { // TODO(user): We might need to separate out children into separate batches from parents to // avoid deleting a parent before somehow failing to delete a child. // Delete children before their parents. // // Note: we modify the input list, which is ok for current usage. // We should make a copy in case that changes in future. itemsToDelete.sort(FILE_INFO_PATH_COMPARATOR.reversed()); if (!itemsToDelete.isEmpty()) { List<StorageResourceId> objectsToDelete = new ArrayList<>(itemsToDelete.size()); for (FileInfo fileInfo : itemsToDelete) { // TODO(b/110833109): populate generation ID in StorageResourceId when listing infos? objectsToDelete.add( new StorageResourceId( fileInfo.getItemInfo().getBucketName(), fileInfo.getItemInfo().getObjectName(), fileInfo.getItemInfo().getContentGeneration()));
private void deleteInternal(List<FileInfo> itemsToDelete, List<FileInfo> bucketsToDelete) throws IOException { // TODO(user): We might need to separate out children into separate batches from parents to // avoid deleting a parent before somehow failing to delete a child. // Delete children before their parents. // // Note: we modify the input list, which is ok for current usage. // We should make a copy in case that changes in future. itemsToDelete.sort(FILE_INFO_PATH_COMPARATOR.reversed()); if (!itemsToDelete.isEmpty()) { List<StorageResourceId> objectsToDelete = new ArrayList<>(itemsToDelete.size()); for (FileInfo fileInfo : itemsToDelete) { // TODO(b/110833109): populate generation ID in StorageResourceId when listing infos? objectsToDelete.add( new StorageResourceId( fileInfo.getItemInfo().getBucketName(), fileInfo.getItemInfo().getObjectName(), fileInfo.getItemInfo().getContentGeneration())); } gcs.deleteObjects(objectsToDelete); } if (!bucketsToDelete.isEmpty()) { List<String> bucketNames = new ArrayList<>(bucketsToDelete.size()); for (FileInfo bucketInfo : bucketsToDelete) { bucketNames.add(bucketInfo.getItemInfo().getResourceId().getBucketName()); } if (options.isBucketDeleteEnabled()) { gcs.deleteBuckets(bucketNames);
8,547
2
// TODO(b/110833109): populate generation ID in StorageResourceId when listing infos?
private void deleteInternal(List<FileInfo> itemsToDelete, List<FileInfo> bucketsToDelete) throws IOException { // TODO(user): We might need to separate out children into separate batches from parents to // avoid deleting a parent before somehow failing to delete a child. // Delete children before their parents. // // Note: we modify the input list, which is ok for current usage. // We should make a copy in case that changes in future. itemsToDelete.sort(FILE_INFO_PATH_COMPARATOR.reversed()); if (!itemsToDelete.isEmpty()) { List<StorageResourceId> objectsToDelete = new ArrayList<>(itemsToDelete.size()); for (FileInfo fileInfo : itemsToDelete) { // TODO(b/110833109): populate generation ID in StorageResourceId when listing infos? objectsToDelete.add( new StorageResourceId( fileInfo.getItemInfo().getBucketName(), fileInfo.getItemInfo().getObjectName(), fileInfo.getItemInfo().getContentGeneration())); } gcs.deleteObjects(objectsToDelete); } if (!bucketsToDelete.isEmpty()) { List<String> bucketNames = new ArrayList<>(bucketsToDelete.size()); for (FileInfo bucketInfo : bucketsToDelete) { bucketNames.add(bucketInfo.getItemInfo().getResourceId().getBucketName()); } if (options.isBucketDeleteEnabled()) { gcs.deleteBuckets(bucketNames); } else { logger.atInfo().log( "Skipping deletion of buckets because enableBucketDelete is false: %s", bucketNames); } } }
IMPLEMENTATION
true
List<StorageResourceId> objectsToDelete = new ArrayList<>(itemsToDelete.size()); for (FileInfo fileInfo : itemsToDelete) { // TODO(b/110833109): populate generation ID in StorageResourceId when listing infos? objectsToDelete.add( new StorageResourceId(
// TODO(user): We might need to separate out children into separate batches from parents to // avoid deleting a parent before somehow failing to delete a child. // Delete children before their parents. // // Note: we modify the input list, which is ok for current usage. // We should make a copy in case that changes in future. itemsToDelete.sort(FILE_INFO_PATH_COMPARATOR.reversed()); if (!itemsToDelete.isEmpty()) { List<StorageResourceId> objectsToDelete = new ArrayList<>(itemsToDelete.size()); for (FileInfo fileInfo : itemsToDelete) { // TODO(b/110833109): populate generation ID in StorageResourceId when listing infos? objectsToDelete.add( new StorageResourceId( fileInfo.getItemInfo().getBucketName(), fileInfo.getItemInfo().getObjectName(), fileInfo.getItemInfo().getContentGeneration())); } gcs.deleteObjects(objectsToDelete); } if (!bucketsToDelete.isEmpty()) { List<String> bucketNames = new ArrayList<>(bucketsToDelete.size());
private void deleteInternal(List<FileInfo> itemsToDelete, List<FileInfo> bucketsToDelete) throws IOException { // TODO(user): We might need to separate out children into separate batches from parents to // avoid deleting a parent before somehow failing to delete a child. // Delete children before their parents. // // Note: we modify the input list, which is ok for current usage. // We should make a copy in case that changes in future. itemsToDelete.sort(FILE_INFO_PATH_COMPARATOR.reversed()); if (!itemsToDelete.isEmpty()) { List<StorageResourceId> objectsToDelete = new ArrayList<>(itemsToDelete.size()); for (FileInfo fileInfo : itemsToDelete) { // TODO(b/110833109): populate generation ID in StorageResourceId when listing infos? objectsToDelete.add( new StorageResourceId( fileInfo.getItemInfo().getBucketName(), fileInfo.getItemInfo().getObjectName(), fileInfo.getItemInfo().getContentGeneration())); } gcs.deleteObjects(objectsToDelete); } if (!bucketsToDelete.isEmpty()) { List<String> bucketNames = new ArrayList<>(bucketsToDelete.size()); for (FileInfo bucketInfo : bucketsToDelete) { bucketNames.add(bucketInfo.getItemInfo().getResourceId().getBucketName()); } if (options.isBucketDeleteEnabled()) { gcs.deleteBuckets(bucketNames); } else { logger.atInfo().log( "Skipping deletion of buckets because enableBucketDelete is false: %s", bucketNames); } }
8,549
0
/** * Returns an Observable that emits items that are the result of applying a specified function to pairs of * values, one each from the source ObservableSource and another specified ObservableSource. * <p> * The operator subscribes to its sources in order they are specified and completes eagerly if * one of the sources is shorter than the rest while unsubscribing the other sources. Therefore, it * is possible those other sources will never be able to run to completion (and thus not calling * {@code doOnComplete()}). This can also happen if the sources are exactly the same length; if * source A completes and B has been consumed and is about to complete, the operator detects A won't * be sending further values and it will unsubscribe B immediately. For example: * <pre><code>range(1, 5).doOnComplete(action1).zipWith(range(6, 5).doOnComplete(action2), (a, b) -&gt; a + b)</code></pre> * {@code action1} will be called but {@code action2} won't. * <br>To work around this termination property, * use {@link #doOnDispose(Action)} as well or use {@code using()} to do cleanup in case of completion * or a dispose() call. * * <img width="640" height="380" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/zip.png" alt=""> * <dl> * <dt><b>Scheduler:</b></dt> * <dd>{@code zipWith} does not operate by default on a particular {@link Scheduler}.</dd> * </dl> * * @param <U> * the type of items emitted by the {@code other} ObservableSource * @param <R> * the type of items emitted by the resulting ObservableSource * @param other * the other ObservableSource * @param zipper * a function that combines the pairs of items from the two ObservableSources to generate the items to * be emitted by the resulting ObservableSource * @return an Observable that pairs up values from the source ObservableSource and the {@code other} ObservableSource * and emits the results of {@code zipFunction} applied to these pairs * @see <a href="http://reactivex.io/documentation/operators/zip.html">ReactiveX operators documentation: Zip</a> */
@CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) public final <U, R> Observable<R> zipWith(ObservableSource<? extends U> other, BiFunction<? super T, ? super U, ? extends R> zipper) { ObjectHelper.requireNonNull(other, "other is null"); return zip(this, other, zipper); }
NONSATD
true
@CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) public final <U, R> Observable<R> zipWith(ObservableSource<? extends U> other, BiFunction<? super T, ? super U, ? extends R> zipper) { ObjectHelper.requireNonNull(other, "other is null"); return zip(this, other, zipper); }
@CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) public final <U, R> Observable<R> zipWith(ObservableSource<? extends U> other, BiFunction<? super T, ? super U, ? extends R> zipper) { ObjectHelper.requireNonNull(other, "other is null"); return zip(this, other, zipper); }
@CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) public final <U, R> Observable<R> zipWith(ObservableSource<? extends U> other, BiFunction<? super T, ? super U, ? extends R> zipper) { ObjectHelper.requireNonNull(other, "other is null"); return zip(this, other, zipper); }
8,550
0
/** * Returns an Observable that emits items that are the result of applying a specified function to pairs of * values, one each from the source ObservableSource and another specified ObservableSource. * <p> * The operator subscribes to its sources in order they are specified and completes eagerly if * one of the sources is shorter than the rest while unsubscribing the other sources. Therefore, it * is possible those other sources will never be able to run to completion (and thus not calling * {@code doOnComplete()}). This can also happen if the sources are exactly the same length; if * source A completes and B has been consumed and is about to complete, the operator detects A won't * be sending further values and it will unsubscribe B immediately. For example: * <pre><code>range(1, 5).doOnComplete(action1).zipWith(range(6, 5).doOnComplete(action2), (a, b) -&gt; a + b)</code></pre> * {@code action1} will be called but {@code action2} won't. * <br>To work around this termination property, * use {@link #doOnDispose(Action)} as well or use {@code using()} to do cleanup in case of completion * or a dispose() call. * * <img width="640" height="380" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/zip.png" alt=""> * <dl> * <dt><b>Scheduler:</b></dt> * <dd>{@code zipWith} does not operate by default on a particular {@link Scheduler}.</dd> * </dl> * * @param <U> * the type of items emitted by the {@code other} ObservableSource * @param <R> * the type of items emitted by the resulting ObservableSource * @param other * the other ObservableSource * @param zipper * a function that combines the pairs of items from the two ObservableSources to generate the items to * be emitted by the resulting ObservableSource * @param delayError * if true, errors from the current Observable or the other ObservableSource is delayed until both terminate * @return an Observable that pairs up values from the source ObservableSource and the {@code other} ObservableSource * and emits the results of {@code zipFunction} applied to these pairs * @see <a href="http://reactivex.io/documentation/operators/zip.html">ReactiveX operators documentation: Zip</a> * @since 2.0 */
@CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) public final <U, R> Observable<R> zipWith(ObservableSource<? extends U> other, BiFunction<? super T, ? super U, ? extends R> zipper, boolean delayError) { return zip(this, other, zipper, delayError); }
NONSATD
true
@CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) public final <U, R> Observable<R> zipWith(ObservableSource<? extends U> other, BiFunction<? super T, ? super U, ? extends R> zipper, boolean delayError) { return zip(this, other, zipper, delayError); }
@CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) public final <U, R> Observable<R> zipWith(ObservableSource<? extends U> other, BiFunction<? super T, ? super U, ? extends R> zipper, boolean delayError) { return zip(this, other, zipper, delayError); }
@CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) public final <U, R> Observable<R> zipWith(ObservableSource<? extends U> other, BiFunction<? super T, ? super U, ? extends R> zipper, boolean delayError) { return zip(this, other, zipper, delayError); }
8,551
0
/** * Returns an Observable that emits items that are the result of applying a specified function to pairs of * values, one each from the source ObservableSource and another specified ObservableSource. * <p> * The operator subscribes to its sources in order they are specified and completes eagerly if * one of the sources is shorter than the rest while unsubscribing the other sources. Therefore, it * is possible those other sources will never be able to run to completion (and thus not calling * {@code doOnComplete()}). This can also happen if the sources are exactly the same length; if * source A completes and B has been consumed and is about to complete, the operator detects A won't * be sending further values and it will unsubscribe B immediately. For example: * <pre><code>range(1, 5).doOnComplete(action1).zipWith(range(6, 5).doOnComplete(action2), (a, b) -&gt; a + b)</code></pre> * {@code action1} will be called but {@code action2} won't. * <br>To work around this termination property, * use {@link #doOnDispose(Action)} as well or use {@code using()} to do cleanup in case of completion * or a dispose() call. * * <img width="640" height="380" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/zip.png" alt=""> * <dl> * <dt><b>Scheduler:</b></dt> * <dd>{@code zipWith} does not operate by default on a particular {@link Scheduler}.</dd> * </dl> * * @param <U> * the type of items emitted by the {@code other} ObservableSource * @param <R> * the type of items emitted by the resulting ObservableSource * @param other * the other ObservableSource * @param zipper * a function that combines the pairs of items from the two ObservableSources to generate the items to * be emitted by the resulting ObservableSource * @param bufferSize * the capacity hint for the buffer in the inner windows * @param delayError * if true, errors from the current Observable or the other ObservableSource is delayed until both terminate * @return an Observable that pairs up values from the source ObservableSource and the {@code other} ObservableSource * and emits the results of {@code zipFunction} applied to these pairs * @see <a href="http://reactivex.io/documentation/operators/zip.html">ReactiveX operators documentation: Zip</a> * @since 2.0 */
@CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) public final <U, R> Observable<R> zipWith(ObservableSource<? extends U> other, BiFunction<? super T, ? super U, ? extends R> zipper, boolean delayError, int bufferSize) { return zip(this, other, zipper, delayError, bufferSize); }
NONSATD
true
@CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) public final <U, R> Observable<R> zipWith(ObservableSource<? extends U> other, BiFunction<? super T, ? super U, ? extends R> zipper, boolean delayError, int bufferSize) { return zip(this, other, zipper, delayError, bufferSize); }
@CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) public final <U, R> Observable<R> zipWith(ObservableSource<? extends U> other, BiFunction<? super T, ? super U, ? extends R> zipper, boolean delayError, int bufferSize) { return zip(this, other, zipper, delayError, bufferSize); }
@CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) public final <U, R> Observable<R> zipWith(ObservableSource<? extends U> other, BiFunction<? super T, ? super U, ? extends R> zipper, boolean delayError, int bufferSize) { return zip(this, other, zipper, delayError, bufferSize); }
24,936
0
// TODO: get path while TextPath is set.
@Override protected Path getPath(Canvas canvas, Paint paint) { Path path = new Path(); String text = formatText(); if (text == null) { return path; } // TODO: get path while TextPath is set. if (setupFillPaint(paint, 1.0f, getBox(paint, text))) { applyTextPropertiesToPaint(paint); paint.getTextPath(text, 0, text.length(), 0, -paint.ascent(), path); path.transform(mMatrix); } return path; }
IMPLEMENTATION
true
return path; } // TODO: get path while TextPath is set. if (setupFillPaint(paint, 1.0f, getBox(paint, text))) { applyTextPropertiesToPaint(paint);
@Override protected Path getPath(Canvas canvas, Paint paint) { Path path = new Path(); String text = formatText(); if (text == null) { return path; } // TODO: get path while TextPath is set. if (setupFillPaint(paint, 1.0f, getBox(paint, text))) { applyTextPropertiesToPaint(paint); paint.getTextPath(text, 0, text.length(), 0, -paint.ascent(), path); path.transform(mMatrix); } return path; }
@Override protected Path getPath(Canvas canvas, Paint paint) { Path path = new Path(); String text = formatText(); if (text == null) { return path; } // TODO: get path while TextPath is set. if (setupFillPaint(paint, 1.0f, getBox(paint, text))) { applyTextPropertiesToPaint(paint); paint.getTextPath(text, 0, text.length(), 0, -paint.ascent(), path); path.transform(mMatrix); } return path; }
16,754
0
/** * Attach element identify name to class of "use" usage * * @param psiElement PhpClass used in "use" statement */
@Override public boolean isReferenceTo(PsiElement psiElement) { if(!(psiElement instanceof PhpNamedElement)) { return false; } String text = getElement().getText(); if(StringUtils.isBlank(text)) { return false; } PsiElement namespace = element.getPrevSibling(); if(PhpPsiUtil.isOfType(namespace, PhpDocTokenTypes.DOC_NAMESPACE)) { // @TODO: namespace not supported return false; } String classByContext = PhpElementsUtil.getFqnForClassNameByContext(element, text); if(classByContext != null) { return StringUtils.stripStart(((PhpNamedElement) psiElement).getFQN(), "\\") .equalsIgnoreCase(StringUtils.stripStart(fqn, "\\")); } return false; }
NONSATD
true
@Override public boolean isReferenceTo(PsiElement psiElement) { if(!(psiElement instanceof PhpNamedElement)) { return false; } String text = getElement().getText(); if(StringUtils.isBlank(text)) { return false; } PsiElement namespace = element.getPrevSibling(); if(PhpPsiUtil.isOfType(namespace, PhpDocTokenTypes.DOC_NAMESPACE)) { // @TODO: namespace not supported return false; } String classByContext = PhpElementsUtil.getFqnForClassNameByContext(element, text); if(classByContext != null) { return StringUtils.stripStart(((PhpNamedElement) psiElement).getFQN(), "\\") .equalsIgnoreCase(StringUtils.stripStart(fqn, "\\")); } return false; }
@Override public boolean isReferenceTo(PsiElement psiElement) { if(!(psiElement instanceof PhpNamedElement)) { return false; } String text = getElement().getText(); if(StringUtils.isBlank(text)) { return false; } PsiElement namespace = element.getPrevSibling(); if(PhpPsiUtil.isOfType(namespace, PhpDocTokenTypes.DOC_NAMESPACE)) { // @TODO: namespace not supported return false; } String classByContext = PhpElementsUtil.getFqnForClassNameByContext(element, text); if(classByContext != null) { return StringUtils.stripStart(((PhpNamedElement) psiElement).getFQN(), "\\") .equalsIgnoreCase(StringUtils.stripStart(fqn, "\\")); } return false; }
@Override public boolean isReferenceTo(PsiElement psiElement) { if(!(psiElement instanceof PhpNamedElement)) { return false; } String text = getElement().getText(); if(StringUtils.isBlank(text)) { return false; } PsiElement namespace = element.getPrevSibling(); if(PhpPsiUtil.isOfType(namespace, PhpDocTokenTypes.DOC_NAMESPACE)) { // @TODO: namespace not supported return false; } String classByContext = PhpElementsUtil.getFqnForClassNameByContext(element, text); if(classByContext != null) { return StringUtils.stripStart(((PhpNamedElement) psiElement).getFQN(), "\\") .equalsIgnoreCase(StringUtils.stripStart(fqn, "\\")); } return false; }
16,754
1
// @TODO: namespace not supported
@Override public boolean isReferenceTo(PsiElement psiElement) { if(!(psiElement instanceof PhpNamedElement)) { return false; } String text = getElement().getText(); if(StringUtils.isBlank(text)) { return false; } PsiElement namespace = element.getPrevSibling(); if(PhpPsiUtil.isOfType(namespace, PhpDocTokenTypes.DOC_NAMESPACE)) { // @TODO: namespace not supported return false; } String classByContext = PhpElementsUtil.getFqnForClassNameByContext(element, text); if(classByContext != null) { return StringUtils.stripStart(((PhpNamedElement) psiElement).getFQN(), "\\") .equalsIgnoreCase(StringUtils.stripStart(fqn, "\\")); } return false; }
IMPLEMENTATION
true
PsiElement namespace = element.getPrevSibling(); if(PhpPsiUtil.isOfType(namespace, PhpDocTokenTypes.DOC_NAMESPACE)) { // @TODO: namespace not supported return false; }
public boolean isReferenceTo(PsiElement psiElement) { if(!(psiElement instanceof PhpNamedElement)) { return false; } String text = getElement().getText(); if(StringUtils.isBlank(text)) { return false; } PsiElement namespace = element.getPrevSibling(); if(PhpPsiUtil.isOfType(namespace, PhpDocTokenTypes.DOC_NAMESPACE)) { // @TODO: namespace not supported return false; } String classByContext = PhpElementsUtil.getFqnForClassNameByContext(element, text); if(classByContext != null) { return StringUtils.stripStart(((PhpNamedElement) psiElement).getFQN(), "\\") .equalsIgnoreCase(StringUtils.stripStart(fqn, "\\")); } return false; }
@Override public boolean isReferenceTo(PsiElement psiElement) { if(!(psiElement instanceof PhpNamedElement)) { return false; } String text = getElement().getText(); if(StringUtils.isBlank(text)) { return false; } PsiElement namespace = element.getPrevSibling(); if(PhpPsiUtil.isOfType(namespace, PhpDocTokenTypes.DOC_NAMESPACE)) { // @TODO: namespace not supported return false; } String classByContext = PhpElementsUtil.getFqnForClassNameByContext(element, text); if(classByContext != null) { return StringUtils.stripStart(((PhpNamedElement) psiElement).getFQN(), "\\") .equalsIgnoreCase(StringUtils.stripStart(fqn, "\\")); } return false; }
16,761
0
// TODO(qinmin): May need to report the error to the caller. crbug.com/356498.
@CalledByNative protected void releaseOutputBuffer(int index, boolean render) { try { mMediaCodec.releaseOutputBuffer(index, render); } catch (IllegalStateException e) { // TODO(qinmin): May need to report the error to the caller. crbug.com/356498. Log.e(TAG, "Failed to release output buffer", e); } }
IMPLEMENTATION
true
mMediaCodec.releaseOutputBuffer(index, render); } catch (IllegalStateException e) { // TODO(qinmin): May need to report the error to the caller. crbug.com/356498. Log.e(TAG, "Failed to release output buffer", e); }
@CalledByNative protected void releaseOutputBuffer(int index, boolean render) { try { mMediaCodec.releaseOutputBuffer(index, render); } catch (IllegalStateException e) { // TODO(qinmin): May need to report the error to the caller. crbug.com/356498. Log.e(TAG, "Failed to release output buffer", e); } }
@CalledByNative protected void releaseOutputBuffer(int index, boolean render) { try { mMediaCodec.releaseOutputBuffer(index, render); } catch (IllegalStateException e) { // TODO(qinmin): May need to report the error to the caller. crbug.com/356498. Log.e(TAG, "Failed to release output buffer", e); } }
16,764
0
// TODO(dalecurtis): We may want to drop transient errors here.
@Override public void onError(MediaCodec codec, MediaCodec.CodecException e) { // TODO(dalecurtis): We may want to drop transient errors here. Log.e(TAG, "MediaCodec.onError: %s", e.getDiagnosticInfo()); mMediaCodecBridge.onError(e); }
IMPLEMENTATION
true
@Override public void onError(MediaCodec codec, MediaCodec.CodecException e) { // TODO(dalecurtis): We may want to drop transient errors here. Log.e(TAG, "MediaCodec.onError: %s", e.getDiagnosticInfo()); mMediaCodecBridge.onError(e);
@Override public void onError(MediaCodec codec, MediaCodec.CodecException e) { // TODO(dalecurtis): We may want to drop transient errors here. Log.e(TAG, "MediaCodec.onError: %s", e.getDiagnosticInfo()); mMediaCodecBridge.onError(e); }
@Override public void onError(MediaCodec codec, MediaCodec.CodecException e) { // TODO(dalecurtis): We may want to drop transient errors here. Log.e(TAG, "MediaCodec.onError: %s", e.getDiagnosticInfo()); mMediaCodecBridge.onError(e); }
8,573
0
//TODO: translate code
public void translate() { //TODO: translate code }
IMPLEMENTATION
true
public void translate() { //TODO: translate code }
public void translate() { //TODO: translate code }
public void translate() { //TODO: translate code }
33,149
0
//HACK: Need to have padding at the end of the tag, or Winamp won't see the last frame (at least 6 bytes seem to be required).
private void tag() throws Exception { String[] asFilename = (String[])m_oCmdLineMap.get("filenames"); for (int i=0; i < asFilename.length; i++) { File oSourceFile = new File(asFilename[i]); MP3File oMP3File = new MP3File(oSourceFile); if (m_oCmdLineMap.containsKey("1")) { ID3V1_1Tag oID3V1_1Tag = new ID3V1_1Tag(); if (m_oCmdLineMap.containsKey("album")) { oID3V1_1Tag.setAlbum((String)m_oCmdLineMap.get("album")); } if (m_oCmdLineMap.containsKey("artist")) { oID3V1_1Tag.setArtist((String)m_oCmdLineMap.get("artist")); } if (m_oCmdLineMap.containsKey("comment")) { oID3V1_1Tag.setComment((String)m_oCmdLineMap.get("comment")); } if (m_oCmdLineMap.containsKey("genre")) { String sGenre = (String)m_oCmdLineMap.get("genre"); oID3V1_1Tag.setGenre(ID3V1Tag.Genre.lookupGenre(sGenre)); } if (m_oCmdLineMap.containsKey("title")) { oID3V1_1Tag.setTitle((String)m_oCmdLineMap.get("title")); } if (m_oCmdLineMap.containsKey("year")) { oID3V1_1Tag.setYear(((Integer)m_oCmdLineMap.get("year")).toString()); } if (m_oCmdLineMap.containsKey("track")) { oID3V1_1Tag.setAlbumTrack(((Integer)m_oCmdLineMap.get("track")).intValue()); } oMP3File.setID3Tag(oID3V1_1Tag); } if (m_oCmdLineMap.containsKey("2")) { ID3V2_3_0Tag oID3V2_3_0Tag = new ID3V2_3_0Tag(); //HACK: Need to have padding at the end of the tag, or Winamp won't see the last frame (at least 6 bytes seem to be required). oID3V2_3_0Tag.setPaddingLength(16); if (m_oCmdLineMap.containsKey("album")) { oID3V2_3_0Tag.setAlbum((String)m_oCmdLineMap.get("album")); } if (m_oCmdLineMap.containsKey("artist")) { oID3V2_3_0Tag.setArtist((String)m_oCmdLineMap.get("artist")); } if (m_oCmdLineMap.containsKey("comment")) { oID3V2_3_0Tag.setComment((String)m_oCmdLineMap.get("comment")); } if (m_oCmdLineMap.containsKey("genre")) { oID3V2_3_0Tag.setGenre((String)m_oCmdLineMap.get("genre")); } oMP3File.setID3Tag(oID3V2_3_0Tag); if (m_oCmdLineMap.containsKey("title")) { oID3V2_3_0Tag.setTitle((String)m_oCmdLineMap.get("title")); } if (m_oCmdLineMap.containsKey("year")) { oID3V2_3_0Tag.setYear(((Integer)m_oCmdLineMap.get("year")).intValue()); } if (m_oCmdLineMap.containsKey("track")) { if (m_oCmdLineMap.containsKey("total")) { oID3V2_3_0Tag.setTrackNumber(((Integer)m_oCmdLineMap.get("track")).intValue(), ((Integer)m_oCmdLineMap.get("total")).intValue()); } else { oID3V2_3_0Tag.setTrackNumber(((Integer)m_oCmdLineMap.get("track")).intValue()); } } } oMP3File.sync(); } }
DESIGN
true
{ ID3V2_3_0Tag oID3V2_3_0Tag = new ID3V2_3_0Tag(); //HACK: Need to have padding at the end of the tag, or Winamp won't see the last frame (at least 6 bytes seem to be required). oID3V2_3_0Tag.setPaddingLength(16); if (m_oCmdLineMap.containsKey("album"))
} if (m_oCmdLineMap.containsKey("track")) { oID3V1_1Tag.setAlbumTrack(((Integer)m_oCmdLineMap.get("track")).intValue()); } oMP3File.setID3Tag(oID3V1_1Tag); } if (m_oCmdLineMap.containsKey("2")) { ID3V2_3_0Tag oID3V2_3_0Tag = new ID3V2_3_0Tag(); //HACK: Need to have padding at the end of the tag, or Winamp won't see the last frame (at least 6 bytes seem to be required). oID3V2_3_0Tag.setPaddingLength(16); if (m_oCmdLineMap.containsKey("album")) { oID3V2_3_0Tag.setAlbum((String)m_oCmdLineMap.get("album")); } if (m_oCmdLineMap.containsKey("artist")) { oID3V2_3_0Tag.setArtist((String)m_oCmdLineMap.get("artist")); } if (m_oCmdLineMap.containsKey("comment"))
String sGenre = (String)m_oCmdLineMap.get("genre"); oID3V1_1Tag.setGenre(ID3V1Tag.Genre.lookupGenre(sGenre)); } if (m_oCmdLineMap.containsKey("title")) { oID3V1_1Tag.setTitle((String)m_oCmdLineMap.get("title")); } if (m_oCmdLineMap.containsKey("year")) { oID3V1_1Tag.setYear(((Integer)m_oCmdLineMap.get("year")).toString()); } if (m_oCmdLineMap.containsKey("track")) { oID3V1_1Tag.setAlbumTrack(((Integer)m_oCmdLineMap.get("track")).intValue()); } oMP3File.setID3Tag(oID3V1_1Tag); } if (m_oCmdLineMap.containsKey("2")) { ID3V2_3_0Tag oID3V2_3_0Tag = new ID3V2_3_0Tag(); //HACK: Need to have padding at the end of the tag, or Winamp won't see the last frame (at least 6 bytes seem to be required). oID3V2_3_0Tag.setPaddingLength(16); if (m_oCmdLineMap.containsKey("album")) { oID3V2_3_0Tag.setAlbum((String)m_oCmdLineMap.get("album")); } if (m_oCmdLineMap.containsKey("artist")) { oID3V2_3_0Tag.setArtist((String)m_oCmdLineMap.get("artist")); } if (m_oCmdLineMap.containsKey("comment")) { oID3V2_3_0Tag.setComment((String)m_oCmdLineMap.get("comment")); } if (m_oCmdLineMap.containsKey("genre")) { oID3V2_3_0Tag.setGenre((String)m_oCmdLineMap.get("genre")); } oMP3File.setID3Tag(oID3V2_3_0Tag); if (m_oCmdLineMap.containsKey("title")) {
16,767
0
// Iterate on the messages
@Override public Runnable getConsumer(final KafkaSynchronizedConsumerPool pool, final KafkaStream<byte[], byte[]> stream) { return new Runnable() { @Override public void run() { ConsumerIterator<byte[],byte[]> iter = stream.iterator(); byte[] sipHashKey = frontend.keystore.getKey(KeyStore.SIPHASH_KAFKA_PLASMA_FRONTEND_IN); byte[] aesKey = frontend.keystore.getKey(KeyStore.AES_KAFKA_PLASMA_FRONTEND_IN); // Iterate on the messages TDeserializer deserializer = new TDeserializer(new TCompactProtocol.Factory()); KafkaOffsetCounters counters = pool.getCounters(); // TODO(hbs): allow setting of writeBufferSize try { while (iter.hasNext()) { // // Since the cal to 'next' may block, we need to first // check that there is a message available // boolean nonEmpty = iter.nonEmpty(); if (nonEmpty) { MessageAndMetadata<byte[], byte[]> msg = iter.next(); counters.count(msg.partition(), msg.offset()); byte[] data = msg.message(); Sensision.update(SensisionConstants.SENSISION_CLASS_PLASMA_FRONTEND_KAFKA_MESSAGES, Sensision.EMPTY_LABELS, 1); Sensision.update(SensisionConstants.SENSISION_CLASS_PLASMA_FRONTEND_KAFKA_BYTES, Sensision.EMPTY_LABELS, data.length); if (null != sipHashKey) { data = CryptoUtils.removeMAC(sipHashKey, data); } // Skip data whose MAC was not verified successfully if (null == data) { Sensision.update(SensisionConstants.SENSISION_CLASS_PLASMA_FRONTEND_KAFKA_INVALIDMACS, Sensision.EMPTY_LABELS, 1); continue; } // Unwrap data if need be if (null != aesKey) { data = CryptoUtils.unwrap(aesKey, data); } // Skip data that was not unwrapped successfuly if (null == data) { Sensision.update(SensisionConstants.SENSISION_CLASS_PLASMA_FRONTEND_KAFKA_INVALIDCIPHERS, Sensision.EMPTY_LABELS, 1); continue; } // // Extract KafkaDataMessage // KafkaDataMessage tmsg = new KafkaDataMessage(); deserializer.deserialize(tmsg, data); switch(tmsg.getType()) { case STORE: GTSEncoder encoder = new GTSEncoder(0L, null, tmsg.getData()); encoder.setClassId(tmsg.getClassId()); encoder.setLabelsId(tmsg.getLabelsId()); frontend.dispatch(encoder); break; case DELETE: case ARCHIVE: break; default: throw new RuntimeException("Invalid message type."); } } else { // Sleep a tiny while try { Thread.sleep(1L); } catch (InterruptedException ie) { } } } } catch (Throwable t) { t.printStackTrace(System.err); } finally { // Set abort to true in case we exit the 'run' method pool.getAbort().set(true); } } }; }
NONSATD
true
byte[] sipHashKey = frontend.keystore.getKey(KeyStore.SIPHASH_KAFKA_PLASMA_FRONTEND_IN); byte[] aesKey = frontend.keystore.getKey(KeyStore.AES_KAFKA_PLASMA_FRONTEND_IN); // Iterate on the messages TDeserializer deserializer = new TDeserializer(new TCompactProtocol.Factory()); KafkaOffsetCounters counters = pool.getCounters();
@Override public Runnable getConsumer(final KafkaSynchronizedConsumerPool pool, final KafkaStream<byte[], byte[]> stream) { return new Runnable() { @Override public void run() { ConsumerIterator<byte[],byte[]> iter = stream.iterator(); byte[] sipHashKey = frontend.keystore.getKey(KeyStore.SIPHASH_KAFKA_PLASMA_FRONTEND_IN); byte[] aesKey = frontend.keystore.getKey(KeyStore.AES_KAFKA_PLASMA_FRONTEND_IN); // Iterate on the messages TDeserializer deserializer = new TDeserializer(new TCompactProtocol.Factory()); KafkaOffsetCounters counters = pool.getCounters(); // TODO(hbs): allow setting of writeBufferSize try { while (iter.hasNext()) { // // Since the cal to 'next' may block, we need to first // check that there is a message available // boolean nonEmpty = iter.nonEmpty();
@Override public Runnable getConsumer(final KafkaSynchronizedConsumerPool pool, final KafkaStream<byte[], byte[]> stream) { return new Runnable() { @Override public void run() { ConsumerIterator<byte[],byte[]> iter = stream.iterator(); byte[] sipHashKey = frontend.keystore.getKey(KeyStore.SIPHASH_KAFKA_PLASMA_FRONTEND_IN); byte[] aesKey = frontend.keystore.getKey(KeyStore.AES_KAFKA_PLASMA_FRONTEND_IN); // Iterate on the messages TDeserializer deserializer = new TDeserializer(new TCompactProtocol.Factory()); KafkaOffsetCounters counters = pool.getCounters(); // TODO(hbs): allow setting of writeBufferSize try { while (iter.hasNext()) { // // Since the cal to 'next' may block, we need to first // check that there is a message available // boolean nonEmpty = iter.nonEmpty(); if (nonEmpty) { MessageAndMetadata<byte[], byte[]> msg = iter.next(); counters.count(msg.partition(), msg.offset()); byte[] data = msg.message(); Sensision.update(SensisionConstants.SENSISION_CLASS_PLASMA_FRONTEND_KAFKA_MESSAGES, Sensision.EMPTY_LABELS, 1); Sensision.update(SensisionConstants.SENSISION_CLASS_PLASMA_FRONTEND_KAFKA_BYTES, Sensision.EMPTY_LABELS, data.length); if (null != sipHashKey) { data = CryptoUtils.removeMAC(sipHashKey, data); } // Skip data whose MAC was not verified successfully