auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public Response getOpenApiSpec(@Context HttpHeaders headers, @Context UriInfo uriInfo, @PathParam("type") String type, @Context ServletConfig config, @Context Application app) throws Exception { setOpenApiConfiguration(oasConfig); Response response = super.getOpenApi(headers, config, app, uriInfo, type); response.getHeaders().add("Access-Control-Allow-Origin", "*"); return response; }

Target:
public Response getOpenApiSpec( @Context HttpHeaders headers, @Context UriInfo uriInfo, @PathParam("type") String type, @Context ServletConfig config, @Context Application app) throws Exception { Response response = getOpenApi(headers, config, app, uriInfo, type); response.getHeaders().add("Access-Control-Allow-Origin", "*"); return response; }
Source:
public void setEnabled(boolean enabled) { if (!enabled) slidingPane.closePane(); slidingPane.setSlidingEnabled(enabled); }

Target:
public void setEnabled(boolean enabled) { if (!enabled) { slidingPane.closePane(); } slidingPane.setSlidingEnabled(enabled); }
Source:
public Resource getConfigFile(String profile, String label, String path) { Assert.isTrue(!StringUtils.isEmpty(configClientProperties.getName()), "Spring application name is undefined."); Assert.notEmpty(configClientProperties.getUri(), "Config server URI is undefined"); Assert.hasText(configClientProperties.getUri()[0], "Config server URI is undefined."); String effectiveProfile = profile; if (effectiveProfile == null) { effectiveProfile = configClientProperties.getProfile(); if (effectiveProfile == null || effectiveProfile.isEmpty()) { effectiveProfile = "default"; } } String effectiveLabel = label; if (effectiveLabel == null) { effectiveLabel = configClientProperties.getLabel(); } String url = configClientProperties.getUri()[0] + "/" + configClientProperties.getName() + "/" + effectiveProfile + "/" + (effectiveLabel == null ? path + "?useDefaultLabel" : effectiveLabel + "/" + path); ResponseEntity<Resource> forEntity = restTemplate.getForEntity(url, Resource.class); return forEntity.getBody(); }

Target:
public Resource getConfigFile(String profile, String label, String path) { Assert.hasText(configClientProperties.getName(), "Spring application name is undefined."); Assert.notEmpty(configClientProperties.getUri(), "Config server URI is undefined"); Assert.hasText(configClientProperties.getUri()[0], "Config server URI is undefined."); String effectiveProfile = profile; if (effectiveProfile == null) { effectiveProfile = configClientProperties.getProfile(); if (effectiveProfile == null || effectiveProfile.isEmpty()) { effectiveProfile = "default"; } } String effectiveLabel = label; if (effectiveLabel == null) { effectiveLabel = configClientProperties.getLabel(); } String url = configClientProperties.getUri()[0] + "/" + configClientProperties.getName() + "/" + effectiveProfile + "/" + (effectiveLabel == null ? path + "?useDefaultLabel" : effectiveLabel + "/" + path); ResponseEntity<Resource> forEntity = restTemplate.getForEntity(url, Resource.class); return forEntity.getBody(); }
Source:
public void deleteDnsRecordByFqdn(String environmentCrn, String accountId, List<String> fqdns) throws FreeIpaClientException { Stack stack = stackService.getByEnvironmentCrnAndAccountId(environmentCrn, accountId); MDCBuilder.buildMdcContext(stack); FreeIpa freeIpa = freeIpaService.findByStack(stack); FreeIpaClient freeIpaClient = freeIpaClientFactory.getFreeIpaClientByAccountAndEnvironment(environmentCrn, accountId); for (DnsZone dnsZone : freeIpaClient.findAllDnsZone()) { LOGGER.debug("Looking for records in zone [{}]", dnsZone.getIdnsname()); Set<DnsRecord> allDnsRecordsInZone = freeIpaClient.findAllDnsRecordInZone(dnsZone.getIdnsname()); deleteRegularRecords(freeIpaClient, dnsZone, allDnsRecordsInZone, fqdns, freeIpa.getDomain()); deleteSrvRecords(freeIpaClient, dnsZone, allDnsRecordsInZone, fqdns); } }

Target:
public void deleteDnsRecordByFqdn(String environmentCrn, String accountId, List<String> fqdns) throws FreeIpaClientException { Stack stack = stackService.getByEnvironmentCrnAndAccountId(environmentCrn, accountId); MDCBuilder.buildMdcContext(stack); FreeIpa freeIpa = freeIpaService.findByStack(stack); FreeIpaClient freeIpaClient = freeIpaClientFactory.getFreeIpaClientForStack(stack); for (DnsZone dnsZone : freeIpaClient.findAllDnsZone()) { LOGGER.debug("Looking for records in zone [{}]", dnsZone.getIdnsname()); Set<DnsRecord> allDnsRecordsInZone = freeIpaClient.findAllDnsRecordInZone(dnsZone.getIdnsname()); deleteRegularRecords(freeIpaClient, dnsZone, allDnsRecordsInZone, fqdns, freeIpa.getDomain()); deleteSrvRecords(freeIpaClient, dnsZone, allDnsRecordsInZone, fqdns); } }
Source:
public boolean equals(final Object obj) { return obj instanceof MultipartKey && Arrays.equals(keys, ((MultipartKey)obj).keys); }

Target:
public boolean equals(final Object obj) { return Arrays.equals(keys, ((MultipartKey)obj).keys); }
Source:
private void testDeleteCount(boolean autoCommit, Integer limit) throws Exception { String tableName = generateUniqueName(); String ddl = "CREATE TABLE IF NOT EXISTS " + tableName + " (pk1 DECIMAL NOT NULL, v1 VARCHAR CONSTRAINT PK PRIMARY KEY (pk1))"; int numRecords = 1010; Properties props = new Properties(); props.setProperty(QueryServices.ENABLE_SERVER_SIDE_MUTATIONS, allowServerSideMutations); try (Connection conn = DriverManager.getConnection(getUrl(), props)) { conn.createStatement().execute(ddl); PreparedStatement preStmt = conn.prepareStatement("UPSERT INTO " + tableName + " (pk1, v1) VALUES (" + ? + ",'value')"); for (int i = 0; i < numRecords ; i++) { preStmt.setBigDecimal(1, new BigDecimal(i)); preStmt.executeUpdate(); } conn.commit(); conn.setAutoCommit(autoCommit); String delete = "DELETE FROM " + tableName + " WHERE (pk1) <= (" + numRecords + ")" + (limit == null ? "" : (" limit " + limit)); try (PreparedStatement pstmt = conn.prepareStatement(delete)) { int numberOfDeletes = pstmt.executeUpdate(); assertEquals(limit == null ? numRecords : limit, numberOfDeletes); if (!autoCommit) { conn.commit(); } } } }

Target:
private void testDeleteCount(boolean autoCommit, Integer limit) throws Exception { String tableName = generateUniqueName(); String ddl = "CREATE TABLE IF NOT EXISTS " + tableName + " (pk1 DECIMAL NOT NULL, v1 VARCHAR CONSTRAINT PK PRIMARY KEY (pk1))"; int numRecords = 1010; Properties props = new Properties(); props.setProperty(QueryServices.ENABLE_SERVER_SIDE_MUTATIONS, allowServerSideMutations); try (Connection conn = DriverManager.getConnection(getUrl(), props)) { conn.createStatement().execute(ddl); String command = "UPSERT INTO " + tableName + " (pk1, v1) VALUES (" + ? + ",'value')" PreparedStatement preStmt = conn.prepareStatement(command); for (int i = 0; i < numRecords ; i++) { preStmt.setBigDecimal(1, new BigDecimal(i)); preStmt.executeUpdate(); } conn.commit(); conn.setAutoCommit(autoCommit); String delete = "DELETE FROM " + tableName + " WHERE (pk1) <= (" + numRecords + ")" + (limit == null ? "" : (" limit " + limit)); try (PreparedStatement pstmt = conn.prepareStatement(delete)) { int numberOfDeletes = pstmt.executeUpdate(); assertEquals(limit == null ? numRecords : limit, numberOfDeletes); if (!autoCommit) { conn.commit(); } } } }
Source:
public BeaconState applyBlock(Beacon block, BeaconState to) { CrystallizedState crystallized = to.getCrystallizedState(); ActiveState activeState = to.getActiveState(); List<AttestationRecord> mergedAttestations = new ArrayList<>(); mergedAttestations.addAll(activeState.getPendingAttestations()); mergedAttestations.addAll(block.getAttestations()); block.getAttestations().forEach(at -> beaconAttester.purgeAttestations(at)); activeState = activeState .withPendingAttestations(mergedAttestations); if (block.getSlotNumber() - crystallized.getLastStateRecalc() >= CYCLE_LENGTH) { logger.info("Calculate new crystallized state, slot: {}, prev slot: {}", block.getSlotNumber(), crystallized.getLastStateRecalc()); Finality finality = finalityTransition.applyBlock(block, crystallized.getFinality()); Dynasty dynasty = dynastyTransition.applyBlock(block, crystallized.getDynasty()); crystallized = crystallized .withDynasty(dynasty) .withLastStateRecalc(cycleStartSlot(block)) .withFinality(finality); List<AttestationRecord> uptodateAttestations = new ArrayList<>(); for (AttestationRecord record : activeState.getPendingAttestations()) { if (record.getSlot() >= crystallized.getLastStateRecalc()) { uptodateAttestations.add(record); } } beaconAttester.removeOldSlots(crystallized.getLastStateRecalc()); activeState = activeState. withPendingAttestations(uptodateAttestations); } return new BeaconState(crystallized, activeState); }

Target:
public BeaconState applyBlock(Beacon block, BeaconState to) { CrystallizedState crystallized = to.getCrystallizedState(); ActiveState activeState = to.getActiveState(); block.getAttestations().forEach(at -> publisher.publish(onBeaconAttestationIncluded(at))); activeState = activeState.addPendingAttestations(block.getAttestations()); if (block.getSlotNumber() - crystallized.getLastStateRecalc() >= CYCLE_LENGTH) { logger.info("Calculate new crystallized state, slot: {}, prev slot: {}", block.getSlotNumber(), crystallized.getLastStateRecalc()); Finality finality = finalityTransition.applyBlock(block, crystallized.getFinality()); Dynasty dynasty = dynastyTransition.applyBlock(block, crystallized.getDynasty()); crystallized = crystallized .withDynasty(dynasty) .withLastStateRecalc(cycleStartSlot(block)) .withFinality(finality); if (publisher != null) { publisher.publish(onStateRecalc(crystallized.getLastStateRecalc())); } activeState = activeState.removeAttestationsPriorTo(crystallized.getLastStateRecalc()); } return new BeaconState(crystallized, activeState); }
Source:
public RepositoriesViewContentProvider() { ICommandService srv = (ICommandService) PlatformUI.getWorkbench() .getService(ICommandService.class); commandState = srv.getCommand( "org.eclipse.egit.ui.RepositoriesToggleBranchHierarchy") .getState("org.eclipse.ui.commands.toggleState"); commandState.addListener(this); try { this.branchHierarchyMode = ((Boolean) commandState.getValue()) .booleanValue(); } catch (Exception e) { Activator.handleError(e.getMessage(), e, false); } }

Target:
public RepositoriesViewContentProvider() { ICommandService srv = (ICommandService) PlatformUI.getWorkbench() .getService(ICommandService.class); commandState = srv.getCommand( ToggleBranchHierarchyCommand.ID) .getState(ToggleBranchHierarchyCommand.TOGGLE_STATE); commandState.addListener(this); try { this.branchHierarchyMode = ((Boolean) commandState.getValue()) .booleanValue(); } catch (Exception e) { Activator.handleError(e.getMessage(), e, false); } }
Source:
private ClientAndIterator<T> executeAndCollectWithClient(String jobExecutionName) throws Exception { TypeSerializer<T> serializer = getType().createSerializer(getExecutionEnvironment().getConfig()); String accumulatorName = "dataStreamCollect_" + UUID.randomUUID().toString(); StreamExecutionEnvironment env = getExecutionEnvironment(); CollectSinkOperatorFactory<T> factory = new CollectSinkOperatorFactory<>(serializer, accumulatorName); CollectSinkOperator<T> operator = (CollectSinkOperator<T>) factory.getOperator(); CollectResultIterator<T> iterator = new CollectResultIterator<>( operator.getOperatorIdFuture(), serializer, accumulatorName, env.getCheckpointConfig()); CollectStreamSink<T> sink = new CollectStreamSink<>(this, factory); sink.name("Data stream collect sink"); env.addOperator(sink.getTransformation()); final JobClient jobClient = env.executeAsync(jobExecutionName); iterator.setJobClient(jobClient); return new ClientAndIterator<>(jobClient, iterator); }

Target:
ClientAndIterator<T> executeAndCollectWithClient(String jobExecutionName) throws Exception { TypeSerializer<T> serializer = getType().createSerializer(getExecutionEnvironment().getConfig()); String accumulatorName = "dataStreamCollect_" + UUID.randomUUID().toString(); StreamExecutionEnvironment env = getExecutionEnvironment(); CollectSinkOperatorFactory<T> factory = new CollectSinkOperatorFactory<>(serializer, accumulatorName); CollectSinkOperator<T> operator = (CollectSinkOperator<T>) factory.getOperator(); CollectResultIterator<T> iterator = new CollectResultIterator<>( operator.getOperatorIdFuture(), serializer, accumulatorName, env.getCheckpointConfig()); CollectStreamSink<T> sink = new CollectStreamSink<>(this, factory); sink.name("Data stream collect sink"); env.addOperator(sink.getTransformation()); final JobClient jobClient = env.executeAsync(jobExecutionName); iterator.setJobClient(jobClient); return new ClientAndIterator<>(jobClient, iterator); }
Source:
public boolean generateLaborLedgerBenefitClearingPendingEntries( GeneralLedgerPendingEntrySequenceHelper sequenceHelper) { LOG.debug("started generateLaborLedgerBenefitClearingPendingEntries()"); String chartOfAccountsCode = SpringContext.getBean(ParameterService.class).getParameterValueAsString( SalaryExpenseTransferDocument.class, LaborParameterConstants.BENEFIT_CLEARING_CHART); String accountNumber = SpringContext.getBean(ParameterService.class).getParameterValueAsString( SalaryExpenseTransferDocument.class, LaborParameterConstants.BENEFIT_CLEARING_CHART); List<LaborLedgerPendingEntry> benefitClearingPendingEntries = LaborPendingEntryGenerator.generateBenefitClearingPendingEntries(this, sequenceHelper, accountNumber, chartOfAccountsCode); if (benefitClearingPendingEntries != null && !benefitClearingPendingEntries.isEmpty()) { return this.getLaborLedgerPendingEntries().addAll(benefitClearingPendingEntries); } return true; }

Target:
public boolean generateLaborLedgerBenefitClearingPendingEntries( GeneralLedgerPendingEntrySequenceHelper sequenceHelper) { LOG.debug("started generateLaborLedgerBenefitClearingPendingEntries()"); String chartOfAccountsCode = SpringContext.getBean(ParameterService.class).getParameterValueAsString( SalaryExpenseTransferDocument.class, LaborParameterConstants.BENEFIT_CLEARING_CHART); String accountNumber = SpringContext.getBean(ParameterService.class).getParameterValueAsString( SalaryExpenseTransferDocument.class, LaborParameterConstants.BENEFIT_CLEARING_ACCOUNT); List<LaborLedgerPendingEntry> benefitClearingPendingEntries = LaborPendingEntryGenerator.generateBenefitClearingPendingEntries(this, sequenceHelper, accountNumber, chartOfAccountsCode); if (benefitClearingPendingEntries != null && !benefitClearingPendingEntries.isEmpty()) { return this.getLaborLedgerPendingEntries().addAll(benefitClearingPendingEntries); } return true; }
Source:
public RetryLimitReachedException(List<Exception> exceptions) { super(""); exceptions.forEach(this::addSuppressed); this.numRetries = exceptions.size(); }

Target:
public RetryLimitReachedException(List<Exception> exceptions) { super(MESSAGE); exceptions.forEach(this::addSuppressed); this.numRetries = exceptions.size(); }
Source:
public Optional<Resource> getUsedResource(String accountId) throws NotFoundException, ServerException { final Account account = accountManager.getById(accountId); final long currentlyUsedRuntimes = Lists.newArrayList( iterate( (maxItems, skipCount) -> workspaceManagerProvider .get() .getByNamespace(account.getName(), false, maxItems, skipCount)) .iterator()) .stream() .filter(ws -> STOPPED != ws.getStatus()) .count(); if (currentlyUsedRuntimes > 0) { return Optional.of( new ResourceImpl( RuntimeResourceType.ID, currentlyUsedRuntimes, RuntimeResourceType.UNIT)); } else { return Optional.empty(); } }

Target:
public Optional<Resource> getUsedResource(String accountId) throws NotFoundException, ServerException { final Account account = accountManager.getById(accountId); final long currentlyUsedRuntimes = Pages.stream( (maxItems, skipCount) -> workspaceManagerProvider .get() .getByNamespace(account.getName(), false, maxItems, skipCount)) .filter(ws -> STOPPED != ws.getStatus()) .count(); if (currentlyUsedRuntimes > 0) { return Optional.of( new ResourceImpl( RuntimeResourceType.ID, currentlyUsedRuntimes, RuntimeResourceType.UNIT)); } else { return Optional.empty(); } }
Source:
private void updateDefaultRights(Map<String, BaseObject> rightsObjects, XWikiDocument doc) { Visibility visibility = getVisibility(doc); if (visibility == null || "none".equals(visibility.getDefaultAccessLevel().getName())) { return; } BaseObject right; if ("view".equals(visibility.getDefaultAccessLevel().getName())) { right = rightsObjects.get("view"); } else if ("edit".equals(visibility.getDefaultAccessLevel().getName())) { right = rightsObjects.get("view,edit"); } else { return; } setRights(right, "groups", "XWikiAllGroup.XWikiAllGroup"); }

Target:
private void updateDefaultRights(Map<String, BaseObject> rightsObjects, XWikiDocument doc) { Visibility visibility = getVisibility(doc); if (visibility == null || "none".equals(visibility.getDefaultAccessLevel().getName())) { return; } BaseObject right; if ("view".equals(visibility.getDefaultAccessLevel().getName())) { right = rightsObjects.get("view"); } else if ("edit".equals(visibility.getDefaultAccessLevel().getName())) { right = rightsObjects.get("view,edit"); } else { return; } setRights(right, "groups", "XWiki.XWikiAllGroup"); }
Source:
private List<Integer> getPercentileValues(String percentileString) { List<Integer> percentileValues = new ArrayList<Integer>(); try { for (String rawPercentile: percentileString.split(",")) { percentileValues.add(Integer.parseInt(rawPercentile)); } } catch(Exception e) { System.err.println("[WARN] Couldn't read " + PERCENTILES_PROPERTY + " value: '" + percentileString + "', the default of '" + PERCENTILES_PROPERTY_DEFAULT + "' will be used."); return getPercentileValues(PERCENTILES_PROPERTY_DEFAULT); } return percentileValues; }

Target:
private List<Integer> getPercentileValues(String percentileString) { List<Integer> percentileValues = new ArrayList<Integer>(); try { for (String rawPercentile: percentileString.split(",")) { percentileValues.add(Integer.parseInt(rawPercentile)); } } catch(Exception e) { System.err.println("[WARN] Couldn't read " + PERCENTILES_PROPERTY + " value: '" + percentileString + "', the default of '" + PERCENTILES_PROPERTY_DEFAULT + "' will be used."); e.printStackTrace(); return getPercentileValues(PERCENTILES_PROPERTY_DEFAULT); } return percentileValues; }
Source:
private DhisStatusResponse createEntity(Settings settings, String uri, String json) { HttpUriRequest request = generatePostRequest(settings, uri, json); LOGGER.debug(String.format("Initiating request to create resource: %s, request: %s", json, request.toString())); CloseableHttpResponse response = getResponseForRequest(request); LOGGER.debug(String.format("Received response to create resource: %s, request: %s", json, response)); DhisStatusResponse status; try (InputStream content = getContentForResponse(response)) { status = new ObjectMapper().readValue(content, DhisStatusResponse.class); } catch (IOException e) { String msg = String.format("Error parsing response from uri: %s, exception: %s", uri, e.toString()); statusMessageService.warn(msg, MODULE_NAME); throw new DhisWebException(msg, e); } finally { closeResponse(response); } LOGGER.debug(String.format("DHIS2 status response: %s", status.getStatus().toString())); if (status.getStatus() == DhisStatus.ERROR) { String msg = String.format("Error in DHIS2 status response: %s", status.getStatus().toString()); statusMessageService.warn(msg, MODULE_NAME); throw new DhisWebException(msg); } return status; }

Target:
private DhisStatusResponse createEntity(Settings settings, String uri, String json) { HttpUriRequest request = generatePostRequest(settings, uri, json); LOGGER.debug(String.format("Initiating request to create resource: %s, request: %s", json, request.toString())); CloseableHttpResponse response = getResponseForRequest(request); LOGGER.debug(String.format("Received response to create resource: %s, request: %s", json, response)); DhisStatusResponse status; try (InputStream content = getContentForResponse(response)) { String contentString = IOUtils.toString(content); status = new ObjectMapper().readValue(contentString, DhisStatusResponse.class); if (status.getStatus() == DhisStatus.ERROR) { String msg = String.format("Error in DHIS2 status response, error details: %s", contentString); throw new DhisWebException(msg); } } catch (IOException e) { String msg = String.format("Error parsing response from uri: %s, exception: %s", uri, e.toString()); statusMessageService.warn(msg, MODULE_NAME); throw new DhisWebException(msg, e); } finally { closeResponse(response); } return status; }
Source:
private byte[] encode(ObjectId oldId, ObjectId newId, PersonIdent ident, String message) { final StringBuilder r = new StringBuilder(); r.append(ObjectId.toString(oldId)); r.append(' '); r.append(ObjectId.toString(newId)); r.append(' '); r.append(ident.toExternalString()); r.append('\t'); r.append(message.replace("\n", " ")); r.append('\n'); return Constants.encode(r.toString()); }

Target:
private byte[] encode(ObjectId oldId, ObjectId newId, PersonIdent ident, String message) { final StringBuilder r = new StringBuilder(); r.append(ObjectId.toString(oldId)); r.append(' '); r.append(ObjectId.toString(newId)); r.append(' '); r.append(ident.toExternalString()); r.append('\t'); r.append(message.replace("\r\n", " ").replace("\n", " ")); r.append('\n'); return Constants.encode(r.toString()); }
Source:
void drainLoop() { int missed = 1; JoinInnerSubscriber<T>[] s = this.subscribers; int n = s.length; Subscriber<? super T> a = this.actual; for (;;) { long r = requested.get(); long e = 0; middle: while (e != r) { if (cancelled) { cleanup(); return; } Throwable ex = errors.get(); if (ex != null) { cleanup(); a.onError(ex); return; } boolean d = done.get() == 0; boolean empty = true; for (JoinInnerSubscriber<T> inner : s) { SimplePlainQueue<T> q = inner.queue; if (q != null) { T v = q.poll(); if (v != null) { empty = false; a.onNext(v); inner.requestOne(); if (++e == r) { break middle; } } } } if (d && empty) { a.onComplete(); return; } if (empty) { break; } } if (e == r) { if (cancelled) { cleanup(); return; } Throwable ex = errors.get(); if (ex != null) { cleanup(); a.onError(ex); return; } boolean d = done.get() == 0; boolean empty = true; for (int i = 0; i < n; i++) { JoinInnerSubscriber<T> inner = s[i]; SimpleQueue<T> q = inner.queue; if (q != null && !q.isEmpty()) { empty = false; break; } } if (d && empty) { a.onComplete(); return; } } if (e != 0 && r != Long.MAX_VALUE) { requested.addAndGet(-e); } int w = get(); if (w == missed) { missed = addAndGet(-missed); if (missed == 0) { break; } } else { missed = w; } } }

Target:
void drainLoop() { int missed = 1; JoinInnerSubscriber<T>[] s = this.subscribers; int n = s.length; Subscriber<? super T> a = this.actual; for (;;) { long r = requested.get(); long e = 0; middle: while (e != r) { if (cancelled) { cleanup(); return; } Throwable ex = errors.get(); if (ex != null) { cleanup(); a.onError(ex); return; } boolean d = done.get() == 0; boolean empty = true; for (int i = 0; i < s.length; i++) { JoinInnerSubscriber<T> inner = s[i]; SimplePlainQueue<T> q = inner.queue; if (q != null) { T v = q.poll(); if (v != null) { empty = false; a.onNext(v); inner.requestOne(); if (++e == r) { break middle; } } } } if (d && empty) { a.onComplete(); return; } if (empty) { break; } } if (e == r) { if (cancelled) { cleanup(); return; } Throwable ex = errors.get(); if (ex != null) { cleanup(); a.onError(ex); return; } boolean d = done.get() == 0; boolean empty = true; for (int i = 0; i < n; i++) { JoinInnerSubscriber<T> inner = s[i]; SimpleQueue<T> q = inner.queue; if (q != null && !q.isEmpty()) { empty = false; break; } } if (d && empty) { a.onComplete(); return; } } if (e != 0 && r != Long.MAX_VALUE) { requested.addAndGet(-e); } int w = get(); if (w == missed) { missed = addAndGet(-missed); if (missed == 0) { break; } } else { missed = w; } } }
Source:
public List<Node> getMembers() { List<Node> list = new ArrayList<>(); for (Address address : this.view) { Node node = this.factory.createNode(address); list.add(node); } return list; }

Target:
public List<Node> getMembers() { List<Node> list = new ArrayList<>(this.view.size()); for (Address address : this.view) { list.add(this.factory.createNode(address)); } return list; }
Source:
public void shouldPreserveOffsetsFromCommitByGroupMetadataOnAbortIfTransactionsAreEnabled() { buildMockProducer(true); producer.initTransactions(); producer.beginTransaction(); String group = "g"; Map<TopicPartition, OffsetAndMetadata> groupCommit = new HashMap<TopicPartition, OffsetAndMetadata>() { { put(new TopicPartition(topic, 0), new OffsetAndMetadata(42L, null)); put(new TopicPartition(topic, 1), new OffsetAndMetadata(73L, null)); } }; producer.sendOffsetsToTransaction(groupCommit, groupMetadata(group)); producer.commitTransaction(); producer.beginTransaction(); producer.abortTransaction(); Map<String, Map<TopicPartition, OffsetAndMetadata>> expectedResult = new HashMap<>(); expectedResult.put(group, groupCommit); assertThat(producer.consumerGroupOffsetsHistory(), equalTo(Collections.singletonList(expectedResult))); }

Target:
public void shouldPreserveOffsetsFromCommitByGroupMetadataOnAbortIfTransactionsAreEnabled() { buildMockProducer(true); producer.initTransactions(); producer.beginTransaction(); String group = "g"; Map<TopicPartition, OffsetAndMetadata> groupCommit = new HashMap<TopicPartition, OffsetAndMetadata>() { { put(new TopicPartition(topic, 0), new OffsetAndMetadata(42L, null)); put(new TopicPartition(topic, 1), new OffsetAndMetadata(73L, null)); } }; producer.sendOffsetsToTransaction(groupCommit, new ConsumerGroupMetadata(group)); producer.commitTransaction(); producer.beginTransaction(); String group2 = "g2"; Map<TopicPartition, OffsetAndMetadata> groupCommit2 = new HashMap<TopicPartition, OffsetAndMetadata>() { { put(new TopicPartition(topic, 2), new OffsetAndMetadata(53L, null)); put(new TopicPartition(topic, 3), new OffsetAndMetadata(84L, null)); } }; producer.sendOffsetsToTransaction(groupCommit, new ConsumerGroupMetadata(group2)); producer.abortTransaction(); Map<String, Map<TopicPartition, OffsetAndMetadata>> expectedResult = new HashMap<>(); expectedResult.put(group, groupCommit); assertThat(producer.consumerGroupOffsetsHistory(), equalTo(Collections.singletonList(expectedResult))); }
Source:
private synchronized int readPidFromPidFile(String... commands) throws IOException, InterruptedException { int pid = -1; FilePath pidFile = ws.child(readPidFile(commands)); for (int w = 0; w < 10 && !pidFile.exists(); w++) { try { wait(1000); } catch (InterruptedException e) { break; } } if (pidFile.exists()) { try { pid = Integer.parseInt(pidFile.readToString().trim()); } catch (NumberFormatException x) { throw new IOException("corrupted content in " + pidFile + ": " + x, x); } } return pid; }

Target:
private synchronized int readPidFromPidFile(String... commands) throws IOException, InterruptedException { int pid = -1; String pidFilePath = readPidFile(commands); if (pidFilePath == null) { return pid; } FilePath pidFile = ws.child(pidFilePath); for (int w = 0; w < 10 && !pidFile.exists(); w++) { try { wait(1000); } catch (InterruptedException e) { break; } } if (pidFile.exists()) { try { pid = Integer.parseInt(pidFile.readToString().trim()); } catch (NumberFormatException x) { throw new IOException("corrupted content in " + pidFile + ": " + x, x); } } return pid; }
Source:
public void initTrace(final IResource resource, final String path, final Class<CtfTmfEvent> eventType) throws TmfTraceException { setCacheSize(); super.initTrace(resource, path, eventType); @SuppressWarnings("unused") CtfTmfEventType type; try { this.fTrace = new CTFTrace(path); CtfIteratorManager.init(); CtfIteratorManager.AddTrace(this); ctx = new CtfTmfLightweightContext(this); ctx.setLocation(new CtfLocation(0L)); final CtfIterator iterator = CtfIteratorManager.getIterator(this, ctx); if(iterator.getLocation().equals(CtfIterator.NULL_LOCATION)) { this.setStartTime(TmfTimestamp.BIG_BANG); } else { this.setStartTime(iterator.getCurrentEvent().getTimestamp()); this.setEndTime(iterator.getCurrentEvent().getTimestamp()); } } catch (final CTFReaderException e) { throw new TmfTraceException(e.getMessage(), e); } buildStateSystem(); if ( resource != null) { try { resource.getProject().refreshLocal(IResource.DEPTH_INFINITE, null); } catch (CoreException e) { throw new TmfTraceException(e.getMessage(), e); } } }

Target:
public void initTrace(final IResource resource, final String path, final Class<CtfTmfEvent> eventType) throws TmfTraceException { setCacheSize(); super.initTrace(resource, path, eventType); @SuppressWarnings("unused") CtfTmfEventType type; try { this.fTrace = new CTFTrace(path); CtfIteratorManager.init(); CtfIteratorManager.addTrace(this); ctx = new CtfTmfLightweightContext(this); ctx.setLocation(new CtfLocation(0L)); final CtfIterator iterator = getIterator(); if(iterator.getLocation().equals(CtfIterator.NULL_LOCATION)) { this.setStartTime(TmfTimestamp.BIG_BANG); } else { this.setStartTime(iterator.getCurrentEvent().getTimestamp()); this.setEndTime(iterator.getCurrentEvent().getTimestamp()); } } catch (final CTFReaderException e) { throw new TmfTraceException(e.getMessage(), e); } buildStateSystem(); if ( resource != null) { try { resource.getProject().refreshLocal(IResource.DEPTH_INFINITE, null); } catch (CoreException e) { throw new TmfTraceException(e.getMessage(), e); } } }
Source:
public MemberAssignment(Set<TopicPartition> topicPartitions) { this.topicPartitions = Collections.unmodifiableSet(new HashSet<>(topicPartitions)); }

Target:
public MemberAssignment(Set<TopicPartition> topicPartitions) { Objects.requireNonNull(topicPartitions); this.topicPartitions = Collections.unmodifiableSet(new HashSet<>(topicPartitions)); }
Source:
public void setUp() throws Exception { logFileName = Platform.getInstallLocation().getURL().getPath() + ".." + File.separator + ".." + File.separator + "results" + File.separator + "chkpii"; }

Target:
public void setUp() { logFileName = Platform.getInstallLocation().getURL().getPath() + ".." + File.separator + ".." + File.separator + "results" + File.separator + "chkpii"; }
Source:
public void testApplication() throws Exception { File modelFile = new File("src/test/resources/model/model_file_csv.json"); String model = FileUtils.readFileToString(modelFile); try { LocalMode lma = LocalMode.newInstance(); Configuration conf = new Configuration(false); lma.prepareDAG(new Application(model), conf); LocalMode.Controller lc = lma.getController(); lc.run(10 * 1000); } catch (ConstraintViolationException e) { Assert.fail("constraint violations: " + e.getConstraintViolations()); } catch (Exception e) { Assert.fail("Exception: " + e); } }

Target:
public void testApplication() throws Exception { File modelFile = new File("src/test/resources/model/model_file_csv.json"); String model = FileUtils.readFileToString(modelFile); PrintStream originalSysout = System.out; ByteArrayOutputStream baos = new ByteArrayOutputStream(); System.setOut(new PrintStream(baos)); try { LocalMode lma = LocalMode.newInstance(); Configuration conf = new Configuration(false); lma.prepareDAG(new Application(model), conf); LocalMode.Controller lc = lma.getController(); lc.runAsync(); waitTillStdoutIsPopulated(baos, 30000); lc.shutdown(); } catch (ConstraintViolationException e) { Assert.fail("constraint violations: " + e.getConstraintViolations()); } catch (Exception e) { Assert.fail("Exception: " + e); } System.setOut(originalSysout); String[] sout = baos.toString().split(System.lineSeparator()); Collection<String> filter = Collections2.filter(Arrays.asList(sout), Predicates.containsPattern("Delta Record:")); String[] actualLines = filter.toArray(new String[filter.size()]); Assert.assertEquals(6, actualLines.length); Assert.assertTrue(actualLines[0].contains("RowTime=Mon Feb 15 10:15:00 GMT 2016, Product=paint1")); Assert.assertTrue(actualLines[1].contains("RowTime=Mon Feb 15 10:16:00 GMT 2016, Product=paint2")); Assert.assertTrue(actualLines[2].contains("RowTime=Mon Feb 15 10:17:00 GMT 2016, Product=paint3")); Assert.assertTrue(actualLines[3].contains("RowTime=Mon Feb 15 10:18:00 GMT 2016, Product=paint4")); Assert.assertTrue(actualLines[4].contains("RowTime=Mon Feb 15 10:19:00 GMT 2016, Product=paint5")); Assert.assertTrue(actualLines[5].contains("RowTime=Mon Feb 15 10:10:00 GMT 2016, Product=abcde6")); }
Source:
public SettingSelector setKeyFilter(String keyFilter) { Objects.requireNonNull(keyFilter); this.keyFilter = keyFilter; return this; }

Target:
public SettingSelector setKeyFilter(String keyFilter) { this.keyFilter = keyFilter; return this; }
Source:
public Mono<FileDownloadAsyncResponse> readWithResponse(FileRange range, DownloadRetryOptions options, DataLakeRequestConditions accessConditions, boolean rangeGetContentMD5) { try { return blockBlobAsyncClient.downloadWithResponse(Transforms.toBlobRange(range), Transforms.toBlobDownloadRetryOptions(options), Transforms.toBlobRequestConditions(accessConditions), rangeGetContentMD5).map(response -> new FileDownloadAsyncResponse(response.getRequest(), response.getStatusCode(), response.getHeaders(), response.getValue(), response.getDeserializedHeaders())); } catch (RuntimeException ex) { return monoError(logger, ex); } }

Target:
public Mono<FileReadAsyncResponse> readWithResponse(FileRange range, DownloadRetryOptions options, DataLakeRequestConditions accessConditions, boolean rangeGetContentMD5) { try { return blockBlobAsyncClient.downloadWithResponse(Transforms.toBlobRange(range), Transforms.toBlobDownloadRetryOptions(options), Transforms.toBlobRequestConditions(accessConditions), rangeGetContentMD5).map(Transforms::toFileReadAsyncResponse); } catch (RuntimeException ex) { return monoError(logger, ex); } }
Source:
public void transformCalendarToLocalDate() throws DatatypeConfigurationException { LocalDate date = LocalDate.now(); Calendar value = Calendar.getInstance(); LocalDate transform = new DateTimeTransformer().transform(value, LocalDate.class); assertNotNull("LocalDate should not be null", transform); assertEquals("LocalDates should be equal", date, transform); }

Target:
public void transformCalendarToLocalDate() throws DatatypeConfigurationException { Calendar value = Calendar.getInstance(TimeZone.getDefault()); LocalDate date = value.toInstant().atZone(ZoneId.systemDefault()).toLocalDate(); LocalDate transform = new DateTimeTransformer().transform(value, LocalDate.class); assertNotNull("LocalDate should not be null", transform); assertEquals("LocalDates should be equal", date, transform); }
Source:
public String toCsvString() { SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yyyy", Locale.US); StringBuilder sb = new StringBuilder(); sb.append(chart).append(KFSConstants.COMMA); sb.append(accountNumber).append(KFSConstants.COMMA); sb.append((StringUtils.isNotBlank(subAccountNumber) ? subAccountNumber : KFSConstants.EMPTY_STRING)).append(KFSConstants.COMMA); sb.append(accountClosedIndicator).append(KFSConstants.COMMA); sb.append(sdf.format(accountClosedDate)); return sb.toString(); }

Target:
public String toCsvString() { SimpleDateFormat sdf = new SimpleDateFormat(KFSConstants.MONTH_DAY_YEAR_DATE_FORMAT, Locale.US); StringBuilder sb = new StringBuilder(); sb.append(chart).append(KFSConstants.COMMA); sb.append(accountNumber).append(KFSConstants.COMMA); sb.append((StringUtils.isNotBlank(subAccountNumber) ? subAccountNumber : KFSConstants.EMPTY_STRING)).append(KFSConstants.COMMA); sb.append(accountClosedIndicator).append(KFSConstants.COMMA); sb.append(sdf.format(accountClosedDate)); return sb.toString(); }
Source:
public AnonymousAuthenticator( @JsonProperty("name") String name, @JsonProperty("authorizerName") String authorizerName, @JsonProperty("identity") String identity ) { this.name = name; this.authorizerName = authorizerName; this.identity = identity == null ? DEFAULT_IDENTITY : identity; this.anonymousResult = new AuthenticationResult( this.identity, this.authorizerName, this.name, null ); }

Target:
public AnonymousAuthenticator( @JsonProperty("name") String name, @JsonProperty("authorizerName") String authorizerName, @JsonProperty("identity") String identity ) { this.anonymousResult = new AuthenticationResult( identity == null ? DEFAULT_IDENTITY : identity, authorizerName, name, null ); }
Source:
public List<InternalJob> loadJobWithTasksIfNotRemoved(final JobId... jobIds) { return executeReadOnlyTransaction(session -> { Query jobQuery = session.getNamedQuery("loadJobDataIfNotRemoved").setReadOnly(true); List<Long> ids = new ArrayList<>(jobIds.length); for (JobId jobId : jobIds) { ids.add(jobId(jobId)); } List<InternalJob> result = new ArrayList<>(jobIds.length); batchLoadJobs(session, false, jobQuery, ids, result); return result; }); }

Target:
public List<InternalJob> loadJobWithTasksIfNotRemoved(final JobId... jobIds) { return executeReadOnlyTransaction(session -> { Query jobQuery = session.getNamedQuery("loadJobDataIfNotRemoved").setReadOnly(true); List<Long> ids = Arrays.stream(jobIds).map(SchedulerDBManager::jobId).collect(Collectors.toList()); List<InternalJob> result = new ArrayList<>(jobIds.length); batchLoadJobs(session, false, jobQuery, ids, result); return result; }); }
Source:
public String toString() { return "ParameterizedMetricKey{" + "key=" + key + ", options=" + version + '}'; }

Target:
public String toString() { return "ParameterizedMetricKey{" + "key=" + key + ", version=" + version + '}'; }
Source:
public void shouldFunction0ReturnNotNull() { assertThat(function0(() -> null)).isNotNull(); }

Target:
public void shouldFunction0ReturnNotNull() { assertThat(Function0(() -> null)).isNotNull(); }
Source:
private String getCommandParamatersString(T params) { final String GET = "get"; StringBuilder buf = new StringBuilder(); List<String> methodNames = ReflectionUtils.getMethodNames(params); methodNames.removeAll(ReflectionUtils.getMethodNames(new VdcActionParametersBase())); for (String methodName : methodNames) { if (!methodName.startsWith(GET)) { continue; } Object retVal = ReflectionUtils.invokeMethodWithNoArgs(params, methodName); if (retVal == null) { continue; } if (buf.length() > 0) { buf.append(", "); } buf.append(methodName.substring(GET.length())); buf.append(" = "); buf.append(retVal.toString()); } return buf.toString(); }

Target:
private String getCommandParamatersString(T params) { StringBuilder buf = new StringBuilder(); List<String> methodNames = ReflectionUtils.getMethodNames(params); List<String> fieldNames = ReflectionUtils.getFieldNames(params); fieldNames.removeAll(ReflectionUtils.getFieldNames(new VdcActionParametersBase())); for (String fieldName : fieldNames) { Method method = ReflectionUtils.getGetter(params, fieldName, methodNames); if (method == null) { continue; } Object retVal = ReflectionUtils.invokeMethodWithNoArgs(params, method); if (buf.length() > 0) { buf.append(", "); } buf.append(fieldName); buf.append(" = "); buf.append(retVal == null ? "null" : retVal.toString()); } return buf.toString(); }
Source:
private static TreeItem firstOrNull(TreeItem[] items) { if (items.length == 0) { return items[0]; } return null; }

Target:
private static TreeItem firstOrNull(TreeItem[] items) { if (items.length > 0) { return items[0]; } return null; }
Source:
public void commit(IProgressMonitor monitor) throws CoreException { if (isDirty()) { if (isConnected()) { super.commit(monitor); } else { File file = path.toFile(); try { java.nio.file.Path fp = file.toPath(); if (Files.isSymbolicLink(fp)) { String sp = new String(getContent(), StandardCharsets.UTF_8) .trim(); if (sp.indexOf('\n') > 0) { sp = sp.substring(0, sp.indexOf('\n')).trim(); } if (!sp.isEmpty()) { boolean wasBrokenLink = !file.exists(); java.nio.file.Path link = FileUtils .createSymLink(file, sp); updateLinkResource(wasBrokenLink, link); } } else { if (!file.exists()) { FileUtils.createNewFile(file); } try (OutputStream out = Files .newOutputStream(file.toPath())) { out.write(getContent()); } } fDirty = false; } catch (IOException e) { throw new CoreException( new Status( IStatus.ERROR, Activator.getPluginId(), UIText.LocalNonWorkspaceTypedElement_errorWritingContents, e)); } finally { fireChanges(); } } refreshTimestamp(); } }

Target:
public void commit(IProgressMonitor monitor) throws CoreException { if (isDirty()) { if (isConnected()) { super.commit(monitor); } else { File file = path.toFile(); try { java.nio.file.Path fp = file.toPath(); if (Files.isSymbolicLink(fp)) { String sp = new String(getContent(), StandardCharsets.UTF_8) .trim(); if (sp.indexOf('\n') > 0) { sp = sp.substring(0, sp.indexOf('\n')).trim(); } if (!sp.isEmpty()) { boolean wasBrokenLink = !file.exists(); java.nio.file.Path link = FileUtils .createSymLink(file, sp); updateLinkResource(wasBrokenLink, link); } } else { try (OutputStream out = Files .newOutputStream(file.toPath())) { out.write(getContent()); } } fDirty = false; } catch (IOException e) { throw new CoreException( new Status( IStatus.ERROR, Activator.getPluginId(), UIText.LocalNonWorkspaceTypedElement_errorWritingContents, e)); } finally { fireChanges(); } } refreshTimestamp(); } }
Source:
public Number convert( final String value ) { return new BigDecimal( value ); }

Target:
public Number convert( final String value ) { try { return new BigDecimal( value ); } catch ( NumberFormatException nfe ) { return new BigDecimal( "0.0" ); } }
Source:
public void eachNonZeroInRow(int i, MatrixProcedure procedure) { for (int j = 0; j < columns; j++) { if (get(i, j) > Matrices.EPS) procedure.apply(i,j,get(i,j)); } }

Target:
public void eachNonZeroInRow(int i, MatrixProcedure procedure) { for (int j = 0; j < columns; j++) { if (Math.abs(get(i, j)) > Matrices.EPS) { procedure.apply(i, j, get(i, j)); } } }
Source:
private NatService.Builder newServiceBuilder(JcloudsLocation loc) { String endpoint = loc.getEndpoint(); String convertedUri; try { URI uri = URI.create(endpoint); convertedUri = new URI(uri.getScheme(), uri.getUserInfo(), uri.getHost(), uri.getPort(), null, null, null).toString(); } catch (URISyntaxException e) { throw Exceptions.propagate(e); } String trustStore = (String) loc.getAllConfigBag().getStringKey("trustStore"); String trustStorePassword = (String) loc.getAllConfigBag().getStringKey("trustStorePassword"); return NatService.builder() .identity(loc.getIdentity()) .credential(loc.getCredential()) .endpoint(convertedUri) .trustStore(trustStore) .trustStorePassword(trustStorePassword); }

Target:
private NatService.Builder newServiceBuilder(JcloudsLocation loc) { String endpoint = loc.getEndpoint(); String convertedUri; try { URI uri = URI.create(endpoint); convertedUri = new URI(uri.getScheme(), uri.getUserInfo(), uri.getHost(), uri.getPort(), null, null, null).toString(); } catch (URISyntaxException e) { throw Exceptions.propagate(e); } String trustStore = (String) loc.getAllConfigBag().getStringKey("trustStore"); String trustStorePassword = (String) loc.getAllConfigBag().getStringKey("trustStorePassword"); assertNotNull(trustStorePassword, "trustStorePassword not set on location " + loc); return NatService.builder() .identity(loc.getIdentity()) .credential(loc.getCredential()) .endpoint(convertedUri) .trustStore(trustStore) .trustStorePassword(trustStorePassword); }
Source:
public void sendBlockEntityChange(Location location, CompoundTag nbt, GlowBlockEntity type) throws NullPointerException { Validate.notNull(location, "Location cannot be null"); Validate.notNull(nbt, "NBT cannot be null"); Validate.notNull(type, "Type cannot be null"); afterBlockChanges.add(new UpdateBlockEntityMessage(location.getBlockX(), location.getBlockY(), location.getBlockZ(), type.getValue(), nbt)); }

Target:
public void sendBlockEntityChange(Location location, CompoundTag nbt, GlowBlockEntity type) { Validate.notNull(location, "Location cannot be null"); Validate.notNull(nbt, "NBT cannot be null"); Validate.notNull(type, "Type cannot be null"); afterBlockChanges.add(new UpdateBlockEntityMessage(location.getBlockX(), location.getBlockY(), location.getBlockZ(), type.getValue(), nbt)); }
Source:
public IStructuredSelection findSelection(IEditorInput anInput) { IFile file = ResourceUtil.getFile(anInput); if (file != null) { try { String traceTypeId = file.getPersistentProperty(TmfCommonConstants.TRACETYPE); if (traceTypeId == null) { return StructuredSelection.EMPTY; } final TmfNavigatorContentProvider ncp = new TmfNavigatorContentProvider(); ncp.getChildren(file.getProject()); final TmfProjectElement project = TmfProjectRegistry.getProject(file.getProject()); if (traceTypeId.equals(TmfExperiment.class.getCanonicalName())) { for (final ITmfProjectModelElement projectElement : project.getExperimentsFolder().getChildren()) { if (projectElement.getName().equals(file.getParent().getName())) { return new StructuredSelection(projectElement); } } } else if (traceTypeId.equals(TmfTrace.class.getCanonicalName())) { for (final ITmfProjectModelElement projectElement : project.getTracesFolder().getChildren()) { if (projectElement.getName().equals(file.getParent().getName())) { return new StructuredSelection(projectElement); } } } else { for (final ITmfProjectModelElement projectElement : project.getTracesFolder().getChildren()) { if ((projectElement.getResource().equals(file)) || (projectElement.getName().equals(file.getParent().getName()))) { return new StructuredSelection(projectElement); } } } } catch (CoreException e) { return StructuredSelection.EMPTY; } } return StructuredSelection.EMPTY; }

Target:
public IStructuredSelection findSelection(IEditorInput anInput) { IFile file = ResourceUtil.getFile(anInput); if (file != null) { try { String traceTypeId = file.getPersistentProperty(TmfCommonConstants.TRACETYPE); if (traceTypeId == null) { return StructuredSelection.EMPTY; } final TmfNavigatorContentProvider ncp = new TmfNavigatorContentProvider(); ncp.getChildren(file.getProject()); final TmfProjectElement project = TmfProjectRegistry.getProject(file.getProject()); if (traceTypeId.equals(TmfExperiment.class.getCanonicalName())) { for (final ITmfProjectModelElement projectElement : project.getExperimentsFolder().getChildren()) { if (projectElement.getName().equals(file.getParent().getName())) { return new StructuredSelection(projectElement); } } } else if (traceTypeId.equals(TmfTrace.class.getCanonicalName())) { for (final ITmfProjectModelElement projectElement : project.getTracesFolder().getChildren()) { if (projectElement.getName().equals(file.getParent().getName())) { return new StructuredSelection(projectElement); } } } else { for (final ITmfProjectModelElement projectElement : project.getTracesFolder().getChildren()) { if (projectElement.getResource().equals(file)) { return new StructuredSelection(projectElement); } } } } catch (CoreException e) { return StructuredSelection.EMPTY; } } return StructuredSelection.EMPTY; }
Source:
public Layer instantiate(NeuralNetConfiguration conf, Collection<IterationListener> iterationListeners, int layerIndex, INDArray layerParamsView, boolean initializeParams) { LayerValidation.assertNInNOutSet("GravesLSTM", getLayerName(), layerIndex, getNIn(), getNOut()); org.deeplearning4j.nn.layers.recurrent.LSTM ret = new org.deeplearning4j.nn.layers.recurrent.LSTM(conf); ret.setListeners(iterationListeners); ret.setIndex(layerIndex); ret.setParamsViewArray(layerParamsView); Map<String, INDArray> paramTable = initializer().init(conf, layerParamsView, initializeParams); ret.setParamTable(paramTable); ret.setConf(conf); return ret; }

Target:
public Layer instantiate(NeuralNetConfiguration conf, Collection<IterationListener> iterationListeners, int layerIndex, INDArray layerParamsView, boolean initializeParams) { LayerValidation.assertNInNOutSet("LSTM", getLayerName(), layerIndex, getNIn(), getNOut()); org.deeplearning4j.nn.layers.recurrent.LSTM ret = new org.deeplearning4j.nn.layers.recurrent.LSTM(conf); ret.setListeners(iterationListeners); ret.setIndex(layerIndex); ret.setParamsViewArray(layerParamsView); Map<String, INDArray> paramTable = initializer().init(conf, layerParamsView, initializeParams); ret.setParamTable(paramTable); ret.setConf(conf); return ret; }
Source:
protected void after(ActionInvocation invocation, String result) throws Exception { Map<String, Object> ses = ActionContext.getContext().getSession(); if ( ses != null) { unlock(ses); } }

Target:
protected void after(ActionInvocation invocation, String result) throws Exception { Map<String, Object> session = ActionContext.getContext().getSession(); if ( session != null) { unlock(session); } }