auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public DefaultClassificationEngine(final ClassificationRuleProvider ruleProvider, final FilterService filterService, final boolean initialize) { this.ruleProvider = Objects.requireNonNull(ruleProvider); this.portClassifiersCache = CacheBuilder.newBuilder().build(new CacheLoader<Integer, List<Classifier>>() { @Override public List<Classifier> load(Integer port) throws Exception { final List<RuleDefinition> ruleDefinitions = rulePortList.get(port); final List<Classifier> classifiers = ruleDefinitions.stream().map(rule -> { if (!ruleClassifierMap.containsKey(rule)) { final DefaultRuleDefinition portRule = new DefaultRuleDefinition(); portRule.setName(rule.getName()); portRule.setProtocol(rule.getProtocol()); portRule.setSrcAddress(rule.getSrcAddress()); portRule.setDstAddress(rule.getDstAddress()); portRule.setExporterFilter(rule.getExporterFilter()); portRule.setGroupPosition(rule.getGroupPosition()); portRule.setPosition(rule.getPosition()); if (rule.hasDstPortDefinition() && rule.hasSrcPortDefinition()) { portRule.setSrcPort(rule.getSrcPort()); } else { if (rule.hasDstPortDefinition()) { portRule.setDstPort(rule.getDstPort()); } if (rule.hasSrcPortDefinition()) { portRule.setSrcPort(rule.getSrcPort()); } } ruleClassifierMap.put(rule, new CombinedClassifier(portRule, filterService)); } return ruleClassifierMap.get(rule); }).collect(Collectors.toList()); return classifiers; } }); if (initialize) { this.reload(); } }

Target:
public DefaultClassificationEngine(final ClassificationRuleProvider ruleProvider, final FilterService filterService, final boolean initialize) { this.ruleProvider = Objects.requireNonNull(ruleProvider); this.portClassifiersCache = CacheBuilder.newBuilder().build(new CacheLoader<Integer, List<Classifier>>() { @Override public List<Classifier> load(Integer port) throws Exception { final List<RuleDefinition> ruleDefinitions = rulePortList.get(port); final List<Classifier> classifiers = ruleDefinitions.stream().map(rule -> { if (!ruleClassifierMap.containsKey(rule)) { final DefaultRuleDefinition portRule = new DefaultRuleDefinition(); portRule.setName(rule.getName()); portRule.setProtocol(rule.getProtocol()); portRule.setSrcAddress(rule.getSrcAddress()); portRule.setDstAddress(rule.getDstAddress()); portRule.setExporterFilter(rule.getExporterFilter()); portRule.setGroupPosition(rule.getGroupPosition()); portRule.setPosition(rule.getPosition()); if (rule.hasDstPortDefinition()) { portRule.setDstPort(rule.getDstPort()); } if (rule.hasSrcPortDefinition()) { portRule.setSrcPort(rule.getSrcPort()); } ruleClassifierMap.put(rule, new CombinedClassifier(portRule, filterService)); } return ruleClassifierMap.get(rule); }).collect(Collectors.toList()); return classifiers; } }); if (initialize) { this.reload(); } }
Source:
public void visitClass(ClassTree tree) { if (!isBodyOfEnumConstantTree(tree)) { Type superClass = tree.symbol().superClass(); int dit = 0; while (superClass != null) { dit++; superClass = superClass.symbol().superClass(); } if (dit > max) { Tree reportTree = tree.simpleName(); if (tree.parent().is(Tree.Kind.NEW_CLASS)) { reportTree = ((NewClassTree) tree.parent()).newKeyword(); } context.reportIssue(this, reportTree, "This class has " + dit + " parents which is greater than " + max + " authorized.", new ArrayList<JavaFileScannerContext.Location>(), dit - max); } } super.visitClass(tree); }

Target:
public void visitClass(ClassTree tree) { if (!isBodyOfEnumConstantTree(tree)) { Type superClass = tree.symbol().superClass(); int dit = 0; while (superClass != null) { dit++; superClass = superClass.symbol().superClass(); } if (dit > max) { Tree reportTree = tree.simpleName(); if (tree.parent().is(Tree.Kind.NEW_CLASS)) { reportTree = ((NewClassTree) tree.parent()).newKeyword(); } context.reportIssue(this, reportTree, "This class has " + dit + " parents which is greater than " + max + " authorized.", new ArrayList<>(), dit - max); } } super.visitClass(tree); }
Source:
static String _getRequestBodyForMtsFieldUpdate(List<String> docIds, MetricSchemaRecordList msrList, long currentTimeMillis) { StringBuilder result = new StringBuilder(); for(String docId:docIds) { MetricSchemaRecord record = msrList.getRecord(docId); if (record == null) { _logger.warn("ES create response contains ID that was not in original request", docId); continue; } Integer retention = record.getRetentionDiscovery(); Long expiration = currentTimeMillis + (retention==null? DEFAULT_RETENTION_DISCOVERY_DAYS:retention) * 24L * 3600L * 1000L; result.append("{\"update\" : {\"_id\" : \"").append(docId).append("\" } }") .append(System.lineSeparator()) .append("{\"doc\" : {\"mts\": ").append(currentTimeMillis) .append(",\"").append(EXPIRATION_TS).append("\":").append(expiration); if (retention != null) { result.append(",\"").append(RETENTION_DISCOVERY).append("\":").append(retention); } result.append("}}"); result.append(System.lineSeparator()); } return result.toString(); }

Target:
static String _getRequestBodyForMtsFieldUpdate(List<String> docIds, MetricSchemaRecordList msrList, long currentTimeMillis) { StringBuilder result = new StringBuilder(); for(String docId:docIds) { MetricSchemaRecord record = msrList.getRecord(docId); if (record == null) { _logger.warn("ES create response contains ID that was not in original request", docId); continue; } Integer retention = record.getRetentionDiscovery(); Long expiration = currentTimeMillis + (retention==null? DEFAULT_RETENTION_DISCOVERY_DAYS:retention) * ONE_DAY_IN_MILLIS; result.append("{\"update\" : {\"_id\" : \"").append(docId).append("\" } }") .append(System.lineSeparator()) .append("{\"doc\" : {\"mts\": ").append(currentTimeMillis) .append(",\"").append(EXPIRATION_TS).append("\":").append(expiration); if (retention != null) { result.append(",\"").append(RETENTION_DISCOVERY).append("\":").append(retention); } result.append("}}"); result.append(System.lineSeparator()); } return result.toString(); }
Source:
public List<QualityProfileDto> selectByNameAndLanguages(String name, Collection<String> languageKeys, DbSession session) { return executeLargeInputs(languageKeys, input -> mapper(session).selectByNameAndLanguages(name, input)); }

Target:
public List<QualityProfileDto> selectByNameAndLanguages(String name, Collection<String> languageKeys, DbSession session) { return executeLargeInputs(languageKeys, input -> mapper(session).selectByNameAndLanguages(null, name, input)); }
Source:
static <T> T fromBuffer(ByteBuf buf, Class<T> cls) { if (constructorMap.containsKey(cls)) { return (T) constructorMap.get(cls).construct(buf); } if (cls.isEnum()) { try { Map<Byte, T> enumMap = (Map<Byte, T>) cls.getDeclaredField("typeMap").get(null); constructorMap.put(cls, x -> enumMap.get(x.readByte())); return (T) constructorMap.get(cls).construct(buf); } catch (NoSuchFieldException e) { throw new RuntimeException("only enums with a typeMap are supported!"); } catch (IllegalAccessException e) { throw new RuntimeException(e); } } if (!ICorfuPayload.class.isAssignableFrom(cls)) { throw new RuntimeException("Unknown class " + cls + " for deserialization"); } try { Constructor<?> t = cls.getConstructor(ByteBuf.class); MethodHandle mh = lookup.unreflectConstructor(t); MethodType mt = MethodType.methodType(Object.class, ByteBuf.class); try { CallSite metafactory = LambdaMetafactory.metafactory( lookup, "construct", MethodType.methodType(PayloadConstructor.class), mt, mh, mh.type() ); constructorMap.put(cls, (PayloadConstructor<T>) metafactory.getTarget().invokeExact()); return (T) constructorMap.get(cls).construct(buf); } catch (Throwable th) { throw new RuntimeException(th); } } catch (NoSuchMethodException nsme) { throw new RuntimeException("CorfuPayloads must include a ByteBuf constructor! for class: " + cls.toString()); } catch (IllegalAccessException e) { throw new RuntimeException(e); } }

Target:
static <T> T fromBuffer(ByteBuf buf, Class<T> cls) { if (constructorMap.containsKey(cls)) { return (T) constructorMap.get(cls).construct(buf); } if (cls.isEnum()) { try { Map<Byte, T> enumMap = (Map<Byte, T>) cls.getDeclaredField("typeMap").get(null); constructorMap.put(cls, x -> enumMap.get(x.readByte())); return (T) constructorMap.get(cls).construct(buf); } catch (NoSuchFieldException e) { throw new RuntimeException("only enums with a typeMap are supported!"); } catch (IllegalAccessException e) { throw new RuntimeException(e); } } if (!ICorfuPayload.class.isAssignableFrom(cls)) { throw new RuntimeException("Unknown class " + cls + " for deserialization"); } try { Constructor<?> t = cls.getConstructor(ByteBuf.class); MethodHandle mh = lookup.unreflectConstructor(t); MethodType mt = MethodType.methodType(Object.class, ByteBuf.class); try { CallSite metafactory = LambdaMetafactory.metafactory( lookup, "construct", MethodType.methodType(PayloadConstructor.class), mt, mh, mh.type() ); constructorMap.put(cls, (PayloadConstructor<T>) metafactory.getTarget().invokeExact()); return (T) constructorMap.get(cls).construct(buf); } catch (Throwable th) { throw new RuntimeException(th); } } catch (NoSuchMethodException nsme) { throw new RuntimeException("CorfuPayloads must include a ByteBuf " + "constructor! for class: " + cls.toString()); } catch (IllegalAccessException e) { throw new RuntimeException(e); } }
Source:
public void calculateTiffHeader() { String tifDefinition; ConfigProjects cp; try { cp = new ConfigProjects(this.template.getProject().getTitle()); } catch (IOException e) { logger.error(e.getMessage(), e); Helper.setFehlerMeldung("IOException", e.getMessage()); return; } tifDefinition = cp.getParamString("tifheader." + this.docType.toLowerCase(), "blabla"); tifDefinition = tifDefinition.replaceAll("\\[\\[", "<"); tifDefinition = tifDefinition.replaceAll("\\]\\]", ">"); this.tifHeaderDocumentName = this.prozessKopie.getTitle(); this.tifHeaderImageDescription = new StringBuilder(""); StringTokenizer tokenizer = new StringTokenizer(tifDefinition, "+"); while (tokenizer.hasMoreTokens()) { String string = tokenizer.nextToken(); if (string.startsWith("'") && string.endsWith("'") && string.length() > 2) { this.tifHeaderImageDescription.append(string.substring(1, string.length() - 1)); } else if (string.equals("$Doctype")) { this.tifHeaderImageDescription.append(this.docType); } else { for (AdditionalField additionalField : this.additionalFields) { if ((additionalField.getTitle().equals("ATS") || additionalField.getTitle().equals("TSL")) && additionalField.getShowDependingOnDoctype() && (additionalField.getValue() == null || additionalField.getValue().equals(""))) { additionalField.setValue(this.atstsl); } if (additionalField.getTitle().equals(string) && additionalField.getShowDependingOnDoctype() && additionalField.getValue() != null) { this.tifHeaderImageDescription .append(calcProcessTitleCheck(additionalField.getTitle(), additionalField.getValue())); } } } } }

Target:
public void calculateTiffHeader() { String tifDefinition; ConfigProjects cp; try { cp = new ConfigProjects(this.template.getProject().getTitle()); } catch (IOException e) { Helper.setErrorMessage("IOException", logger, e); return; } tifDefinition = cp.getParamString("tifheader." + this.docType.toLowerCase(), "blabla"); tifDefinition = tifDefinition.replaceAll("\\[\\[", "<"); tifDefinition = tifDefinition.replaceAll("\\]\\]", ">"); this.tifHeaderDocumentName = this.prozessKopie.getTitle(); this.tifHeaderImageDescription = new StringBuilder(); StringTokenizer tokenizer = new StringTokenizer(tifDefinition, "+"); while (tokenizer.hasMoreTokens()) { String string = tokenizer.nextToken(); if (string.startsWith("'") && string.endsWith("'") && string.length() > 2) { this.tifHeaderImageDescription.append(string.substring(1, string.length() - 1)); } else if (string.equals("$Doctype")) { this.tifHeaderImageDescription.append(this.docType); } else { for (AdditionalField additionalField : this.additionalFields) { if ((additionalField.getTitle().equals("ATS") || additionalField.getTitle().equals("TSL")) && additionalField.getShowDependingOnDoctype() && (additionalField.getValue() == null || additionalField.getValue().equals(""))) { additionalField.setValue(CopyProcess.atstsl); } if (additionalField.getTitle().equals(string) && additionalField.getShowDependingOnDoctype() && additionalField.getValue() != null) { this.tifHeaderImageDescription .append(calcProcessTitleCheck(additionalField.getTitle(), additionalField.getValue())); } } } } }
Source:
private static String getRoot() { URL url = io.crate.frameworks.mesos.Main.class.getProtectionDomain().getCodeSource().getLocation(); String jarPath = null; try { jarPath = URLDecoder.decode(url.getFile(), "UTF-8"); } catch (UnsupportedEncodingException e) { e.printStackTrace(); System.exit(2); } return new File(jarPath).getParentFile().getPath(); }

Target:
private static String getRoot() { URL url = io.crate.frameworks.mesos.Main.class.getProtectionDomain().getCodeSource().getLocation(); String jarPath = null; try { jarPath = URLDecoder.decode(url.getFile(), "UTF-8"); } catch (UnsupportedEncodingException e) { LOGGER.debug("Could not encode jar file path", e); System.exit(2); } return new File(jarPath).getParentFile().getPath(); }
Source:
public void configure() { if(templateStorage.isUnsatisfied()){ logger.warn("Unable to find template storage implementation, using in memory"); } else { setTemplateStorage(templateStorage.get()); } if(notificationService.isUnsatisfied()) { setNotificationService(notificationService.get()); } else { logger.warn("Unable to find notification service implementation, using logging only"); } }

Target:
public void configure() { if(templateStorage.isUnsatisfied()){ logger.warn("Unable to find template storage implementation, using in memory"); } else { setTemplateStorage(templateStorage.get()); } if(notificationService.isUnsatisfied()) { logger.warn("Unable to find notification service implementation, using logging only"); } else { setNotificationService(notificationService.get()); } }
Source:
private void manageNetworkConnection(String containerId, String methodname, String networkId) throws DockerException, InterruptedException { final WebTarget resource = resource().path("networks").path(networkId).path(methodname); Map<String, String> request = new HashMap<>(); request.put("Container", containerId); Response response = request(POST, Response.class, resource, resource.request(APPLICATION_JSON_TYPE), Entity.json(request)); switch (response.getStatus()) { case 200: return; case 404: throw new ContainerNotFoundException(containerId); case 500: throw new DockerException(response.readEntity(String.class)); } System.out.println(response.getStatus()); }

Target:
private void manageNetworkConnection(String containerId, String methodname, String networkId) throws DockerException, InterruptedException { final WebTarget resource = resource().path("networks").path(networkId).path(methodname); Map<String, String> request = new HashMap<>(); request.put("Container", containerId); Response response = request(POST, Response.class, resource, resource.request(APPLICATION_JSON_TYPE), Entity.json(request)); switch (response.getStatus()) { case 200: return; case 404: throw new ContainerNotFoundException(containerId); case 500: throw new DockerException(response.readEntity(String.class)); } }
Source:
public static void fillImagesMapBasedOnTemplate(VmTemplate template, List<StorageDomain> domains, Map<Guid, DiskImage> diskInfoDestinationMap, Map<Guid, StorageDomain> destStorages) { Map<Guid, StorageDomain> storageDomainsMap = domains.stream().filter(ImagesHandler::isDomainValidDestination) .collect(Collectors.toMap(d -> d.getId(), Function.identity())); for (DiskImage image : template.getDiskTemplateMap().values()) { for (Guid storageId : image.getStorageIds()) { if (storageDomainsMap.containsKey(storageId)) { ArrayList<Guid> storageIds = new ArrayList<>(); storageIds.add(storageId); image.setStorageIds(storageIds); diskInfoDestinationMap.put(image.getId(), image); break; } } } if (destStorages != null) { destStorages.putAll(diskInfoDestinationMap.values().stream() .collect(Collectors.toMap(d -> d.getStorageIds().get(0), d -> storageDomainsMap.get(d.getStorageIds().get(0))))); } }

Target:
public static void fillImagesMapBasedOnTemplate(VmTemplate template, List<StorageDomain> domains, Map<Guid, DiskImage> diskInfoDestinationMap, Map<Guid, StorageDomain> destStorages) { Map<Guid, StorageDomain> storageDomainsMap = domains.stream().filter(ImagesHandler::isDomainValidDestination) .collect(Collectors.toMap(StorageDomain::getId, Function.identity())); for (DiskImage image : template.getDiskTemplateMap().values()) { for (Guid storageId : image.getStorageIds()) { if (storageDomainsMap.containsKey(storageId)) { ArrayList<Guid> storageIds = new ArrayList<>(); storageIds.add(storageId); image.setStorageIds(storageIds); diskInfoDestinationMap.put(image.getId(), image); break; } } } if (destStorages != null) { destStorages.putAll(diskInfoDestinationMap.values().stream() .collect(Collectors.toMap(d -> d.getStorageIds().get(0), d -> storageDomainsMap.get(d.getStorageIds().get(0))))); } }
Source:
public ActivationKeyDTO setAddOns(Set<String> addOns) { this.addOns = addOns; return this; }

Target:
public ActivationKeyDTO setAddOns(Set<String> addOns) { this.addOns = addOns != null ? new HashSet<>(addOns) : null; return this; }
Source:
public void testGetUnitResource() { YarnConfiguration yarnConfig = new YarnConfiguration(); yarnConfig.set("yarn.resourcemanager.scheduler.class", "org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.FairScheduler"); yarnConfig.setInt("yarn.scheduler.minimum-allocation-mb", 64); yarnConfig.setInt("yarn.scheduler.minimum-allocation-vcores", 1); yarnConfig.setInt("yarn.scheduler.increment-allocation-mb", 1024); yarnConfig.setInt("yarn.scheduler.increment-allocation-vcores", 4); Resource unitResource1 = Utils.getUnitResource(yarnConfig); assertEquals(1024, unitResource1.getMemory()); assertEquals(4, unitResource1.getVirtualCores()); yarnConfig.setInt("yarn.resource-types.memory-mb.increment-allocation", 512); yarnConfig.setInt("yarn.resource-types.vcores.increment-allocation", 2); Resource unitResource2 = Utils.getUnitResource(yarnConfig); assertEquals(512, unitResource2.getMemory()); assertEquals(2, unitResource2.getVirtualCores()); yarnConfig.set("yarn.resourcemanager.scheduler.class", "org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.CapacityScheduler"); Resource unitResource3 = Utils.getUnitResource(yarnConfig); assertEquals(64, unitResource3.getMemory()); assertEquals(1, unitResource3.getVirtualCores()); }

Target:
public void testGetUnitResource() { final int minMem = 64; final int minVcore = 1; final int incMem = 512; final int incVcore = 2; final int incMemLegacy = 1024; final int incVcoreLegacy = 4; YarnConfiguration yarnConfig = new YarnConfiguration(); yarnConfig.setInt(YarnConfiguration.RM_SCHEDULER_MINIMUM_ALLOCATION_MB, minMem); yarnConfig.setInt(YarnConfiguration.RM_SCHEDULER_MINIMUM_ALLOCATION_VCORES, minVcore); yarnConfig.setInt(Utils.YARN_RM_INCREMENT_ALLOCATION_MB_LEGACY_KEY, incMemLegacy); yarnConfig.setInt(Utils.YARN_RM_INCREMENT_ALLOCATION_VCORES_LEGACY_KEY, incVcoreLegacy); verifyUnitResourceVariousSchedulers(yarnConfig, minMem, minVcore, incMemLegacy, incVcoreLegacy); yarnConfig.setInt(Utils.YARN_RM_INCREMENT_ALLOCATION_MB_KEY, incMem); yarnConfig.setInt(Utils.YARN_RM_INCREMENT_ALLOCATION_VCORES_KEY, incVcore); verifyUnitResourceVariousSchedulers(yarnConfig, minMem, minVcore, incMem, incVcore); }
Source:
private Object getFromDB(String serviceName, String type, String user) throws CredentialStoreException { String application = findApplicationName(); if(StringUtil.isEmpty(user)){ user = serviceName+application; } try { Connection connection = getConnection(); try { PreparedStatement stmt = connection .prepareStatement("SELECT CREDENTIALTOKEN FROM "+getTableName()+" WHERE APPID = ? AND SERVICENAME = ? and TYPE = ? AND USERID = ?"); try { stmt.setString(1, application); stmt.setString(2, serviceName); stmt.setString(3, type); stmt.setString(4, user); ResultSet rs = stmt.executeQuery(); try { if(rs.next()){ byte[] buf = rs.getBytes(1); return(deSerialize(buf)); } } finally { rs.close(); } } finally { stmt.close(); } } finally { connection.close(); } } catch (SQLException e) { logger.log(Level.SEVERE, "getAppToken : ", e); throw new CredentialStoreException(e, "DBCredentialStore.java : getAppToken caused a SQLException"); } return null; }

Target:
private Object getFromDB(String serviceName, String type, String user) throws CredentialStoreException { String application = findApplicationName(); if(StringUtil.isEmpty(user)){ user = ""; } try { Connection connection = getConnection(); try { PreparedStatement stmt = connection .prepareStatement("SELECT CREDENTIALTOKEN FROM "+getTableName()+" WHERE APPID = ? AND SERVICENAME = ? and TYPE = ? AND USERID = ?"); try { stmt.setString(1, application); stmt.setString(2, serviceName); stmt.setString(3, type); stmt.setString(4, user); ResultSet rs = stmt.executeQuery(); try { if(rs.next()){ byte[] buf = rs.getBytes(1); return(deSerialize(buf)); } } finally { rs.close(); } } finally { stmt.close(); } } finally { connection.close(); } } catch (SQLException e) { logger.log(Level.SEVERE, "getAppToken : ", e); throw new CredentialStoreException(e, "DBCredentialStore.java : getAppToken caused a SQLException"); } return null; }
Source:
public String toString() { StringBuilder sb = new StringBuilder(); sb.append("ReceivedPutRequest["); sb.append("BlobID=").append(blobId.getID()); sb.append(", ").append("PartitionId=").append(blobId.getPartition()); sb.append(", ").append("ClientId=").append(clientId); sb.append(", ").append("CorrelationId=").append(correlationId); if (blobProperties != null) { sb.append(", ").append(blobProperties); } else { sb.append(", ").append("Properties=Null"); } if (userMetadata != null) { sb.append(", ").append("UserMetaDataSize=").append(userMetadata.capacity()); } else { sb.append(", ").append("UserMetaDataSize=0"); } sb.append(", ").append("blobType=").append(blobType); sb.append(", ").append("blobSize=").append(blobSize); sb.append(", ").append("crc=").append(receivedCrc); sb.append(", ").append("BlobKeyAvailable=").append(blobKey != null); sb.append("]"); return sb.toString(); }

Target:
public String toString() { StringBuilder sb = new StringBuilder(); sb.append("ReceivedPutRequest["); sb.append("BlobID=").append(blobId.getID()); sb.append(", ").append("PartitionId=").append(blobId.getPartition()); sb.append(", ").append("ClientId=").append(clientId); sb.append(", ").append("CorrelationId=").append(correlationId); if (blobProperties != null) { sb.append(", ").append(blobProperties); } else { sb.append(", ").append("Properties=Null"); } if (userMetadata != null) { sb.append(", ").append("UserMetaDataSize=").append(userMetadata.capacity()); } else { sb.append(", ").append("UserMetaDataSize=0"); } sb.append(", ").append("blobType=").append(blobType); sb.append(", ").append("blobSize=").append(blobSize); sb.append(", ").append("crc=").append(receivedCrc); sb.append(", ").append("BlobKeyAvailable=").append(blobEncryptionKey != null); sb.append("]"); return sb.toString(); }
Source:
public boolean advanceNextPosition() { try { if (closed || !recordReader.next(key, value)) { close(); return false; } Arrays.fill(loaded, false); rowData = deserializer.deserialize(value); return true; } catch (IOException | SerDeException | RuntimeException e) { closeWithSuppression(this, e); if (e instanceof TextLineLengthLimitExceededException) { throw new PrestoException(HIVE_BAD_DATA, e); } throw new PrestoException(HIVE_CURSOR_ERROR, e); } }

Target:
public boolean advanceNextPosition() { try { if (closed || !recordReader.next(key, value)) { close(); return false; } Arrays.fill(loaded, false); rowData = deserializer.deserialize(value); return true; } catch (IOException | SerDeException | RuntimeException e) { closeWithSuppression(this, e); if (e instanceof TextLineLengthLimitExceededException) { throw new PrestoException(HIVE_BAD_DATA, "Line too long in text file: " + path, e); } throw new PrestoException(HIVE_CURSOR_ERROR, e); } }
Source:
public List<Map<String, Map<Category, Double>>> getNamedEntities() throws IndicoException { if (!results.containsKey(Api.NamedEntities)) throw new IndicoException(Api.NamedEntities.name + " was not included in the request"); List<Map<String, Map<Category, Double>>> result = new ArrayList<>(); List<Map<String, Map<String, Object>>> responses = (List<Map<String, Map<String, Object>>>) results.get(Api.NamedEntities); for (Map<String, Map<String, Object>> response : responses) { Map<String, Map<Category, Double>> each = new HashMap<>(); for (Map.Entry<String, Map<String, Object>> entry : response.entrySet()) { Map<String, Double> res = new HashMap<>(); res.putAll((Map<String, Double>) entry.getValue().remove("categories")); res.put("confidence", (Double) entry.getValue().get("confidence")); each.put(entry.getKey(), EnumParser.parse(Category.class, res)); } result.add(each); } return result; }

Target:
public List<Map<String, Map<Category, Double>>> getNamedEntities() throws IndicoException { List<Map<String, Map<Category, Double>>> result = new ArrayList<>(); List<Map<String, Map<String, Object>>> responses = (List<Map<String, Map<String, Object>>>) get(Api.NamedEntities); for (Map<String, Map<String, Object>> response : responses) { Map<String, Map<Category, Double>> each = new HashMap<>(); for (Map.Entry<String, Map<String, Object>> entry : response.entrySet()) { Map<String, Double> res = new HashMap<>(); res.putAll((Map<String, Double>) entry.getValue().remove("categories")); res.put("confidence", (Double) entry.getValue().get("confidence")); each.put(entry.getKey(), EnumParser.parse(Category.class, res)); } result.add(each); } return result; }
Source:
public void _doBuild(StaplerRequest req, StaplerResponse rsp, @QueryParameter TimeDuration delay) throws IOException, ServletException { if (delay==null) delay=new TimeDuration(getJob().getQuietPeriod() * 1000); List<ParameterValue> values = new ArrayList<ParameterValue>(); JSONObject formData = req.getSubmittedForm(); JSONArray a = JSONArray.fromObject(formData.get("parameter")); for (Object o : a) { JSONObject jo = (JSONObject) o; String name = jo.getString("name"); ParameterDefinition d = getParameterDefinition(name); if(d==null) throw new IllegalArgumentException("No such parameter definition: " + name); ParameterValue parameterValue = d.createValue(req, jo); if (parameterValue != null) { values.add(parameterValue); } else { throw new IllegalArgumentException("Cannot retrieve the parameter value: " + name); } } WaitingItem item = Jenkins.getInstance().getQueue().schedule( getJob(), delay.getTimeInSeconds(), new ParametersAction(values), new CauseAction(new Cause.UserIdCause())); if (item!=null) { String url = formData.optString("redirectTo"); if (url==null || !Util.isSafeToRedirectTo(url)) url = req.getContextPath()+'/'+item.getUrl(); rsp.sendRedirect(formData.optInt("statusCode",SC_CREATED), url); } else rsp.sendRedirect("."); }

Target:
public void _doBuild(StaplerRequest req, StaplerResponse rsp, @QueryParameter TimeDuration delay) throws IOException, ServletException { if (delay==null) delay=new TimeDuration(TimeUnit.MILLISECONDS.convert(getJob().getQuietPeriod(), TimeUnit.SECONDS)); List<ParameterValue> values = new ArrayList<ParameterValue>(); JSONObject formData = req.getSubmittedForm(); JSONArray a = JSONArray.fromObject(formData.get("parameter")); for (Object o : a) { JSONObject jo = (JSONObject) o; String name = jo.getString("name"); ParameterDefinition d = getParameterDefinition(name); if(d==null) throw new IllegalArgumentException("No such parameter definition: " + name); ParameterValue parameterValue = d.createValue(req, jo); if (parameterValue != null) { values.add(parameterValue); } else { throw new IllegalArgumentException("Cannot retrieve the parameter value: " + name); } } WaitingItem item = Jenkins.getInstance().getQueue().schedule( getJob(), delay.getTimeInSeconds(), new ParametersAction(values), new CauseAction(new Cause.UserIdCause())); if (item!=null) { String url = formData.optString("redirectTo"); if (url==null || !Util.isSafeToRedirectTo(url)) url = req.getContextPath()+'/'+item.getUrl(); rsp.sendRedirect(formData.optInt("statusCode",SC_CREATED), url); } else rsp.sendRedirect("."); }
Source:
private IAction createOpenAction() { ITreeSelection selection = (ITreeSelection) tree.getSelection(); final List<String> pathsToOpen = getSelectedPaths(selection); if (pathsToOpen == null) return null; return new Action( UIText.CommitFileDiffViewer_OpenWorkingTreeVersionInEditorMenuLabel) { @Override public void run() { for (Iterator<String> iterator = pathsToOpen.iterator(); iterator .hasNext();) { openFileInEditor(iterator.next()); } } }; }

Target:
private IAction createOpenAction() { ITreeSelection selection = (ITreeSelection) tree.getSelection(); final List<String> pathsToOpen = getSelectedPaths(selection); if (pathsToOpen == null) return null; return new Action( UIText.CommitFileDiffViewer_OpenWorkingTreeVersionInEditorMenuLabel) { @Override public void run() { for (String filePath: pathsToOpen) openFileInEditor(filePath); } }; }
Source:
protected void onHandleIntent(Intent intent) { FormResourceDAO formResourceDAO = AppDatabase.getDatabase(OpenMRS.getInstance().getApplicationContext()).formResourceDAO(); if (NetworkUtils.isOnline()) { Call<Results<FormResourceEntity>> call = apiService.getForms(); call.enqueue(new Callback<Results<FormResourceEntity>>() { @Override public void onResponse(@NonNull Call<Results<FormResourceEntity>> call, @NonNull Response<Results<FormResourceEntity>> response) { if (response.isSuccessful()) { formResourceDAO.deleteALlForms(); formresourcelist = response.body().getResults(); int size = formresourcelist.size(); for (int i = 0; i < size; i++) { formResourceDAO.addFormResource(formresourcelist.get(i)); } } } @Override public void onFailure(@NonNull Call<Results<FormResourceEntity>> call, @NonNull Throwable t) { ToastUtil.error(t.getMessage()); } }); Call<Results<EncounterType>> call2 = apiService.getEncounterTypes(); call2.enqueue(new Callback<Results<EncounterType>>() { @Override public void onResponse(@NonNull Call<Results<EncounterType>> call, @NonNull Response<Results<EncounterType>> response) { if (response.isSuccessful()) { formResourceDAO.deleteALlForms(); Results<EncounterType> encountertypelist = response.body(); for (EncounterType enctype : encountertypelist.getResults()) enctype.save(); } } @Override public void onFailure(@NonNull Call<Results<EncounterType>> call, @NonNull Throwable t) { ToastUtil.error(t.getMessage()); } }); } }

Target:
protected void onHandleIntent(Intent intent) { FormResourceDAO formResourceDAO = AppDatabase.getDatabase(OpenMRS.getInstance().getApplicationContext()).formResourceDAO(); EncounterTypeRoomDAO encounterTypeRoomDAO = AppDatabase.getDatabase(OpenMRS.getInstance().getApplicationContext()).encounterTypeRoomDAO(); if (NetworkUtils.isOnline()) { Call<Results<FormResourceEntity>> call = apiService.getForms(); call.enqueue(new Callback<Results<FormResourceEntity>>() { @Override public void onResponse(@NonNull Call<Results<FormResourceEntity>> call, @NonNull Response<Results<FormResourceEntity>> response) { if (response.isSuccessful()) { formResourceDAO.deleteAllForms(); formresourcelist = response.body().getResults(); int size = formresourcelist.size(); for (int i = 0; i < size; i++) { formResourceDAO.addFormResource(formresourcelist.get(i)); } } } @Override public void onFailure(@NonNull Call<Results<FormResourceEntity>> call, @NonNull Throwable t) { ToastUtil.error(t.getMessage()); } }); Call<Results<EncounterType>> call2 = apiService.getEncounterTypes(); call2.enqueue(new Callback<Results<EncounterType>>() { @Override public void onResponse(@NonNull Call<Results<EncounterType>> call, @NonNull Response<Results<EncounterType>> response) { if (response.isSuccessful()) { encounterTypeRoomDAO.deleteAllEncounterTypes(); Results<EncounterType> encounterTypeList = response.body(); for (EncounterType encounterType : encounterTypeList.getResults()) encounterTypeRoomDAO.addEncounterType(encounterType); } } @Override public void onFailure(@NonNull Call<Results<EncounterType>> call, @NonNull Throwable t) { ToastUtil.error(t.getMessage()); } }); } }
Source:
public ISchedulingRule getRule(int kind, Map<String, String> args) { if (InstanceScope.INSTANCE.getNode(JavaCore.PLUGIN_ID).getBoolean(PREF_NULL_SCHEDULING_RULE, false)) { return getProject(); } return super.getRule(kind, args); }

Target:
public ISchedulingRule getRule(int kind, Map<String, String> args) { String pref = InstanceScope.INSTANCE.getNode(JavaCore.PLUGIN_ID).get(PREF_SCHEDULING_RULE, null); if (pref != null) { if(pref.equals("project")) return getProject(); else if(pref.equals("null")) { return null; } } return super.getRule(kind, args); }
Source:
public void sawClient(Client client) { long now = OffsetDateTime.now().toEpochSecond(); dslContext.transaction(configuration -> { DSL.using(configuration) .update(CLIENTS) .set(CLIENTS.LASTSEEN, now) .where(CLIENTS.ID.eq(client.getId())) .execute(); }); }

Target:
public void sawClient(Client client) { Instant now = Instant.now(); Instant lastSeen = Optional.ofNullable(client.getLastSeen()).map(ls -> Instant.ofEpochSecond(ls.toEpochSecond())).orElse(null); if (lastSeen == null || now.isAfter(lastSeen.plus(lastSeenThreshold, SECONDS))) { dslContext.transaction(configuration -> { Param<Long> val = DSL.val(now.getEpochSecond(), CLIENTS.LASTSEEN); DSL.using(configuration) .update(CLIENTS) .set(CLIENTS.LASTSEEN, DSL.when(CLIENTS.LASTSEEN.isNull(), val).otherwise(DSL.greatest(CLIENTS.LASTSEEN, val))) .where(CLIENTS.ID.eq(client.getId())) .execute(); }); } }
Source:
public void purge(Set<Integer> parts, IgniteCallable<Boolean> shouldStop) throws IgniteCheckedException { if (F.isEmpty(parts)) return; if (segments.length == 1) segments[0].purge(parts, shouldStop); else { for (int seg = 0; seg < segments.length; seg++) { for (Integer part : parts) { if (part % segments.length == seg) { segments[seg].purge(parts, shouldStop); break; } } } } }

Target:
public void purge(Set<Integer> parts, IgniteCallable<Boolean> shouldStop) throws IgniteCheckedException { assert !F.isEmpty(parts) : "Empty parts"; for (int seg = 0; seg < segments.length; seg++) { for (Integer part : parts) { if (part % segments.length == seg) { segments[seg].purge(parts, shouldStop); break; } } } }
Source:
public RowExpressionMatchVisitor(Map<String, String> aliases) { this.aliases = aliases; }

Target:
public RowExpressionMatchVisitor(Map<String, String> aliases) { requireNonNull(aliases); this.aliases = ImmutableMap.copyOf(aliases); }
Source:
public AbstractParamContainerPanel getJSplitPane() { if (jSplitPane == null) { jSplitPane = new AbstractParamContainerPanel(); jSplitPane.setVisible(true); if (this.rootName != null) { jSplitPane.getRootNode().setUserObject(rootName); } } return jSplitPane; }

Target:
private AbstractParamContainerPanel getJSplitPane() { if (jSplitPane == null) { jSplitPane = new AbstractParamContainerPanel(); jSplitPane.setVisible(true); if (this.rootName != null) { jSplitPane.getRootNode().setUserObject(rootName); } } return jSplitPane; }
Source:
protected void doInit() { this.evaluationContext = ExpressionUtils.createStandardEvaluationContext(this.getBeanFactory()); ConversionService conversionService = this.getConversionService(); if (conversionService == null){ conversionService = new GenericConversionService(); } if (conversionService instanceof ConverterRegistry){ ConverterRegistry converterRegistry = (ConverterRegistry) conversionService; if (!conversionService.canConvert(Class.class, String.class)) { converterRegistry.addConverter(new ClassToStringConverter()); converterRegistry.addConverter(new ObjectToStringConverter()); } this.evaluationContext.setTypeConverter(new StandardTypeConverter(conversionService)); } else { logger.warn("ConversionService is not an instance of ConverterRegistry therefore" + "ClassToStringConverter and ObjectToStringConverter will not be registered"); } }

Target:
protected void doInit() { this.evaluationContext = ExpressionUtils.createStandardEvaluationContext(this.getBeanFactory()); }
Source:
List<RemoteReplicaInfo> getRemoteReplicaInfos(Host remoteHost, StoreEventListener listener) { List<? extends ReplicaId> replicaIds = clusterMap.getReplicaIds(dataNodeId); List<RemoteReplicaInfo> remoteReplicaInfos = new ArrayList<>(); for (ReplicaId replicaId : replicaIds) { for (ReplicaId peerReplicaId : replicaId.getPeerReplicaIds()) { if (peerReplicaId.getDataNodeId().equals(remoteHost.dataNodeId)) { PartitionId partitionId = replicaId.getPartitionId(); MockStore store = storesByPartition.computeIfAbsent(partitionId, partitionId1 -> new MockStore(partitionId, infosByPartition.computeIfAbsent(partitionId1, (Function<PartitionId, List<MessageInfo>>) partitionId2 -> new ArrayList<>()), buffersByPartition.computeIfAbsent(partitionId1, (Function<PartitionId, List<ByteBuffer>>) partitionId22 -> new ArrayList<>()), listener)); RemoteReplicaInfo remoteReplicaInfo = new RemoteReplicaInfo(peerReplicaId, replicaId, store, new MockFindToken(0, 0), Long.MAX_VALUE, SystemTime.getInstance(), new Port(peerReplicaId.getDataNodeId().getPort(), PortType.PLAINTEXT)); remoteReplicaInfos.add(remoteReplicaInfo); break; } } } return remoteReplicaInfos; }

Target:
List<RemoteReplicaInfo> getRemoteReplicaInfos(Host remoteHost, StoreEventListener listener) { List<? extends ReplicaId> replicaIds = clusterMap.getReplicaIds(dataNodeId); List<RemoteReplicaInfo> remoteReplicaInfos = new ArrayList<>(); for (ReplicaId replicaId : replicaIds) { for (ReplicaId peerReplicaId : replicaId.getPeerReplicaIds()) { if (peerReplicaId.getDataNodeId().equals(remoteHost.dataNodeId)) { PartitionId partitionId = replicaId.getPartitionId(); MockStore store = storesByPartition.computeIfAbsent(partitionId, partitionId1 -> new MockStore(partitionId, infosByPartition.computeIfAbsent(partitionId1, (Function<PartitionId, List<MessageInfo>>) partitionId2 -> new ArrayList<>()), buffersByPartition.computeIfAbsent(partitionId1, (Function<PartitionId, List<ByteBuffer>>) partitionId22 -> new ArrayList<>()), listener)); RemoteReplicaInfo remoteReplicaInfo = new RemoteReplicaInfo(peerReplicaId, replicaId, store, new MockFindToken(0, 0), Long.MAX_VALUE, SystemTime.getInstance(), new Port(peerReplicaId.getDataNodeId().getPort(), PortType.PLAINTEXT)); remoteReplicaInfos.add(remoteReplicaInfo); } } } return remoteReplicaInfos; }
Source:
private boolean tryRehash() { long newCapacityLong = hashCapacity * 2L; if (newCapacityLong > Integer.MAX_VALUE) { throw new PrestoException(GENERIC_INSUFFICIENT_RESOURCES, "Size of hash table cannot exceed 1 billion entries"); } int newCapacity = (int) newCapacityLong; if (!updateReservedMemory.apply(((long) (newCapacity - hashCapacity)) * (Long.BYTES + Integer.BYTES))) { } expectedHashCollisions += estimateNumberOfHashCollisions(getGroupCount(), hashCapacity); int newMask = newCapacity - 1; LongBigArray newValues = new LongBigArray(); newValues.ensureCapacity(newCapacity); IntBigArray newGroupIds = new IntBigArray(-1); newGroupIds.ensureCapacity(newCapacity); for (int groupId = 0; groupId < nextGroupId; groupId++) { if (groupId == nullGroupId) { continue; } long value = valuesByGroupId.get(groupId); long hashPosition = getHashPosition(value, newMask); while (newGroupIds.get(hashPosition) != -1) { hashPosition = (hashPosition + 1) & newMask; hashCollisions++; } newValues.set(hashPosition, value); newGroupIds.set(hashPosition, groupId); } mask = newMask; hashCapacity = newCapacity; maxFill = calculateMaxFill(hashCapacity); values = newValues; groupIds = newGroupIds; this.valuesByGroupId.ensureCapacity(maxFill); return true; }

Target:
private boolean tryRehash() { long newCapacityLong = hashCapacity * 2L; if (newCapacityLong > Integer.MAX_VALUE) { throw new PrestoException(GENERIC_INSUFFICIENT_RESOURCES, "Size of hash table cannot exceed 1 billion entries"); } int newCapacity = toIntExact(newCapacityLong); preallocatedMemoryInBytes = (newCapacity - hashCapacity) * (long) (Long.BYTES + Integer.BYTES) + (calculateMaxFill(newCapacity) - maxFill) * Long.BYTES + currentPageSizeInBytes; if (!updateMemory.update()) { return false; } preallocatedMemoryInBytes = 0; expectedHashCollisions += estimateNumberOfHashCollisions(getGroupCount(), hashCapacity); int newMask = newCapacity - 1; LongBigArray newValues = new LongBigArray(); newValues.ensureCapacity(newCapacity); IntBigArray newGroupIds = new IntBigArray(-1); newGroupIds.ensureCapacity(newCapacity); for (int groupId = 0; groupId < nextGroupId; groupId++) { if (groupId == nullGroupId) { continue; } long value = valuesByGroupId.get(groupId); long hashPosition = getHashPosition(value, newMask); while (newGroupIds.get(hashPosition) != -1) { hashPosition = (hashPosition + 1) & newMask; hashCollisions++; } newValues.set(hashPosition, value); newGroupIds.set(hashPosition, groupId); } mask = newMask; hashCapacity = newCapacity; maxFill = calculateMaxFill(hashCapacity); values = newValues; groupIds = newGroupIds; this.valuesByGroupId.ensureCapacity(maxFill); return true; }
Source:
public void fillPresentationAttributes(String name, String value) { logger.log(Level.FINE, ">>>> PROP " + name + " = " + value); if (value.startsWith("url(")) { getTree().logErrorLine("Can't support url values as:" + value, getDocumentNode(), SvgTree.SvgLogLevel.ERROR); return; } mVdAttributesMap.put(name, value); }

Target:
public void fillPresentationAttributes(String name, String value) { logger.log(Level.FINE, ">>>> PROP " + name + " = " + value); if (value.startsWith("url(")) { getTree().logErrorLine("Unsupported URL value: " + value, getDocumentNode(), SvgTree.SvgLogLevel.ERROR); return; } mVdAttributesMap.put(name, value); }
Source:
public Trace getFragment(String tenantId, String id) { if (log.isLoggable(Level.FINEST)) { log.finest("Get trace fragment: tenantId=[" + tenantId + "] id=[" + id + "]"); } try { URL url = new URL(getUri() + "hawkular/apm/traces/fragments/" + id); HttpURLConnection connection = (HttpURLConnection) url.openConnection(); connection.setRequestMethod("GET"); connection.setDoOutput(true); connection.setDoInput(true); connection.setUseCaches(false); connection.setAllowUserInteraction(false); connection.setRequestProperty("Content-Type", "application/json"); addHeaders(connection, tenantId); java.io.InputStream is = connection.getInputStream(); byte[] b = new byte[is.available()]; int count = is.read(b); if (count != b.length) { log.warning("Incomplete data read"); } is.close(); if (connection.getResponseCode() == 200) { if (log.isLoggable(Level.FINEST)) { log.finest("Returned json=[" + new String(b) + "]"); } try { return mapper.readValue(b, Trace.class); } catch (Throwable t) { log.log(Level.SEVERE, "Failed to deserialize", t); } } else { if (log.isLoggable(Level.FINEST)) { log.finest("Failed to get trace fragment: status=[" + connection.getResponseCode() + "]:" + connection.getResponseMessage()); } } } catch (Exception e) { log.log(Level.SEVERE, "Failed to send 'get' trace fragment request", e); } return null; }

Target:
public Trace getFragment(String tenantId, String id) { if (log.isLoggable(Level.FINEST)) { log.finest("Get trace fragment: tenantId=[" + tenantId + "] id=[" + id + "]"); } try { URL url = new URL(getUri() + "hawkular/apm/traces/fragments/" + id); HttpURLConnection connection = (HttpURLConnection) url.openConnection(); connection.setRequestMethod("GET"); connection.setDoOutput(true); connection.setDoInput(true); connection.setUseCaches(false); connection.setAllowUserInteraction(false); connection.setRequestProperty("Content-Type", "application/json"); addHeaders(connection, tenantId); java.io.InputStream is = connection.getInputStream(); byte[] b = new byte[is.available()]; int count = is.read(b); if (count != b.length) { log.warning("Incomplete data read"); } is.close(); if (connection.getResponseCode() == 200) { if (log.isLoggable(Level.FINEST)) { log.finest("Returned json=[" + new String(b) + "]"); } try { return mapper.readValue(b, Trace.class); } catch (JsonMappingException|JsonParseException t) { log.log(Level.SEVERE, "Failed to deserialize", t); } catch (IOException t) { log.log(Level.SEVERE, "Failed to deserialize", t); } } else { if (log.isLoggable(Level.FINEST)) { log.finest("Failed to get trace fragment: status=[" + connection.getResponseCode() + "]:" + connection.getResponseMessage()); } } } catch (IOException e) { log.log(Level.SEVERE, "Failed to send 'get' trace fragment request", e); } return null; }
Source:
public void destroy(ClaudiaData claudiaData, EnvironmentInstance envInstance) throws Exception { log.info("Destroying enviornment isntance " + envInstance.getBlueprintName() + " with environment " + envInstance.getEnvironment().getName() + " vdc " + envInstance.getVdc()); boolean error = false; try { envInstance.setStatus(Status.UNINSTALLING); envInstance = environmentInstanceDao.update(envInstance); for (int i = 0; i < envInstance.getTierInstances().size(); i++) { deleteVM(claudiaData, envInstance); } } catch (NullPointerException ne) { log.info("Environment Instance " + envInstance.getBlueprintName() + " does not have any TierInstances associated"); } List<TierInstance> tierInstancesSDC = envInstance.getTierInstances(); envInstance.setTierInstances(null); for (int i = 0; i < tierInstancesSDC.size(); i++) { TierInstance tierInstance = tierInstancesSDC.get(i); try { deleteTierOnSDC(claudiaData, tierInstance, error); } catch (Exception e) { String errorMsg = "Error deleting node from Node Manager : " + tierInstance.getVM().getFqn() + "" + e.getMessage(); log.error(errorMsg); error = true; } envInstance.setStatus(Status.UNINSTALLED); envInstance = environmentInstanceDao.update(envInstance); deletePaaSDB(claudiaData, envInstance, tierInstance, error); } log.info("Environment Instance " + envInstance.getBlueprintName() + " DESTROYED"); envInstance.setStatus(Status.UNDEPLOYED); environmentInstanceDao.remove(envInstance); if (error) { String errorMsg = "Unexpected error destroying environmentInstance"; throw new Exception(errorMsg); } }

Target:
public void destroy(ClaudiaData claudiaData, EnvironmentInstance envInstance) throws Exception { log.info("Destroying environment instance " + envInstance.getBlueprintName() + " with environment " + envInstance.getEnvironment().getName() + " vdc " + envInstance.getVdc()); boolean error = false; try { envInstance.setStatus(Status.UNINSTALLING); envInstance = environmentInstanceDao.update(envInstance); for (int i = 0; i < envInstance.getTierInstances().size(); i++) { deleteVM(claudiaData, envInstance); } } catch (NullPointerException ne) { log.info("Environment Instance " + envInstance.getBlueprintName() + " does not have any TierInstance associated"); } List<TierInstance> tierInstancesSDC = envInstance.getTierInstances(); envInstance.setTierInstances(null); for (int i = 0; i < tierInstancesSDC.size(); i++) { TierInstance tierInstance = tierInstancesSDC.get(i); try { deleteTierOnSDC(claudiaData, tierInstance, error); } catch (Exception e) { String errorMsg = "Error deleting node from Node Manager : " + tierInstance.getVM().getFqn() + " " + e.getMessage(); log.error(errorMsg); error = true; } envInstance.setStatus(Status.UNINSTALLED); envInstance = environmentInstanceDao.update(envInstance); deletePaaSDB(claudiaData, envInstance, tierInstance, error); } log.info("Environment Instance " + envInstance.getBlueprintName() + " DESTROYED"); envInstance.setStatus(Status.UNDEPLOYED); environmentInstanceDao.remove(envInstance); if (error) { String errorMsg = "Unexpected error destroying environmentInstance"; throw new Exception(errorMsg); } }
Source:
public void testByteBufferInputStreamNonZeroOffset2() throws Exception { ByteBuffer byteBuffer = ByteBuffer.allocate(1000); AvroKafkaSpoutTranslator.ByteBufferInputStream is = new AvroKafkaSpoutTranslator.ByteBufferInputStream(byteBuffer); byte[] dest = new byte[1000]; int res = is.read(dest, 600, 400); assertEquals(400, res); }

Target:
public void testByteBufferInputStreamNonZeroOffset2() throws Exception { int res = read(1000, 1000, 600, 400); assertEquals(400, res); }