auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>protected boolean canDoAction() { if (!super.canDoAction()) { return false; } if (getParameters().getSysPrepUserName() == null ^ getParameters().getSysPrepPassword() == null) { return failCanDoAction(VdcBllMessages.VM_CANNOT_RUN_ONCE_WITH_ILLEGAL_SYSPREP_PARAM); } if (getParameters().getVmInit() != null) { if (!OsRepositoryImpl.INSTANCE.isWindows(getVm().getOs()) && !FeatureSupported.cloudInit(getVm().getVdsGroupCompatibilityVersion())) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_CLOUD_INIT_IS_NOT_SUPPORTED); } if (getParameters().getVmInit().isPasswordAlreadyStored()) { VmBase temp = new VmBase(); temp.setId(getParameters().getVmId()); VmHandler.updateVmInitFromDB(temp, false); getParameters().getVmInit().setRootPassword(temp.getVmInit().getRootPassword()); } } <START> if (getParameters().getVmPayload() == null) { <END> loadPayload(); } return true; }</code><technical_language>please move this initialization code constructor</technical_language>

Target:
protected boolean canDoAction() { if (!super.canDoAction()) { return false; } if (getParameters().getSysPrepUserName() == null ^ getParameters().getSysPrepPassword() == null) { return failCanDoAction(VdcBllMessages.VM_CANNOT_RUN_ONCE_WITH_ILLEGAL_SYSPREP_PARAM); } if (getParameters().getVmInit() != null) { if (!OsRepositoryImpl.INSTANCE.isWindows(getVm().getOs()) && !FeatureSupported.cloudInit(getVm().getVdsGroupCompatibilityVersion())) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_CLOUD_INIT_IS_NOT_SUPPORTED); } if (getParameters().getVmInit().isPasswordAlreadyStored()) { VmBase temp = new VmBase(); temp.setId(getParameters().getVmId()); VmHandler.updateVmInitFromDB(temp, false); getParameters().getVmInit().setRootPassword(temp.getVmInit().getRootPassword()); } } return true; }
Source:
<code>public void testRuleTableGDSTWorkItem() throws Exception { final String xml = loadResource("WorkItem.gdst"); final GuidedDecisionTable52 table52 = GuidedDTXMLPersistence.getInstance() .unmarshal(xml); final Analyzer analyzer = analyzerProvider.makeAnalyser(table52); analyzer.resetChecks(); analyzer.analyze(); final Set<Issue> analysisReport = analyzerProvider.getAnalysisReport(); for (final Issue issue : analysisReport) { System.out.println(issue.getCheckType()); System.out.println(issue.getDebugMessage()); <START> } <END> assertTrue(analysisReport.isEmpty()); }</code><technical_language>I remove this for cycle some logger</technical_language>

Target:
public void testRuleTableGDSTWorkItem() throws Exception { final String xml = loadResource("WorkItem.gdst"); final GuidedDecisionTable52 table52 = GuidedDTXMLPersistence.getInstance() .unmarshal(xml); final Analyzer analyzer = analyzerProvider.makeAnalyser(table52); analyzer.resetChecks(); analyzer.analyze(); final Set<Issue> analysisReport = analyzerProvider.getAnalysisReport(); assertTrue(analysisReport.isEmpty()); }
Source:
<code>public void updatingTimestampForOneShardDoesNotAffectOthers() { progress.updateLastSweptTimestampPartition(10, true, 1024L); assertThat(progress.getLastSweptTimestampPartition(20, true)).isEqualTo(-1L); progress.updateLastSweptTimestampPartition(20, true, 512L); assertThat(progress.getLastSweptTimestampPartition(20, true)).isEqualTo(512L); <START> assertThat(progress.getLastSweptTimestampPartition(10, true)).isEqualTo(1024L); <END> }</code><technical_language>nit: this more 1024L (since update hit (10, true) a noop)</technical_language>

Target:
public void updatingTimestampForOneShardDoesNotAffectOthers() { assertThat(progress.getLastSweptTimestampPartition(CONSERVATIVE_TEN)).isEqualTo(INITIAL_TIMESTAMP); assertThat(progress.getLastSweptTimestampPartition(CONSERVATIVE_TWENTY)).isEqualTo(INITIAL_TIMESTAMP); progress.updateLastSweptTimestampPartition(CONSERVATIVE_TEN, 1024L); assertThat(progress.getLastSweptTimestampPartition(CONSERVATIVE_TWENTY)).isEqualTo(INITIAL_TIMESTAMP); progress.updateLastSweptTimestampPartition(CONSERVATIVE_TWENTY, 512L); assertThat(progress.getLastSweptTimestampPartition(CONSERVATIVE_TWENTY)).isEqualTo(512L); assertThat(progress.getLastSweptTimestampPartition(CONSERVATIVE_TEN)).isEqualTo(1024L); }
Source:
<code>protected void deleteItems(List<Scene> selectedItems) { setShowProgressBar(true); for (Scene item : selectedItems) { try { sceneController.delete(item); } catch (IOException e) { Log.e(TAG, Log.getStackTraceString(e)); } adapter.remove(item); } ToastUtil.showSuccess(getActivity(), getResources().getQuantityString(R.plurals.deleted_scenes, selectedItems.size(), selectedItems.size())); finishActionMode(); if (adapter.getItems().isEmpty()) { createEmptySceneWithDefaultName(); } Project currentProject = ProjectManager.getInstance().getCurrentProject(); if (currentProject.getSceneList().size() < 2) { <START> switchToSpriteListFragment(currentProject); <END> } }</code><technical_language>added parameter a scene removed currentlyEditedScene is updated correctly, absolutely sense. However, set instead of extra setCurrentProject(..), easier understand do is necessary</technical_language>

Target:
protected void deleteItems(List<Scene> selectedItems) { setShowProgressBar(true); for (Scene item : selectedItems) { try { sceneController.delete(item); } catch (IOException e) { Log.e(TAG, Log.getStackTraceString(e)); } adapter.remove(item); } ToastUtil.showSuccess(getActivity(), getResources().getQuantityString(R.plurals.deleted_scenes, selectedItems.size(), selectedItems.size())); finishActionMode(); if (adapter.getItems().isEmpty()) { createEmptySceneWithDefaultName(); } Project currentProject = ProjectManager.getInstance().getCurrentProject(); if (currentProject.getSceneList().size() < 2) { ProjectManager.getInstance().setCurrentlyEditedScene(currentProject.getDefaultScene()); switchToSpriteListFragment(); } }
Source:
<code>public Sequence<T> run(final Query<T> query) { final boolean isBySegment = query.getContextBySegment(false); final boolean shouldFinalize = query.getContextFinalize(true); Function<T, T> finalizerFn; if (shouldFinalize) { if (isBySegment) { finalizerFn = new Function<T, T>() { final Function<T, T> baseFinalizer = toolChest.makePostComputeManipulatorFn( query, new MetricManipulationFn() { @Override public Object manipulate(AggregatorFactory factory, Object object) { return factory.finalizeComputation(factory.deserialize(object)); } } ); @Override @SuppressWarnings("unchecked") public T apply(@Nullable T input) { Result<BySegmentResultValueClass<T>> result = (Result<BySegmentResultValueClass<T>>) input; BySegmentResultValueClass<T> resultsClass = result.getValue(); return (T) new Result<BySegmentResultValueClass>( result.getTimestamp(), new BySegmentResultValueClass( Lists.transform(resultsClass.getResults(), baseFinalizer), resultsClass.getSegmentId(), resultsClass.getInterval() ) ); } }; } else { finalizerFn = toolChest.makePostComputeManipulatorFn( query, new MetricManipulationFn() { @Override public Object manipulate(AggregatorFactory factory, Object object) { return factory.finalizeComputation(object); } } ); } } else { finalizerFn = toolChest.makePostComputeManipulatorFn( query, new MetricManipulationFn() { @Override public Object manipulate(AggregatorFactory factory, Object object) { return object; } } ); } return Sequences.map( <START> baseRunner.run(query.withOverriddenContext(ImmutableMap.<String, Object>of("finalize", false))), <END> finalizerFn ); }</code><technical_language>override context finalize</technical_language>

Target:
public Sequence<T> run(final Query<T> query) { final boolean isBySegment = query.getContextBySegment(false); final boolean shouldFinalize = query.getContextFinalize(true); final Query<T> queryToRun; final Function<T, T> finalizerFn; if (shouldFinalize) { queryToRun = query.withOverriddenContext(ImmutableMap.<String, Object>of("finalize", false)); if (isBySegment) { finalizerFn = new Function<T, T>() { final Function<T, T> baseFinalizer = toolChest.makePostComputeManipulatorFn( query, new FinalizeMetricManipulationFn() ); @Override @SuppressWarnings("unchecked") public T apply(@Nullable T input) { Result<BySegmentResultValueClass<T>> result = (Result<BySegmentResultValueClass<T>>) input; BySegmentResultValueClass<T> resultsClass = result.getValue(); return (T) new Result<BySegmentResultValueClass>( result.getTimestamp(), new BySegmentResultValueClass( Lists.transform(resultsClass.getResults(), baseFinalizer), resultsClass.getSegmentId(), resultsClass.getInterval() ) ); } }; } else { finalizerFn = toolChest.makePostComputeManipulatorFn(query, new FinalizeMetricManipulationFn()); } } else { queryToRun = query; finalizerFn = toolChest.makePostComputeManipulatorFn( query, new IdentityMetricManipulationFn() ); } return Sequences.map( baseRunner.run(queryToRun), finalizerFn ); }
Source:
<code>public void createPartControl(Composite parent) { super.createPartControl(parent); pinPropertySheetAction.addPropertyChangeListener(new IPropertyChangeListener(){ @Override public void propertyChange(PropertyChangeEvent event) { if (IAction.CHECKED.equals(event.getProperty())) { updateContentDescription(); } } }); IMenuManager menuManager = getViewSite().getActionBars() .getMenuManager(); menuManager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS)); menuManager.add(pinPropertySheetAction); IToolBarManager toolBarManager = getViewSite().getActionBars() .getToolBarManager(); menuManager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS)); toolBarManager.add(pinPropertySheetAction); SaveablesList saveables = (SaveablesList) getSite().getService(ISaveablesLifecycleListener.class); <START> saveables.addModelLifecycleListener(saveablesTracker); <END> getSite().getPage().getWorkbenchWindow().getWorkbench().getHelpSystem() .setHelp(getPageBook(), IPropertiesHelpContextIds.PROPERTY_SHEET_VIEW); }</code><technical_language>check for null</technical_language>

Target:
public void createPartControl(Composite parent) { super.createPartControl(parent); pinPropertySheetAction.addPropertyChangeListener(new IPropertyChangeListener(){ @Override public void propertyChange(PropertyChangeEvent event) { if (IAction.CHECKED.equals(event.getProperty())) { updateContentDescription(); } } }); IMenuManager menuManager = getViewSite().getActionBars() .getMenuManager(); menuManager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS)); menuManager.add(pinPropertySheetAction); IToolBarManager toolBarManager = getViewSite().getActionBars() .getToolBarManager(); menuManager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS)); toolBarManager.add(pinPropertySheetAction); SaveablesList saveables = (SaveablesList) getSite().getService(ISaveablesLifecycleListener.class); if (saveables != null) { saveables.addModelLifecycleListener(saveablesTracker); } getSite().getPage().getWorkbenchWindow().getWorkbench().getHelpSystem() .setHelp(getPageBook(), IPropertiesHelpContextIds.PROPERTY_SHEET_VIEW); }
Source:
<code>private static List<List<ScheduledSplit>> assignSplitsToTasks(List<ScheduledSplit> scheduledSplits, int numTasks) { List<List<ScheduledSplit>> assignedSplits = new ArrayList<>(); for (int i = 0; i < numTasks; i++) { assignedSplits.add(new ArrayList<>()); } for (ScheduledSplit split : scheduledSplits) { <START> int taskId = split.hashCode() % numTasks; <END> if (taskId < 0) { taskId += numTasks; } assignedSplits.get(taskId).add(split); } return assignedSplits; }</code><technical_language>nit: Do this: int taskId = Objects.hash(split.getPlanNodeId(), split.getSequenceId())) % numTasks; discussed in <LINK_0> ;)</technical_language>

Target:
private static List<List<ScheduledSplit>> assignSplitsToTasks(List<ScheduledSplit> scheduledSplits, int numTasks) { List<List<ScheduledSplit>> assignedSplits = new ArrayList<>(); for (int i = 0; i < numTasks; i++) { assignedSplits.add(new ArrayList<>()); } for (ScheduledSplit split : scheduledSplits) { int taskId = Objects.hash(split.getPlanNodeId(), split.getSequenceId()) % numTasks; if (taskId < 0) { taskId += numTasks; } assignedSplits.get(taskId).add(split); } return assignedSplits; }
Source:
<code>private boolean shouldPerformRecursiveChanges(List changes) { if (!changes.isEmpty()) { StringBuilder message = new StringBuilder(IDEWorkbenchMessages.ResourceInfo_recursiveChangesSummary) <START> .append("\n"); <END> for (int i = 0; i < changes.size(); i++) { message.append(((IResourceChange) changes.get(i)).getMessage()); } message.append(IDEWorkbenchMessages.ResourceInfo_recursiveChangesQuestion); MessageDialog dialog = new MessageDialog(getShell(), IDEWorkbenchMessages.ResourceInfo_recursiveChangesTitle, null, message.toString(), MessageDialog.QUESTION, 1, IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL); return dialog.open() == 0; } return false; }</code><technical_language>'\n' saves pesky //$NON_NLS-1$ :-)</technical_language>

Target:
private boolean shouldPerformRecursiveChanges(List changes) { if (!changes.isEmpty()) { StringBuilder message = new StringBuilder(IDEWorkbenchMessages.ResourceInfo_recursiveChangesSummary) .append('\n'); for (int i = 0; i < changes.size(); i++) { message.append(((IResourceChange) changes.get(i)).getMessage()); } message.append(IDEWorkbenchMessages.ResourceInfo_recursiveChangesQuestion); MessageDialog dialog = new MessageDialog(getShell(), IDEWorkbenchMessages.ResourceInfo_recursiveChangesTitle, null, message.toString(), MessageDialog.QUESTION, 1, IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL); return dialog.open() == 0; } return false; }
Source:
<code>public void testOnNextPropagation() throws Exception { LOG.info("gRPC pingAsyncSync method aync test start"); final CountDownLatch latch = new CountDownLatch(1); PingRequest pingRequest = PingRequest.newBuilder().setPingName(GRPC_TEST_PING_VALUE).setPingId(GRPC_TEST_PING_ID).build(); PongResponseStreamObserver responseObserver = new PongResponseStreamObserver(latch); StreamObserver<PingRequest> requestObserver = asyncNonBlockingStub.pingAsyncSync(responseObserver); requestObserver.onNext(pingRequest); latch.await(5, TimeUnit.SECONDS); MockEndpoint mockEndpoint = getMockEndpoint("mock:async-propagation"); mockEndpoint.expectedMessageCount(1); mockEndpoint.expectedHeaderValuesReceivedInAnyOrder(GrpcConstants.GRPC_EVENT_TYPE_HEADER, GrpcConstants.GRPC_EVENT_TYPE_ON_NEXT); mockEndpoint.expectedHeaderValuesReceivedInAnyOrder(GrpcConstants.GRPC_METHOD_NAME_HEADER, "pingAsyncSync"); <START> <END> PongResponse pongResponse = responseObserver.getPongResponse(); assertNotNull(pongResponse); assertEquals(GRPC_TEST_PING_ID, pongResponse.getPongId()); assertEquals(GRPC_TEST_PING_VALUE + GRPC_TEST_PONG_VALUE, pongResponse.getPongName()); }</code><technical_language>call mockEndpoint.assertIsSatisfied(), expectations verified (please, check other tests)</technical_language>

Target:
public void testOnNextPropagation() throws Exception { LOG.info("gRPC pingAsyncSync method aync test start"); final CountDownLatch latch = new CountDownLatch(1); PingRequest pingRequest = PingRequest.newBuilder().setPingName(GRPC_TEST_PING_VALUE).setPingId(GRPC_TEST_PING_ID).build(); PongResponseStreamObserver responseObserver = new PongResponseStreamObserver(latch); StreamObserver<PingRequest> requestObserver = asyncOnNextStub.pingAsyncSync(responseObserver); requestObserver.onNext(pingRequest); latch.await(5, TimeUnit.SECONDS); MockEndpoint mockEndpoint = getMockEndpoint("mock:async-on-next-propagation"); mockEndpoint.expectedMessageCount(1); mockEndpoint.expectedHeaderValuesReceivedInAnyOrder(GrpcConstants.GRPC_EVENT_TYPE_HEADER, GrpcConstants.GRPC_EVENT_TYPE_ON_NEXT); mockEndpoint.expectedHeaderValuesReceivedInAnyOrder(GrpcConstants.GRPC_METHOD_NAME_HEADER, "pingAsyncSync"); mockEndpoint.assertIsSatisfied(); PongResponse pongResponse = responseObserver.getPongResponse(); assertNotNull(pongResponse); assertEquals(GRPC_TEST_PING_ID, pongResponse.getPongId()); assertEquals(GRPC_TEST_PING_VALUE + GRPC_TEST_PONG_VALUE, pongResponse.getPongName()); }
Source:
<code>public void checkExecuteCommandWithEmptyVdsId() { parameters.setStorageServerConnection(NFSConnection); parameters.setVdsId(Guid.Empty); doNothing().when(storageServerConnectionDAO).remove(NFSConnection.getid()); <START> command.executeCommand(); <END> }</code><technical_language>I suggest add validation disconnect method is called, you</technical_language>

Target:
public void checkExecuteCommandWithEmptyVdsId() { parameters.setStorageServerConnection(NFSConnection); parameters.setVdsId(Guid.Empty); doNothing().when(storageServerConnectionDAO).remove(NFSConnection.getid()); command.executeCommand(); verify(command, never()).disconnectStorage(); }
Source:
<code>public int getTechIntroYear() { if (campaignOptions.limitByYear()) { return calendar.get(Calendar.YEAR); } else { return 0; } <START> } <END></code><technical_language>I this method anywhere, this matter, a named constant 0 if limitByYear is turned off</technical_language>

Target:
public int getTechIntroYear() { if (campaignOptions.limitByYear()) { return calendar.get(Calendar.YEAR); } else { return Integer.MAX_VALUE; } }
Source:
<code>public void getAttachment(Long attachmentId) throws IOException { Attachment attachment = attachments.load(attachmentId); if (attachment == null) { result.notFound(); return; <START> } <END> try { InputStream is = fileStorage.open(attachment); response.setHeader("Content-Type", attachment.getMime()); send(is); } catch (FileNotFoundException e) { result.notFound(); } }</code><technical_language>if attachment null, start Optionals(the guava least) throw NotFoundException attachments.load</technical_language>

Target:
public InputStreamDownload getAttachment(Long attachmentId) throws IOException { Attachment attachment = attachments.load(attachmentId); InputStream is = attachments.open(attachment); return new InputStreamDownload(is, attachment.getMime(), attachment.getName()); }
Source:
<code>public ServerContext build() { ServerConfiguration conf = new ServerConfiguration() .setSingleMode(single) .setInMemoryMode(memory) <START> .setHandshakeTimeout(handshakeTimeout) <END> .setSequencerConflictWindowSize(seqCache) .setLogSizeQuota(logSizeLimitPercentage) .setStateTransferBatchSize(batchSize) .setMetadataRetention(retention) .setCompressionCodec(compressionCodec); if (logPath != null) { conf.setServerDirectory(logPath); } conf.setVerifyChecksum(verifyChecksum) .setSyncData(syncData) .setHostAddress(address) .setServerPort(port) .setLogUnitCacheRatio(cacheSizeHeapRatio) .setEnableTls(tlsEnabled) .setEnableTlsMutualAuth(tlsMutualAuthEnabled) .setTlsProtocols(tlsProtocols) .setTlsCiphers(tlsCiphers) .setKeystore(keystore) .setKeystorePasswordFile(keystorePasswordFile) .setTruststore(truststore) .setTruststorePasswordFile(truststorePasswordFile) .setEnableSaslPlainTextAuth(saslPlainTextAuth) .setClusterId(clusterId) .setChannelImplementation(implementation); if (implementation == ChannelImplementation.LOCAL) { conf.setTestClientEventLoop(TestThreadGroups.NETTY_CLIENT_GROUP.get().next()) .setTestBossEventLoop(TestThreadGroups.NETTY_BOSS_GROUP.get()) .setTestWorkerEventLoop(TestThreadGroups.NETTY_CLIENT_GROUP.get()); } ServerContext sc = new ServerContext(conf); sc.setServerRouter(serverRouter); return sc; }</code><technical_language>missing numThreads</technical_language>

Target:
public ServerContext build() { ServerConfiguration conf = new ServerConfiguration() .setSingleMode(single) .setInMemoryMode(memory) .setHandshakeTimeout(handshakeTimeout) .setSequencerConflictWindowSize(seqCache) .setLogSizeQuota(logSizeLimitPercentage) .setStateTransferBatchSize(batchSize) .setMetadataRetention(retention); if (logPath != null) { conf.setServerDirectory(logPath); } conf.setVerifyChecksum(verifyChecksum) .setSyncData(syncData) .setHostAddress(address) .setServerPort(port) .setLogUnitCacheRatio(cacheSizeHeapRatio) .setEnableTls(tlsEnabled) .setEnableTlsMutualAuth(tlsMutualAuthEnabled) .setTlsProtocols(tlsProtocols) .setTlsCiphers(tlsCiphers) .setKeystore(keystore) .setKeystorePasswordFile(keystorePasswordFile) .setTruststore(truststore) .setTruststorePasswordFile(truststorePasswordFile) .setEnableSaslPlainTextAuth(saslPlainTextAuth) .setClusterId(clusterId) .setChannelImplementation(implementation); if (implementation == ChannelImplementation.LOCAL) { conf.setTestClientEventLoop(TestThreadGroups.NETTY_CLIENT_GROUP.get().next()) .setTestBossEventLoop(TestThreadGroups.NETTY_BOSS_GROUP.get()) .setTestWorkerEventLoop(TestThreadGroups.NETTY_CLIENT_GROUP.get()); } ServerContext sc = new ServerContext(conf); sc.setServerRouter(serverRouter); return sc; }
Source:
<code>private void performTestForJDBCParamUsage(String jdbcUrl) throws SQLException { try (HikariDataSource dataSource = getDataSource(jdbcUrl, 1)) { boolean result = new QueryRunner(dataSource).query("select CURRENT_USER", rs -> { rs.next(); String resultUser = rs.getString(1); if(resultUser.endsWith("@%")) resultUser = resultUser.substring(0, resultUser.length() - 2); assertEquals("User from query param is created.", "someuser", resultUser); return true; }); assertTrue("The database returned a record as expected", result); String databaseQuery = "SELECT DATABASE()"; String databaseType = ConnectionUrl.newInstance(jdbcUrl).getDatabaseType(); <START> if(databaseType.equalsIgnoreCase("postgresql") || databaseType.equalsIgnoreCase("postgis")) <END> databaseQuery = "SELECT CURRENT_DATABASE()"; result = new QueryRunner(dataSource).query(databaseQuery, rs -> { rs.next(); String resultDB = rs.getString(1); assertEquals("Database name from URL String is used.", "databasename", resultDB); return true; }); assertTrue("The database returned a record as expected", result); } }</code><technical_language>a tiny style thing: suggestion if (databaseType.equalsIgnoreCase("postgresql") || databaseType.equalsIgnoreCase("postgis"))</technical_language>

Target:
private void performTestForJDBCParamUsage(String jdbcUrl) throws SQLException { try (HikariDataSource dataSource = getDataSource(jdbcUrl, 1)) { boolean result = new QueryRunner(dataSource).query("select CURRENT_USER", rs -> { rs.next(); String resultUser = rs.getString(1); if (resultUser.endsWith("@%")) { resultUser = resultUser.substring(0, resultUser.length() - 2); } assertEquals("User from query param is created.", "someuser", resultUser); return true; }); assertTrue("The database returned a record as expected", result); String databaseQuery = "SELECT DATABASE()"; String databaseType = ConnectionUrl.newInstance(jdbcUrl).getDatabaseType(); if (databaseType.equalsIgnoreCase("postgresql") || databaseType.equalsIgnoreCase("postgis")) { databaseQuery = "SELECT CURRENT_DATABASE()"; } result = new QueryRunner(dataSource).query(databaseQuery, rs -> { rs.next(); String resultDB = rs.getString(1); assertEquals("Database name from URL String is used.", "databasename", resultDB); return true; }); assertTrue("The database returned a record as expected", result); } }
Source:
<code>public void updateTicketTypeTestNoneThere() { TicketType ticketType = new TicketType("type1", "text", 5F, 0, LocalDateTime.now(), false); ticketType = ticketService.updateTicketType(ticketType.getId(), ticketType); <START> assertFalse(ticketType.isBuyable()); <END> }</code><technical_language>I dont this is kind of assertion want for this test</technical_language>

Target:
public void updateTicketTypeTestNoneThere() { thrown.expect(TicketTypeNotFoundException.class); thrown.expectMessage("TicketType with ID null not found!"); TicketType ticketType = new TicketType("type1", "text", 5F, 0, LocalDateTime.now(), false); ticketService.updateTicketType(ticketType.getId(), ticketType); }
Source:
<code>private StorableKey buildStorableKey(String namespace, List<QueryParam> queryParams) throws Exception { final Map<Schema.Field, Object> fieldsToVal = new HashMap<>(); StorableKey storableKey = null; try { for (QueryParam qp : queryParams) { <START> if (!queryExecutor.isColumnInNamespace(namespace, qp.getName())) { <END> log.warn("Query parameter does not exist for namespace [{}]. Query parameter ignored.", qp.getName(), namespace); } else { final String val = qp.getValue(); final Schema.Type typeOfVal = Schema.Type.getTypeOfVal(val); fieldsToVal.put(new Schema.Field(qp.getName(), typeOfVal), typeOfVal.getJavaType().getConstructor(String.class).newInstance(val)); } } if (!fieldsToVal.isEmpty()) { final PrimaryKey primaryKey = new PrimaryKey(fieldsToVal); storableKey = new StorableKey(namespace, primaryKey); } log.debug("Building StorableKey from QueryParam: \n\tnamespace = [{}]\n\t queryParams = [{}]\n\t StorableKey = [{}]", namespace, queryParams, storableKey); } catch (Exception e) { log.debug("Exception occurred when attempting to generate StorableKey from QueryParam", e); throw new IllegalQueryParameterException(e); } return storableKey; }</code><technical_language>this is get metadata for table for query param in loop. instead get loop result check</technical_language>

Target:
private StorableKey buildStorableKey(String namespace, List<QueryParam> queryParams) throws Exception { final Map<Schema.Field, Object> fieldsToVal = new HashMap<>(); StorableKey storableKey = null; try { CaseAgnosticStringSet columnNames = queryExecutor.getColumnNames(namespace); for (QueryParam qp : queryParams) { if (!columnNames.contains(qp.getName())) { log.warn("Query parameter does not exist for namespace [{}]. Query parameter ignored.", qp.getName(), namespace); } else { final String val = qp.getValue(); final Schema.Type typeOfVal = Schema.Type.getTypeOfVal(val); fieldsToVal.put(new Schema.Field(qp.getName(), typeOfVal), typeOfVal.getJavaType().getConstructor(String.class).newInstance(val)); } } if (!fieldsToVal.isEmpty()) { final PrimaryKey primaryKey = new PrimaryKey(fieldsToVal); storableKey = new StorableKey(namespace, primaryKey); } log.debug("Building StorableKey from QueryParam: \n\tnamespace = [{}]\n\t queryParams = [{}]\n\t StorableKey = [{}]", namespace, queryParams, storableKey); } catch (Exception e) { log.debug("Exception occurred when attempting to generate StorableKey from QueryParam", e); throw new IllegalQueryParameterException(e); } return storableKey; }
Source:
<code>public Object handle(CommandMessage<?> command) throws Exception { AtomicReference<Object> resultReference = new AtomicReference<>(); Aggregate<T> aggregate = repository.newInstance(() -> { T newInstance = factoryMethod.call(); resultReference.set(handler.handle(command, newInstance)); return newInstance; }); Object commandHandlingResult = resultReference.get(); <START> return commandHandlingResult != null ? commandHandlingResult : resolveReturnValue(command, aggregate); <END> }</code><technical_language>resolve return if handler is of type Void. In other situations, fine return null: @CommandHandler public MySuperAwesomeReturnType handle(MyCommand cmd) { if (iDontLikeMyCmd(cmd)) { return null; } return nonNullValue; }</technical_language>

Target:
public Object handle(CommandMessage<?> command) throws Exception { AtomicReference<Object> resultReference = new AtomicReference<>(); Aggregate<T> aggregate = repository.newInstance(() -> { T newInstance = factoryMethod.call(); resultReference.set(handler.handle(command, newInstance)); return newInstance; }); return handlerHasVoidReturnType() ? resolveReturnValue(command, aggregate) : resultReference.get(); }
Source:
<code>protected ScenarioResult fillResult(FactMappingValue expectedResult, Supplier<ResultWrapper<?>> resultSupplier, ExpressionEvaluator expressionEvaluator) { ResultWrapper<?> resultValue = resultSupplier.get(); <START> if (!resultValue.isSatisfied() && resultValue.getErrorMessage().isPresent()) { expectedResult.setExceptionMessage(resultValue.getErrorMessage().get()); } else if (!resultValue.isSatisfied()) { try { expectedResult.setErrorValue(expressionEvaluator.fromObjectToExpression(resultValue.getResult())); } catch (Exception e) { expectedResult.setExceptionMessage(e.getMessage()); } } else { expectedResult.resetStatus(); } <END> return new ScenarioResult(expectedResult, resultValue.getResult()).setResult(resultValue.isSatisfied()); }</code><technical_language>java if (resultValue.isSatisfied()) { expectedResult.resetStatus(); } else { if (resultValue.getErrorMessage().isPresent()) { expectedResult.setExceptionMessage(resultValue.getErrorMessage().get()); } else { try { expectedResult.setErrorValue(expressionEvaluator.fromObjectToExpression(resultValue.getResult())); } catch (Exception e) { expectedResult.setExceptionMessage(e.getMessage()); } } } I a bit spaghetti like, is more readable</technical_language>

Target:
protected ScenarioResult fillResult(FactMappingValue expectedResult, Supplier<ResultWrapper<?>> resultSupplier, ExpressionEvaluator expressionEvaluator) { ResultWrapper<?> resultValue = resultSupplier.get(); if (resultValue.isSatisfied()) { expectedResult.resetStatus(); } else if (resultValue.getErrorMessage().isPresent()) { expectedResult.setExceptionMessage(resultValue.getErrorMessage().get()); } else { try { expectedResult.setErrorValue(expressionEvaluator.fromObjectToExpression(resultValue.getResult())); } catch (Exception e) { expectedResult.setExceptionMessage(e.getMessage()); } } return new ScenarioResult(expectedResult, resultValue.getResult()).setResult(resultValue.isSatisfied()); }
Source:
<code>public DatasetWriter<E> load(StorageKey key) throws Exception { Preconditions.checkArgument(view.contains(key), "View does not contain StorageKey {}", view, key); Preconditions.checkState(view.getDataset() instanceof FileSystemDataset, "FileSystemWriters cannot create writer for " + view.getDataset()); final FileSystemDataset dataset = (FileSystemDataset) view.getDataset(); final DatasetWriter<E> writer = FileSystemWriters.newFileWriter( dataset.getFileSystem(), <START> new Path(dataset.getDirectory(), convert.fromKey(key)), <END> dataset.getDescriptor(), dataset.getPartitionListener(), dataset.getName(), key); writer.open(); return writer; }</code><technical_language>If pass path created convert.fromKey(key) partitionAdded StorageKey, need expose dirnameForValue Accessor. I this passing actual directory names passed newFileWriter, relying partitionAdded convert.fromKey(key) implementation</technical_language>

Target:
public DatasetWriter<E> load(StorageKey key) throws Exception { Preconditions.checkArgument(view.contains(key), "View does not contain StorageKey {}", view, key); Preconditions.checkState(view.getDataset() instanceof FileSystemDataset, "FileSystemWriters cannot create writer for " + view.getDataset()); FileSystemDataset dataset = (FileSystemDataset) view.getDataset(); Path partition = convert.fromKey(key); DatasetWriter<E> writer = FileSystemWriters.newFileWriter( dataset.getFileSystem(), new Path(dataset.getDirectory(), partition), dataset.getDescriptor()); PartitionListener listener = dataset.getPartitionListener(); if (listener != null) { listener.partitionAdded(dataset.getName(), partition.toString()); } writer.open(); return writer; }
Source:
<code>void processOutputBatch(InputStream[] output, Consumer<InputStream> outputConsumer) { if (output == null || output.length == 0) return; if (allowsEndpointState() && output.length > 0) { setEndpointState(output[0]); <START> } <END> processOutput(output, outputConsumer); }</code><technical_language>code caches endpoint state (lines 258 259 above) execute in next() case in output consumer case</technical_language>

Target:
void processOutputBatch(InputStream[] output, Consumer<InputStream> outputConsumer) { if (output == null || output.length == 0) return; assignEndpointState(output); for (int i=allowsEndpointState()?1:0; i < output.length; i++) { outputConsumer.accept(output[i]); } }
Source:
<code>private void isSizeExceeded() { <START> if (limitAvailable) { <END> if (incrementalSize > limit) { throw new WcsException("This request is trying to " + readGenerate + " too much data, the limit is " + formatBytes(limit) + " but the actual amount of bytes to be " + readWrite + " is " + formatBytes(incrementalSize)); } } }</code><technical_language>I remove this boolean check if limit is > 0 instead</technical_language>

Target:
private void isSizeExceeded() { if (limit > 0 && incrementalSize > limit) { throw new WcsException("This request is trying to " + (input ? "read" : "generate") + " too much data, the limit is " + formatBytes(limit) + " but the actual amount of bytes to be " + (input ? "read" : "written") + " is " + formatBytes(incrementalSize)); } }
Source:
<code>private ILaunchConfiguration createLaunchConfiguration(GradleRunConfigurationAttributes configurationAttributes) { String taskNamesOrDefault = configurationAttributes.getTasks().isEmpty() ? "(default tasks)" : CollectionsUtils.joinWithSpace(configurationAttributes.getTasks()); String rawLaunchConfigurationName = String.format("%s - %s", configurationAttributes.getWorkingDir().getName(), taskNamesOrDefault); String launchConfigurationName = this.launchManager.generateLaunchConfigurationName(rawLaunchConfigurationName.replace(':', '.')); ILaunchConfigurationType launchConfigurationType = this.launchManager.getLaunchConfigurationType(GradleRunConfigurationDelegate.ID); try { ILaunchConfigurationWorkingCopy launchConfiguration = launchConfigurationType.newInstance(null, launchConfigurationName); configurationAttributes.apply(launchConfiguration); try { return launchConfiguration.doSave(); } catch (CoreException ex) { <START> CorePlugin.logger().warn("Could not persisting Gradle launch configuration file", ex); <END> return launchConfiguration; } } catch (CoreException e) { throw new GradlePluginsRuntimeException(String.format("Cannot create Gradle launch configuration %s.", launchConfigurationName), e); } }</code><technical_language>"Cannot persist Gradle launch configuration"</technical_language>

Target:
private ILaunchConfiguration createLaunchConfiguration(GradleRunConfigurationAttributes configurationAttributes) { String taskNamesOrDefault = configurationAttributes.getTasks().isEmpty() ? "(default tasks)" : CollectionsUtils.joinWithSpace(configurationAttributes.getTasks()); String rawLaunchConfigurationName = String.format("%s - %s", configurationAttributes.getWorkingDir().getName(), taskNamesOrDefault); String launchConfigurationName = this.launchManager.generateLaunchConfigurationName(rawLaunchConfigurationName.replace(':', '.')); ILaunchConfigurationType launchConfigurationType = this.launchManager.getLaunchConfigurationType(GradleRunConfigurationDelegate.ID); try { ILaunchConfigurationWorkingCopy launchConfiguration = launchConfigurationType.newInstance(null, launchConfigurationName); configurationAttributes.apply(launchConfiguration); return persistConfiguration(launchConfiguration); } catch (CoreException e) { throw new GradlePluginsRuntimeException(String.format("Cannot create Gradle launch configuration %s.", launchConfigurationName), e); } }
Source:
<code>private void clearSystemProperties() { <START> System.setProperty("zookeeper.clientCnxnSocket", ""); <END> System.setProperty("zookeeper.serverCnxnFactory", ""); System.setProperty("zookeeper.client.secure", ""); System.setProperty("zookeeper.ssl.keyStore.location", ""); System.setProperty("zookeeper.ssl.keyStore.password", ""); System.setProperty("zookeeper.ssl.trustStore.location", ""); System.setProperty("zookeeper.ssl.trustStore.password", ""); System.setProperty("zookeeper.ssl.hostnameVerification", ""); }</code><technical_language>System.clearProperty instead</technical_language>

Target:
private void clearSystemProperties() { System.clearProperty(ZOOKEEPER_CLIENT_CNXN_SOCKET); System.clearProperty(ZOOKEEPER_SERVER_CNXN_FACTORY); System.clearProperty(SECURE_CLIENT); System.clearProperty(ZOOKEEPER_SSL_KEYSTORE_LOCATION); System.clearProperty(ZOOKEEPER_SSL_TRUSTSTORE_LOCATION); System.clearProperty(ZOOKEEPER_SSL_KEYSTORE_PASSWORD); System.clearProperty(ZOOKEEPER_SSL_TRUSTSTORE_PASSWORD); System.clearProperty(ZOOKEEPER_SSL_HOSTNAME_VERIFICATION); }
Source:
<code>public void testOnDateChanged() { final Consumer<Moment> consumer = mock(Consumer.class); picker.setOnDateChanged(consumer); final String expected = "14:55:01"; final Moment moment = mock(Moment.class); when(moment.format("HH:mm:ss")).thenReturn(expected); picker.onDateChanged(moment); assertEquals(expected, input.value); <START> verify(consumer).accept(momentArgumentCaptor.capture()); <END> }</code><technical_language>want do additional assertions captured value, is this case? If not, please other mockito matcher</technical_language>

Target:
public void testOnDateChanged() { final Consumer<Moment> consumer = mock(Consumer.class); picker.setOnDateChanged(consumer); final String expected = "14:55:01"; final Moment moment = mock(Moment.class); when(moment.format("HH:mm:ss")).thenReturn(expected); picker.onDateChanged(moment); assertEquals(expected, input.value); verify(consumer).accept(argThat(new ArgumentMatcher<Moment>() { @Override public boolean matches(Object argument) { return Objects.equals(argument, moment); } })); }
Source:
<code>public static boolean isServerStartedUp(AutomationContext automationContext, int portOffset) throws Exception { ClientConnectionUtil.waitForPort( Integer.parseInt(FrameworkConstants.SERVER_DEFAULT_HTTPS_PORT) + portOffset, <START> DEFAULT_START_STOP_WAIT_MS, false, automationContext.getInstance().getHosts().get("default")); <END> ClientConnectionUtil.waitForLogin(automationContext); log.info("Server started successfully."); return true; }</code><technical_language>Change this Constant name DEFAULT_WAIT_TIME</technical_language>

Target:
public static boolean isServerStartedUp(AutomationContext automationContext, int portOffset) throws CarbonToolsIntegrationTestException { try { ClientConnectionUtil.waitForPort( Integer.parseInt(FrameworkConstants.SERVER_DEFAULT_HTTPS_PORT) + portOffset, DEFAULT_START_STOP_WAIT_MS, false, automationContext.getInstance().getHosts().get("default")); ClientConnectionUtil.waitForLogin(automationContext); log.info("Server started successfully."); return true; } catch (Exception e) { log.error("Error while waiting for login ", e); throw new CarbonToolsIntegrationTestException("Error while waiting for login ", e); } }
Source:
<code>public void testRegionReplicaSplitRegionAssignment() throws Exception { TableName tn = TableName.valueOf(this.name.getMethodName()); Table table = null; try { table = createTableAndLoadData(tn); HTU.loadNumericRows(table, f, 0, 3); List<RegionInfo> regions = new ArrayList<RegionInfo>(); for (RegionServerThread rs : HTU.getMiniHBaseCluster().getRegionServerThreads()) { for (Region r : rs.getRegionServer().getRegions(table.getName())) { regions.add(r.getRegionInfo()); } } HTU.getAdmin().split(table.getName(), Bytes.toBytes("d")); int count = 0; while (true) { <START> for (RegionServerThread rs : HTU.getMiniHBaseCluster().getRegionServerThreads()) { <END> for (Region r : rs.getRegionServer().getRegions(table.getName())) { count++; } } if (count >= 9) { break; } count = 0; } RegionReplicaTestHelper.assertReplicaDistributed(HTU, table); } finally { if (table != null) { HTU.deleteTable(tn); } } }</code><technical_language>this change</technical_language>

Target:
public void testRegionReplicaSplitRegionAssignment() throws Exception { TableName tn = TableName.valueOf(this.name.getMethodName()); Table table = null; try { table = createTableAndLoadData(tn); HTU.loadNumericRows(table, f, 0, 3); List<RegionInfo> regions = new ArrayList<RegionInfo>(); for (RegionServerThread rs : HTU.getMiniHBaseCluster().getRegionServerThreads()) { for (Region r : rs.getRegionServer().getRegions(table.getName())) { regions.add(r.getRegionInfo()); } } HTU.getAdmin().split(table.getName(), Bytes.toBytes("d")); int count = 0; while (true) { for (RegionServerThread rs : HTU.getMiniHBaseCluster().getRegionServerThreads()) { for (Region r : rs.getRegionServer().getRegions(table.getName())) { if (RegionReplicaUtil.isDefaultReplica(r.getRegionInfo())) { assertTrue(r.getStore(f).hasReferences() || r.getStore(f).getStorefiles().size() > 0); } count++; } } if (count >= 9) { break; } count = 0; } RegionReplicaTestHelper.assertReplicaDistributed(HTU, table); } finally { if (table != null) { HTU.deleteTable(tn); } } }
Source:
<code>public File uploadFile(MultipartFile file) throws Exception { InputStream is = null; byte[] fileByteArray = null; <START> File fileToPersist = getEntityClass().newInstance(); <END> try { is = file.getInputStream(); fileByteArray = IOUtils.toByteArray(is); } catch(Exception e) { throw new Exception("Could not create the bytearray: " + e.getMessage()); } finally { IOUtils.closeQuietly(is); } fileToPersist.setFile(fileByteArray); fileToPersist.setFileType(file.getContentType()); fileToPersist.setFileName(file.getOriginalFilename()); dao.saveOrUpdate((E) fileToPersist); return fileToPersist; }</code><technical_language>File fileToPersist E fileToPersist</technical_language>

Target:
public E uploadFile(MultipartFile file) throws Exception { InputStream is = null; byte[] fileByteArray = null; E fileToPersist = getEntityClass().newInstance(); try { is = file.getInputStream(); fileByteArray = IOUtils.toByteArray(is); } catch(Exception e) { throw new Exception("Could not create the bytearray: " + e.getMessage()); } finally { IOUtils.closeQuietly(is); } fileToPersist.setFile(fileByteArray); fileToPersist.setFileType(file.getContentType()); fileToPersist.setFileName(file.getOriginalFilename()); dao.saveOrUpdate((E) fileToPersist); return fileToPersist; }
Source:
<code>public void setup() { <START> openTSDBMessageFormatter = Mockito.mock(OpenTSDBMessageFormatter.class); <END> writer = new OpenTSDBWriter2(openTSDBMessageFormatter); outputWriter = Mockito.mock(Writer.class); result = Mockito.mock(Result.class); }</code><technical_language>for fun ... fid more readable a static import of Mockito.mock() (this is a complete detail, feel free ignore)</technical_language>

Target:
public void setup() { openTSDBMessageFormatter = mock(OpenTSDBMessageFormatter.class); writer = new OpenTSDBWriter2(openTSDBMessageFormatter); outputWriter = mock(Writer.class); result = mock(Result.class); }
Source:
<code>public static void validateTwoSegments(File dir1, File dir2) throws IOException { final QueryableIndexIndexableAdapter adapter1 = new QueryableIndexIndexableAdapter(loadIndex(dir1)); final QueryableIndexIndexableAdapter adapter2 = new QueryableIndexIndexableAdapter(loadIndex(dir2)); if (adapter1.getNumRows() != adapter2.getNumRows()) { <START> throw new SegmentValidationException("Row count mismatch"); <END> } { final Set<String> dimNames1 = Sets.newHashSet(adapter1.getDimensionNames()); final Set<String> dimNames2 = Sets.newHashSet(adapter2.getDimensionNames()); if (!dimNames1.equals(dimNames2)) { throw new SegmentValidationException("Dimension names differ %s vs %s", dimNames1, dimNames2); } final Set<String> metNames1 = Sets.newHashSet(adapter1.getMetricNames()); final Set<String> metNames2 = Sets.newHashSet(adapter2.getMetricNames()); if (!metNames1.equals(metNames2)) { throw new SegmentValidationException("Metric names differ %s vs %s", metNames1, metNames2); } } final Iterator<Rowboat> it1 = adapter1.getRows().iterator(); final Iterator<Rowboat> it2 = adapter2.getRows().iterator(); long row = 0L; while (it1.hasNext()) { if (it1.hasNext() ^ it2.hasNext()) { throw new SegmentValidationException("Iterator doesn't have enough"); } final Rowboat rb1 = it1.next(); final Rowboat rb2 = it2.next(); ++row; if (rb1.getRowNum() != rb2.getRowNum()) { throw new SegmentValidationException("Row number mismatch: [%d] vs [%d]", rb1.getRowNum(), rb2.getRowNum()); } if (rb1.compareTo(rb2) != 0) { try { validateRowValues(rb1, adapter1, rb2, adapter2); } catch (SegmentValidationException ex) { throw new SegmentValidationException(ex, "Validation failure on row %d: [%s] vs [%s]", row, rb1, rb2); } } } if (it2.hasNext()) { throw new SegmentValidationException("Iterator still has more"); } if (row != adapter1.getNumRows()) { throw new SegmentValidationException("Actual Row count mismatch"); } }</code><technical_language>add expected actual number of rows</technical_language>

Target:
public static void validateTwoSegments(File dir1, File dir2) throws IOException { validateTwoSegments( new QueryableIndexIndexableAdapter(loadIndex(dir1)), new QueryableIndexIndexableAdapter(loadIndex(dir2)) ); }
Source:
<code>protected final void checkOracleConfig() { Preconditions.checkState(tablePrefix() != null, "Oracle 'tablePrefix' cannot be null."); Preconditions.checkState(!tablePrefix().isEmpty(), "Oracle 'tablePrefix' must not be an empty string."); Preconditions.checkState(!tablePrefix().startsWith("_"), "Oracle 'tablePrefix' cannot begin with underscore."); Preconditions.checkState(tablePrefix().endsWith("_"), "Oracle 'tablePrefix' must end with an underscore."); Preconditions.checkState( tablePrefix().length() <= AtlasDbConstants.MAX_TABLE_PREFIX_LENGTH, "Oracle 'tablePrefix' cannot be more than %s characters long.", AtlasDbConstants.MAX_TABLE_PREFIX_LENGTH); Preconditions.checkState( !overflowTablePrefix().startsWith("_"), "Oracle 'overflowTablePrefix' cannot begin with underscore."); Preconditions.checkState( overflowTablePrefix().endsWith("_"), "Oracle 'overflowTablePrefix' must end with an underscore."); Preconditions.checkState( overflowTablePrefix().length() <= AtlasDbConstants.MAX_OVERFLOW_TABLE_PREFIX_LENGTH, "Oracle 'overflowTablePrefix' cannot be more than %s characters long.", AtlasDbConstants.MAX_OVERFLOW_TABLE_PREFIX_LENGTH); <START> Preconditions.checkState( <END> overflowTablePrefix().length() <= AtlasDbConstants.MAX_OVERFLOW_TABLE_PREFIX_LENGTH, "Oracle 'overflowTablePrefix' cannot be more than %s characters long.", AtlasDbConstants.MAX_OVERFLOW_TABLE_PREFIX_LENGTH); }</code><technical_language>this now. :)</technical_language>

Target:
protected final void checkOracleConfig() { Preconditions.checkState(tablePrefix() != null, "Oracle 'tablePrefix' cannot be null."); Preconditions.checkState(!tablePrefix().isEmpty(), "Oracle 'tablePrefix' must not be an empty string."); Preconditions.checkState(!tablePrefix().startsWith("_"), "Oracle 'tablePrefix' cannot begin with underscore."); Preconditions.checkState(tablePrefix().endsWith("_"), "Oracle 'tablePrefix' must end with an underscore."); Preconditions.checkState( tablePrefix().length() <= AtlasDbConstants.MAX_TABLE_PREFIX_LENGTH, "Oracle 'tablePrefix' cannot be more than %s characters long.", AtlasDbConstants.MAX_TABLE_PREFIX_LENGTH); Preconditions.checkState( !overflowTablePrefix().startsWith("_"), "Oracle 'overflowTablePrefix' cannot begin with underscore."); Preconditions.checkState( overflowTablePrefix().endsWith("_"), "Oracle 'overflowTablePrefix' must end with an underscore."); Preconditions.checkState( overflowTablePrefix().length() <= AtlasDbConstants.MAX_OVERFLOW_TABLE_PREFIX_LENGTH, "Oracle 'overflowTablePrefix' cannot be more than %s characters long.", AtlasDbConstants.MAX_OVERFLOW_TABLE_PREFIX_LENGTH); }
Source:
<code>private void updateGatewayInfoSynchronious() { deviceClient.setURI(this.gatewayInfoURI); String data = deviceClient.get().getResponseText(); JsonObject json = new JsonParser().parse(data).getAsJsonObject(); String firmwareVersion = json.get(VERSION).getAsString(); <START> getThing().setProperty("firmwareVersion", firmwareVersion); <END> deviceClient.setURI(gatewayURI); }</code><technical_language>final Thing.PROPERTY_FIRMWARE_VERSION instead of String "firmwareVersion"</technical_language>

Target:
private void updateGatewayInfoSynchronious() { deviceClient.setURI(this.gatewayInfoURI); String data = deviceClient.get().getResponseText(); JsonObject json = new JsonParser().parse(data).getAsJsonObject(); String firmwareVersion = json.get(VERSION).getAsString(); getThing().setProperty(Thing.PROPERTY_FIRMWARE_VERSION, firmwareVersion); deviceClient.setURI(gatewayURI); }
Source:
<code><START> public String getFormId() { <END> FormDefinition def = renderingContext.getRootForm(); return renderingContext.getRootForm().getId(); }</code><technical_language>I this line def.getId(); code line 112 is useless</technical_language>

Target:
public String getFormId() { return renderingContext.getRootForm().getId(); }
Source:
<code><START> public Boolean validateQuery(String query) { <END> try { Document document = Parser.parse(query); return true; } catch (Exception e) { return false; } }</code><technical_language>boolean</technical_language>

Target:
public boolean validateQuery(String query) { try { Document document = Parser.parse(query); return true; } catch (Exception e) { return false; } }