auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public Destination getJMSDestination() throws JMSException { if (dest == null) { SimpleString address = message.getAddressSimpleString(); SimpleString name = address; if (address != null & session.isEnable1xPrefixes()) { if (address.startsWith(PacketImpl.OLD_QUEUE_PREFIX)) { name = address.subSeq(PacketImpl.OLD_QUEUE_PREFIX.length(), address.length()); } else if (address.startsWith(PacketImpl.OLD_TEMP_QUEUE_PREFIX)) { name = address.subSeq(PacketImpl.OLD_TEMP_QUEUE_PREFIX.length(), address.length()); } else if (address.startsWith(PacketImpl.OLD_TOPIC_PREFIX)) { name = address.subSeq(PacketImpl.OLD_TOPIC_PREFIX.length(), address.length()); } else if (address.startsWith(PacketImpl.OLD_TEMP_TOPIC_PREFIX)) { name = address.subSeq(PacketImpl.OLD_TEMP_TOPIC_PREFIX.length(), address.length()); } } if (address == null) { dest = null; } else if (RoutingType.ANYCAST.equals(message.getRoutingType())) { dest = ActiveMQDestination.createQueue(address); } else if (RoutingType.MULTICAST.equals(message.getRoutingType())) { dest = ActiveMQDestination.createTopic(address); } else { dest = (ActiveMQDestination) ActiveMQDestination.fromPrefixedName(address.toString()); } if (name != null) { ((ActiveMQDestination) dest).setName(name.toString()); } } return dest; }

Target:
public Destination getJMSDestination() throws JMSException { if (dest == null) { SimpleString address = message.getAddressSimpleString(); SimpleString changedAddress = checkPrefix(address); if (address == null) { dest = null; } else if (RoutingType.ANYCAST.equals(message.getRoutingType())) { dest = ActiveMQDestination.createQueue(address); } else if (RoutingType.MULTICAST.equals(message.getRoutingType())) { dest = ActiveMQDestination.createTopic(address); } else { dest = (ActiveMQDestination) ActiveMQDestination.fromPrefixedName(address.toString()); } if (changedAddress != null) { ((ActiveMQDestination) dest).setName(changedAddress.toString()); } } return dest; }
Source:
void checkForDependentConfigs(String templateId) { List<String> dependentConfigIds = new ArrayList<>(); pipelineDAO.all() .stream() .filter(pipeline -> pipeline.getType() != null && pipeline.getType().equals("templatedPipeline")) .forEach(templatedPipeline -> { String source; try { TemplateConfiguration config = objectMapper.convertValue(templatedPipeline.getConfig(), TemplateConfiguration.class); source = config.getPipeline().getTemplate().getSource(); } catch (Exception e) { return; } if (source != null && source.equalsIgnoreCase("spinnaker://" + templateId)) { dependentConfigIds.add(templatedPipeline.getId()); } }); if (dependentConfigIds.size() != 0) { throw new InvalidRequestException("The following pipeline config(s)" + " depend on this template: " + String.join(", ", dependentConfigIds)); } }

Target:
void checkForDependentConfigs(String templateId) { List<String> dependentConfigIds = new ArrayList<>(); pipelineDAO.all() .stream() .filter(pipeline -> pipeline.getType() != null && pipeline.getType().equals("templatedPipeline")) .forEach(templatedPipeline -> { String source; try { TemplateConfiguration config = objectMapper.convertValue(templatedPipeline.getConfig(), TemplateConfiguration.class); source = config.getPipeline().getTemplate().getSource(); } catch (Exception e) { return; } if (source != null && source.equalsIgnoreCase("spinnaker://" + templateId)) { dependentConfigIds.add(templatedPipeline.getId()); } }); if (dependentConfigIds.size() != 0) { throw new InvalidRequestException("The following pipeline configs" + " depend on this template: " + String.join(", ", dependentConfigIds)); } }
Source:
private static String getEmbeddedDefaultRepositoryXml( final String fullyQualifiedServerUrl ) { String repositoriesXml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><repositories>" + "<repository><id>PentahoEnterpriseRepository</id>" + "<name>" + SINGLE_DI_SERVER_INSTANCE + "</name>" + "<description>" + SINGLE_DI_SERVER_INSTANCE + "</description>" + "<repository_location_url>" + fullyQualifiedServerUrl + "</repository_location_url>" + "<version_comment_mandatory>N</version_comment_mandatory>" + "</repository>" + "</repositories>"; return repositoriesXml; }

Target:
private static String getEmbeddedDefaultRepositoryXml( final String fullyQualifiedServerUrl ) { return "<?xml version=\"1.0\" encoding=\"UTF-8\"?><repositories>" + "<repository><id>PentahoEnterpriseRepository</id>" + "<name>" + SINGLE_DI_SERVER_INSTANCE + "</name>" + "<description>" + SINGLE_DI_SERVER_INSTANCE + "</description>" + "<repository_location_url>" + fullyQualifiedServerUrl + "</repository_location_url>" + "<version_comment_mandatory>N</version_comment_mandatory>" + "</repository>" + "</repositories>"; }
Source:
@Nonnull public Explosion getExplosion() { return explosion; }

Target:
public Explosion getExplosion() { return explosion; }
Source:
public void testMapFromJson() throws Exception { Map<String,Object> helperJSONHashMap = new HashMap<String, Object>(); for(String key:helperJSONTreeMap.keySet()){ Object value = helperJSONTreeMap.get(key); if(value instanceof TreeMap){ value = new HashMap<String,Object>((TreeMap)value); } helperJSONHashMap.put(key,value); } File fixture = TestUtils.loadFixture("fixture/json_helper.json"); FileReader fr = new FileReader(fixture); Map<String, Object> objectHashMap = helper.fromJson(fr); for(String key:helperJSONTreeMap.keySet()){ Object value = helperJSONTreeMap.get(key); if(value instanceof TreeMap){ value = new HashMap<String,Object>((TreeMap)value); } helperJSONHashMap.put(key,value); } Assert.assertTrue("Map read is not equal to expected map", helperJSONHashMap.equals(objectHashMap)); }

Target:
public void testMapFromJson() throws Exception { File fixture = TestUtils.loadFixture("fixture/json_helper.json"); FileReader fr = new FileReader(fixture); Map<String, Object> objectHashMap = helper.fromJson(fr); Assert.assertTrue("Map read is not equal to expected map", expectedJSONMap.equals(objectHashMap)); }
Source:
public void setSummary(@CheckForNull String summary) throws IOException { checkPermission(UPDATE); this.description = description; save(); }

Target:
public void setSummary(@CheckForNull String summary) throws IOException { checkPermission(UPDATE); this.summary = summary; save(); }
Source:
public void addMoodToMessage(Message message, Mood mood, MoodConcretisation concretisation) { MoodElement element = buildMood(mood, concretisation, null); message.addExtension(element); }

Target:
public static void addMoodToMessage(Message message, Mood mood, MoodConcretisation concretisation) { MoodElement element = buildMood(mood, concretisation, null); message.addExtension(element); }
Source:
public void start() { Set<Object> singletons = new HashSet<Object>(); singletons.add(new DispoSetMessageReader()); singletons.add(new DispoSetMessageWriter()); singletons.add(new DispoItemMessageReader()); singletons.add(new DispoItemMessageWriter()); singletons.add(new DispoAnnotationMessageReader()); singletons.add(new DispoAnnotationMessageWriter()); DispoHtmlWriter writer = new DispoHtmlWriter(TemplateRegistry.newRegistry()); singletons.add(new DispoProgramResource(dispoApi, writer, dispoApi.getDispoFactory())); singletons.add(new DispoInitResource(writer)); singletons.add(new DispoAdminResource(writer)); }

Target:
public void start() { singletons.add(new DispoSetMessageReader()); singletons.add(new DispoSetMessageWriter()); singletons.add(new DispoItemMessageReader()); singletons.add(new DispoItemMessageWriter()); singletons.add(new DispoAnnotationMessageReader()); singletons.add(new DispoAnnotationMessageWriter()); DispoHtmlWriter writer = new DispoHtmlWriter(TemplateRegistry.newRegistry()); singletons.add(new DispoProgramResource(dispoApi, writer, dispoApi.getDispoFactory())); singletons.add(new DispoInitResource(writer)); singletons.add(new DispoAdminResource(writer)); }
Source:
public Elasticsearch5SearchIndex(Graph graph, GraphConfiguration config) { this.graph = graph; this.config = new ElasticsearchSearchIndexConfiguration(graph, config); this.indexSelectionStrategy = this.config.getIndexSelectionStrategy(); this.allFieldEnabled = this.config.isAllFieldEnabled(false); this.propertyNameVisibilitiesStore = this.config.createPropertyNameVisibilitiesStore(graph); this.client = createClient(this.config); this.serverPluginInstalled = checkPluginInstalled(this.client); this.geoShapePrecision = this.config.getGeoShapePrecision(); this.geoShapeErrorPct = this.config.getGeoShapeErrorPct(); this.logRequestSizeLimit = this.config.getLogRequestSizeLimit(); this.exceptionHandler = this.config.getExceptionHandler(graph); this.flushObjectQueue = new FlushObjectQueue(this); storePainlessScript("addFieldsToExtendedDataScript", getClass().getResourceAsStream("add-fields-to-extended-data.painless"), true); storePainlessScript("deleteFieldsFromDocumentScript", getClass().getResourceAsStream("remove-fields-from-document.painless"), true); storePainlessScript("updateFieldsOnDocumentScript", getClass().getResourceAsStream("update-fields-on-document.painless"), false); }

Target:
public Elasticsearch5SearchIndex(Graph graph, GraphConfiguration config) { this.graph = graph; this.config = new ElasticsearchSearchIndexConfiguration(graph, config); this.indexSelectionStrategy = this.config.getIndexSelectionStrategy(); this.allFieldEnabled = this.config.isAllFieldEnabled(false); this.propertyNameVisibilitiesStore = this.config.createPropertyNameVisibilitiesStore(graph); this.client = createClient(this.config); this.serverPluginInstalled = checkPluginInstalled(this.client); this.geoShapePrecision = this.config.getGeoShapePrecision(); this.geoShapeErrorPct = this.config.getGeoShapeErrorPct(); this.logRequestSizeLimit = this.config.getLogRequestSizeLimit(); this.exceptionHandler = this.config.getExceptionHandler(graph); this.flushObjectQueue = new FlushObjectQueue(this); storePainlessScript("addFieldsToExtendedDataScript", "add-fields-to-extended-data.painless", true); storePainlessScript("deleteFieldsFromDocumentScript", "remove-fields-from-document.painless", true); storePainlessScript("updateFieldsOnDocumentScript", "update-fields-on-document.painless", false); }
Source:
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { final Bundle bundle; { if (savedInstanceState != null) { bundle = savedInstanceState; } else { bundle = getArguments(); } } restore(bundle); View view = inflater.inflate(R.layout.fragment_course_outline_new, container, false); initListView(view); errorNotification = new FullScreenErrorNotification(listView); snackbarErrorNotification = new SnackbarErrorNotification(listView); fetchCourseComponent(view); return view; }

Target:
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { final Bundle bundle; { if (savedInstanceState != null) { bundle = savedInstanceState; } else { bundle = getArguments(); } } restore(bundle); final View view = inflater.inflate(R.layout.fragment_course_outline_new, container, false); initListView(view); errorNotification = new FullScreenErrorNotification(listView); snackbarErrorNotification = new SnackbarErrorNotification(listView); fetchCourseComponent(view); return view; }
Source:
public static void createDEAStandaloneGratuityPostingRule(StandaloneInstallmentBean bean, DegreeCurricularPlan degreeCurricularPlan) { check(AcademicPredicates.MANAGE_PAYMENTS); DegreeCurricularPlanServiceAgreementTemplate dcpSAT = degreeCurricularPlan.getServiceAgreementTemplate(); if (dcpSAT != null) { YearMonthDay startDate = bean.getStartDate(); LocalDate startLocalDate = new LocalDate(startDate.getYear(), startDate.getMonthOfYear(), startDate.getDayOfMonth()); BigDecimal ectsForYear = bean.getEctsForYear(); BigDecimal gratuityFactor = bean.getGratuityFactor(); BigDecimal ectsFactor = bean.getEctsFactor(); new StandaloneEnrolmentGratuityPR(startLocalDate.toDateTimeAtStartOfDay(), null, dcpSAT, ectsForYear, gratuityFactor, ectsFactor); } else { throw new DomainException(""); } }

Target:
public static void createDEAStandaloneGratuityPostingRule(StandaloneInstallmentBean bean, DegreeCurricularPlan degreeCurricularPlan) { check(AcademicPredicates.MANAGE_PAYMENTS); DegreeCurricularPlanServiceAgreementTemplate dcpSAT = degreeCurricularPlan.getServiceAgreementTemplate(); if (dcpSAT != null) { YearMonthDay startDate = bean.getStartDate(); LocalDate startLocalDate = new LocalDate(startDate.getYear(), startDate.getMonthOfYear(), startDate.getDayOfMonth()); BigDecimal ectsForYear = bean.getEctsForYear(); BigDecimal gratuityFactor = bean.getGratuityFactor(); BigDecimal ectsFactor = bean.getEctsFactor(); new StandaloneEnrolmentGratuityPR(startLocalDate.toDateTimeAtStartOfDay(), null, dcpSAT, ectsForYear, gratuityFactor, ectsFactor); } else { throw new DomainException("StandaloneEnrolmentGratuityPR.DegreeCurricularPlanServiceAgreementTemplate.cannot.be.null"); } }
Source:
ClusterContext(Set<AssignableReplica> replicaSet, int instanceCount, Map<String, ResourceAssignment> baselineAssignment, Map<String, ResourceAssignment> bestPossibleAssignment) { int totalReplicas = 0; int totalTopStateReplicas = 0; for (Map.Entry<String, List<AssignableReplica>> entry : replicaSet.stream() .collect(Collectors.groupingBy(AssignableReplica::getResourceName)) .entrySet()) { int replicas = entry.getValue().size(); totalReplicas += replicas; int replicaCnt = Math.max(1, estimateAvgReplicaCount(replicas, instanceCount)); _estimatedMaxPartitionByResource.put(entry.getKey(), replicaCnt); totalTopStateReplicas += entry.getValue().stream().filter(AssignableReplica::isReplicaTopState).count(); } _estimatedMaxPartitionCount = estimateAvgReplicaCount(totalReplicas, instanceCount); _estimatedMaxTopStateCount = estimateAvgReplicaCount(totalTopStateReplicas, instanceCount); _baselineAssignment = baselineAssignment.isEmpty() ? Collections.emptyMap() : baselineAssignment; _bestPossibleAssignment = bestPossibleAssignment.isEmpty() ? Collections.emptyMap() : baselineAssignment; }

Target:
ClusterContext(Set<AssignableReplica> replicaSet, int instanceCount, Map<String, ResourceAssignment> baselineAssignment, Map<String, ResourceAssignment> bestPossibleAssignment) { int totalReplicas = 0; int totalTopStateReplicas = 0; for (Map.Entry<String, List<AssignableReplica>> entry : replicaSet.stream() .collect(Collectors.groupingBy(AssignableReplica::getResourceName)) .entrySet()) { int replicas = entry.getValue().size(); totalReplicas += replicas; int replicaCnt = Math.max(1, estimateAvgReplicaCount(replicas, instanceCount)); _estimatedMaxPartitionByResource.put(entry.getKey(), replicaCnt); totalTopStateReplicas += entry.getValue().stream().filter(AssignableReplica::isReplicaTopState).count(); } _estimatedMaxPartitionCount = estimateAvgReplicaCount(totalReplicas, instanceCount); _estimatedMaxTopStateCount = estimateAvgReplicaCount(totalTopStateReplicas, instanceCount); _baselineAssignment = baselineAssignment; _bestPossibleAssignment = bestPossibleAssignment; }
Source:
private static ImmutableMap<String, FxIndex> loadFromCsv() { List<ResourceLocator> resources = ResourceConfig.orderedResources("FxIndexData.csv"); Map<String, FxIndex> map = new HashMap<>(); for (ResourceLocator resource : resources) { try { CsvFile csv = CsvFile.of(resource.getCharSource(), true); for (int i = 0; i < csv.rowCount(); i++) { FxIndex parsed = parseFxIndex(csv, i); map.put(parsed.getName(), parsed); } } catch (RuntimeException ex) { log.severe("Error processing resource as FX Index CSV file: " + resource + ex.getMessage()); return ImmutableMap.of(); } } return ImmutableMap.copyOf(map); }

Target:
private static ImmutableMap<String, FxIndex> loadFromCsv() { List<ResourceLocator> resources = ResourceConfig.orderedResources("FxIndexData.csv"); Map<String, FxIndex> map = new HashMap<>(); for (ResourceLocator resource : resources) { try { CsvFile csv = CsvFile.of(resource.getCharSource(), true); for (int i = 0; i < csv.rowCount(); i++) { FxIndex parsed = parseFxIndex(csv, i); map.put(parsed.getName(), parsed); } } catch (RuntimeException ex) { log.log(Level.SEVERE, "Error processing resource as FX Index CSV file: " + resource, ex); return ImmutableMap.of(); } } return ImmutableMap.copyOf(map); }
Source:
public void testNullACL() throws Exception { File tmpDir = ClientBase.createTmpDir(); ClientBase.setupTestEnv(); ZooKeeperServer zks = new ZooKeeperServer(tmpDir, tmpDir, 3000); final int PORT = Integer.parseInt(HOSTPORT.split(":")[1]); ServerCnxnFactory f = ServerCnxnFactory.createFactory(PORT, -1); f.startup(zks); ZooKeeper zk = ClientBase.createZKClient(HOSTPORT); try { try { zk.create("/foo", "foo".getBytes(), null, CreateMode.PERSISTENT); Assert.fail("Expected InvalidACLException for null ACL parameter"); } catch (InvalidACLException e) { } catch (Exception e) { LOG.error("Error in testNullACL", e); Assert.fail("Expected InvalidACLException for null ACL parameter"); } try { zk.create("/foo", "foo".getBytes(), null, CreateMode.PERSISTENT, null); Assert.fail("Expected InvalidACLException for null ACL parameter"); } catch (InvalidACLException e) { } catch (Exception e) { LOG.error("Error in testNullACL", e); Assert.fail("Expected InvalidACLException for null ACL parameter"); } try { zk.setACL("/foo", null, 0); Assert.fail("Expected InvalidACLException for null ACL parameter"); } catch (InvalidACLException e) { } catch (Exception e) { LOG.error("Error in testNullACL", e); Assert.fail("Expected InvalidACLException for null ACL parameter"); } } finally { zk.close(); f.shutdown(); zks.shutdown(); Assert.assertTrue("waiting for server down", ClientBase.waitForServerDown(HOSTPORT, ClientBase.CONNECTION_TIMEOUT)); } }

Target:
public void testNullACL() throws Exception { File tmpDir = ClientBase.createTmpDir(); ClientBase.setupTestEnv(); ZooKeeperServer zks = new ZooKeeperServer(tmpDir, tmpDir, 3000); final int PORT = Integer.parseInt(HOSTPORT.split(":")[1]); ServerCnxnFactory f = ServerCnxnFactory.createFactory(PORT, -1); f.startup(zks); ZooKeeper zk = ClientBase.createZKClient(HOSTPORT); try { try { zk.create("/foo", "foo".getBytes(), null, CreateMode.PERSISTENT); Assert.fail("Expected InvalidACLException for null ACL parameter"); } catch (InvalidACLException e) { } try { zk.create("/foo", "foo".getBytes(), null, CreateMode.PERSISTENT, null); Assert.fail("Expected InvalidACLException for null ACL parameter"); } catch (InvalidACLException e) { } try { zk.setACL("/foo", null, 0); Assert.fail("Expected InvalidACLException for null ACL parameter"); } catch (InvalidACLException e) { } } finally { zk.close(); f.shutdown(); zks.shutdown(); Assert.assertTrue("waiting for server down", ClientBase.waitForServerDown(HOSTPORT, ClientBase.CONNECTION_TIMEOUT)); } }
Source:
public void testChunkingSizeAndTime() throws IOException { final String testId = "testChunkingSizeAndTime"; final int recordCount = 25; final int deferredWriteDelay = 500; final IMonitoringController controller = this.createController(testId, deferredWriteDelay); for (int recordIndex = 0; recordIndex < recordCount; recordIndex++) { final OperationExecutionRecord record = new OperationExecutionRecord("op()", "SESS-ID", 0, recordIndex, recordIndex, "host", recordIndex, 1); controller.newMonitoringRecord(record); } LockSupport.parkNanos(2 * deferredWriteDelay * 1000000L); controller.terminateMonitoring(); final byte[] data = TestRawDataStorage.getInstance().getData(testId); final List<String> lines = TestChunkingCollector.linesFromData(data); final int numberOfLines = lines.size(); Assert.assertEquals(recordCount + 1, numberOfLines); }

Target:
public void testChunkingSizeAndTime() throws IOException { final String testId = "testChunkingSizeAndTime"; final int recordCount = 25; final int deferredWriteDelayInMs = 500; final IMonitoringController controller = this.createController(testId, deferredWriteDelayInMs); for (int recordIndex = 0; recordIndex < recordCount; recordIndex++) { final OperationExecutionRecord record = new OperationExecutionRecord("op()", "SESS-ID", 0, recordIndex, recordIndex, "host", recordIndex, 1); controller.newMonitoringRecord(record); } LockSupport.parkNanos(2 * deferredWriteDelayInMs * 1000000L); controller.terminateMonitoring(); final byte[] data = TestRawDataStorage.getInstance().getData(testId); final List<String> lines = TestChunkingCollector.linesFromData(data); final int numberOfLines = lines.size(); Assert.assertEquals(recordCount + 1, numberOfLines); }
Source:
public static File getSelectedFile(String extension, String description, DialogType type, boolean fixExtension) { JFileChooser chooser = new JFileChooser(); FileNameExtensionFilter filter = new FileNameExtensionFilter(description, extension); chooser.setFileFilter(filter); String currentDirectory = (String) ApplicationSettings.Setting.USER_LASTDIR.getValue(); if(currentDirectory != null && currentDirectory.length() > 0) { chooser.setCurrentDirectory(new File(currentDirectory)); } int returnVal = 0; switch (type) { case SAVE: chooser.setDialogTitle("Save As"); returnVal = chooser.showSaveDialog(null); break; case SAVEAS: chooser.setDialogTitle("Save As"); returnVal = chooser.showSaveDialog(null); break; case OPEN: returnVal = chooser.showOpenDialog(null); break; case PDF: returnVal = chooser.showDialog(null, "Generate PDF"); break; default: break; } if (returnVal == JFileChooser.APPROVE_OPTION) { File file = chooser.getSelectedFile(); if (!file.exists() && type == DialogType.OPEN) { JOptionPane.showMessageDialog(null, "File doesn't exist", "Item not found", JOptionPane.ERROR_MESSAGE); } else { String filePath = file.getAbsolutePath(); if (fixExtension && !filePath.endsWith("." + extension)) { file = new File(filePath + "." + extension); } ApplicationSettings.Setting.USER_LASTDIR.setValue(file.getAbsolutePath()); ApplicationSettings.INSTANCE.save(); return file; } } return null; }

Target:
public static File getSelectedFile(String extension, String description, DialogType type, boolean fixExtension) { JFileChooser chooser = new JFileChooser(); FileNameExtensionFilter filter = new FileNameExtensionFilter(description, extension); chooser.setFileFilter(filter); String currentDirectory = (String) ApplicationSettings.Setting.USER_LASTDIR.getValue(); if(currentDirectory != null && currentDirectory.length() > 0) { chooser.setCurrentDirectory(new File(currentDirectory)); } int returnVal = 0; switch (type) { case SAVE: case SAVEAS: chooser.setDialogTitle("Save As"); returnVal = chooser.showSaveDialog(null); break; case OPEN: returnVal = chooser.showOpenDialog(null); break; case PDF: returnVal = chooser.showDialog(null, "Generate PDF"); break; default: break; } if (returnVal == JFileChooser.APPROVE_OPTION) { File file = chooser.getSelectedFile(); if (!file.exists() && type == DialogType.OPEN) { JOptionPane.showMessageDialog(null, "File doesn't exist", "Item not found", JOptionPane.ERROR_MESSAGE); } else { String filePath = file.getAbsolutePath(); if (fixExtension && !filePath.endsWith("." + extension)) { file = new File(filePath + "." + extension); } ApplicationSettings.Setting.USER_LASTDIR.setValue(file.getAbsolutePath()); ApplicationSettings.INSTANCE.save(); return file; } } return null; }
Source:
private Optional<List<String>> parseResults(String[] lines) { List<String> result = new ArrayList<>(); for (String line : lines) { Matcher matcher = TEST.matcher(line); if (matcher.matches()) { result.add(matcher.group("name")); } } return Optional.of(result); }

Target:
private List<String> parseResults(String[] lines) { List<String> result = new ArrayList<>(); for (String line : lines) { Matcher matcher = TEST.matcher(line); if (matcher.matches()) { result.add(matcher.group("name")); } } return result; }
Source:
public Mono<Instant> renewMessageLock(UUID lockToken) { return renewMessageLock(new UUID[]{lockToken}) .last() .publishOn(scheduler); }

Target:
public Mono<Instant> renewMessageLock(UUID lockToken) { return renewMessageLock(new UUID[]{lockToken}) .next() .publishOn(scheduler); }
Source:
public static Process execute(String exportUnixFile, String initUnixFile) { Process p = null; try { File file = new File(exportUnixFile); if(!exportUnixFile.equals("")) p = Runtime.getRuntime().exec( "/bin/bash -c 'source "+exportUnixFile+"'"); file = new File(initUnixFile); p = Runtime.getRuntime().exec( "/bin/bash "+initUnixFile+""); p.waitFor(); } catch (Exception ex) { ex.printStackTrace(); System.exit(-1); p = null; } return null; }

Target:
public static Process execute(String exportUnixFile, String initUnixFile) { Process p = null; try { if (!exportUnixFile.equals("")) p = Runtime.getRuntime().exec( "/bin/bash -c 'source " + exportUnixFile + "'"); p = Runtime.getRuntime().exec("/bin/bash " + initUnixFile + ""); p.waitFor(); } catch (Exception ex) { ex.printStackTrace(); p = null; } return null; }
Source:
public static void create(IResource resource, GradleBuild gradleBuild, String message, Throwable exception, int lineNumber) throws CoreException { IMarker marker = resource.createMarker(GradleErrorMarker.ID); if (lineNumber >= 0) { marker.setAttribute(IMarker.LINE_NUMBER, lineNumber); } marker.setAttribute(IMarker.MESSAGE, collectErrorMessages(exception)); marker.setAttribute(IMarker.PRIORITY, IMarker.PRIORITY_HIGH); marker.setAttribute(IMarker.SEVERITY, IMarker.SEVERITY_ERROR); marker.setAttribute(IMarker.LOCATION, "Gradle build script"); marker.setAttribute(ATTRIBUTE_ROOT_DIR, gradleBuild.getBuildConfig().getRootProjectDirectory().getAbsolutePath()); if (exception != null) { marker.setAttribute(GradleErrorMarker.ATTRIBUTE_STACKTRACE, collectStacktrace(exception)); } }

Target:
public static void create(IResource resource, GradleBuild gradleBuild, String message, Throwable exception, int lineNumber) throws CoreException { IMarker marker = resource.createMarker(GradleErrorMarker.ID); if (lineNumber >= 0) { marker.setAttribute(IMarker.LINE_NUMBER, lineNumber); } marker.setAttribute(IMarker.MESSAGE, collectErrorMessages(exception)); marker.setAttribute(IMarker.PRIORITY, IMarker.PRIORITY_HIGH); marker.setAttribute(IMarker.SEVERITY, IMarker.SEVERITY_ERROR); marker.setAttribute(ATTRIBUTE_ROOT_DIR, gradleBuild.getBuildConfig().getRootProjectDirectory().getAbsolutePath()); if (exception != null) { marker.setAttribute(GradleErrorMarker.ATTRIBUTE_STACKTRACE, collectStacktrace(exception)); } }
Source:
protected InputStream openObjectStream(URI object) throws IOException { URLConnection urlConnection = object.toURL().openConnection(); if (!"".equals(httpAuthenticationUsername) && !"".equals(httpAuthenticationPassword)) { String userPass = httpAuthenticationUsername + ":" + httpAuthenticationPassword; String basicAuthString = "Basic " + Base64.getEncoder().encodeToString(StringUtils.toUtf8(userPass)); urlConnection.setRequestProperty("Authorization", basicAuthString); } return urlConnection.getInputStream(); }

Target:
protected InputStream openObjectStream(URI object) throws IOException { return openObjectStream(object, 0); }
Source:
protected void authenticateUser() { userType = gateKeeper.getCurrentUser(); }

Target:
protected void authenticateUser() { }
Source:
private int getRowForTheDay(int date) { int row = date / DAYS_IN_WEEK; return date % 7 == 0 ? row - 1 : row; }

Target:
private int getRowForTheDay(int date) { int row = date / DAYS_IN_WEEK; return date % DAYS_IN_WEEK == 0 ? row - 1 : row; }
Source:
public int hashCode() { int result = rowParts != null ? rowParts.hashCode() : 0; result = 31 * result + numberOfComponentsHashed; return result; }

Target:
public int hashCode() { final int prime = 31; int result = 1; result = prime * result + (numberOfComponentsHashed == 1 ? 1231 : 1237); result = prime * result + ((rowParts == null) ? 0 : rowParts.hashCode()); if (numberOfComponentsHashed > 1) { result = prime * result + numberOfComponentsHashed; } return result; }
Source:
private void setLayoutRestrictions(boolean allowScrollThumb, boolean allowAlphaJump, boolean bias) { Resources res = mPagedListView.getContext().getResources(); ImageView upButton = mPagedListView.findViewById(androidx.car.test.R.id.page_up); ImageView downButton = mPagedListView.findViewById(androidx.car.test.R.id.page_down); Button alphaJump = mPagedListView.findViewById(androidx.car.test.R.id.alpha_jump); View scrollThumb = mPagedListView.findViewById(androidx.car.test.R.id.scrollbar_thumb); View scrollBarView = mPagedListView.findViewById(androidx.car.test.R.id.paged_scroll_view); ViewGroup.LayoutParams params = scrollBarView.getLayoutParams(); int seperateMargin = res.getDimensionPixelSize(androidx.car.R.dimen.car_padding_4); int restrictedHeight = mPagedListView.getPaddingTop() + upButton.getHeight() + downButton.getHeight() + mPagedListView.getPaddingBottom() + seperateMargin; if (allowScrollThumb) { restrictedHeight += scrollThumb.getHeight() + seperateMargin; } if (allowAlphaJump) { restrictedHeight += alphaJump.getHeight() + seperateMargin; } if (bias) { restrictedHeight += -1; } params.height = restrictedHeight; try { mActivityRule.runOnUiThread(() -> { scrollBarView.setLayoutParams(params); }); } catch (Throwable throwable) { throwable.printStackTrace(); throw new RuntimeException(throwable); } }

Target:
private void setLayoutRestrictions(boolean allowScrollThumb, boolean allowAlphaJump, boolean bias) { ImageView upButton = mPagedListView.findViewById(androidx.car.test.R.id.page_up); ImageView downButton = mPagedListView.findViewById(androidx.car.test.R.id.page_down); Button alphaJump = mPagedListView.findViewById(androidx.car.test.R.id.alpha_jump); View scrollThumb = mPagedListView.findViewById(androidx.car.test.R.id.scrollbar_thumb); View scrollBarView = mPagedListView.findViewById(androidx.car.test.R.id.paged_scroll_view); ViewGroup.LayoutParams params = scrollBarView.getLayoutParams(); int seperateMargin = mPagedListView.getContext().getResources() .getDimensionPixelSize(androidx.car.R.dimen.car_padding_4); int restrictedHeight = mPagedListView.getPaddingTop() + upButton.getHeight() + downButton.getHeight() + mPagedListView.getPaddingBottom() + seperateMargin; if (allowScrollThumb) { restrictedHeight += scrollThumb.getHeight() + seperateMargin; } if (allowAlphaJump) { restrictedHeight += alphaJump.getHeight() + seperateMargin; } if (bias) { restrictedHeight += -1; } params.height = restrictedHeight; try { mActivityRule.runOnUiThread(() -> { scrollBarView.requestLayout(); }); } catch (Throwable throwable) { throwable.printStackTrace(); throw new RuntimeException(throwable); } }
Source:
@Override public E poll(long timeout, TimeUnit unit) throws InterruptedException { lock.lock(); try { long timeoutNanos = unit.toNanos(timeout); while (queue.isEmpty() && timeoutNanos > 0) { timeoutNanos = nonEmpty.awaitNanos(timeoutNanos); } E peek = queue.peek(); if (peek == null) { throw new NoSuchElementException(); } queue.remove(); return peek; } catch (IOException e) { QueueFile.<Error>getSneakyThrowable(e); return null; } finally { lock.unlock(); } }

Target:
@Override public E poll(long timeout, TimeUnit unit) throws InterruptedException { lock.lock(); try { long timeoutNanos = unit.toNanos(timeout); while (queue.isEmpty() && timeoutNanos > 0) { timeoutNanos = nonEmpty.awaitNanos(timeoutNanos); } E peek = queue.peek(); if (peek == null) { throw new NoSuchElementException(); } queue.remove(); return peek; } catch (IOException e) { throw QueueFile.<Error>getSneakyThrowable(e); } finally { lock.unlock(); } }
Source:
protected void initSelectedType() { final VmInterfaceType defaultNicType = getDeafultNicTypeByProfile(); getNicType().setItems(supportedVnicTypes, defaultNicType); }

Target:
protected void initSelectedType() { final VmInterfaceType defaultNicType = getDeafultNicTypeByProfile(); final Collection<VmInterfaceType> vnicTypes = supportedVnicTypes == null ? new ArrayList<VmInterfaceType>() : supportedVnicTypes; if (getNicType().getItems() != vnicTypes) { getNicType().setItems(vnicTypes, defaultNicType); } else { getNicType().setSelectedItem(defaultNicType); } }
Source:
private void doSlice(ObjectReader or, Slice s) throws IOException { dw = new DeltaWindow(block.config, block.dc, or, block.pm, block.list, s.beginIndex, s.endIndex); dw.search(); dw = null; }

Target:
private void doSlice(ObjectReader or, Slice s) throws IOException { DeltaWindow w = new DeltaWindow(block.config, block.dc, or, block.pm, block.list, s.beginIndex, s.endIndex); synchronized (this) { dw = w; } w.search(); synchronized (this) { dw = null; } }
Source:
protected void after() { logger.debug("S3 proxy is stopping"); try { s3Proxy.stop(); } catch (Exception e) { throw new RuntimeException("Unable to stop S3 proxy", e); } logger.debug("S3 proxy has stopped"); }

Target:
protected void after() { logger.debug("S3 proxy is stopping"); try { s3Proxy.stop(); BlobStore blobStore = blobStoreContext.getBlobStore(); for (StorageMetadata metadata : blobStore.list()) { blobStore.deleteContainer(metadata.getName()); } blobStoreContext.close(); } catch (Exception e) { throw new RuntimeException("Unable to stop S3 proxy", e); } FileUtils.deleteQuietly(blobStoreLocation); logger.debug("S3 proxy has stopped"); }
Source:
public String getResponseContinuation() { return this.inner.getContinuation(); }

Target:
public String getResponseContinuation() { return FeedResponse.getValueOrNull(this.inner.getResponseHeaders(), HttpConstants.HttpHeaders.CONTINUATION); }
Source:
public static @Nullable ResourceLocation guessName(@Nullable Object input) { if (input instanceof IForgeRegistryEntry) { return ((IForgeRegistryEntry) input).getRegistryName(); } else if (input instanceof ItemStack) { return getNameFromOutput((ItemStack) input); } else if (input instanceof String) { return new ResourceLocation("ore", (String) input); } else if (input instanceof IRailcraftObjectContainer) { IRailcraftObjectContainer<?> container = Code.cast(input); return container.getRegistryName(); } return null; }

Target:
public static @Nullable ResourceLocation guessName(@Nullable Object input) { if (input instanceof IForgeRegistryEntry) { return getNameFromOutput(Objects.requireNonNull(((IForgeRegistryEntry) input).getRegistryName())); } else if (input instanceof ItemStack) { return getNameFromOutput((ItemStack) input); } else if (input instanceof String) { return getNameFromOutput(new ResourceLocation("ore", (String) input)); } else if (input instanceof IRailcraftObjectContainer) { IRailcraftObjectContainer<?> container = Code.cast(input); return getNameFromOutput(container.getRegistryName()); } return null; }
Source:
public boolean execute() { Gson gsonParser = Utils.getTeammatesGson(); ArrayList<StudentEnrollDetails> enrollmentList = gsonParser .fromJson(enrollmentDetails, new TypeToken<ArrayList<StudentEnrollDetails>>(){} .getType()); log.info("Adjusting submissions for feedback session :" + sessionName + "in course : " + courseId); FeedbackSessionAttributes feedbackSession = FeedbackSessionsLogic.inst() .getFeedbackSession(sessionName, courseId); StudentsLogic stLogic = StudentsLogic.inst(); String errorString = "Error encountered while adjusting feedback session responses " + "of %s in course : %s : %s\n%s"; if(feedbackSession != null) { List<FeedbackResponseAttributes> allResponses = FeedbackResponsesLogic.inst() .getFeedbackResponsesForSession(feedbackSession.feedbackSessionName, feedbackSession.courseId); for (FeedbackResponseAttributes response : allResponses) { try { stLogic.adjustFeedbackResponseForEnrollments(enrollmentList, response); } catch (Exception e) { log.severe(String.format(errorString, sessionName, courseId, e.getMessage(), e.getStackTrace().toString())); return false; } } return true; } else { log.severe(String.format(errorString, sessionName, courseId, "feedback session is null", "")); return false; } }

Target:
public boolean execute() { Gson gsonParser = Utils.getTeammatesGson(); ArrayList<StudentEnrollDetails> enrollmentList = gsonParser .fromJson(enrollmentDetails, new TypeToken<ArrayList<StudentEnrollDetails>>(){} .getType()); log.info("Adjusting submissions for feedback session :" + sessionName + "in course : " + courseId); FeedbackSessionAttributes feedbackSession = FeedbackSessionsLogic.inst() .getFeedbackSession(sessionName, courseId); StudentsLogic stLogic = StudentsLogic.inst(); String errorString = "Error encountered while adjusting feedback session responses " + "of %s in course : %s : %s\n%s"; if(feedbackSession != null) { List<FeedbackResponseAttributes> allResponses = FeedbackResponsesLogic.inst() .getFeedbackResponsesForSession(feedbackSession.feedbackSessionName, feedbackSession.courseId); for (FeedbackResponseAttributes response : allResponses) { try { stLogic.adjustFeedbackResponseForEnrollments(enrollmentList, response); } catch (Exception e) { log.severe(String.format(errorString, sessionName, courseId, e.getMessage(), ActivityLogEntry.generateServletActionFailureLogMessage(request, e))); return false; } } return true; } else { log.severe(String.format(errorString, sessionName, courseId, "feedback session is null", "")); return false; } }
Source:
private void generateTarFile() throws IOException { File folder = new File(backupTempDirPath); File[] srcFiles = folder.listFiles(); if (srcFiles == null) { log.debug("no backup file found under directory {}", backupTempDirPath); return; } try (FileOutputStream fileOutput = new FileOutputStream(filePath); TarArchiveOutputStream tarOutput = new TarArchiveOutputStream(fileOutput)) { for (File srcFile : srcFiles) { addToTarFile(srcFile, tarOutput); } } catch (IOException e) { log.error("failed to generate a backup tar file {}", filePath); throw e; } log.debug("backup tar file is generated at {}", filePath); }

Target:
private void generateTarFile() throws IOException { File folder = new File(backupTempDirPath); File[] srcFiles = folder.listFiles(); if (srcFiles == null) { log.debug("no backup file found under directory {}", backupTempDirPath); return; } try (FileOutputStream fileOutput = new FileOutputStream(filePath); TarArchiveOutputStream tarOutput = new TarArchiveOutputStream(fileOutput)) { for (File srcFile : srcFiles) { addToTarFile(srcFile, tarOutput); } } catch (IOException e) { log.error("failed to generate a backup tar file {}", filePath); throw e; } log.info("backup tar file is generated at {}", filePath); }
Source:
public static Queue queueMapToQueue(Map<String, Object> map) { String name = (String) map.get("name"); boolean durable = (Boolean) map.get("durable"); boolean exclusive = false; boolean autoDelete = (Boolean) map.get("auto_delete"); @SuppressWarnings("unchecked") Map<String, Object> arguments = (Map<String, Object>) map.get("arguments"); map.remove("name"); map.remove("durable"); map.remove("auto_delete"); map.remove("arguments"); return new Queue(name, durable, exclusive, autoDelete, arguments, map); }

Target:
public static Queue queueMapToQueue(Map<String, Object> map) { String name = (String) map.get("name"); boolean durable = (Boolean) map.get("durable"); boolean exclusive = map.get("owner_pid_details") != null; boolean autoDelete = (Boolean) map.get("auto_delete"); @SuppressWarnings("unchecked") Map<String, Object> arguments = (Map<String, Object>) map.get("arguments"); map.remove("name"); map.remove("durable"); map.remove("auto_delete"); map.remove("arguments"); return new Queue(name, durable, exclusive, autoDelete, arguments, map); }
Source:
public boolean isAssignableTo(Type other) { if ( equals( other ) ) { return true; } TypeMirror typeMirrotToMatch = isWildCardExtendsBound() ? getTypeBound().typeMirror : typeMirror; TypeMirror otherTypeMirrotToMatch = other.isWildCardSuperBound() ? other.getTypeBound().typeMirror : other.typeMirror; return typeUtils.isAssignable( typeMirrotToMatch, otherTypeMirrotToMatch ); }

Target:
public boolean isAssignableTo(Type other) { if ( equals( other ) ) { return true; } TypeMirror typeMirrorToMatch = isWildCardExtendsBound() ? getTypeBound().typeMirror : typeMirror; return typeUtils.isAssignable( typeMirrorToMatch, other.typeMirror ); }
Source:
public void setNewCommand(UICommand newCommand) { this.newCommand = newCommand; }

Target:
private void setNewCommand(UICommand newCommand) { this.newCommand = newCommand; }
Source:
private void writeNullToLeaves(GroupColumnIO group) { IntArrayList nullCache = groupNullCache.get(group); if (nullCache == null || nullCache.isEmpty()) return; int parentDefinitionLevel = group.getParent().getDefinitionLevel(); for (ColumnWriter leafWriter : groupToLeafWriter.get(group)) { for (int repetitionLevel : groupNullCache.get(group)) { leafWriter.writeNull(repetitionLevel, parentDefinitionLevel); } } nullCache.clear(); }

Target:
private void writeNullToLeaves(GroupColumnIO group) { IntArrayList nullCache = groupNullCache.get(group); if (nullCache == null || nullCache.isEmpty()) return; int parentDefinitionLevel = group.getParent().getDefinitionLevel(); for (ColumnWriter leafWriter : groupToLeafWriter.get(group)) { for (IntIterator iter = nullCache.iterator(); iter.hasNext();) { int repetitionLevel = iter.nextInt(); leafWriter.writeNull(repetitionLevel, parentDefinitionLevel); } } nullCache.clear(); }
Source:
public PollerFlux<OperationResult, List<FormPage>> beginRecognizeContent(RecognizeOptions recognizeOptions) { if (recognizeOptions.getFormUrl() != null) { return beginRecognizeContentFromUrl(recognizeOptions); } Flux<ByteBuffer> buffer = getByteBufferFlux(recognizeOptions.getForm(), recognizeOptions.getFormData()); return new PollerFlux<>( recognizeOptions.getPollInterval(), contentStreamActivationOperation(buffer, recognizeOptions.getLength(), recognizeOptions.getFormContentType()), extractContentPollOperation(), (activationResponse, context) -> monoError(logger, new RuntimeException("Cancellation is not supported")), fetchExtractContentResult()); }

Target:
public PollerFlux<OperationResult, List<FormPage>> beginRecognizeContent(RecognizeOptions recognizeOptions) { try { Objects.requireNonNull(recognizeOptions, "'recognizeOptions' is required and cannot be null."); if (recognizeOptions.getFormUrl() != null) { return beginRecognizeContentFromUrl(recognizeOptions); } Flux<ByteBuffer> buffer = getByteBufferFlux(recognizeOptions.getForm(), recognizeOptions.getFormData()); return new PollerFlux<>( recognizeOptions.getPollInterval(), contentStreamActivationOperation(buffer, recognizeOptions.getLength(), recognizeOptions.getFormContentType()), extractContentPollOperation(), (activationResponse, context) -> monoError(logger, new RuntimeException("Cancellation is not supported")), fetchExtractContentResult()); } catch (RuntimeException ex) { return PollerFlux.error(ex); } }
Source:
public Map<List<Object>, Integer> processMessage(Message<?> message) { if (this.routingSlip == null) { synchronized (this) { if (this.routingSlip == null) { List<Object> routingSlipValues = new ArrayList<Object>(this.routingSlipPath.size()); for (Object path : this.routingSlipPath) { if (path instanceof String) { String entry = (String) path; if (this.beanFactory.containsBean(entry)) { Object bean = this.beanFactory.getBean(entry); Assert.state(bean instanceof MessageChannel || bean instanceof RoutingSlipRouteStrategy, "The RoutingSlip can contain only bean names of MessageChannel or " + "RoutingSlipRouteStrategy: " + bean); routingSlipValues.add(entry); } else { ExpressionEvaluatingRoutingSlipRouteStrategy strategy = new ExpressionEvaluatingRoutingSlipRouteStrategy(entry); strategy.setIntegrationEvaluationContext(this.evaluationContext); routingSlipValues.add(strategy); } } else { routingSlipValues.add(path); } } this.routingSlip = Collections.singletonMap(Collections.unmodifiableList(routingSlipValues), 0); } } } return this.routingSlip; }

Target:
public Map<List<Object>, Integer> processMessage(Message<?> message) { if (this.routingSlip == null) { synchronized (this) { if (this.routingSlip == null) { List<Object> routingSlipValues = new ArrayList<Object>(this.routingSlipPath.size()); for (Object path : this.routingSlipPath) { if (path instanceof String) { String entry = (String) path; if (this.beanFactory.containsBean(entry)) { Object bean = this.beanFactory.getBean(entry); if (!(bean instanceof MessageChannel || bean instanceof RoutingSlipRouteStrategy)) { throw new IllegalArgumentException("The RoutingSlip can contain " + "only bean names of MessageChannel or RoutingSlipRouteStrategy: " + bean); } routingSlipValues.add(entry); } else { ExpressionEvaluatingRoutingSlipRouteStrategy strategy = new ExpressionEvaluatingRoutingSlipRouteStrategy(entry); strategy.setIntegrationEvaluationContext(this.evaluationContext); routingSlipValues.add(strategy); } } else { routingSlipValues.add(path); } } this.routingSlip = Collections.singletonMap(Collections.unmodifiableList(routingSlipValues), 0); } } } return this.routingSlip; }
Source:
public Map<String, Set<DatastreamTask>> assign(List<DatastreamGroup> datastreams, List<String> instances, Map<String, Set<DatastreamTask>> currentAssignment) { LOG.info(String.format("Trying to assign datastreams {%s} to instances {%s} and the current assignment is {%s}", datastreams, instances, currentAssignment)); Map<String, Set<DatastreamTask>> assignment = new HashMap<>(); for (String instance : instances) { assignment.put(instance, new HashSet<>()); currentAssignment.computeIfAbsent(instance, (x) -> new HashSet<>()); } int instancePos = 0; for (DatastreamGroup dg : datastreams) { int numTask = Math.min(getMaxTasks(dg), instances.size()); for (int taskPos=0; taskPos <numTask; taskPos++) { String instance = instances.get(instancePos); DatastreamTask foundDatastreamTask = currentAssignment.get(instance).stream() .filter(x -> x.getTaskPrefix().equals(dg.getTaskPrefix())) .findFirst() .orElse(new DatastreamTaskImpl(dg.getDatastreams())); assignment.get(instance).add(foundDatastreamTask); instancePos = (instancePos + 1) % instances.size(); } } LOG.info(String.format("New assignment is {%s}", assignment)); return assignment; }

Target:
public Map<String, Set<DatastreamTask>> assign(List<DatastreamGroup> datastreams, List<String> instances, Map<String, Set<DatastreamTask>> currentAssignment) { LOG.info(String.format("Trying to assign datastreams {%s} to instances {%s} and the current assignment is {%s}", datastreams, instances, currentAssignment)); Map<String, Set<DatastreamTask>> assignment = new HashMap<>(); for (String instance : instances) { assignment.put(instance, new HashSet<>()); currentAssignment.computeIfAbsent(instance, (x) -> new HashSet<>()); } int instancePos = 0; for (DatastreamGroup dg : datastreams) { int numTask = getNumTasks(dg, instances.size()); for (int taskPos = 0; taskPos < numTask; taskPos++) { String instance = instances.get(instancePos); DatastreamTask foundDatastreamTask = currentAssignment.get(instance) .stream() .filter(x -> x.getTaskPrefix().equals(dg.getTaskPrefix())) .findFirst() .orElse(new DatastreamTaskImpl(dg.getDatastreams())); assignment.get(instance).add(foundDatastreamTask); instancePos = (instancePos + 1) % instances.size(); } } LOG.info(String.format("New assignment is {%s}", assignment)); return assignment; }
Source:
public void close() { synchronized (documentStores) { DocumentStore ds = documentStores.get(location); if (ds != null) { System.out.println("removing "+location); ((DatabaseImpl)database).close(); ((IndexManagerImpl)query).close(); documentStores.remove(location); } } eventBus.post(new DatabaseClosed(databaseName)); }

Target:
public void close() { synchronized (documentStores) { DocumentStore ds = documentStores.remove(location); if (ds != null) { ((DatabaseImpl)database).close(); ((IndexManagerImpl)query).close(); } else { throw new IllegalStateException("DocumentStore "+location+" already closed"); } } eventBus.post(new DatabaseClosed(databaseName)); }
Source:
public void updateInstructorByGoogleId(String googleId, InstructorAttributes instructor) throws InvalidParametersException, EntityDoesNotExistException { Assumption.assertNotNull("Supplied parameter was null", instructor); coursesLogic.verifyCourseIsPresent(instructor.courseId); verifyIsInstructorOfCourse(googleId, instructor.courseId); InstructorAttributes instructorToUpdate = getInstructorForGoogleId(instructor.courseId, googleId); instructorToUpdate.name = instructor.name; instructorToUpdate.email = instructor.email; instructorsDb.updateInstructorByGoogleId(instructorToUpdate); }

Target:
public void updateInstructorByGoogleId(String googleId, InstructorAttributes instructor) throws InvalidParametersException, EntityDoesNotExistException { Assumption.assertNotNull("Supplied parameter was null", instructor); coursesLogic.verifyCourseIsPresent(instructor.courseId); verifyIsGoogleIdOfInstructorOfCourse(googleId, instructor.courseId); InstructorAttributes instructorToUpdate = getInstructorForGoogleId(instructor.courseId, googleId); instructorToUpdate.name = instructor.name; instructorToUpdate.email = instructor.email; instructorsDb.updateInstructorByGoogleId(instructorToUpdate); }