auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private static Target lookupTarget(StructDefinition streamPacketContextDef, boolean hasDevice, Long cpuId) { Target ret = new Target(); if (hasDevice) { IDefinition def = streamPacketContextDef.lookupDefinition(CTFStrings.DEVICE); if (def instanceof SimpleDatatypeDefinition) { SimpleDatatypeDefinition simpleDefinition = (SimpleDatatypeDefinition) def; ret.string = simpleDefinition.getStringValue(); ret.number = simpleDefinition.getIntegerValue(); } else if (def instanceof StringDefinition) { StringDefinition stringDefinition = (StringDefinition) def; ret.string = stringDefinition.getValue(); ret.number = Integer.parseInt(ret.string.replaceAll("[\\D]", "")); } } else if (cpuId != null) { ret.string = ("CPU" + cpuId.toString()); ret.number = cpuId; } return ret; }

Target:
private static Target lookupTarget(StructDefinition streamPacketContextDef, boolean hasDevice, Long cpuId) { Target ret = new Target(); if (hasDevice) { IDefinition def = streamPacketContextDef.lookupDefinition(CTFStrings.DEVICE); if (def instanceof SimpleDatatypeDefinition) { SimpleDatatypeDefinition simpleDefinition = (SimpleDatatypeDefinition) def; ret.string = simpleDefinition.getStringValue(); ret.number = simpleDefinition.getIntegerValue(); } else if (def instanceof StringDefinition) { StringDefinition stringDefinition = (StringDefinition) def; ret.string = stringDefinition.getValue(); final Matcher matcher = NUMBER_PATTERN.matcher(ret.string); if(matcher.find()){ String number = matcher.group(0); ret.number = Integer.parseInt(number); } } } else if (cpuId != null) { ret.string = ("CPU" + cpuId.toString()); ret.number = cpuId; } return ret; }
Source:
private boolean isSequenceElement(Object notifier) { boolean isSequenceElement = false; View view = null; if (notifier instanceof EObject) { if (notifier instanceof View) { view = (View) notifier; } else if (((EObject) notifier).eContainer() instanceof View) { view = (View) ((EObject) notifier).eContainer(); } } if (view != null) { if (view.eContainer() instanceof View && (CombinedFragment.compartmentNotationPredicate().apply(view) || Operand.compartmentNotationPredicate().apply(view))) { view = (View) view.eContainer(); } Option<ISequenceElement> sequenceElementOption = ISequenceElementAccessor.getISequenceElement(view); isSequenceElement = sequenceElementOption.some(); } return isSequenceElement; }

Target:
private boolean isSequenceElement(Object notifier) { boolean isSequenceElement = false; if (notifier instanceof EObject) { View view = null; if (notifier instanceof View) { view = (View) notifier; } else if (((EObject) notifier).eContainer() instanceof View) { view = (View) ((EObject) notifier).eContainer(); } if (view != null) { isSequenceElement = ISequenceElementAccessor.isPartOfSequenceElement(view); } } return isSequenceElement; }
Source:
public static <T extends MessageOrBuilder> List<T> readMessages(Path file, Class<T> messageClass) throws IOException { ParquetReader.Builder readerBuilder = ProtoParquetReader.builder(file); if (messageClass != null) { readerBuilder.set(ProtoReadSupport.PB_CLASS, messageClass.getName()).build(); } ParquetReader reader = readerBuilder.build(); try { List<T> result = new ArrayList<T>(); boolean hasNext = true; while (hasNext) { T item = (T) reader.read(); if (item == null) { hasNext = false; } else { result.add((T) asMessage(item)); } } return result; } finally { reader.close(); } }

Target:
public static <T extends MessageOrBuilder> List<T> readMessages(Path file, Class<T> messageClass) throws IOException { ParquetReader.Builder readerBuilder = ProtoParquetReader.builder(file); if (messageClass != null) { readerBuilder.set(ProtoReadSupport.PB_CLASS, messageClass.getName()).build(); } try (ParquetReader reader = readerBuilder.build()) { List<T> result = new ArrayList<T>(); boolean hasNext = true; while (hasNext) { T item = (T) reader.read(); if (item == null) { hasNext = false; } else { result.add((T) asMessage(item)); } } return result; } }
Source:
public void init() { clearAll(); alertPolicy = policyService.alert().create( new AlertPolicyConfig() .name("Sample Alert Policy") .action(new AlertAction() .settings(new ActionSettingsEmail("sampleuser@samplecompany.com"))) .triggers( new AlertTrigger().duration(5).metric(AlertTriggerMetric.CPU).threshold(52.0f) ) ).waitUntilComplete().getResult(); antiAffinityPolicy = policyService.antiAffinity().create( new AntiAffinityPolicyConfig() .dataCenter(DataCenter.US_EAST_NEW_YORK) .name(antiAffinityPolicyName) ).waitUntilComplete().getResult(); server = serverService.create(new CreateServerConfig() .name("plc") .group(Group.refByName(DataCenter.US_EAST_NEW_YORK, Group.DEFAULT_GROUP)) .description("Sample server for policies") .type(HYPERSCALE) .machine(new Machine() .cpuCount(1) .ram(1) ) .template(Template.refByOs() .dataCenter(DataCenter.US_EAST_NEW_YORK) .type(CENTOS) .version("6") .architecture(x86_64) ) .timeToLive( ZonedDateTime.now().plusHours(2) ) .antiAffinityPolicy(antiAffinityPolicy) ) .waitUntilComplete().getResult().asRefById(); }

Target:
public void init() { clearAll(); int initDuration = 5; float initThreshold = 52f; alertPolicy = policyService.alert().create( new AlertPolicyConfig() .name("Sample Alert Policy") .action(new AlertAction() .settings(new ActionSettingsEmail("sampleuser@samplecompany.com"))) .triggers( new AlertTrigger().duration(initDuration).metric(AlertTriggerMetric.CPU).threshold(initThreshold) ) ).waitUntilComplete().getResult(); antiAffinityPolicy = policyService.antiAffinity().create( new AntiAffinityPolicyConfig() .dataCenter(DataCenter.US_EAST_NEW_YORK) .name(antiAffinityPolicyName) ).waitUntilComplete().getResult(); server = serverService.create(new CreateServerConfig() .name("plc") .group(Group.refByName(DataCenter.US_EAST_NEW_YORK, Group.DEFAULT_GROUP)) .description("Sample server for policies") .type(HYPERSCALE) .machine(new Machine() .cpuCount(1) .ram(1) ) .template(Template.refByOs() .dataCenter(DataCenter.US_EAST_NEW_YORK) .type(CENTOS) .version("6") .architecture(x86_64) ) .timeToLive( ZonedDateTime.now().plusHours(2) ) .antiAffinityPolicy(antiAffinityPolicy) ) .waitUntilComplete().getResult().asRefById(); }
Source:
protected A param(String key, int val) { params.put(key, Integer.toString(val)); @SuppressWarnings("unchecked") A result = (A) this; return result; }

Target:
protected A param(String key, int val) { return this.param(key, Integer.toString(val)); }
Source:
protected Schema generateSchema() { final Schema leftSchema = getLeft().getSchema(); if (leftSchema == null) { return null; } final Schema rightSchema = getRight().getSchema(); if (rightSchema == null) { return null; } ImmutableList.Builder<Type> types = ImmutableList.builder(); ImmutableList.Builder<String> names = ImmutableList.builder(); for (int i = 0; i < rightCompareColumns.length; ++i) { int leftIndex = leftCompareColumns[i]; int rightIndex = rightCompareColumns[i]; Type leftType = leftSchema.getColumnType(leftIndex); Type rightType = rightSchema.getColumnType(rightIndex); Preconditions.checkState( leftType == rightType, "column types do not match for join op %s at index %s: left column type %s [%s] != right column type %s [%s]", getOpId() + "", i, leftIndex, leftType, rightIndex, rightType); } for (int i : leftAnswerColumns) { types.add(leftSchema.getColumnType(i)); names.add(leftSchema.getColumnName(i)); } for (int i : rightAnswerColumns) { types.add(rightSchema.getColumnType(i)); names.add(rightSchema.getColumnName(i)); } if (outputColumns != null) { return new Schema(types.build(), outputColumns); } else { return new Schema(types, names); } }

Target:
protected Schema generateSchema() { final Schema leftSchema = getLeft().getSchema(); if (leftSchema == null) { return null; } final Schema rightSchema = getRight().getSchema(); if (rightSchema == null) { return null; } ImmutableList.Builder<Type> types = ImmutableList.builder(); ImmutableList.Builder<String> names = ImmutableList.builder(); for (int i = 0; i < rightCompareColumns.length; ++i) { int leftIndex = leftCompareColumns[i]; int rightIndex = rightCompareColumns[i]; Type leftType = leftSchema.getColumnType(leftIndex); Type rightType = rightSchema.getColumnType(rightIndex); Preconditions.checkState( leftType == rightType, "column types do not match for join op %s at index %s: left column type %s [%s] != right column type %s [%s]", getOpId(), i, leftIndex, leftType, rightIndex, rightType); } for (int i : leftAnswerColumns) { types.add(leftSchema.getColumnType(i)); names.add(leftSchema.getColumnName(i)); } for (int i : rightAnswerColumns) { types.add(rightSchema.getColumnType(i)); names.add(rightSchema.getColumnName(i)); } if (outputColumns != null) { return new Schema(types.build(), outputColumns); } else { return new Schema(types, names); } }
Source:
public void add(Edge<I, E> edge) { ExtendedDataOutput extendedDataOutput = getConf().createExtendedDataOutput( serializedEdges, serializedEdgesBytesUsed); try { WritableUtils.writeEdge(extendedDataOutput, edge); } catch (IOException e) { throw new IllegalStateException("add: Failed to write to the new " + "byte array"); } catch (NegativeArraySizeException negativeArraySizeException) { throw new IllegalStateException("add: Too many edges for a vertex, " + edge.getTargetVertexId() + "hence failed to write to byte array"); } serializedEdges = extendedDataOutput.getByteArray(); serializedEdgesBytesUsed = extendedDataOutput.getPos(); ++edgeCount; }

Target:
public void add(Edge<I, E> edge) { ExtendedDataOutput extendedDataOutput = getConf().createExtendedDataOutput( serializedEdges, serializedEdgesBytesUsed); try { WritableUtils.writeEdge(extendedDataOutput, edge); } catch (IOException e) { throw new IllegalStateException("add: Failed to write to the new " + "byte array"); } catch (NegativeArraySizeException negativeArraySizeException) { throw new IllegalStateException("add: Too many edges for a vertex, " + "hence failed to write to byte array"); } serializedEdges = extendedDataOutput.getByteArray(); serializedEdgesBytesUsed = extendedDataOutput.getPos(); ++edgeCount; }
Source:
public Diagnosis voidDiagnosis(Diagnosis diagnosis, String voidReason) { diagnosis.setVoided(true); diagnosis.setVoidedBy(Context.getAuthenticatedUser()); diagnosis.setVoidReason(voidReason); diagnosis.setDateVoided(new Date()); return save(diagnosis); }

Target:
public Diagnosis voidDiagnosis(Diagnosis diagnosis, String voidReason) { return Context.getDiagnosisService().save(diagnosis); }
Source:
public void testWithCacheWithNoViolation() throws Exception { final TreeWalker treeWalker = new TreeWalker(); treeWalker.configure(createCheckConfig(TypeNameCheck.class)); final PackageObjectFactory factory = new PackageObjectFactory( new HashSet<>(), Thread.currentThread().getContextClassLoader()); treeWalker.setModuleFactory(factory); treeWalker.setupChild(createCheckConfig(TypeNameCheck.class)); final File file = temporaryFolder.newFile("file.java"); final List<String> lines = new ArrayList<>(); lines.add(" class a "); try { treeWalker.processFiltered(file, lines); } catch (CheckstyleException ex) { fail("Exception is not expected"); } }

Target:
public void testWithCacheWithNoViolation() throws Exception { final TreeWalker treeWalker = new TreeWalker(); treeWalker.configure(createCheckConfig(TypeNameCheck.class)); final PackageObjectFactory factory = new PackageObjectFactory( new HashSet<>(), Thread.currentThread().getContextClassLoader()); treeWalker.setModuleFactory(factory); treeWalker.setupChild(createCheckConfig(TypeNameCheck.class)); final File file = temporaryFolder.newFile("file.java"); final List<String> lines = new ArrayList<>(); lines.add(" class a "); treeWalker.processFiltered(file, lines); }
Source:
public boolean equals(Object obj) { if (caseType.equals(obj)) { return true; } return false; }

Target:
public boolean equals(Object obj) { CaseTypeWithApplicationName o = (CaseTypeWithApplicationName) obj; return Objects.equals(this.caseType, o.caseType) && Objects.equals(this.applicationName, o.applicationName) && Objects.equals(this.caseProperties, o.caseProperties); }
Source:
private int getHorseFlags() { int value = 0; if (isTamed()) { value |= 0x02; } if (this instanceof GlowHorse) { GlowHorse horse = (GlowHorse) this; if (getInventory() != null && getInventory().getSaddle() != null) { value |= 0x04; } if (horse.hasReproduced()) { value |= 0x10; } if (horse.isEatingHay()) { value |= 0x20; } } if (this instanceof ChestedHorse) { ChestedHorse horse = (ChestedHorse) this; if (horse.isCarryingChest()) { value |= 0x08; } } return value; }

Target:
private int getHorseFlags() { int value = 0; if (isTamed()) { value |= 0x02; } if (this instanceof GlowHorse) { GlowHorse horse = (GlowHorse) this; if (getInventory() != null && !InventoryUtil.isEmpty(getInventory().getSaddle())) { value |= 0x04; } if (horse.hasReproduced()) { value |= 0x10; } if (horse.isEatingHay()) { value |= 0x20; } } if (this instanceof ChestedHorse) { ChestedHorse horse = (ChestedHorse) this; if (horse.isCarryingChest()) { value |= 0x08; } } return value; }
Source:
public ApplicationInstance deletePendingInstance(String instanceId){ ResponseEntity<ApplicationInstance> respAppInstance = kernel.exchange(appsEndpoint + "/instance/{instance_id}", HttpMethod.GET, null, ApplicationInstance.class, user(), instanceId); String eTag = respAppInstance.getHeaders().getETag(); HttpHeaders headers = new HttpHeaders(); headers.add("If-Match", eTag); ResponseEntity<ApplicationInstance> object = kernel.exchange(appsEndpoint + "/instance/{instanceId}", HttpMethod.DELETE, new HttpEntity<>(null,headers), ApplicationInstance.class, user(), instanceId); logger.debug("Delete pending instance", object); return object.getBody(); }

Target:
public ApplicationInstance deletePendingInstance(String instanceId){ ResponseEntity<ApplicationInstance> respAppInstance = kernel.exchange(appsEndpoint + "/instance/{instance_id}", HttpMethod.GET, null, ApplicationInstance.class, user(), instanceId); if(!Objects.requireNonNull(respAppInstance.getBody()).getStatus().equals(ApplicationInstance.InstantiationStatus.PENDING)){ throw new WrongQueryException("Instance is not pending",409); } String eTag = respAppInstance.getHeaders().getETag(); HttpHeaders headers = new HttpHeaders(); headers.add("If-Match", eTag); ResponseEntity<ApplicationInstance> object = kernel.exchange(appsEndpoint + "/instance/{instanceId}", HttpMethod.DELETE, new HttpEntity<>(null,headers), ApplicationInstance.class, user(), instanceId); logger.debug("Delete pending instance", object); return object.getBody(); }
Source:
public void unbind() { if (LiteDownloadMigrationService.isBound() && migrationCallback != null) { context.unbindService(serviceConnection); context.stopService(new Intent(context, LiteDownloadMigrationService.class)); serviceConnection = null; } }

Target:
public void unbind() { if (serviceConnection != null) { context.unbindService(serviceConnection); context.stopService(new Intent(context, LiteDownloadMigrationService.class)); serviceConnection = null; } }
Source:
private void assertSuggestion(String query, String expectedName, List<LatLon> expectedGeo) { List<Suggestion> list = new LinkedList<>(); processor.enhanceResults(list, query); assertThat(list, is(not(empty()))); assertThat(list, hasSize(1)); LiteralSuggestion literalSuggestion = (LiteralSuggestion) list.get(0); assertThat(literalSuggestion.getId(), is("LITERAL-DMS")); assertThat(literalSuggestion.getName(), is(expectedName)); assertThat(literalSuggestion.hasGeo(), is(true)); List<LatLon> actualGeo = literalSuggestion.getGeo(); List<LatLon> diff = new ArrayList<>(); assertThat( "Actual geo and expected geo are the same size", actualGeo.size(), is(equalTo(expectedGeo.size()))); for (int i = 0; i < expectedGeo.size(); i++) { LatLon actual = actualGeo.get(i); LatLon expected = expectedGeo.get(i); Double latDiff = actual.getLat() - expected.getLat(); Double lonDiff = actual.getLon() - expected.getLon(); if (Math.abs(latDiff) > 0.00001 || Math.abs(lonDiff) > 0.00001) { diff.add(actual); } } assertThat("Actual geo is the same as the expected geo", diff, is(empty())); }

Target:
private void assertSuggestion(String query, String expectedName, List<LatLon> expectedGeo) { List<Suggestion> list = new LinkedList<>(); processor.enhanceResults(list, query); assertThat(list, hasSize(1)); LiteralSuggestion literalSuggestion = (LiteralSuggestion) list.get(0); assertThat(literalSuggestion.getId(), is("LITERAL-DMS")); assertThat(literalSuggestion.getName(), is(expectedName)); assertThat(literalSuggestion.hasGeo(), is(true)); List<LatLon> actualGeo = literalSuggestion.getGeo(); List<LatLon> diff = new ArrayList<>(); assertThat( "Actual geo and expected geo are not the same size", actualGeo.size(), is(equalTo(expectedGeo.size()))); for (int i = 0; i < expectedGeo.size(); i++) { LatLon actual = actualGeo.get(i); LatLon expected = expectedGeo.get(i); Double latDiff = actual.getLat() - expected.getLat(); Double lonDiff = actual.getLon() - expected.getLon(); if (Math.abs(latDiff) > 0.00001 || Math.abs(lonDiff) > 0.00001) { diff.add(actual); } } assertThat("Actual geo is not the same as the expected geo", diff, is(empty())); }
Source:
public void testAcceptNullFileContents() { final SuppressWithNearbyCommentFilter filter = new SuppressWithNearbyCommentFilter(); final TreeWalkerAuditEvent auditEvent = new TreeWalkerAuditEvent(null, null, new LocalizedMessage(1, null, null, null, null, Object.class, null), null); assertTrue("Filter should accept audit event", filter.accept(auditEvent)); }

Target:
public void testAcceptNullFileContents() { final SuppressWithNearbyCommentFilter filter = new SuppressWithNearbyCommentFilter(); final FileContents contents = null; final TreeWalkerAuditEvent auditEvent = new TreeWalkerAuditEvent(contents, null, new LocalizedMessage(1, null, null, null, null, Object.class, null), null); assertTrue("Filter should accept audit event", filter.accept(auditEvent)); }
Source:
public Builder withProtocolVersion(ProtocolVersion version) { if (allowBetaProtocolVersion) throw new IllegalStateException("Can not set the version explicitly if `allowBetaProtocolVersion` was used."); if (version.toInt() > ProtocolVersion.NEWEST_SUPPORTED.toInt()) throw new IllegalArgumentException("Can not use " + version + " protocol version. " + "Newest supported protocol version is: " + ProtocolVersion.NEWEST_SUPPORTED + ". " + "For beta versions, use `allowBetaProtocolVersion` instead"); this.protocolVersion = version; return this; }

Target:
public Builder withProtocolVersion(ProtocolVersion version) { if (allowBetaProtocolVersion) throw new IllegalStateException("Can not set the version explicitly if `allowBetaProtocolVersion` was used."); if (version.compareTo(ProtocolVersion.NEWEST_SUPPORTED) > 0) throw new IllegalArgumentException("Can not use " + version + " protocol version. " + "Newest supported protocol version is: " + ProtocolVersion.NEWEST_SUPPORTED + ". " + "For beta versions, use `allowBetaProtocolVersion` instead"); this.protocolVersion = version; return this; }
Source:
public void spoutFailedTuple(String streamId) { String key = streamId; String metricName = METRIC_NAME_FAILED + "-" + key; Counter c = this.counters.get(metricName); if (c == null) { c = metricRegistry.counter(metricName, this.topologyId, this.componentId, this.taskId, this.workerPort, streamId); this.counters.put(metricName, c); } c.inc(this.samplingRate); }

Target:
public void spoutFailedTuple(String streamId) { String key = streamId; String metricName = METRIC_NAME_FAILED + "-" + key; Counter c = this.getCounter(metricName, streamId); c.inc(this.samplingRate); }
Source:
private static Map<String, String> normalizeJUnitOutput(String input) throws IOException { BufferedReader bufReader = new BufferedReader(new StringReader(input)); String methodName = null; Map<String, String> resultMap = new HashMap<>(); StringBuilder result = new StringBuilder(); int index = 1; for (String line; (line = bufReader.readLine()) != null; ) { String indexStr = index + ") "; if (line.startsWith(indexStr)) { if (methodName != null) { resultMap.put(methodName, result.toString()); result.setLength(0); } methodName = line; index += 1; } else if (line.isEmpty()) { resultMap.put(methodName, result.toString()); break; } else if (methodName != null) { int lParenIndex = line.indexOf('('); if (lParenIndex >= 0) { line = line.substring(0, lParenIndex); } result.append(line).append(Globals.lineSep); } } bufReader.close(); return resultMap; }

Target:
private static Map<String, String> normalizeJUnitOutput(String input) { BufferedReader bufReader = new BufferedReader(new StringReader(input)); String methodName = null; Map<String, String> resultMap = new HashMap<>(); StringBuilder result = new StringBuilder(); int index = 1; try { for (String line; (line = bufReader.readLine()) != null; ) { String indexStr = index + ") "; if (line.startsWith(indexStr)) { if (methodName != null) { resultMap.put(methodName, result.toString()); result.setLength(0); } methodName = line; index += 1; } else if (line.isEmpty()) { resultMap.put(methodName, result.toString()); break; } else if (methodName != null) { int lParenIndex = line.indexOf('('); if (lParenIndex >= 0) { line = line.substring(0, lParenIndex); } result.append(line).append(Globals.lineSep); } } bufReader.close(); } catch (IOException e) { throw new RuntimeException(e); } return resultMap; }
Source:
public void testConcurrentModificationException() { org.robolectric.shadows.ShadowLog.stream = System.err; final Context applicationContext = ShadowApplication.getInstance().getApplicationContext(); final AndroidModel model = new AndroidModel("4.4.2", "KOT49H", "Nexus 4", "LGE"); final ModelSpecificDistanceCalculator distanceCalculator = new ModelSpecificDistanceCalculator(applicationContext, null, model); Runnable runnable2 = new Runnable() { @Override public void run() { try { while (true) { distanceCalculator._buildModelMapTest("{\n" + " \"models\":\n" + " [\n" + " {\n" + " \"coefficient1\": 0.42093,\n" + " \"coefficient2\": 6.9476,\n" + " \"coefficient3\": 0.54992,\n" + " \"version\":\"4.4.2\",\n" + " \"build_number\":\"KOT49H\",\n" + " \"model\":\"Nexus 4\",\n" + " \"manufacturer\":\"LGE\"\n" + " },\n" + " {\n" + " \"coefficient1\": 0.42093,\n" + " \"coefficient2\": 6.9476,\n" + " \"coefficient3\": 0.54992,\n" + " \"version\":\"4.4.2\",\n" + " \"build_number\":\"LPV79\",\n" + " \"model\":\"Nexus 5\",\n" + " \"manufacturer\":\"LGE\",\n" + " \"default\": true\n" + " }\n" + " ]\n" + "}"); } } catch (Exception ex) { ex.printStackTrace(); } } }; Thread thread2 = new Thread(runnable2); thread2.start(); int i = 0; while (++i < 1000 && thread2.getState() != Thread.State.TERMINATED) { distanceCalculator._findCalculatorForModelTest(model); } thread2.interrupt(); }

Target:
public void testConcurrentModificationException() { org.robolectric.shadows.ShadowLog.stream = System.err; final Context applicationContext = ShadowApplication.getInstance().getApplicationContext(); final AndroidModel model = new AndroidModel("4.4.2", "KOT49H", "Nexus 4", "LGE"); final String modelMapJson = "{\"models\":[ \"coefficient1\": 0.89976,\"coefficient2\": 7.7095,\"coefficient3\": 0.111," + "\"version\":\"4.4.2\",\"build_number\":\"KOT49H\",\"model\":\"Nexus 4\"," + "\"manufacturer\":\"LGE\"},{\"coefficient1\": 0.42093,\"coefficient2\": 6.9476," + "\"coefficient3\": 0.54992,\"version\":\"4.4.2\",\"build_number\":\"LPV79\"," + "\"model\":\"Nexus 5\",\"manufacturer\":\"LGE\",\"default\": true}]}"; final ModelSpecificDistanceCalculator distanceCalculator = new ModelSpecificDistanceCalculator(applicationContext, null, model); Runnable runnable2 = new Runnable() { @Override public void run() { try { while (true) { distanceCalculator.buildModelMapWithLock(modelMapJson); } } catch (Exception ex) { ex.printStackTrace(); } } }; Thread thread2 = new Thread(runnable2); thread2.start(); int i = 0; while (++i < 1000 && thread2.getState() != Thread.State.TERMINATED) { distanceCalculator.findCalculatorForModelWithLock(model); } thread2.interrupt(); }
Source:
public AcknowledgementType auditLog(LogEventRequestType request, AssertionType assertion) { LOG.debug("Entering AuditRepositoryProxyWebServiceUnsecuredImpl.auditLog(...)"); if (request.getAuditMessage() == null) { LOG.error("Audit Request Message is null."); synchronized (result) { return result; } } try { String url = oProxyHelper.getUrlLocalHomeCommunity(NhincConstants.AUDIT_REPO_SERVICE_NAME); if (NullChecker.isNotNullish(url)) { ServicePortDescriptor<AuditRepositoryManagerPortType> portDescriptor = new AuditRepositoryUnsecuredServicePortDescriptor(); CONNECTClient<AuditRepositoryManagerPortType> client = CONNECTCXFClientFactory.getInstance() .getCONNECTClientUnsecured(portDescriptor, url, assertion); synchronized (result) { result = (AcknowledgementType) client.invokePort(AuditRepositoryManagerPortType.class, "logEvent", request); } } } catch (Exception e) { LOG.error("Failed to call the web service (" + NhincConstants.AUDIT_REPO_SERVICE_NAME + "). An unexpected exception occurred. " + "Exception: " + e.getLocalizedMessage(), e); } LOG.debug("In AuditRepositoryProxyWebServiceUnsecuredImpl.auditLog(...) - completed called to " + "ConnectionManager to retrieve endpoint."); return result; }

Target:
public AcknowledgementType auditLog(LogEventRequestType request, AssertionType assertion) { if (request.getAuditMessage() == null) { LOG.error("Audit Request Message is null."); synchronized (result) { return result; } } try { String url = oProxyHelper.getUrlLocalHomeCommunity(NhincConstants.AUDIT_REPO_SERVICE_NAME); if (NullChecker.isNotNullish(url)) { ServicePortDescriptor<AuditRepositoryManagerPortType> portDescriptor = new AuditRepositoryUnsecuredServicePortDescriptor(); CONNECTClient<AuditRepositoryManagerPortType> client = CONNECTCXFClientFactory.getInstance() .getCONNECTClientUnsecured(portDescriptor, url, assertion); synchronized (result) { result = (AcknowledgementType) client.invokePort(AuditRepositoryManagerPortType.class, invokeMethodName, request); } } } catch (Exception e) { LOG.error("Failed to call the web service (" + NhincConstants.AUDIT_REPO_SERVICE_NAME + "). An unexpected exception occurred. " + "Exception: " + e.getLocalizedMessage(), e); } LOG.debug("In AuditRepositoryProxyWebServiceUnsecuredImpl.auditLog(...) - completed called to " + "ConnectionManager to retrieve endpoint."); return result; }
Source:
public void updateElement(int index) { final TableViewer tableViewer = fTableViewer; final ISegment[] segmentArray = fSegmentArray; if (tableViewer != null && segmentArray != null) { tableViewer.replace(segmentArray[index], index); } }

Target:
public void updateElement(int index) { final TableViewer tableViewer = fTableViewer; final ISegment[] segmentArray = fSegmentArray; if (tableViewer != null && segmentArray != null) { if (index < segmentArray.length) { tableViewer.replace(segmentArray[index], index); } } }
Source:
private static Set<Type> primitiveWrappers(Set<Type> types) { if (!types.stream().allMatch(Type::isPrimitive)) { return types.stream().map(t -> !t.isPrimitive() ? t : ((JavaType) t).primitiveWrapperType()).collect(Collectors.toCollection(LinkedHashSet::new)); } return types; }

Target:
private static Set<Type> primitiveWrappers(Set<Type> types) { if (types.stream().allMatch(Type::isPrimitive)) { return types; } return types.stream().map(t -> !t.isPrimitive() ? t : ((JavaType) t).primitiveWrapperType()).collect(Collectors.toCollection(LinkedHashSet::new)); }
Source:
private static List<String> getFailedNotifications() throws MambuApiException{ List<String> foundFaildNotifications = new ArrayList<>(); ArrayList<JSONFilterConstraint> constraints = new ArrayList<JSONFilterConstraint>(); JSONFilterConstraint constraint = new JSONFilterConstraint(); constraint.setDataFieldType(DataFieldType.NATIVE.name()); constraint.setFilterSelection(NotificationMessageDataField.STATE.name()); constraint.setFilterElement(FilterElement.EQUALS.name()); constraint.setValue(MessageState.FAILED.name()); constraints.add(constraint); JSONFilterConstraints filterConstraints = new JSONFilterConstraints(); filterConstraints.setFilterConstraints(constraints); SearchService searchService = MambuAPIFactory.getSearchService(); List<NotificationMessage> notificationMessages = searchService.getNotificationMessages(filterConstraints, "0", "5"); for(NotificationMessage failedessage :notificationMessages){ foundFaildNotifications.add(failedessage.getEncodedKey()); } return foundFaildNotifications; }

Target:
private static List<String> getFailedNotifications() throws MambuApiException{ List<String> foundFailedNotifications = new ArrayList<>(); List<JSONFilterConstraint> constraints = new ArrayList<>(); JSONFilterConstraint constraint = new JSONFilterConstraint(); constraint.setDataFieldType(DataFieldType.NATIVE.name()); constraint.setFilterSelection(NotificationMessageDataField.STATE.name()); constraint.setFilterElement(FilterElement.EQUALS.name()); constraint.setValue(MessageState.FAILED.name()); constraints.add(constraint); JSONFilterConstraints filterConstraints = new JSONFilterConstraints(); filterConstraints.setFilterConstraints(constraints); SearchService searchService = MambuAPIFactory.getSearchService(); List<NotificationMessage> notificationMessages = searchService.getNotificationMessages(filterConstraints, "0", "5"); for(NotificationMessage failedMessage :notificationMessages){ foundFailedNotifications.add(failedMessage.getEncodedKey()); } return foundFailedNotifications; }
Source:
public void whenTopicCreationFailsRemoveEventTypeFromRepositoryAnd500() throws Exception { Mockito .doNothing() .when(eventTypeRepository) .saveEventType(any(EventType.class)); Mockito .doThrow(TopicCreationException.class) .when(topicRepository) .createTopic(EVENT_TYPE_NAME); Mockito .doNothing() .when(eventTypeRepository) .removeEventType(EVENT_TYPE_NAME); final Problem expectedProblem = Problem.valueOf(Response.Status.SERVICE_UNAVAILABLE); postEventType(buildEventType()) .andExpect(status().isServiceUnavailable()) .andExpect(content().contentType("application/problem+json")) .andExpect(content().string(matchesProblem(expectedProblem))); verify(eventTypeRepository, times(1)).saveEventType(any(EventType.class)); verify(topicRepository, times(1)).createTopic("team.event-name"); verify(eventTypeRepository, times(1)).removeEventType("team.event-name"); }

Target:
public void whenTopicCreationFailsRemoveEventTypeFromRepositoryAnd500() throws Exception { final EventType et = buildDefaultEventType(); Mockito.doNothing().when(eventTypeRepository).saveEventType(any(EventType.class)); Mockito.doThrow(TopicCreationException.class).when(topicRepository).createTopic(et.getName()); Mockito.doNothing().when(eventTypeRepository).removeEventType(et.getName()); final Problem expectedProblem = Problem.valueOf(Response.Status.SERVICE_UNAVAILABLE); postEventType(et).andExpect(status().isServiceUnavailable()) .andExpect(content().contentType("application/problem+json")).andExpect(content().string( matchesProblem(expectedProblem))); verify(eventTypeRepository, times(1)).saveEventType(any(EventType.class)); verify(topicRepository, times(1)).createTopic(et.getName()); verify(eventTypeRepository, times(1)).removeEventType(et.getName()); }
Source:
public double mean(String colName) { double[] colArray = toDoubleArray(colName); double arrayMean = StatUtils.mean(colArray); return arrayMean; }

Target:
public double mean(String colName) { return StatUtils.mean(toDoubleArray(colName)); }
Source:
public final Long getCardinalityLimit() { if (cardinalityLimit == null) { return null; } return cardinalityLimit; }

Target:
public final Long getCardinalityLimit() { return cardinalityLimit; }
Source:
public boolean mergeTypeParameters(ParameterizedTypeBinding current, ParameterizedTypeBinding newB) { TypeBinding[] curTypeArgs = current.typeArguments(); TypeBinding[] newTypeArgs = newB.typeArguments(); TypeBinding[] merged = new TypeBinding[curTypeArgs.length]; System.arraycopy(curTypeArgs, 0, merged, 0, curTypeArgs.length); boolean wasMerged = false; for (int i = 0; i < curTypeArgs.length; i++) { if (TypeBinding.equalsEquals(curTypeArgs[i], newTypeArgs[i])) continue; if(curTypeArgs[i].isCapture() || newTypeArgs[i].isCapture()) return false; if (curTypeArgs[i] instanceof InferenceVariable) { if (!(newTypeArgs[i] instanceof InferenceVariable)) { if(this.sameBounds != null && !this.sameBounds.contains(new TypeBound((InferenceVariable) curTypeArgs[i], newTypeArgs[i], ReductionResult.SAME))) { merged[i] = newTypeArgs[i]; wasMerged = true; } } else if (!curTypeArgs[i].equals(newTypeArgs[i])) { return false; } } else { if (!(newTypeArgs[i] instanceof InferenceVariable)) { if (!TypeBinding.equalsEquals(curTypeArgs[i], newTypeArgs[i])) { return false; } } else { if(this.sameBounds == null || !this.sameBounds.contains(new TypeBound((InferenceVariable) newTypeArgs[i], curTypeArgs[i], ReductionResult.SAME))) { return false; } } } } if(wasMerged) { current.arguments = merged; return true; } return false; }

Target:
public ParameterizedTypeBinding mergeTypeParameters(ParameterizedTypeBinding current, ParameterizedTypeBinding newB) { TypeBinding[] curTypeArgs = current.typeArguments(); TypeBinding[] newTypeArgs = newB.typeArguments(); TypeBinding[] merged = new TypeBinding[curTypeArgs.length]; System.arraycopy(curTypeArgs, 0, merged, 0, curTypeArgs.length); boolean wasMerged = false; for (int i = 0; i < curTypeArgs.length; i++) { if (TypeBinding.equalsEquals(curTypeArgs[i], newTypeArgs[i])) continue; if(curTypeArgs[i].isCapture() || newTypeArgs[i].isCapture()) return null; if (curTypeArgs[i] instanceof InferenceVariable) { if (!(newTypeArgs[i] instanceof InferenceVariable)) { ThreeSets three = BoundSet.this.boundsPerVariable.get(curTypeArgs[i]); if(three != null && three.sameBounds != null && three.sameBounds.contains(new TypeBound((InferenceVariable) curTypeArgs[i], newTypeArgs[i], ReductionResult.SAME))) { merged[i] = newTypeArgs[i]; wasMerged = true; } } else if (!curTypeArgs[i].equals(newTypeArgs[i])) { return null; } } else { if (!(newTypeArgs[i] instanceof InferenceVariable)) { if (!TypeBinding.equalsEquals(curTypeArgs[i], newTypeArgs[i])) { return null; } } else { ThreeSets three = BoundSet.this.boundsPerVariable.get(newTypeArgs[i]); if(three == null || three.sameBounds == null || !three.sameBounds.contains(new TypeBound((InferenceVariable) newTypeArgs[i], curTypeArgs[i], ReductionResult.SAME))) { return null; } } } } if(wasMerged) { ParameterizedTypeBinding clone = (ParameterizedTypeBinding)current.clone(current.enclosingType()); clone.arguments = merged; return clone; } return null; }
Source:
public boolean isEmpty() { return Arrays.stream(lookupSources).allMatch(lookupSource -> lookupSource.isEmpty()); }

Target:
public boolean isEmpty() { return Arrays.stream(lookupSources).allMatch(LookupSource::isEmpty); }
Source:
public void testResend() throws Exception { final AtomicInteger flushCount = new AtomicInteger(); final EmbeddedChannel channel = newChannel(flushCount, true); channel.writeAndFlush(1L).addListener(new GenericFutureListener<Future<? super Void>>() { @Override public void operationComplete(Future<? super Void> future) throws Exception { channel.writeAndFlush(1L); } }); channel.flushOutbound(); assertEquals(1L, channel.readOutbound()); assertEquals(1L, channel.readOutbound()); assertNull(channel.readOutbound()); channel.finish(); }

Target:
public void testResend() throws Exception { final AtomicInteger flushCount = new AtomicInteger(); final EmbeddedChannel channel = newChannel(flushCount, true); channel.writeAndFlush(1L).addListener(new GenericFutureListener<Future<? super Void>>() { @Override public void operationComplete(Future<? super Void> future) throws Exception { channel.writeAndFlush(1L); } }); channel.flushOutbound(); assertEquals(1L, channel.readOutbound()); assertEquals(1L, channel.readOutbound()); assertNull(channel.readOutbound()); assertFalse(channel.finish()); }
Source:
public void testGetSet_shouldBeAtomic() throws ExecutionException, InterruptedException, TimeoutException { jedis.set("contestedKey", "0"); assertThat(jedis.get("contestedKey")).isEqualTo("0"); CountDownLatch latch = new CountDownLatch(1); ExecutorService pool = Executors.newFixedThreadPool(2); Callable<Integer> callable1 = () -> doABunchOfIncrs(jedis, latch); Callable<Integer> callable2 = () -> doABunchOfGetSets(jedis2, latch); Future<Integer> future1 = pool.submit(callable1); Future<Integer> future2 = pool.submit(callable2); latch.countDown(); Integer getSetSum = future2.get(60, TimeUnit.SECONDS); Integer incrSum = future1.get(); assertThat(getSetSum).isEqualTo(incrSum); assertThat(incrSum + getSetSum).isEqualTo(2 * ITERATION_COUNT); }

Target:
public void testGetSet_shouldBeAtomic() throws ExecutionException, InterruptedException, TimeoutException { jedis.set("contestedKey", "0"); assertThat(jedis.get("contestedKey")).isEqualTo("0"); CountDownLatch latch = new CountDownLatch(1); ExecutorService pool = Executors.newFixedThreadPool(2); Callable<Integer> callable1 = () -> doABunchOfIncrs(jedis, latch); Callable<Integer> callable2 = () -> doABunchOfGetSets(jedis2, latch); Future<Integer> future1 = pool.submit(callable1); Future<Integer> future2 = pool.submit(callable2); latch.countDown(); GeodeAwaitility.await().untilAsserted(() -> assertThat(future2.get()).isEqualTo(future1.get())); assertThat(future1.get() + future2.get()).isEqualTo(2 * ITERATION_COUNT); }
Source:
public void drainPermissions() { State prevState = state.getAndUpdate(activeState -> { if (activeState.activePermissions > 0) { return calculateNextState(activeState.activePermissions, 0, activeState); } else { return activeState; } }); if (eventProcessor.hasConsumers()) { eventProcessor.consumeEvent(new RateLimiterOnDrainedEvent(name, Math.min(prevState.activePermissions, 0))); } }

Target:
public void drainPermissions() { AtomicRateLimiter.State prev; AtomicRateLimiter.State next; do { prev = state.get(); next = calculateNextState(prev.activePermissions, 0, prev); } while (!compareAndSet(prev, next)); if (eventProcessor.hasConsumers()) { eventProcessor.consumeEvent(new RateLimiterOnDrainedEvent(name, Math.min(prev.activePermissions, 0))); } }
Source:
private void restartPoller(final long pollInterval) { LOG.debug("Restarting alarm poller (interval {}s).", pollInterval); if (m_alarmPoller != null) { stopPoller(); } startPoller(pollInterval); }

Target:
private void restartPoller(final long pollInterval) { LOG.debug("Restarting alarm poller (interval {}s).", pollInterval); stopPoller(); startPoller(pollInterval); }
Source:
public void updateFromMethodInvocation( MethodInvocationNode methodInvNode, Tree receiverTree, ExecutableElement methodElt, AnnotatedTypeFactory atf) { if (ElementUtils.isElementFromByteCode(methodElt)) { return; } String className = getEnclosingClassName(methodElt); String jaifPath = storage.getJaifPath(className); AClassWrapper clazz = storage.getAClass(className, jaifPath); String methodName = JVMNames.getJVMMethodName(methodElt); AMethodWrapper method = clazz.vivifyMethod(methodName); method.setReturnType(methodElt.getReturnType()); List<Node> arguments = methodInvNode.getArguments(); updateInferredExecutableParameterTypes(methodElt, atf, jaifPath, method, arguments); }

Target:
public void updateFromMethodInvocation( MethodInvocationNode methodInvNode, Tree receiverTree, ExecutableElement methodElt, AnnotatedTypeFactory atf) { if (!ElementUtils.isElementFromSourceCode(methodElt)) { return; } String className = getEnclosingClassName(methodElt); String jaifPath = storage.getJaifPath(className); AClass clazz = storage.getAClass(className, jaifPath, ((MethodSymbol) methodElt).enclClass()); AMethod method = clazz.methods.getVivify(JVMNames.getJVMMethodSignature(methodElt)); method.setFieldsFromMethodElement(methodElt); List<Node> arguments = methodInvNode.getArguments(); updateInferredExecutableParameterTypes(methodElt, atf, jaifPath, method, arguments); }
Source:
public void testRedirect() throws Exception { final MockHttpSession session = new MockHttpSession(); final MockHttpServletRequest request = new MockHttpServletRequest(); final MockHttpServletResponse response = new MockHttpServletResponse(); final FilterChain filterChain = new FilterChain() { public void doFilter(ServletRequest arg0, ServletResponse arg1) throws IOException, ServletException { } }; request.setSession(session); this.filter.doFilter(request, response, filterChain); assertEquals(CAS_LOGIN_URL + "?service=" + URLEncoder.encode(CAS_SERVICE_URL, "UTF-8"), response.getRedirectedUrl()); }

Target:
public void testRedirect() throws Exception { final MockHttpSession session = new MockHttpSession(); final MockHttpServletRequest request = new MockHttpServletRequest(); final MockHttpServletResponse response = new MockHttpServletResponse(); final FilterChain filterChain = new FilterChain() { public void doFilter(ServletRequest request, ServletResponse response) throws IOException, ServletException { } }; request.setSession(session); this.filter.doFilter(request, response, filterChain); assertEquals(CAS_LOGIN_URL + "?service=" + URLEncoder.encode(CAS_SERVICE_URL, "UTF-8"), response.getRedirectedUrl()); }
Source:
public void dispose() { super.dispose(); if (composedAdapterFactory != null) { composedAdapterFactory.dispose(); } }

Target:
public void dispose() { super.dispose(); if (composedAdapterFactory != null) { composedAdapterFactory.dispose(); } registeredEcores.forEach(EcoreHelper::unregisterEcore); }
Source:
public void sendResponseToClient(CoreEvent response, Map<String, Object> parameters, CompletableCallback<Void> callback) { ((BaseEventContext) response.getContext()).success(); }

Target:
public void sendResponseToClient(CoreEvent response, Map<String, Object> parameters, CompletableCallback<Void> callback) { }
Source:
public Map<String, Boolean> getPartitionStoppableCheck(String baseUrl, List<String> partitions, Map<String, String> customPayloads) throws IOException { String url = baseUrl + PARTITION_HEALTH_STATUS; Map<String, String> payLoads = new HashMap<>(customPayloads); payLoads.put(PARTITIONS, partitions.toString()); JsonConverter jsonConverter = jsonNode -> { Map<String, Boolean> result = new HashMap<>(); jsonNode.fields().forEachRemaining( kv -> result.put(kv.getKey(), kv.getValue().get(IS_HEALTHY_FIELD).asBoolean())); return result; }; try { _semaphore.acquire(); return handleResponse(post(url, payLoads), jsonConverter); } catch (InterruptedException e) { LOG.warn("Interrupted while acquiring the semaphore", e); } finally { _semaphore.release(); } return Collections.emptyMap(); }

Target:
public Map<String, Boolean> getPartitionStoppableCheck(String baseUrl, List<String> partitions, Map<String, String> customPayloads) throws IOException { String url = baseUrl + PARTITION_HEALTH_STATUS; Map<String, String> payLoads = new HashMap<>(customPayloads); payLoads.put(PARTITIONS, partitions.toString()); JsonConverter jsonConverter = jsonNode -> { Map<String, Boolean> result = new HashMap<>(); jsonNode.fields().forEachRemaining( kv -> result.put(kv.getKey(), kv.getValue().get(IS_HEALTHY_FIELD).asBoolean())); return result; }; String requestId = baseUrl + customPayloads.toString() + partitions.toString(); try { lock(requestId); if (_cachedResults.containsKey(requestId)) { return _cachedResults.get(requestId); } Map<String, Boolean> result = handleResponse(post(url, payLoads), jsonConverter); _cachedResults.put(requestId, result); return result; } catch (InterruptedException e) { LOG.error("Error while acquiring the lock", e); } finally { unlock(requestId); } return Collections.emptyMap(); }
Source:
public boolean isEnabled() { IResource[] selectedResources = getSelectedResources(); return super.isEnabled() && selectedResources.length == 1 && selectionMapsToSingleRepository(); }

Target:
public boolean isEnabled() { IStructuredSelection selection = getSelection(); return super.isEnabled() && selection.size() == 1 && selectionMapsToSingleRepository(); }
Source:
public int size() { if (size == -1) { int tempsize = 0; if ((from instanceof Integer || from instanceof Long) && (to instanceof Integer || to instanceof Long)) { final BigInteger fromNum = new BigInteger(from.toString()); final BigInteger toNum = new BigInteger(to.toString()); final BigInteger sizeNum = toNum.subtract(fromNum).add(new BigInteger("1")); tempsize = sizeNum.intValue(); if (!BigInteger.valueOf(tempsize).equals(sizeNum)) { tempsize = Integer.MAX_VALUE; } } else if (from instanceof Character && to instanceof Character) { final char fromNum = (Character) from; final char toNum = (Character) to; tempsize = toNum - fromNum + 1; } else if (((from instanceof BigDecimal || from instanceof BigInteger) && to instanceof Number) || ((to instanceof BigDecimal || to instanceof BigInteger) && from instanceof Number)) { final BigDecimal fromNum = new BigDecimal(from.toString()); final BigDecimal toNum = new BigDecimal(to.toString()); final BigInteger sizeNum = toNum.subtract(fromNum).add(new BigDecimal(1.0)).toBigInteger(); tempsize = sizeNum.intValue(); if (!BigInteger.valueOf(tempsize).equals(sizeNum)) { tempsize = Integer.MAX_VALUE; } } else { for (Iterator it = iterator(); it.hasNext(); ) { tempsize++; if (tempsize < 0) { break; } it.next(); } } if (tempsize < 0) { tempsize = Integer.MAX_VALUE; } size = tempsize; } return size; }

Target:
public int size() { if (size == -1) { int tempsize = 0; if ((from instanceof Integer || from instanceof Long) && (to instanceof Integer || to instanceof Long)) { final BigInteger fromNum = new BigInteger(from.toString()); final BigInteger toNum = new BigInteger(to.toString()); final BigInteger sizeNum = toNum.subtract(fromNum).add(new BigInteger("1")); tempsize = sizeNum.intValue(); if (!BigInteger.valueOf(tempsize).equals(sizeNum)) { tempsize = Integer.MAX_VALUE; } } else if (from instanceof Character && to instanceof Character) { final char fromNum = (Character) from; final char toNum = (Character) to; tempsize = toNum - fromNum + 1; } else if (((from instanceof BigDecimal || from instanceof BigInteger) && to instanceof Number) || ((to instanceof BigDecimal || to instanceof BigInteger) && from instanceof Number)) { final BigDecimal fromNum = new BigDecimal(from.toString()); final BigDecimal toNum = new BigDecimal(to.toString()); final BigInteger sizeNum = toNum.subtract(fromNum).add(new BigDecimal(1.0)).toBigInteger(); tempsize = sizeNum.intValue(); if (!BigInteger.valueOf(tempsize).equals(sizeNum)) { tempsize = Integer.MAX_VALUE; } } else { for (Iterator<Comparable> iter = new LazySteppingIterator(this, 1); iter.hasNext(); ) { tempsize++; if (tempsize < 0) { break; } iter.next(); } } if (tempsize < 0) { tempsize = Integer.MAX_VALUE; } size = tempsize; } return size; }
Source:
public Map<Guid, VdcObjectType> getPermissionCheckSubjects() { Map<Guid, VdcObjectType> map = new HashMap<Guid, VdcObjectType>(); map.put(Guid.createGuidFromString(getStoragePoolId().toString()), VdcObjectType.StoragePool); return map; }

Target:
public Map<Guid, VdcObjectType> getPermissionCheckSubjects() { return Collections.singletonMap(getStoragePoolId() == null ? null : getStoragePoolId().getValue(), VdcObjectType.Quota); }
Source:
public void transformSlope(){ final ITmfTimestampTransform slope = TimestampTransformFactory.create(10, 0); assertEquals(t1e3, slope.transform(t1e2)); assertEquals(tn100, slope.transform(new TmfNanoTimestamp(10))); assertEquals(tn100, slope.transform(slope.transform(tn1))); assertEquals(tn100, slope.transform(slope.transform(tn1))); assertEquals(tn100, slope.composeWith(slope).transform(tn1)); }

Target:
public void transformSlope(){ final ITmfTimestampTransform slope = TimestampTransformFactory.create(10, 0); assertEquals(t1e3, slope.transform(t1e2)); assertEquals(tn100, slope.transform(new TmfNanoTimestamp(10))); assertEquals(tn100, slope.transform(slope.transform(tn1))); assertEquals(tn100, slope.composeWith(slope).transform(tn1)); }
Source:
public static Function<ProductItem, String> imageId() { return new Function<ProductItem, String>() { @Override public String apply(ProductItem productItem) { checkNotNull(productItem, "productItem"); ProductItemPrice price = ProductItems.price().apply(productItem); return Objects.firstNonNull(price.getId() + "", ""); } }; }

Target:
public static Function<ProductItem, String> imageId() { return new Function<ProductItem, String>() { @Override public String apply(ProductItem productItem) { checkNotNull(productItem, "productItem"); ProductItemPrice price = ProductItems.price().apply(productItem); return String.valueOf(checkNotNull(price, "price").getId()); } }; }