auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public ChannelPipeline getPipeline() throws Exception { ChannelPipeline pipeline = pipeline(); pipeline.addLast("decoder", new HttpRequestDecoder()); pipeline.addLast("aggregator", new HttpChunkAggregator(1048576)); pipeline.addLast("encoder", new HttpResponseEncoder()); pipeline.addLast("deflater", new HttpContentCompressor()); pipeline.addLast("handler", new CoordinatorAdminRequestHandler(storeClientConfigs)); return pipeline; }

Target:
public ChannelPipeline getPipeline() throws Exception { ChannelPipeline pipeline = pipeline(); pipeline.addLast("decoder", new HttpRequestDecoder()); pipeline.addLast("aggregator", new HttpChunkAggregator(MAX_AGGREGATE_SIZE)); pipeline.addLast("encoder", new HttpResponseEncoder()); pipeline.addLast("deflater", new HttpContentCompressor()); pipeline.addLast("handler", new CoordinatorAdminRequestHandler(storeClientConfigs)); return pipeline; }
Source:
public void visitError(Node node, String message) { errors.add(String.format("[%s] - %s", node.getLocation().toString(), message)); }

Target:
public void visitError(Node node, String message) { errors.add(String.format("[%s] - %s", String.valueOf(node.getLocation()), message)); }
Source:
protected boolean initializeMatchingFrame(SearchPlanExecutor nextPlan) { frame = new MatchingFrame(nextPlan.getVariableMapping().size()); parametersOfFrameView = new VolatileModifiableMaskedTuple(frame, TupleMask.fromSelectedIndices(frame.getSize(), nextPlan.getParameterIndices())); for (int i = 0; i < parameterSeedMask.getSize(); i++) { int index = parameterSeedMask.indices[i]; Object valueToSet = parameterValues.get(i); if (valueToSet != null) { Object oldValue = parametersOfFrameView.get(index); if (oldValue == null) { parametersOfFrameView.set(index, valueToSet); } else if (!Objects.equals(valueToSet, oldValue)) { return false; } } } return true; }

Target:
protected boolean initializeMatchingFrame(SearchPlanExecutor nextPlan) { frame = new MatchingFrame(nextPlan.getVariableMapping().size()); parametersOfFrameView = new VolatileModifiableMaskedTuple(frame, nextPlan.getParameterMask()); for (int i = 0; i < parameterSeedMask.getSize(); i++) { int index = parameterSeedMask.indices[i]; Object valueToSet = parameterValues.get(i); if (valueToSet != null) { Object oldValue = parametersOfFrameView.get(index); if (oldValue == null) { parametersOfFrameView.set(index, valueToSet); } else if (!Objects.equals(valueToSet, oldValue)) { return false; } } } return true; }
Source:
public List<Marker> getMarkersByMapId(final Integer mapId) throws MiddlewareQueryException { List<Marker> dataValues = new ArrayList<>(); if (null == mapId) { return dataValues; } try { SQLQuery query = this.getSession().createSQLQuery(MarkerDAO.GET_MARKERS_BY_MAP_ID); query.setParameter("map_id", mapId); List results = query.list(); for (Object o : results) { Object[] result = (Object[]) o; if (result != null) { dataValues.add(this.convertToMarker(result)); } } return dataValues; } catch (HibernateException e) { this.logAndThrowException("Error with getMarkersByMapId() query from Marker: " + e.getMessage(), e); } return dataValues; }

Target:
public List<Marker> getMarkersByMapId(final Integer mapId) throws MiddlewareQueryException { List<Marker> dataValues = new ArrayList<>(); if (null == mapId) { return dataValues; } try { SQLQuery query = this.getSession().createSQLQuery(MarkerDAO.GET_MARKERS_BY_MAP_ID); query.setParameter("map_id", mapId); List results = query.list(); for (final Object o : results) { Object[] result = (Object[]) o; if (result != null) { dataValues.add(this.convertToMarker(result)); } } return dataValues; } catch (HibernateException e) { this.logAndThrowException("Error with getMarkersByMapId() query from Marker: " + e.getMessage(), e); } return dataValues; }
Source:
public void testInterruptedWhileWaitingForInputTransformers() throws InterruptedException { CdmServiceWaiter serviceWaiter = mock(CdmServiceWaiter.class); doThrow(new InterruptedException()).when(serviceWaiter).waitFor(anySet()); CdmState cdmState = new CdmState(); ContentDirectoryMonitor monitor = new ContentDirectoryMonitor( camelContext, mock(AttributeRegistry.class), 1, 1, Runnable::run, serviceWaiter, cdmState); monitor.systemSubjectBinder = exchange -> {}; monitor.setNumThreads(1); monitor.setReadLockIntervalMilliseconds(1000); submitConfigOptions(monitor, monitoredDirectoryPath, ContentDirectoryMonitor.MOVE); assertThat( "The content directory monitor should have no route definitions", monitor.getRouteDefinitions(), hasSize(0)); assertThat(cdmState.isRoutesStarted(), is(false)); Thread.interrupted(); }

Target:
public void testInterruptedWhileWaitingForInputTransformers() { Thread.currentThread().interrupt(); monitor.setInputTransformers(Collections.emptyList()); monitor.init(); assertThat( "The content directory monitor should have no route definitions", camelContext.getRouteDefinitions(), hasSize(0)); }
Source:
public void createSemanticTagEntity() throws IOException, JsonParseException, IllegalAccessException, IllegalArgumentException, InvocationTargetException { Annotation storedAnno = createTag(SEMANTICTAG_ENTITY, false); log.info(storedAnno.getBody().getInternalType()); assertTrue(storedAnno.getMotivation().equals(MotivationTypes.TAGGING.name().toLowerCase())); assertEquals(storedAnno.getBody().getInternalType(), BodyInternalTypes.ENTITY.name()); }

Target:
public void createSemanticTagEntity() throws IOException, JsonParseException, IllegalAccessException, IllegalArgumentException, InvocationTargetException { Annotation storedAnno = createTag(SEMANTICTAG_ENTITY, false); log.info(storedAnno.getBody().getInternalType()); assertTrue(storedAnno.getMotivation().equals(MotivationTypes.TAGGING.name().toLowerCase())); assertEquals(storedAnno.getBody().getInternalType(), BodyInternalTypes.AGENT.name()); }
Source:
private boolean scheduleSinkMessageAfterDelay(SinkMessage sinkMessage) { ScheduledFuture<Boolean> future = blockingSinkMessageScheduler.schedule( () -> sendSinkMessage(sinkMessage), SINK_BLOCKING_TIMEOUT, TimeUnit.MILLISECONDS); try { boolean succeeded = future.get(); if (succeeded) { return true; } } catch (InterruptedException | ExecutionException e) { LOG.error("Error while attempting to send sink message to gRPC IPC server", e); } return scheduleSinkMessageAfterDelay(sinkMessage); }

Target:
private boolean scheduleSinkMessageAfterDelay(SinkMessage sinkMessage) { ScheduledFuture<Boolean> future = blockingSinkMessageScheduler.schedule( () -> sendSinkMessage(sinkMessage), SINK_BLOCKING_TIMEOUT, TimeUnit.MILLISECONDS); try { boolean succeeded = future.get(); if (succeeded) { return true; } } catch (InterruptedException | ExecutionException e) { LOG.error("Error while attempting to send sink message with id from module to gRPC IPC server", sinkMessage.getMessageId(), sinkMessage.getModuleId(), e); } return scheduleSinkMessageAfterDelay(sinkMessage); }
Source:
protected boolean doExecute(ITestCase scenario) { try { if (Scenarios.isEclMode((Scenario) scenario.getNamedElement())) { IQ7NamedElement copy = scenario .getWorkingCopy(new NullProgressMonitor()); try { Scenario sc = (Scenario) copy.getNamedElement(); Scenarios.setTypeToTesla(sc, true); Scenarios.setTypeToEcl(sc); WriteAccessChecker writeAccessChecker = new WriteAccessChecker(); if (writeAccessChecker.makeResourceWritable(copy)) { copy.commitWorkingCopy(true, new NullProgressMonitor()); } } catch (CoreException e) { e.printStackTrace(); } finally { copy.discardWorkingCopy(); } return true; } } catch (ModelException e) { e.printStackTrace(); } return false; }

Target:
protected boolean doExecute(ITestCase scenario) { try { if (Scenarios.isEclMode((Scenario) scenario.getNamedElement())) { IQ7NamedElement copy = scenario .getWorkingCopy(new NullProgressMonitor()); try { Scenario sc = (Scenario) copy.getNamedElement(); Scenarios.setTypeToTesla(sc, true); Scenarios.setTypeToEcl(sc); WriteAccessChecker writeAccessChecker = new WriteAccessChecker(); if (writeAccessChecker.makeResourceWritable(copy)) { copy.commitWorkingCopy(true, new NullProgressMonitor()); } } catch (CoreException e) { Q7UIPlugin.log(e); } finally { copy.discardWorkingCopy(); } return true; } } catch (ModelException e) { Q7UIPlugin.log(e); } return false; }
Source:
public Map<String, Object> findQuestion(@PathVariable("id") Long id) { final Map<String, Object> response = new HashMap<String, Object>(); List<QuestionOptionDto> qoResults = new ArrayList<QuestionOptionDto>(); Question q = questionDao.getByKey(id); QuestionDto dto = null; if (q != null) { QuestionDtoMapper qdm = new QuestionDtoMapper(); dto = qdm.transform(q); if (q.getType() == Question.Type.OPTION) { Map<Integer, QuestionOption> qoMap = questionOptionDao.listOptionByQuestion(dto .getKeyId()); List<Long> qoList = new ArrayList<Long>(); for (QuestionOption qo : qoMap.values()) { QuestionOptionDto qoDto = new QuestionOptionDto(); BeanUtils.copyProperties(qo, qoDto, new String[] { "translationMap" }); qoDto.setKeyId(qo.getKey().getId()); qoList.add(qo.getKey().getId()); qoResults.add(qoDto); } dto.setQuestionOptions(qoList); } } response.put("questionOptions", qoResults); response.put("question", dto); return response; }

Target:
public Map<String, Object> findQuestion(@PathVariable("id") Long id) { final Map<String, Object> response = new HashMap<String, Object>(); List<QuestionOptionDto> qoResults = new ArrayList<QuestionOptionDto>(); Question q = questionDao.getByKey(id); QuestionDto dto = null; if (q != null) { QuestionDtoMapper qdm = new QuestionDtoMapper(); dto = qdm.transform(q); qoResults = attachAnyOptions(dto); } response.put("questionOptions", qoResults); response.put("question", dto); return response; }
Source:
public Item[] getDrops() { List<Item> drops = new ArrayList<>(); if (this.lastDamageCause instanceof EntityDamageByEntityEvent) { int rottenFlesh = Drops.rand(0, 2); int goldNuggets = Drops.rand(0, 101) <= 3 ? 1 : 0; int goldSword = Drops.rand(0, 101) <= 9 ? 1 : 0; for (int i=0; i < rottenFlesh; i++) { drops.add(Item.get(Item.ROTTEN_FLESH, 0, 1)); } for (int i=0; i < goldNuggets; i++) { drops.add(Item.get(Item.GOLD_NUGGET, 0, 1)); } for (int i=0; i < goldSword; i++) { drops.add(Item.get(Item.GOLD_SWORD, 0, 1)); } } return drops.toArray(new Item[drops.size()]); }

Target:
public Item[] getDrops() { List<Item> drops = new ArrayList<>(); if (this.lastDamageCause instanceof EntityDamageByEntityEvent) { int rottenFlesh = Drops.rand(0, 2); int goldNuggets = Drops.rand(0, 2); int goldSword = Drops.rand(0, 101) <= 9 ? 1 : 0; for (int i=0; i < rottenFlesh; i++) { drops.add(Item.get(Item.ROTTEN_FLESH, 0, 1)); } for (int i=0; i < goldNuggets; i++) { drops.add(Item.get(Item.GOLD_NUGGET, 0, 1)); } for (int i=0; i < goldSword; i++) { drops.add(Item.get(Item.GOLD_SWORD, 0, 1)); } } return drops.toArray(new Item[drops.size()]); }
Source:
public List<String> getRecoveryCodes() { return recoveryService.getRecoveryCodes().map(RecoveryCode::getCode).collect(toList()); }

Target:
public Map<String, List<String>> getRecoveryCodes() { return convertToRecoveryCodesMap( recoveryService.getRecoveryCodes().map(RecoveryCode::getCode).collect(toList())); }
Source:
public void testAssertRegexOnNullSensor() { boolean sensorTestFail = false; final String sensorValue = String.format("%s%s%s", UUID.randomUUID().toString(), System.currentTimeMillis(), UUID.randomUUID().toString()); app.createAndManageChild(EntitySpec.create(TestSensor.class) .configure(TestSensor.TARGET_ENTITY, app) .configure(TestSensor.SENSOR_NAME, STRING_SENSOR.getName()) .configure(TestSensor.ASSERTIONS, ImmutableMap.of("regex", String.format(".*%s.*", UUID.randomUUID().toString())))); try { app.start(ImmutableList.of(loc)); } catch (final PropagatedRuntimeException pre) { final AssertionError assertionError = Exceptions.getFirstThrowableOfType(pre, AssertionError.class); assertThat(assertionError).isNotNull().as("An assertion error should have been thrown"); sensorTestFail = true; } finally { assertThat(sensorTestFail).isTrue().as("regex assert should have failed"); } }

Target:
public void testAssertRegexOnNullSensor() { boolean sensorTestFail = false; app.createAndManageChild(EntitySpec.create(TestSensor.class) .configure(TestSensor.TARGET_ENTITY, app) .configure(TestSensor.SENSOR_NAME, STRING_SENSOR.getName()) .configure(TestSensor.ASSERTIONS, ImmutableMap.of("regex", String.format(".*%s.*", Identifiers.makeRandomId(8))))); try { app.start(ImmutableList.of(loc)); } catch (final PropagatedRuntimeException pre) { final AssertionError assertionError = Exceptions.getFirstThrowableOfType(pre, AssertionError.class); assertThat(assertionError).isNotNull().as("An assertion error should have been thrown"); sensorTestFail = true; } finally { assertThat(sensorTestFail).isTrue().as("regex assert should have failed"); } }
Source:
private void fillInUnsetIpConfigs() { for (NetworkAttachment networkAttachment : getParameters().getNetworkAttachments()) { if (networkAttachment.getIpConfiguration() == null) { IpConfiguration ipConfiguration = NetworkUtils.createDefaultIpConfiguration(); networkAttachment.setIpConfiguration(ipConfiguration); } } }

Target:
private void fillInUnsetIpConfigs() { getParameters().getNetworkAttachments().stream().forEach(networkAttachment -> { if (networkAttachment.getIpConfiguration() == null) { IpConfiguration ipConfiguration = NetworkUtils.createDefaultIpConfiguration(); networkAttachment.setIpConfiguration(ipConfiguration); } }); }
Source:
private void installDiscoveryService(final ServiceTarget serviceTarget, List<DiscoveryOption> discoveryOptions) { if (hostControllerInfo.getNativeManagementInterface() != null && !hostControllerInfo.getNativeManagementInterface().isEmpty() && hostControllerInfo.getNativeManagementPort() > 0) { DiscoveryService.install(serviceTarget, discoveryOptions, hostControllerInfo.getNativeManagementInterface(), hostControllerInfo.getNativeManagementPort(), REMOTE.toString(), hostControllerInfo.isMasterDomainController()); } else if (hostControllerInfo.getHttpManagementSecureInterface() != null && !hostControllerInfo.getHttpManagementSecureInterface().isEmpty() && hostControllerInfo.getHttpManagementSecurePort() > 0) { DiscoveryService.install(serviceTarget, discoveryOptions, hostControllerInfo.getHttpManagementSecureInterface(), hostControllerInfo.getHttpManagementSecurePort(), HTTPS_REMOTING.toString(), hostControllerInfo.isMasterDomainController()); } else { DiscoveryService.install(serviceTarget, discoveryOptions, hostControllerInfo.getHttpManagementInterface(), hostControllerInfo.getHttpManagementPort(), HTTP_REMOTING.toString(), hostControllerInfo.isMasterDomainController()); } }

Target:
private void installDiscoveryService(final ServiceTarget serviceTarget, List<DiscoveryOption> discoveryOptions) { List<DomainControllerManagementInterface> interfaces = new ArrayList<>(); if (hostControllerInfo.getNativeManagementInterface() != null && !hostControllerInfo.getNativeManagementInterface().isEmpty() && hostControllerInfo.getNativeManagementPort() > 0) { interfaces.add(new DomainControllerManagementInterface(hostControllerInfo.getNativeManagementPort(), hostControllerInfo.getNativeManagementInterface(), REMOTE)); } if (hostControllerInfo.getHttpManagementSecureInterface() != null && !hostControllerInfo.getHttpManagementSecureInterface().isEmpty() && hostControllerInfo.getHttpManagementSecurePort() > 0) { interfaces.add(new DomainControllerManagementInterface(hostControllerInfo.getHttpManagementSecurePort(), hostControllerInfo.getHttpManagementSecureInterface(), HTTPS_REMOTING)); } if (hostControllerInfo.getHttpManagementInterface() != null && !hostControllerInfo.getHttpManagementInterface().isEmpty() && hostControllerInfo.getHttpManagementPort() > 0) { interfaces.add(new DomainControllerManagementInterface(hostControllerInfo.getHttpManagementPort(), hostControllerInfo.getHttpManagementInterface(), HTTP_REMOTING)); } DiscoveryService.install(serviceTarget, discoveryOptions, interfaces, hostControllerInfo.isMasterDomainController()); }
Source:
public void testSuccessfulReadAhead() throws Exception { AbfsClient client = getMockAbfsClient(); AbfsRestOperation op = getMockRestOp(); doReturn(op) .doReturn(op) .doReturn(op) .doThrow(new TimeoutException("Internal Server error for RAH-X")) .doThrow(new TimeoutException("Internal Server error for RAH-Y")) .doThrow(new TimeoutException("Internal Server error for RAH-Z")) .when(client) .read(any(String.class), any(Long.class), any(byte[].class), any(Integer.class), any(Integer.class), any(String.class), any(String.class)); AbfsInputStream inputStream = getAbfsInputStream(client, "testSuccessfulReadAhead.txt"); int beforeReadCompletedListSize = ReadBufferManager.getBufferManager().getCompletedReadListSize(); inputStream.read(new byte[ONE_KB]); verifyReadCallCount(client, 3); int newAdditionsToCompletedRead = ReadBufferManager.getBufferManager().getCompletedReadListSize() - beforeReadCompletedListSize; assertTrue( "New additions to completed reads should be same or less than as number of readaheads", newAdditionsToCompletedRead <= 3); inputStream.read(ONE_KB, new byte[ONE_KB], 0, ONE_KB); verifyReadCallCount(client, 3); checkEvictedStatus(inputStream, 0, true); }

Target:
public void testSuccessfulReadAhead() throws Exception { AbfsClient client = getMockAbfsClient(); AbfsRestOperation op = getMockRestOp(); doReturn(op) .doReturn(op) .doReturn(op) .doThrow(new TimeoutException("Internal Server error for RAH-X")) .doThrow(new TimeoutException("Internal Server error for RAH-Y")) .doThrow(new TimeoutException("Internal Server error for RAH-Z")) .when(client) .read(any(String.class), any(Long.class), any(byte[].class), any(Integer.class), any(Integer.class), any(String.class), any(String.class)); AbfsInputStream inputStream = getAbfsInputStream(client, "testSuccessfulReadAhead.txt"); int beforeReadCompletedListSize = ReadBufferManager.getBufferManager().getCompletedReadListSize(); inputStream.read(new byte[ONE_KB]); verifyReadCallCount(client, 3); int newAdditionsToCompletedRead = ReadBufferManager.getBufferManager().getCompletedReadListSize() - beforeReadCompletedListSize; Assertions.assertThat(newAdditionsToCompletedRead) .describedAs( "New additions to completed reads should be same or less than as number of readaheads") .isLessThanOrEqualTo(3); inputStream.read(ONE_KB, new byte[ONE_KB], 0, ONE_KB); verifyReadCallCount(client, 3); checkEvictedStatus(inputStream, 0, true); }
Source:
public void testSetClientIdAfterSetExceptionListener() throws Exception { Connection conn = cf.createConnection(); conn.setExceptionListener((e) -> { }); conn.setClientID("clientId"); }

Target:
public void testSetClientIdAfterSetExceptionListener() throws Exception { Connection conn = cf.createConnection(); conn.setExceptionListener((e) -> { }); conn.setClientID("clientId"); conn.close(); }
Source:
public void muteTopic(Message message) { mutedTopics.add(message.getStream().getId() + message.getSubject()); SharedPreferences.Editor editor = settings.edit(); editor.putStringSet(MUTED_TOPIC_KEY, new HashSet<String>(mutedTopics)); editor.apply(); }

Target:
public void muteTopic(Message message) { mutedTopics.add(message.concatStreamAndTopic()); SharedPreferences.Editor editor = settings.edit(); editor.putStringSet(MUTED_TOPIC_KEY, new HashSet<String>(mutedTopics)); editor.apply(); }
Source:
public void deleteSnapshots(Pattern pattern) throws IOException { if (pattern != null && !pattern.matcher("").matches()) { for (SnapshotDescription description : listSnapshots(pattern)) { tableAdminClientWrapper.deleteBackupAsync( getClusterName().getClusterId(), description.getName()); } } }

Target:
public void deleteSnapshots(Pattern pattern) throws IOException { throw new UnsupportedOperationException("use deleteSnapshot instead"); }
Source:
public void testTruncateWithSplits() throws IOException { byte[][] splits = new byte[][] { Bytes.toBytes("AAA"), Bytes.toBytes("BBB"), Bytes.toBytes("CCC"), }; TableName tableName = IntegrationTests.newTestTableName(); HTableDescriptor descriptor = new HTableDescriptor(tableName); descriptor.addFamily(new HColumnDescriptor(COLUMN_FAMILY)); Admin admin = getConnection().getAdmin(); admin.createTable(descriptor, splits); try { try (Table table = getConnection().getTable(tableName)) { byte[] rowKey = dataHelper.randomData("testrow-"); byte[] qual = dataHelper.randomData("qual-"); byte[] value = dataHelper.randomData("value-"); Put put = new Put(rowKey); put.addColumn(COLUMN_FAMILY, qual, 1L, value); put.addColumn(COLUMN_FAMILY, qual, 2L, value); table.put(put); assertTrue(table.exists(new Get(rowKey))); admin.disableTable(tableName); admin.truncateTable(tableName, true); assertTrue(admin.tableExists(tableName)); assertFalse(table.exists(new Get(rowKey))); } List<HRegionLocation> regions = null; try (RegionLocator locator = getConnection().getRegionLocator(tableName)) { regions = locator.getAllRegionLocations(); } Assert.assertEquals(splits.length + 1, regions.size()); for (int i = 0; i < regions.size(); i++) { HRegionLocation region = regions.get(i); String start_key = Bytes.toString(region.getRegionInfo().getStartKey()); String end_key = Bytes.toString(region.getRegionInfo().getEndKey()); if (i == 0) { Assert.assertEquals(Bytes.toString(splits[0]), end_key); } else if (i == regions.size() - 1) { Assert.assertEquals(Bytes.toString(splits[splits.length - 1]), start_key); } else { Assert.assertEquals(Bytes.toString(splits[i - 1]), start_key); Assert.assertEquals(Bytes.toString(splits[i]), end_key); } } } finally { if (admin.tableExists(tableName)) { admin.disableTable(tableName); admin.deleteTable(tableName); } } }

Target:
public void testTruncateWithSplits() throws IOException { byte[][] splits = new byte[][] { Bytes.toBytes("AAA"), Bytes.toBytes("BBB"), Bytes.toBytes("CCC"), }; TableName tableName = IntegrationTests.newTestTableName(); HTableDescriptor descriptor = new HTableDescriptor(tableName); descriptor.addFamily(new HColumnDescriptor(COLUMN_FAMILY)); Admin admin = getConnection().getAdmin(); admin.createTable(descriptor, splits); testSpllits(tableName, splits); try { try (Table table = getConnection().getTable(tableName)) { byte[] rowKey = dataHelper.randomData("testrow-"); byte[] qual = dataHelper.randomData("qual-"); byte[] value = dataHelper.randomData("value-"); Put put = new Put(rowKey); put.addColumn(COLUMN_FAMILY, qual, 1L, value); put.addColumn(COLUMN_FAMILY, qual, 2L, value); table.put(put); assertTrue(table.exists(new Get(rowKey))); admin.disableTable(tableName); admin.truncateTable(tableName, true); assertTrue(admin.tableExists(tableName)); assertFalse(table.exists(new Get(rowKey))); } testSpllits(tableName, splits); } finally { if (admin.tableExists(tableName)) { admin.disableTable(tableName); admin.deleteTable(tableName); } } }
Source:
private void testOrderEditStagedUpdateAction(final OrderEditStagedUpdateAction orderEditStagedUpdateAction) { OrderEditFixtures.withUpdateableOrderEdit(client(), orderEdit -> { final OrderEditUpdateCommand orderEditUpdateCommand = OrderEditUpdateCommand.of(orderEdit, AddStagedAction.of(orderEditStagedUpdateAction)); final OrderEdit updatedOrderEdit = client().executeBlocking(orderEditUpdateCommand); Assertions.assertThat(updatedOrderEdit).isNotNull(); Assertions.assertThat(updatedOrderEdit.getStagedActions().get(0).getAction()).isEqualTo(orderEditStagedUpdateAction.getAction()); Assertions.assertThat(updatedOrderEdit.getStagedActions().get(0)).isInstanceOf(orderEditStagedUpdateAction.getClass()); return updatedOrderEdit; }); }

Target:
private void testOrderEditStagedUpdateAction(final OrderEditStagedUpdateAction orderEditStagedUpdateAction) { OrderEditFixtures.withUpdateableOrderEdit(client(), orderEdit -> { final OrderEditUpdateCommand orderEditUpdateCommand = OrderEditUpdateCommand.of(orderEdit, AddStagedAction.of(orderEditStagedUpdateAction)); final OrderEdit updatedOrderEdit = client().executeBlocking(orderEditUpdateCommand); Assertions.assertThat(updatedOrderEdit).isNotNull(); Assertions.assertThat(updatedOrderEdit.getStagedActions().size()).isEqualTo(1); Assertions.assertThat(updatedOrderEdit.getStagedActions().get(0).getAction()).isEqualTo(orderEditStagedUpdateAction.getAction()); Assertions.assertThat(updatedOrderEdit.getStagedActions().get(0)).isInstanceOf(orderEditStagedUpdateAction.getClass()); return updatedOrderEdit; }); }
Source:
public static StandardUsernamePasswordCredentials migrateCredentials(@Nonnull String username, String password, @CheckForNull URL url) { StandardUsernamePasswordCredentials cred = null; List<StandardUsernamePasswordCredentials> credentials = CredentialsMatchers.filter( CredentialsProvider.lookupCredentials( StandardUsernamePasswordCredentials.class, Jenkins.getInstance(), ACL.SYSTEM, URIRequirementBuilder.fromUri(url != null ? url.toExternalForm() : null).build() ), CredentialsMatchers.withUsername(username) ); for (StandardUsernamePasswordCredentials c : credentials) { if (StringUtils.equals(password, Secret.toString(c.getPassword()))) { cred = c; break; } } if (cred == null) { StandardUsernamePasswordCredentials newCredentials = new UsernamePasswordCredentialsImpl( CredentialsScope.SYSTEM, null, "Migrated by JIRA Plugin", username, password ); SystemCredentialsProvider.getInstance().getCredentials().add(newCredentials); try { SystemCredentialsProvider.getInstance().save(); LOGGER.log(Level.INFO, "Migrated credentials"); } catch (IOException e) { LOGGER.log(Level.WARNING, "Unable to store migrated credentials", e); } cred = newCredentials; } return cred; }

Target:
public static StandardUsernamePasswordCredentials migrateCredentials(@Nonnull String username, String password, @CheckForNull URL url) { List<StandardUsernamePasswordCredentials> credentials = CredentialsMatchers.filter( CredentialsProvider.lookupCredentials( StandardUsernamePasswordCredentials.class, Jenkins.getInstance(), ACL.SYSTEM, URIRequirementBuilder.fromUri(url != null ? url.toExternalForm() : null).build() ), CredentialsMatchers.withUsername(username) ); for (StandardUsernamePasswordCredentials c : credentials) { if (StringUtils.equals(password, Secret.toString(c.getPassword()))) { return c; } } StandardUsernamePasswordCredentials newCredentials = new UsernamePasswordCredentialsImpl( CredentialsScope.SYSTEM, null, "Migrated by JIRA Plugin", username, password ); SystemCredentialsProvider.getInstance().getCredentials().add(newCredentials); try { SystemCredentialsProvider.getInstance().save(); LOGGER.log(Level.INFO, "Provided username and password were successfully migrated and stored as {0}", newCredentials.getId()); } catch (IOException e) { LOGGER.log(Level.WARNING, "Unable to store migrated credentials", e); } return newCredentials; }
Source:
private void initializeMeta() throws BlockAlreadyExistsException, IOException, WorkerOutOfSpaceException { boolean isDirectoryNewlyCreated = FileUtils.createStorageDirPath(mDirPath, ServerConfiguration.get(PropertyKey.WORKER_DATA_FOLDER_PERMISSIONS)); if (isDirectoryNewlyCreated) { LOG.info("Folder was created!", mDirPath); } File dir = new File(mDirPath); File[] paths = dir.listFiles(); if (paths == null) { return; } for (File path : paths) { if (!path.isFile()) { if (!path.getName().equals(ServerConfiguration.get(PropertyKey.WORKER_DATA_TMP_FOLDER))) { LOG.error("{} in StorageDir is not a file", path.getAbsolutePath()); } try { org.apache.commons.io.FileUtils.deleteDirectory(path); } catch (IOException e) { LOG.error("can not delete directory {}", path.getAbsolutePath(), e); } } else { try { long blockId = Long.parseLong(path.getName()); addBlockMeta(new BlockMeta(blockId, path.length(), this)); } catch (NumberFormatException e) { LOG.error("filename of in StorageDir can not be parsed into long", path.getAbsolutePath(), e); if (path.delete()) { LOG.warn("file has been deleted", path.getAbsolutePath()); } else { LOG.error("can not delete file {}", path.getAbsolutePath()); } } } } }

Target:
private void initializeMeta() throws BlockAlreadyExistsException, IOException, WorkerOutOfSpaceException, InvalidPathException { boolean isDirectoryNewlyCreated = FileUtils.createStorageDirPath(mDirPath, ServerConfiguration.get(PropertyKey.WORKER_DATA_FOLDER_PERMISSIONS)); String tmpDir = Paths.get(ServerConfiguration.get(PropertyKey.WORKER_DATA_TMP_FOLDER)) .getName(0).toString(); if (isDirectoryNewlyCreated) { LOG.info("Folder was created!", mDirPath); } File dir = new File(mDirPath); File[] paths = dir.listFiles(); if (paths == null) { return; } for (File path : paths) { if (!path.isFile()) { if (!path.getName().equals(tmpDir)) { LOG.error("{} in StorageDir is not a file", path.getAbsolutePath()); } try { org.apache.commons.io.FileUtils.deleteDirectory(path); } catch (IOException e) { LOG.error("can not delete directory {}", path.getAbsolutePath(), e); } } else { try { long blockId = Long.parseLong(path.getName()); addBlockMeta(new BlockMeta(blockId, path.length(), this)); } catch (NumberFormatException e) { LOG.error("filename of in StorageDir can not be parsed into long", path.getAbsolutePath(), e); if (path.delete()) { LOG.warn("file has been deleted", path.getAbsolutePath()); } else { LOG.error("can not delete file {}", path.getAbsolutePath()); } } } } }
Source:
public String createDatabase() throws SQLException { return getJdbcUri(createNewDatabase()); }

Target:
public String createDatabase() throws SQLException { return getJdbcUri(createNewDB()); }
Source:
protected VMs mapCollection(List<org.ovirt.engine.core.common.businessentities.VM> entities) { VMs collection = new VMs(); for (org.ovirt.engine.core.common.businessentities.VM entity : entities) { VM vm = map(entity); collection.getVMs().add(addLinks(populate(vm, entity))); setPayload(vm); } return collection; }

Target:
protected VMs mapCollection(List<org.ovirt.engine.core.common.businessentities.VM> entities) { VMs collection = new VMs(); for (org.ovirt.engine.core.common.businessentities.VM entity : entities) { VM vm = map(entity); collection.getVMs().add(addLinks(populate(vm, entity))); } return collection; }
Source:
public void testConversions(TimeUnit unit, TimeUnit toTimeUnit, double factor) { Duration size = new Duration(1, unit).convertTo(toTimeUnit); assertEquals(size.getUnit(), toTimeUnit); assertEquals(size.getValue(), factor, factor * 0.001); assertEquals(size.getValue(toTimeUnit), factor, factor * 0.001); }

Target:
public void testConversions(TimeUnit unit, TimeUnit toTimeUnit, double factor) { Duration duration = new Duration(1, unit).convertTo(toTimeUnit); assertEquals(duration.getUnit(), toTimeUnit); assertEquals(duration.getValue(), factor, factor * 0.001); assertEquals(duration.getValue(toTimeUnit), factor, factor * 0.001); }
Source:
public RegionScanner preScannerOpen(ObserverContext<RegionCoprocessorEnvironment> e, Scan scan, RegionScanner s) throws IOException { s = super.preScannerOpen(e, scan, s); if (ScanUtil.isAnalyzeTable(scan)) { if (!ScanUtil.isLocalIndex(scan)) { scan.getFamilyMap().clear(); } scan.setStartRow(HConstants.EMPTY_START_ROW); scan.setStopRow(HConstants.EMPTY_END_ROW); scan.setFilter(null); } return s; }

Target:
public RegionScanner preScannerOpen(ObserverContext<RegionCoprocessorEnvironment> e, Scan scan, RegionScanner s) throws IOException { s = super.preScannerOpen(e, scan, s); if (ScanUtil.isAnalyzeTable(scan)) { scan.setStartRow(HConstants.EMPTY_START_ROW); scan.setStopRow(HConstants.EMPTY_END_ROW); scan.setFilter(null); } return s; }
Source:
public void killSyncthing() { for (int i = 0; i < 2; i++) { List<String> syncthingPIDs = getSyncthingPIDs(); if (syncthingPIDs.isEmpty()) { Log.d(TAG, "killSyncthing: Found no more running instances of " + Constants.FILENAME_SYNCTHING_BINARY); break; } int exitCode; String shellCmd; for (String syncthingPID : syncthingPIDs) { if (i > 0) { shellCmd = "sleep 3; kill -SIGKILL " + syncthingPID + "\n"; } else { shellCmd = "kill -SIGINT " + syncthingPID + "; sleep 1\n"; } exitCode = Util.runShellCommand(shellCmd, mUseRoot); if (exitCode == 0) { Log.d(TAG, "Killed Syncthing process " + syncthingPID); } else { Log.w(TAG, "Failed to kill Syncthing process " + syncthingPID + " exit code " + Integer.toString(exitCode)); } } } }

Target:
public void killSyncthing() { for (int i = 0; i < 2; i++) { List<String> syncthingPIDs = getSyncthingPIDs(); if (syncthingPIDs.isEmpty()) { Log.d(TAG, "killSyncthing: Found no more running instances of " + Constants.FILENAME_SYNCTHING_BINARY); break; } int exitCode; for (String syncthingPID : syncthingPIDs) { if (i > 0) { SystemClock.sleep(3000); exitCode = Util.runShellCommand("kill -SIGKILL " + syncthingPID + "\n", mUseRoot); } else { exitCode = Util.runShellCommand("kill -SIGINT " + syncthingPID + "\n", mUseRoot); SystemClock.sleep(1000); } if (exitCode == 0) { Log.d(TAG, "Killed Syncthing process " + syncthingPID); } else { Log.w(TAG, "Failed to kill Syncthing process " + syncthingPID + " exit code " + Integer.toString(exitCode)); } } } }
Source:
private String buildErrorLines(String prefix, String errorMessage) { StringBuffer errorLines = new StringBuffer(); String[] lines = errorMessage.split(KFSConstants.NEWLINE); for (String line : lines) { if (StringUtils.isNoneBlank(line)) { errorLines.append(prefix); errorLines.append(line); errorLines.append(KFSConstants.NEWLINE); } } return errorLines.toString(); }

Target:
private String buildErrorLines(String prefix, String errorMessage) { StringBuilder errorLines = new StringBuilder(); String[] lines = errorMessage.split(KFSConstants.NEWLINE); for (String line : lines) { if (StringUtils.isNotBlank(line)) { errorLines.append(prefix); errorLines.append(line); errorLines.append(KFSConstants.NEWLINE); } } return errorLines.toString(); }
Source:
public void createMatches(Comparison comparison, Iterator<? extends EObject> leftEObjects, Iterator<? extends EObject> rightEObjects, Iterator<? extends EObject> originEObjects, Monitor monitor) { final List<EObject> leftEObjectsNoID = Lists.newArrayList(); final List<EObject> rightEObjectsNoID = Lists.newArrayList(); final List<EObject> originEObjectsNoID = Lists.newArrayList(); List<EObject> leftList = Lists.newArrayList(leftEObjects); List<EObject> rightList = Lists.newArrayList(rightEObjects); List<EObject> originList = Lists.newArrayList(originEObjects); checkAndReportDuplicateIDs(comparison, leftList, Side.LEFT); checkAndReportDuplicateIDs(comparison, rightList, Side.RIGHT); checkAndReportDuplicateIDs(comparison, originList, Side.ORIGIN); final Set<Match> matches = matchPerId(leftList.iterator(), rightList.iterator(), originList .iterator(), leftEObjectsNoID, rightEObjectsNoID, originEObjectsNoID); Iterables.addAll(comparison.getMatches(), matches); if (delegate.isPresent()) { doDelegation(comparison, leftEObjectsNoID, rightEObjectsNoID, originEObjectsNoID, monitor); } else { for (EObject eObject : leftEObjectsNoID) { Match match = CompareFactory.eINSTANCE.createMatch(); match.setLeft(eObject); matches.add(match); } for (EObject eObject : rightEObjectsNoID) { Match match = CompareFactory.eINSTANCE.createMatch(); match.setRight(eObject); matches.add(match); } for (EObject eObject : originEObjectsNoID) { Match match = CompareFactory.eINSTANCE.createMatch(); match.setOrigin(eObject); matches.add(match); } } }

Target:
public void createMatches(Comparison comparison, Iterator<? extends EObject> leftEObjects, Iterator<? extends EObject> rightEObjects, Iterator<? extends EObject> originEObjects, Monitor monitor) { final List<EObject> leftEObjectsNoID = Lists.newArrayList(); final List<EObject> rightEObjectsNoID = Lists.newArrayList(); final List<EObject> originEObjectsNoID = Lists.newArrayList(); diagnostic = (BasicDiagnostic)Diagnostic.OK_INSTANCE; final Set<Match> matches = matchPerId(leftEObjects, rightEObjects, originEObjects, leftEObjectsNoID, rightEObjectsNoID, originEObjectsNoID); addDiagnostic(comparison); Iterables.addAll(comparison.getMatches(), matches); if (delegate.isPresent()) { doDelegation(comparison, leftEObjectsNoID, rightEObjectsNoID, originEObjectsNoID, monitor); } else { for (EObject eObject : leftEObjectsNoID) { Match match = CompareFactory.eINSTANCE.createMatch(); match.setLeft(eObject); matches.add(match); } for (EObject eObject : rightEObjectsNoID) { Match match = CompareFactory.eINSTANCE.createMatch(); match.setRight(eObject); matches.add(match); } for (EObject eObject : originEObjectsNoID) { Match match = CompareFactory.eINSTANCE.createMatch(); match.setOrigin(eObject); matches.add(match); } } }
Source:
public void run() { SentryEnvironment.startManagingThread(); try { actualConnection.send(event); } catch (LockedDownException e) { lockdownLogger.warn(e.getMessage()); } catch (Exception e) { logger.error("An exception occurred while sending the event to Sentry.", e); } finally { SentryEnvironment.stopManagingThread(); } }

Target:
public void run() { SentryEnvironment.startManagingThread(); try { actualConnection.send(event); } catch (LockedDownException | TooManyRequestsException e) { logger.debug("Dropping an Event due to lockdown: " + event); } catch (Exception e) { logger.error("An exception occurred while sending the event to Sentry.", e); } finally { SentryEnvironment.stopManagingThread(); } }
Source:
default Option<Tuple2<K, V>> max() { if (isEmpty()) { return Option.none(); } else { if (head()._2 instanceof Comparator) { final Comparator<Tuple2<K, V>> comparator = (e1, e2) -> ((Comparable<V>) e1._2).compareTo(e2._2); return iterator().maxBy(comparator); } else { return Option.none(); } } }

Target:
default Option<Tuple2<K, V>> max() { if (isEmpty()) { return Option.none(); } else { if (head()._2 instanceof Comparable) { final Comparator<Tuple2<K, V>> comparator = (e1, e2) -> ((Comparable<V>) e1._2).compareTo(e2._2); return iterator().maxBy(comparator); } else { return Option.none(); } } }
Source:
public String getContainerIdFromPath(final String fullPath) throws DotDataException { Host host = null; String hostname = this.getHostName(fullPath); try { if (null != hostname) { host = this.getHostFromHostname(hostname); } } catch (DotDataException | DotSecurityException e) { host = null; } if (null == host) { try { host = WebAPILocator.getHostWebAPI() .getCurrentHost(HttpServletRequestThreadLocal.INSTANCE.getRequest()); } catch (DotSecurityException | PortalException | SystemException e) { Logger.debug(FileAssetContainerUtil.class, e.getMessage()); try { host = APILocator.getHostAPI().findDefaultHost(APILocator.systemUser(), false); } catch (DotDataException | DotSecurityException ex) { Logger.debug(FileAssetContainerUtil.class, e.getMessage()); host = APILocator.systemHost(); } } } if (null == hostname) { hostname = null != host?host.getHostname():StringPool.BLANK; } final String relativePath = this.getPathFromFullPath (hostname, fullPath); final String containerUri = (relativePath.endsWith(FORWARD_SLASH)? relativePath:relativePath+FORWARD_SLASH)+"container.vtl"; final Identifier identifier = APILocator.getIdentifierAPI().find(host, containerUri); return identifier.getId(); }

Target:
public String getContainerIdFromPath(final String fullPath) throws DotDataException { Host host = null; String hostname = this.getHostName(fullPath); try { if (null != hostname) { host = this.getHostFromHostname(hostname); } } catch (DotDataException | DotSecurityException e) { host = null; } if (null == host) { try { host = WebAPILocator.getHostWebAPI() .getCurrentHost(HttpServletRequestThreadLocal.INSTANCE.getRequest()); } catch (DotSecurityException | PortalException | SystemException e) { Logger.warnAndDebug(FileAssetContainerUtil.class, e); try { host = APILocator.getHostAPI().findDefaultHost(APILocator.systemUser(), false); } catch (DotDataException | DotSecurityException ex) { Logger.warnAndDebug(FileAssetContainerUtil.class, e); host = APILocator.systemHost(); } } } if (null == hostname) { hostname = null != host?host.getHostname():StringPool.BLANK; } final String relativePath = this.getPathFromFullPath (hostname, fullPath); final String containerUri = (relativePath.endsWith(FORWARD_SLASH)? relativePath:relativePath+FORWARD_SLASH)+"container.vtl"; final Identifier identifier = APILocator.getIdentifierAPI().find(host, containerUri); return identifier.getId(); }
Source:
public boolean textboxKeyTyped(char par1, int par2) { if (getEnabled() && this.isFocused() && par1 == '\r') { return true; setFocused(false); } return super.textboxKeyTyped(par1, par2); }

Target:
public boolean textboxKeyTyped(char par1, int par2) { if (getEnabled() && this.isFocused() && par1 == '\r') { setFocused(false); return true; } return super.textboxKeyTyped(par1, par2); }
Source:
public void nonWritableDatastoreManagerPathThrows() throws DatastoreNotOpenedException, IOException { File f = new File(TEST_PATH, "c_root_test"); try { FileUtils.forceMkdir(f); f.setReadOnly(); DocumentStore ds = DocumentStore.getInstance(f); ds.close(); } finally { f.setWritable(true); f.delete(); } }

Target:
public void nonWritableDatastoreManagerPathThrows() throws DatastoreNotOpenedException, IOException { File f = new File(TEST_PATH, "c_root_test"); try { f.mkdirs(); f.setReadOnly(); DocumentStore ds = DocumentStore.getInstance(f); ds.close(); } finally { f.setWritable(true); f.delete(); } }
Source:
public void doGet(final HttpServletRequest request, final HttpServletResponse response) throws ServletException, IOException { if (this.sharedCache.size() == MAX_SIZE_OF_QUEUE) { this.sharedCache.clear(); } response.setContentType("text/event-stream"); response.setCharacterEncoding("UTF-8"); response.setHeader("Cache-control", "no-cache"); response.setHeader("Connection", "keep-alive"); final PrintWriter writer = response.getWriter(); while (!this.sharedCache.isEmpty()) { writer.write("data: " + this.sharedCache.poll() + "\n\n"); } writer.flush(); writer.close(); }

Target:
public void doGet(final HttpServletRequest request, final HttpServletResponse response) throws ServletException, IOException { final String sessionId = request.getParameter("session"); if (!isNullOrEmpty(sessionId)) { this.requests.put(sessionId, request); } response.setContentType("text/event-stream"); response.setCharacterEncoding("UTF-8"); response.setHeader("Cache-control", "no-cache"); response.setHeader("Connection", "keep-alive"); response.setHeader("Access-Control-Allow-Origin", "*"); final HttpSession session = request.getSession(false); session.setMaxInactiveInterval(MAX_INACTIVE_INTERVAL); final String sessionToDestroy = request.getParameter("logout"); if ((!isNullOrEmpty(sessionToDestroy)) && this.requests.containsKey(sessionId)) { this.requests.remove(sessionId); session.invalidate(); return; } final BlockingQueue<String> eventQueue = new LinkedBlockingQueue<>(MAX_SIZE_OF_QUEUE); final ServletOutputStream outputStream = response.getOutputStream(); final PrintStream printStream = new PrintStream(outputStream); final AtomicReference<Closeable> closeableReference = new AtomicReference<>(outputStream); final CompletableFuture<Void> elementRemovalFuture = CompletableFuture.runAsync(() -> { try { final boolean sessionExistsAndValid = this.requests.containsKey(sessionId) && this.requests.get(sessionId).isRequestedSessionIdValid(); while (sessionExistsAndValid) { final String data = eventQueue.poll(2, TimeUnit.SECONDS); if (isNull(data)) { printStream.print(":\n\n"); } else { printStream.printf("data: %s%n%n", data); } printStream.flush(); } } catch (final InterruptedException ex) { logger.warn("Element removal timeout..." + stackTraceAsString(ex)); response.setStatus(HttpServletResponse.SC_OK); } }); final ServiceRegistration<?> registration = registerEventHandler(EMIT_EVENT_TOPIC, eventQueue, sessionId, closeableReference, elementRemovalFuture); final CompletableFuture<Void> cleanupFuture = elementRemovalFuture.handle((ok, exeption) -> { registration.unregister(); try { outputStream.close(); } catch (final IOException ex) { logger.warn("Outport Stream closing issue..." + stackTraceAsString(ex)); } return null; }); try { cleanupFuture.join(); } catch (RuntimeException re) { } }
Source:
public void validate(PlanNode plan, Session session, Metadata metadata, SqlParser sqlParser, Map<Symbol, Type> types) { for (Expression expression : ExpressionExtractor.extractExpressions(plan)) { new DefaultTraversalVisitor<Void, Void>() { @Override protected Void visitIdentifier(Identifier node, Void context) { throw new IllegalStateException(format("Unexpected identifier in logical plan: %s", node)); } }.process(expression, null); } }

Target:
public void validate(PlanNode plan, Session session, Metadata metadata, SqlParser sqlParser, Map<Symbol, Type> types) { List<Identifier> identifiers = ExpressionTreeUtils.extractExpressions(ExpressionExtractor.extractExpressions(plan), Identifier.class); if (!identifiers.isEmpty()) { throw new IllegalStateException("Unexpected identifier in logical plan: " + identifiers.get(0)); } }
Source:
public void onTerminate() { unregisterExtranlControlClient(); super.onTerminate(); }

Target:
public void onTerminate() { super.onTerminate(); }
Source:
public void testSnapshotMapReduceJobNotImpactingTableMapReduceJob() throws Exception { PhoenixMapReduceUtil .setInput(job, PhoenixIndexDBWritable.class, SNAPSHOT_NAME, tableName, tmpDir, null, FIELD1, FIELD2, FIELD3); configureJob(job, tableName, null, null, false); Connection conn = DriverManager.getConnection(getUrl()); tableName = generateUniqueName(); conn.createStatement().execute(String.format(CREATE_TABLE, tableName)); conn.commit(); createAndTestJob(conn); }

Target:
public void testSnapshotMapReduceJobNotImpactingTableMapReduceJob() throws Exception { PhoenixMapReduceUtil .setInput(job, PhoenixIndexDBWritable.class, SNAPSHOT_NAME, tableName, tmpDir, null, FIELD1, FIELD2, FIELD3); configureJob(job, tableName, null, null, false); Configuration config = job.getConfiguration(); Assert.assertEquals("Correct snapshot name not found in configuration", SNAPSHOT_NAME, config.get(PhoenixConfigurationUtil.SNAPSHOT_NAME_KEY)); try (Connection conn = DriverManager.getConnection(getUrl())) { tableName = generateUniqueName(); conn.createStatement().execute(String.format(CREATE_TABLE, tableName)); conn.commit(); job = createAndTestJob(conn); } config = job.getConfiguration(); Assert.assertNull("Snapshot name is not null in Configuration", config.get(PhoenixConfigurationUtil.SNAPSHOT_NAME_KEY)); }
Source:
protected void endSuccessfully() { removeRedudantVolumesForOrphanedDisks(); if (!getParameters().isParentHasTasks()) { getBackend().endAction(getParameters().getParentCommand(), getParameters().getParentParameters(), getContext().clone().withoutCompensationContext().withoutExecutionContext().withoutLock()); } }

Target:
protected void endSuccessfully() { removeRedundantVolumesForOrphanedDisks(); if (!getParameters().isParentHasTasks()) { getBackend().endAction(getParameters().getParentCommand(), getParameters().getParentParameters(), getContext().clone().withoutCompensationContext().withoutExecutionContext().withoutLock()); } }
Source:
public double getDouble(ByteBuffer buf, int position) { return buf.getDouble(position); }

Target:
public double getDouble(ByteBuffer buf, int position) { return (double) buf.getLong(position); }
Source:
public ValidationResult validateStatusForActivation() { ValidationResult existsValidation = exists(); if (!existsValidation.isValid()) { return existsValidation; } if (vds.getStatus().equals(VDSStatus.Up)) { return new ValidationResult(VdcBllMessages.VDS_ALREADY_UP); } if (vds.getStatus().equals(VDSStatus.NonResponsive)) { return new ValidationResult(VdcBllMessages.VDS_NON_RESPONSIVE); } return ValidationResult.VALID; }

Target:
public ValidationResult validateStatusForActivation() { ValidationResult existsValidation = exists(); if (!existsValidation.isValid()) { return existsValidation; } if (VDSStatus.Up == vds.getStatus()) { return new ValidationResult(VdcBllMessages.VDS_ALREADY_UP); } if (VDSStatus.NonResponsive == vds.getStatus()) { return new ValidationResult(VdcBllMessages.VDS_NON_RESPONSIVE); } return ValidationResult.VALID; }
Source:
protected abstract void sendEmailWithService(EmailWrapper wrapper) throws Exception; static boolean isErrorStatus(int statusCode) { return statusCode < 200 || statusCode > 299; }

Target:
protected abstract void sendEmailWithService(EmailWrapper wrapper) throws Exception; static boolean isNotSuccessStatus(int statusCode) { return statusCode < 200 || statusCode > 299; }