auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void define(WebService.NewController context) { WebService.NewAction action = context.createAction(ACTION_CREATE) .setDescription("Create a project.<br/>" + "Requires 'Create Projects' permission<br/>" + "Since 6.3, the response format has been updated and does not contain the database ID anymore<br/>" + "Since 6.3, the 'key' parameter has been renamed 'project'") .setSince("4.0") .setPost(true) .setResponseExample(getClass().getResource("create-example.json")) .setHandler(this); action.setChangelog( new Change("6.3", "The response format has been updated and does not contain the database ID anymore"), new Change("6.3", "The 'key' parameter has been renamed 'project'")); action.createParam(PARAM_PROJECT) .setDescription("Key of the project") .setDeprecatedKey(DEPRECATED_PARAM_KEY, "6.3") .setRequired(true) .setExampleValue(KEY_PROJECT_EXAMPLE_001); action.createParam(PARAM_NAME) .setDescription("Name of the project") .setRequired(true) .setExampleValue("SonarQube"); action.createParam(PARAM_BRANCH) .setDescription("SCM Branch of the project. The key of the project will become key:branch, for instance 'SonarQube:branch-5.0'") .setExampleValue("branch-5.0"); action.createParam(PARAM_VISIBILITY) .setDescription("Whether the created project should be visible to everyone, or only specific user/groups.<br/>" + "If no visibility is specified, the default project visibility of the organization will be used.") .setRequired(false) <START> .setInternal(true) <END> .setSince("6.4") .setPossibleValues("private", "public"); support.addOrganizationParam(action); }</code><technical_language>![CRITICAL](<LINK_0> 'Severity: CRITICAL') Define a constant instead of duplicating this literal "private" 3 times. [![rule](<LINK_1>](<LINK_2></technical_language>

Target:
public void define(WebService.NewController context) { WebService.NewAction action = context.createAction(ACTION_CREATE) .setDescription("Create a project.<br/>" + "Requires 'Create Projects' permission") .setSince("4.0") .setPost(true) .setResponseExample(getClass().getResource("create-example.json")) .setHandler(this); action.setChangelog( new Change("6.3", "The response format has been updated and does not contain the database ID anymore"), new Change("6.3", "The 'key' parameter has been renamed 'project'")); action.createParam(PARAM_PROJECT) .setDescription("Key of the project") .setDeprecatedKey(DEPRECATED_PARAM_KEY, "6.3") .setRequired(true) .setExampleValue(KEY_PROJECT_EXAMPLE_001); action.createParam(PARAM_NAME) .setDescription("Name of the project") .setRequired(true) .setExampleValue("SonarQube"); action.createParam(PARAM_BRANCH) .setDescription("SCM Branch of the project. The key of the project will become key:branch, for instance 'SonarQube:branch-5.0'") .setExampleValue("branch-5.0"); action.createParam(PARAM_VISIBILITY) .setDescription("Whether the created project should be visible to everyone, or only specific user/groups.<br/>" + "If no visibility is specified, the default project visibility of the organization will be used.") .setRequired(false) .setInternal(true) .setSince("6.4") .setPossibleValues("private", "public"); support.addOrganizationParam(action); }
Source:
<code>public void define(Context context) { NewController controller = context.createController("orchestrator") .setDescription("Orchestrator web service"); controller.createAction("reset") .setDescription("Reset data") .setSince("Orchestrator 3.4") .setInternal(true) .setPost(true) <START> .setHandler(new RequestHandler() { <END> public void handle(Request request, Response response) throws Exception { backendCleanup.resetData(); } }); controller.done(); }</code><technical_language>@Override removed</technical_language>

Target:
public void define(Context context) { NewController controller = context.createController("orchestrator") .setDescription("Orchestrator web service"); controller.createAction("reset") .setDescription("Reset data") .setSince("Orchestrator 3.4") .setInternal(true) .setPost(true) .setHandler(new RequestHandler() { @Override public void handle(Request request, Response response) throws Exception { backendCleanup.resetData(); } }); controller.done(); }
Source:
<code>private void joinLeaderElection() { List<String> liveInstances = _zkclient.getChildren(KeyBuilder.liveInstances(_cluster)); Collections.sort(liveInstances); String[] nodePathParts = _instanceName.split("/"); String nodeName = nodePathParts[nodePathParts.length - 1]; nodeName = nodeName.substring(_hostname.length() + 1); int index = liveInstances.indexOf(nodeName); if (index < 0) { LOG.error("Failed to join leader election. Try reconnect the zookeeper"); connect(); return; } if (index == 0) { if (_currentSubscription != null) { <START> _zkclient.unsubscribeDataChanges(_currentSubscription, _leaderElectionListener); <END> } if (!_isLeader) { onBecomeLeader(); } return; } String prevCandidate = liveInstances.get(index - 1); if (!prevCandidate.equals(_currentSubscription)) { if (_currentSubscription != null) { _zkclient.unsubscribeDataChanges(_currentSubscription, _leaderElectionListener); } _currentSubscription = prevCandidate; _zkclient.subscribeDataChanges(KeyBuilder.liveInstance(_cluster, _currentSubscription), _leaderElectionListener); } boolean exists = _zkclient.exists(KeyBuilder.liveInstance(_cluster, prevCandidate), true); if (exists) { if (_isLeader) { onBecomeFollower(); } } else { try { Thread.sleep(randomGenerator.nextInt(1000)); } catch (InterruptedException ie) { } joinLeaderElection(); } }</code><technical_language>Set _currentSubscription null unsubscribing</technical_language>

Target:
private void joinLeaderElection() { List<String> liveInstances = _zkclient.getChildren(KeyBuilder.liveInstances(_cluster)); Collections.sort(liveInstances); String[] nodePathParts = _instanceName.split("/"); String nodeName = nodePathParts[nodePathParts.length - 1]; nodeName = nodeName.substring(_hostname.length() + 1); int index = liveInstances.indexOf(nodeName); if (index < 0) { LOG.error("Failed to join leader election. Try reconnect the zookeeper"); connect(); return; } if (index == 0) { if (_currentSubscription != null) { _zkclient.unsubscribeDataChanges(KeyBuilder.liveInstance(_cluster, _currentSubscription), _leaderElectionListener); _currentSubscription = null; } if (!_isLeader) { onBecomeLeader(); } return; } String prevCandidate = liveInstances.get(index - 1); if (!prevCandidate.equals(_currentSubscription)) { if (_currentSubscription != null) { _zkclient.unsubscribeDataChanges(KeyBuilder.liveInstance(_cluster, _currentSubscription), _leaderElectionListener); } _currentSubscription = prevCandidate; _zkclient.subscribeDataChanges(KeyBuilder.liveInstance(_cluster, _currentSubscription), _leaderElectionListener); } boolean exists = _zkclient.exists(KeyBuilder.liveInstance(_cluster, prevCandidate), true); if (exists) { if (_isLeader) { onBecomeFollower(); } } else { try { Thread.sleep(randomGenerator.nextInt(1000)); } catch (InterruptedException ie) { } joinLeaderElection(); } }
Source:
<code>void registerSubclass(Class<? extends ParseObject> clazz) { if (!ParseObject.class.isAssignableFrom(clazz)) { throw new IllegalArgumentException("Cannot register a type that is not a subclass of ParseObject"); <START> } <END> String className = ObjectSubclassInfo.getClassName(clazz); synchronized (mutex) { ObjectSubclassInfo previousInfo = registeredSubclasses.get(className); if (previousInfo != null) { if (clazz.isAssignableFrom(previousInfo.type)) { return; } else if (previousInfo.type.isAssignableFrom(clazz)) { } else { throw new IllegalArgumentException( "Tried to regiser both " + previousInfo.type.getName() + " and " + clazz.getName() + " as the ParseObject subclass of " + className + ". " + "Cannot determine the right class to use because netiher inherits from " + "the other." ); } } try { registeredSubclasses.put(className, new ObjectSubclassInfo(clazz)); } catch (NoSuchMethodException ex) { throw new IllegalArgumentException( "Cannot register a type that does not implement the default constructor!" ); } } }</code><technical_language>hit this condition? strong typing in method signature clazz extend ParseObject</technical_language>

Target:
void registerSubclass(Class<? extends ParseObject> clazz) { if (!ParseObject.class.isAssignableFrom(clazz)) { throw new IllegalArgumentException("Cannot register a type that is not a subclass of ParseObject"); } String className = getClassName(clazz); Constructor<? extends ParseObject> previousConstructor = null; synchronized (mutex) { previousConstructor = registeredSubclasses.get(className); if (previousConstructor != null) { Class<? extends ParseObject> previousClass = previousConstructor.getDeclaringClass(); if (clazz.isAssignableFrom(previousClass)) { return; } else if (previousClass.isAssignableFrom(clazz)) { } else { throw new IllegalArgumentException( "Tried to register both " + previousClass.getName() + " and " + clazz.getName() + " as the ParseObject subclass of " + className + ". " + "Cannot determine the right " + "class to use because neither inherits from the other." ); } } try { registeredSubclasses.put(className, getConstructor(clazz)); } catch (NoSuchMethodException ex) { throw new IllegalArgumentException( "Cannot register a type that does not implement the default constructor!" ); } catch (IllegalAccessException ex) { throw new IllegalArgumentException( "Default constructor for " + clazz + " is not accessible." ); } } if (previousConstructor != null) { if (className.equals(getClassName(ParseUser.class))) { ParseUser.getCurrentUserController().clearFromMemory(); } else if (className.equals(getClassName(ParseInstallation.class))) { ParseInstallation.getCurrentInstallationController().clearFromMemory(); } } }
Source:
<code>private ContentViewer getSupportingViewer(String mimeType) { <START> return mimeTypeToViewerMap.containsKey(mimeType) ? mimeTypeToViewerMap.get(mimeType) : null; <END> }</code><technical_language>Map.get(key) returns null if key is contained in map</technical_language>

Target:
private ContentViewer getSupportingViewer(String mimeType) { return mimeTypeToViewerMap.get(mimeType); }
Source:
<code>public IASTTranslationUnit getASTTranslationUnit(FileContent reader, IScannerInfo scanInfo, IncludeFileContentProvider fileCreator, IIndex index, int options, IParserLogService log) throws CoreException { final IScanner scanner= createScanner(reader, scanInfo, fileCreator, log); scanner.setComputeImageLocations((options & OPTION_NO_IMAGE_LOCATIONS) == 0); scanner.setProcessInactiveCode((options & OPTION_PARSE_INACTIVE_CODE) != 0); final ISourceCodeParser parser= createParser(scanner, log, index, false, options); if(scanInfo instanceof ExtendedScannerInfo) { ExtendedScannerInfo extendedScannerInfo = (ExtendedScannerInfo) scanInfo; IParserSettings parserSettings = extendedScannerInfo.getParserSettings(); <START> if(parserSettings != null) { <END> int maximumTrivialExpressions = parserSettings.getMaximumTrivialExpressionsInAggregateInitializers(); if (maximumTrivialExpressions >= 0 && (options & OPTION_SKIP_TRIVIAL_EXPRESSIONS_IN_AGGREGATE_INITIALIZERS) != 0) { if (parser instanceof AbstractGNUSourceCodeParser) { ((AbstractGNUSourceCodeParser) parser) .setMaximumTrivialExpressionsInAggregateInitializers(maximumTrivialExpressions); } } } } ICanceler canceler= null; if (log instanceof ICanceler) { canceler= (ICanceler) log; canceler.setCancelable(new ICancelable() { @Override public void cancel() { scanner.cancel(); parser.cancel(); }}); } try { IASTTranslationUnit ast= parser.parse(); ast.setIsHeaderUnit((options & OPTION_IS_SOURCE_UNIT) == 0); return ast; } finally { if (canceler != null) { canceler.setCancelable(null); } } }</code><technical_language>A space is missing (</technical_language>

Target:
public IASTTranslationUnit getASTTranslationUnit(FileContent reader, IScannerInfo scanInfo, IncludeFileContentProvider fileCreator, IIndex index, int options, IParserLogService log) throws CoreException { final IScanner scanner= createScanner(reader, scanInfo, fileCreator, log); scanner.setComputeImageLocations((options & OPTION_NO_IMAGE_LOCATIONS) == 0); scanner.setProcessInactiveCode((options & OPTION_PARSE_INACTIVE_CODE) != 0); IParserSettings parserSettings= null; if (scanInfo instanceof ExtendedScannerInfo) { ExtendedScannerInfo extendedScannerInfo = (ExtendedScannerInfo) scanInfo; parserSettings = extendedScannerInfo.getParserSettings(); } final ISourceCodeParser parser= createParser(scanner, log, index, false, options, parserSettings); ICanceler canceler= null; if (log instanceof ICanceler) { canceler= (ICanceler) log; canceler.setCancelable(new ICancelable() { @Override public void cancel() { scanner.cancel(); parser.cancel(); }}); } try { IASTTranslationUnit ast= parser.parse(); ast.setIsHeaderUnit((options & OPTION_IS_SOURCE_UNIT) == 0); return ast; } finally { if (canceler != null) { canceler.setCancelable(null); } } }
Source:
<code>private void prepareForSending() { try { if (partitionId != null) { attemptedPartitionIds.add(partitionId); } partitionId = getPartitionForPut(attemptedPartitionIds); chunkBlobId = new BlobId(BlobId.DEFAULT_FLAG, clusterMap.getLocalDatacenterId(), passedInBlobProperties.getAccountId(), passedInBlobProperties.getContainerId(), partitionId); chunkBlobProperties = new BlobProperties(buf.remaining(), passedInBlobProperties.getServiceId(), passedInBlobProperties.getOwnerId(), passedInBlobProperties.getContentType(), passedInBlobProperties.isPrivate(), passedInBlobProperties.getTimeToLiveInSeconds(), passedInBlobProperties.getCreationTimeInMs(), passedInBlobProperties.getAccountId(), <START> passedInBlobProperties.getContainerId(), false); <END> operationTracker = new SimpleOperationTracker(routerConfig.routerDatacenterName, partitionId, false, routerConfig.routerPutSuccessTarget, routerConfig.routerPutRequestParallelism); correlationIdToChunkPutRequestInfo.clear(); state = ChunkState.Ready; } catch (RouterException e) { setOperationExceptionAndComplete(e); } catch (Exception e) { setOperationExceptionAndComplete(new RouterException("Operation tracker could not be initialized", e, RouterErrorCode.UnexpectedInternalError)); } }</code><technical_language>BlobProperties isEncrypted() is added in this patch. call it</technical_language>

Target:
private void prepareForSending() { try { if (partitionId != null) { attemptedPartitionIds.add(partitionId); } partitionId = getPartitionForPut(attemptedPartitionIds); chunkBlobId = new BlobId(BlobId.DEFAULT_FLAG, clusterMap.getLocalDatacenterId(), passedInBlobProperties.getAccountId(), passedInBlobProperties.getContainerId(), partitionId); chunkBlobProperties = new BlobProperties(buf.remaining(), passedInBlobProperties.getServiceId(), passedInBlobProperties.getOwnerId(), passedInBlobProperties.getContentType(), passedInBlobProperties.isPrivate(), passedInBlobProperties.getTimeToLiveInSeconds(), passedInBlobProperties.getCreationTimeInMs(), passedInBlobProperties.getAccountId(), passedInBlobProperties.getContainerId(), passedInBlobProperties.isEncrypted()); operationTracker = new SimpleOperationTracker(routerConfig.routerDatacenterName, partitionId, false, routerConfig.routerPutSuccessTarget, routerConfig.routerPutRequestParallelism); correlationIdToChunkPutRequestInfo.clear(); state = ChunkState.Ready; } catch (RouterException e) { setOperationExceptionAndComplete(e); } catch (Exception e) { setOperationExceptionAndComplete(new RouterException("Operation tracker could not be initialized", e, RouterErrorCode.UnexpectedInternalError)); } }
Source:
<code>public TestHiveIntegrationSmokeTest() { this(() -> createQueryRunner( ImmutableList.of(ORDERS, CUSTOMER, LINE_ITEM, PART_SUPPLIER), ImmutableMap.of( "experimental.table-writer-merge-operator-enabled", "true", <START> "task.writer-count", "2"), <END> Optional.empty()), createBucketedSession(Optional.of(new SelectedRole(ROLE, Optional.of("admin")))), createMaterializeExchangesSession(Optional.of(new SelectedRole(ROLE, Optional.of("admin")))), HIVE_CATALOG, new HiveTypeTranslator()); }</code><technical_language>ditto for 4</technical_language>

Target:
public TestHiveIntegrationSmokeTest() { this(() -> createQueryRunner(ORDERS, CUSTOMER, LINE_ITEM, PART_SUPPLIER), createBucketedSession(Optional.of(new SelectedRole(ROLE, Optional.of("admin")))), createMaterializeExchangesSession(Optional.of(new SelectedRole(ROLE, Optional.of("admin")))), HIVE_CATALOG, new HiveTypeTranslator()); }
Source:
<code>private static EventFiringWebDriver getAndroidInstance(){ DesiredCapabilities destCaps = new DesiredCapabilities(); destCaps.setCapability("deviceName", ConfigurationFactory.getConfig().getDeviceName().toString()); URL url = null; try { url = new URL("http://" + ConfigurationFactory.getConfig().getAppiumIp().toString() + "/wd/hub"); } catch (MalformedURLException e) { <START> e.printStackTrace(); <END> } mobileDriver = new AndroidDriver(url, destCaps); return new EventFiringWebDriver(mobileDriver); }</code><technical_language>Do e.printStackTrace. Please log error instead. PageObjectLogging.log("getAndroindInstance", e.getMessage(), false);</technical_language>

Target:
private static EventFiringWebDriver getAndroidInstance(){ DesiredCapabilities destCaps = new DesiredCapabilities(); destCaps.setCapability("deviceName", ConfigurationFactory.getConfig().getDeviceName().toString()); URL url = null; try { url = new URL("http://" + ConfigurationFactory.getConfig().getAppiumIp().toString() + "/wd/hub"); } catch (MalformedURLException e) { PageObjectLogging.log("getAndroindInstance", e.getMessage(), false); } mobileDriver = new AndroidDriver(url, destCaps); return new EventFiringWebDriver(mobileDriver); }
Source:
<code>private void testTransactionalTable(boolean batch) { TableEnvironment tableEnv = batch ? getTableEnvWithHiveCatalog() : getStreamTableEnvWithHiveCatalog(); tableEnv.executeSql("create database db1"); try { tableEnv.executeSql("create table db1.src (x string,y string)"); hiveShell.execute("create table db1.dest (x string,y string) clustered by (x) into 3 buckets stored as orc tblproperties ('transactional'='true')"); <START> HiveTestUtils.createTextTableInserter(hiveShell, "db1", "src") .addRow(new Object[]{"a", "b"}) .addRow(new Object[]{"c", "d"}) .commit(); <END> try { TableEnvUtil.execInsertSqlAndWaitResult(tableEnv, "insert into db1.src select * from db1.dest"); } catch (TableException e) { assertEquals("Cannot read on the ACID table db1.dest.", e.getMessage()); } try { TableEnvUtil.execInsertSqlAndWaitResult(tableEnv, "insert into db1.dest select * from db1.src"); } catch (TableException e) { assertEquals("Cannot write on the ACID table test-catalog.db1.dest.", e.getMessage()); } } finally { tableEnv.executeSql("drop database db1 cascade"); } }</code><technical_language>need insert data</technical_language>

Target:
private void testTransactionalTable(boolean batch) { TableEnvironment tableEnv = batch ? getTableEnvWithHiveCatalog() : getStreamTableEnvWithHiveCatalog(); tableEnv.executeSql("create database db1"); try { tableEnv.executeSql("create table db1.src (x string,y string)"); hiveShell.execute("create table db1.dest (x string,y string) clustered by (x) into 3 buckets stored as orc tblproperties ('transactional'='true')"); List<Exception> exceptions = new ArrayList<>(); try { TableEnvUtil.execInsertSqlAndWaitResult(tableEnv, "insert into db1.src select * from db1.dest"); } catch (Exception e) { exceptions.add(e); } try { TableEnvUtil.execInsertSqlAndWaitResult(tableEnv, "insert into db1.dest select * from db1.src"); } catch (Exception e) { exceptions.add(e); } assertEquals(2, exceptions.size()); exceptions.forEach(e -> { assertTrue(e instanceof FlinkHiveException); assertEquals("Reading or writing ACID table db1.dest is not supported.", e.getMessage()); }); } finally { tableEnv.executeSql("drop database db1 cascade"); } }
Source:
<code>public static void sendRuntimeConfig(String topologyName, TMasterCommand topologyStateControlCommand, SchedulerStateManagerAdaptor statemgr, String[] configs, NetworkUtils.TunnelConfig tunnelConfig) throws TMasterException { final String runtimeConfigKey = "runtime-config"; final String runtimeConfigUpdateEndpoint = "runtime_config/update"; <START> String[] arguments = new String[configs.length]; <END> for (int i = 0; i < configs.length; ++i) { arguments[i] = runtimeConfigKey + "=" + configs[i]; } TMasterUtils.sendToTMasterWithArguments( runtimeConfigUpdateEndpoint, topologyName, arguments, statemgr, tunnelConfig); LOG.log(Level.INFO, "Topology command {0} completed successfully.", topologyStateControlCommand); }</code><technical_language>vector<string> need allocate memory</technical_language>

Target:
public static void sendRuntimeConfig(String topologyName, TMasterCommand topologyStateControlCommand, SchedulerStateManagerAdaptor statemgr, String[] configs, NetworkUtils.TunnelConfig tunnelConfig) throws TMasterException { final String runtimeConfigKey = "runtime-config"; final String runtimeConfigUpdateEndpoint = "runtime_config/update"; List<String> arguments = new ArrayList<String>(); for (String config: configs) { arguments.add(runtimeConfigKey + "=" + config); } TMasterUtils.sendToTMasterWithArguments( runtimeConfigUpdateEndpoint, topologyName, arguments, statemgr, tunnelConfig); LOG.log(Level.INFO, "Topology command {0} completed successfully.", topologyStateControlCommand); }
Source:
<code>public void initializeDefaultPreferences() { final IEclipsePreferences p = DefaultScope.INSTANCE.getNode(Activator.getPluginId()); p.putInt(GitCorePreferences.core_packedGitWindowSize, 8 * 1024); p.putInt(GitCorePreferences.core_packedGitLimit, 10 * MB); p.putBoolean(GitCorePreferences.core_packedGitMMAP, false); p.putInt(GitCorePreferences.core_deltaBaseCacheLimit, 10 * MB); p.putInt(GitCorePreferences.core_streamFileThreshold, 50 * MB); p.putBoolean(GitCorePreferences.core_autoShareProjects, true); p.putBoolean(GitCorePreferences.core_autoIgnoreDerivedResources, true); p.putBoolean(GitCorePreferences.core_enableLogicalModel, true); p.put(GitCorePreferences.core_preferredModelMergeStrategy, <START> MergeStrategy.RECURSIVE.getName()); <END> }</code><technical_language>Again: hardcode default MergeStrategy</technical_language>

Target:
public void initializeDefaultPreferences() { final IEclipsePreferences p = DefaultScope.INSTANCE.getNode(Activator.getPluginId()); p.putInt(GitCorePreferences.core_packedGitWindowSize, 8 * 1024); p.putInt(GitCorePreferences.core_packedGitLimit, 10 * MB); p.putBoolean(GitCorePreferences.core_packedGitMMAP, false); p.putInt(GitCorePreferences.core_deltaBaseCacheLimit, 10 * MB); p.putInt(GitCorePreferences.core_streamFileThreshold, 50 * MB); p.putBoolean(GitCorePreferences.core_autoShareProjects, true); p.putBoolean(GitCorePreferences.core_autoIgnoreDerivedResources, true); }
Source:
<code>public List<PoolSubpageMetric> tinySubpages() { <START> return new ArrayList<PoolSubpageMetric>(); <END> }</code><technical_language>suggestion return Collections.emptyList();</technical_language>

Target:
public List<PoolSubpageMetric> tinySubpages() { return Collections.emptyList(); }
Source:
<code>public static void onUpdate(SQLiteDatabase db, int from, int to) { Timber.d("bookmarksLocations db is updated from:"+from+", to:"+to); if (from == to) { return; } if (from < 7) { from++; onUpdate(db, from, to); return; } if (from == 7) { onCreate(db); from++; onUpdate(db, from, to); return; } if (from == 8) { from++; onUpdate(db, from, to); return; } if (from == 10 && to == 11) { from++; try { db.execSQL("ALTER TABLE bookmarksLocations ADD COLUMN location_pic STRING;"); }catch (SQLiteException exception){ Timber.e(exception); } return; } <START> if (from == 12 && to == 13) { <END> from++; try { db.execSQL("ALTER TABLE bookmarksLocations ADD COLUMN location_destroyed STRING;"); }catch (SQLiteException exception){ Timber.e(exception); } return; } }</code><technical_language>this == x && == y is done, typically this is done in a switch fallthrough. problem is guarantee a user upgrades monotonically, a user theoretically v1 v100 of intervening updates migrations happily walk path</technical_language>

Target:
public static void onUpdate(SQLiteDatabase db, int from, int to) { Timber.d("bookmarksLocations db is updated from:"+from+", to:"+to); switch (from) { case 7: onCreate(db); case 8: case 9: case 10: try { db.execSQL("ALTER TABLE bookmarksLocations ADD COLUMN location_pic STRING;"); } catch (SQLiteException exception){ Timber.e(exception); } case 11: case 12: try { db.execSQL("ALTER TABLE bookmarksLocations ADD COLUMN location_destroyed STRING;"); }catch (SQLiteException exception){ Timber.e(exception); } break; } }
Source:
<code>protected OperationRequest makeOperationRequest(ReplicaId replicaId) { <START> if(!sslEnabledColos.contains(replicaId.getDataNodeId().getDatacenterName())) { <END> return new GetBlobPropertiesOperationRequest(connectionPool, responseQueue, context, blobId, replicaId, makeGetRequest(), clusterMap, this, false); } else{ return new GetBlobPropertiesOperationRequest(connectionPool, responseQueue, context, blobId, replicaId, makeGetRequest(), clusterMap, this, true); } }</code><technical_language>again</technical_language>

Target:
protected OperationRequest makeOperationRequest(ReplicaId replicaId) { return new GetBlobPropertiesOperationRequest(connectionPool, responseQueue, context, blobId, replicaId, makeGetRequest(), clusterMap, this); }
Source:
<code>public AnnotationRoutingStrategy(Class<? extends Annotation> annotationType) { <START> this(annotationType, UnresolvedRoutingKeyPolicy.RANDOM_KEY); <END> }</code><technical_language>guess previous behaviour, allow users set a UnresolvedRoutingKeyPolicy, Reason is introduce unexpected behaviour for users move a version</technical_language>

Target:
public AnnotationRoutingStrategy(Class<? extends Annotation> annotationType) { this(annotationType, UnresolvedRoutingKeyPolicy.ERROR); }
Source:
<code>public synchronized void putIfAbsent(String key, String value) { <START> if(getProperty(key) == null) { <END> put(key,value); } }</code><technical_language>space</technical_language>

Target:
public synchronized TypedProperties putIfAbsent(String key, String value) { if (getProperty(key) == null) { put(key, value); } return this; }
Source:
<code>private void pushAdapter(ITestDevice device, String bitness) throws DeviceNotAvailableException, IOException { VtsCompatibilityInvocationHelper invocationHelper = createVtsHelper(); File adapterDir = new File( invocationHelper.getTestsDir(), String.format(VTS_NATIVE_TEST_DIR, bitness)); File adapter = FileUtil.findFile(adapterDir, mAdapterBinaryName); if (adapter != null) { CLog.i("Pushing %s", mAdapterBinaryName); device.pushFile( adapter, String.format(TARGET_NATIVE_TEST_DIR, bitness) + mAdapterBinaryName); } else { throw new <START> RuntimeException("Could <END> not find adapter: " + mAdapterBinaryName); } }</code><technical_language>match declaration</technical_language>

Target:
private void pushAdapter(ITestDevice device, String bitness) throws DeviceNotAvailableException, IOException, NoSuchElementException { VtsCompatibilityInvocationHelper invocationHelper = createVtsHelper(); File adapterDir = new File( invocationHelper.getTestsDir(), String.format(VTS_NATIVE_TEST_DIR, bitness)); File adapter = FileUtil.findFile(adapterDir, mAdapterBinaryName); if (adapter != null) { CLog.i("Pushing %s", mAdapterBinaryName); device.pushFile( adapter, String.format(TARGET_NATIVE_TEST_DIR, bitness) + mAdapterBinaryName); } else { throw new NoSuchElementException("Could not find adapter: " + mAdapterBinaryName); } }
Source:
<code><START> protected Class<? extends BaseBlockRender> getRenderer() <END> { return RenderQuartzTorch.class; }</code><technical_language>raw</technical_language>

Target:
protected Class<? extends RenderQuartzTorch> getRenderer() { return RenderQuartzTorch.class; }
Source:
<code>public ArrayMutableBlockBuffer(BlockPalette palette, Vector3i start, Vector3i size) { super(start, size); <START> this.palette = palette; <END> this.data = new PackedBackingData(size.getX() * size.getY() * size.getZ(), palette.getHighestId()); }</code><technical_language>need setting contents of backing data id for air in incoming palette (which zero)</technical_language>

Target:
public ArrayMutableBlockBuffer(BlockPalette palette, Vector3i start, Vector3i size) { super(start, size); this.palette = palette; int airId = palette.getOrAssign(AIR); int dataSize = area(); this.data = new PackedBackingData(dataSize, palette.getHighestId()); if (airId != 0) { for (int i = 0; i < dataSize; i++) { this.data.set(i, airId); } } }
Source:
<code>private IndexDiffData doReload(final Repository repository) { currentRepository = repository; IndexDiffCacheEntry cacheEntry = org.eclipse.egit.core.Activator.getDefault().getIndexDiffCache().getIndexDiffCacheEntry(currentRepository); <START> cacheEntry.addIndexDiffChangedListener(myIndexDiffListener); <END> return cacheEntry.getIndexDiff(); }</code><technical_language>is unregistration ? I expect removeIndexDiffChangedListener() revert this registration need informed updates anymore</technical_language>

Target:
private IndexDiffData doReload(final Repository repository) { currentRepository = repository; IndexDiffCacheEntry entry = org.eclipse.egit.core.Activator.getDefault().getIndexDiffCache().getIndexDiffCacheEntry(currentRepository); if(cacheEntry != null && cacheEntry != entry) cacheEntry.removeIndexDiffChangedListener(myIndexDiffListener); cacheEntry = entry; cacheEntry.addIndexDiffChangedListener(myIndexDiffListener); return cacheEntry.getIndexDiff(); }
Source:
<code>public synchronized void commit() throws IOException { if (logStream != null) { logStream.flush(); } for (FileOutputStream log : streamsToFlush) { log.flush(); if (forceSync) { long startSyncNS = System.nanoTime(); log.getChannel().force(false); long syncElapsedMS = TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - startSyncNS); if (syncElapsedMS > fsyncWarningThresholdMS) { if(serverStats != null) { serverStats.incrementFsyncThresholdExceedCount(); } else { <START> LOG.warn("fsyncWarningThresholdMS exceeded, but serverStats not added in FileTxnLog!"); <END> } LOG.warn("fsync-ing the write ahead log in " + Thread.currentThread().getName() + " took " + syncElapsedMS + "ms which will adversely effect operation latency. " + "See the ZooKeeper troubleshooting guide"); } } } while (streamsToFlush.size() > 1) { streamsToFlush.removeFirst().close(); } }</code><technical_language>This log redundant me, fsync threshold exceeded log line 340, serverStats is set, stats in serverStats, set</technical_language>

Target:
public synchronized void commit() throws IOException { if (logStream != null) { logStream.flush(); } for (FileOutputStream log : streamsToFlush) { log.flush(); if (forceSync) { long startSyncNS = System.nanoTime(); log.getChannel().force(false); long syncElapsedMS = TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - startSyncNS); if (syncElapsedMS > fsyncWarningThresholdMS) { if(serverStats != null) { serverStats.incrementFsyncThresholdExceedCount(); } LOG.warn("fsync-ing the write ahead log in " + Thread.currentThread().getName() + " took " + syncElapsedMS + "ms which will adversely effect operation latency. " + "See the ZooKeeper troubleshooting guide"); } } } while (streamsToFlush.size() > 1) { streamsToFlush.removeFirst().close(); } }
Source:
<code>public void checksignatureHelpProvider() { editor.goToCursorPositionVisible(25, 38); editor.typeTextIntoEditor(ENTER.toString()); editor.typeTextIntoEditor("printVar.print("); try { editor.waitExpTextIntoShowHintsPopUp(""); } catch (WebDriverException ex) { <START> fail("Known permanent failure: issue <LINK_0>"); <END> } }</code><technical_language>**WebDriverException** is general here. So, useful exact error in logs: fail("Known permanent failure <LINK_0>", ex);</technical_language>

Target:
public void checksignatureHelpProvider() { editor.goToCursorPositionVisible(25, 38); editor.typeTextIntoEditor(ENTER.toString()); editor.typeTextIntoEditor("printVar.print("); try { editor.waitExpTextIntoShowHintsPopUp("setVAlue: string"); } catch (WebDriverException ex) { fail("Known permanent failure <LINK_0>", ex); } }
Source:
<code>synchronized boolean tryAcquirePersistentLock() { Preconditions.checkState(!isShutDown, "This PersistentLockManager is shut down, and cannot be used to acquire locks."); try { lockId = persistentLockService.acquireBackupLock("Sweep"); log.info("Successfully acquired persistent lock for sweep: {}", SafeArg.of("lockId", lockId)); return true; } catch (CheckAndSetException e) { List<byte[]> actualValues = e.getActualValues(); if (!actualValues.isEmpty()) { LockEntry actualEntry = LockEntry.fromStoredValue(actualValues.get(0)); if (actualEntry.instanceId().equals(lockId.value())) { throw new IllegalStateException( <START> "Acquiring a lock is unsupported when we've already acquired a lock"); <END> } else { lockId = null; } } lockFailureMeter.mark(); log.info("Failed to acquire persistent lock for sweep. Waiting and retrying."); return false; } catch (NotInitializedException e) { log.info("The LockStore is not initialized yet. Waiting and retrying."); return false; } }</code><technical_language>If throw a IllegalStateException here, end in retry-loop before, catch Exception BackgroundSweeperImpl. log a warning continue - worse happen is else able acquire backup lock while this thread thought released</technical_language>

Target:
synchronized boolean tryAcquirePersistentLock() { Preconditions.checkState(!isShutDown, "This PersistentLockManager is shut down, and cannot be used to acquire locks."); try { lockId = persistentLockService.acquireBackupLock("Sweep"); log.info("Successfully acquired persistent lock for sweep: {}", SafeArg.of("lockId", lockId)); return true; } catch (CheckAndSetException e) { List<byte[]> actualValues = e.getActualValues(); if (!actualValues.isEmpty()) { LockEntry actualEntry = LockEntry.fromStoredValue(actualValues.get(0)); log.debug("CAS failed on lock acquire. We thought the lockId was {}, and the database has {}", SafeArg.of("lockId", lockId), SafeArg.of("actualEntry", actualEntry)); if (lockId != null && actualEntry.instanceId().equals(lockId.value())) { log.info("Attempted to acquire the a new lock when we already held a lock." + " The acquire failed, but our lock is still valid, so we still hold the lock."); return true; } else { lockId = null; } } lockFailureMeter.mark(); log.info("Failed to acquire persistent lock for sweep. Waiting and retrying."); return false; } catch (NotInitializedException e) { log.info("The LockStore is not initialized yet. Waiting and retrying."); return false; } }
Source:
<code>public void testValidatePipe() throws Exception { <START> String sc = PasswordHash.createHash("password"); <END> session.put("key", sc ); pipe.setHashSessionKey("key"); pipe.configure(); PipeRunResult res = doPipe(pipe, "password", session); assertEquals("success", res.getPipeForward().getName()); }</code><technical_language>convert current PasswordHash tests (in static main method of class) proper junit tests</technical_language>

Target:
public void testValidatePipe() throws Exception { pipe.configure(); PipeRunResult res = doPipe(pipe, "password", session); assertTrue(PasswordHash.validatePassword("password", res.getResult().asString())); assertEquals("success", res.getPipeForward().getName()); }
Source:
<code>private void onShareClicked() { String videoUrl = getVideoUrl(); final int ts = getPlaybackSeekBar().getProgress() / 1000; <START> if (!isLive() && videoUrl.contains("<LINK_0>") && ts >= 0) { <END> videoUrl += ("&t=" + ts); } ShareUtils.shareUrl(service, getVideoTitle(), videoUrl); }</code><technical_language>ServiceHelper.getSelectedService used? advantage of relying specific format of url</technical_language>

Target:
private void onShareClicked() { final int ts = getPlaybackSeekBar().getProgress() / 1000; final MediaSourceTag metadata = getCurrentMetadata(); String videoUrl = getVideoUrl(); if (!isLive() && ts >= 0 && metadata != null && metadata.getMetadata().getServiceId() == YouTube.getServiceId()) { videoUrl += ("&t=" + ts); } ShareUtils.shareUrl(service, getVideoTitle(), videoUrl); }
Source:
<code>protected void doStop() throws Exception { super.doStop(); if (log.isTraceEnabled()) { <START> log.trace("Shutting down consumer gracefully"); <END> } dbzEngine.stop(); getEndpoint().getCamelContext().getExecutorServiceManager().shutdownGraceful(executorService); }</code><technical_language>Is this needed? super.doStop() is logging debug message</technical_language>

Target:
protected void doStop() throws Exception { dbzEngine.stop(); getEndpoint().getCamelContext().getExecutorServiceManager().shutdownGraceful(executorService); super.doStop(); }
Source:
<code>protected VDSReturnValue getStatsForDomain() { VDS spmVds = LinqUtils.first(LinqUtils.filter(getAllRunningVdssInPool(), new Predicate<VDS>() { @Override public boolean eval(VDS vds) { return vds.getSpmStatus() == VdsSpmStatus.SPM; } })); return runVdsCommand(VDSCommandType.GetStorageDomainStats, <START> new GetStorageDomainStatsVDSCommandParameters(spmVds.getId(), getParameters().getStorageDomainId())); <END> }</code><technical_language>In 3.6.0 SPM. In this case, host</technical_language>

Target:
protected VDSReturnValue getStatsForDomain() { VDS spmVds = LinqUtils.first(getAllRunningVdssInPool()); return runVdsCommand(VDSCommandType.GetStorageDomainStats, new GetStorageDomainStatsVDSCommandParameters(spmVds.getId(), getParameters().getStorageDomainId())); }
Source:
<code><START> public ModuleCrawlerResult crawl( ModuleRecord parentRecord ) <END> throws ParserException, IOException, ModuleException { crawlModule( parentRecord ); this.cache.put( parentRecord.source(), parentRecord ); while( modulesToCrawl.peek() != null ) { Source module = modulesToCrawl.poll(); if( this.result.isRecordInResult( module.source() ) ) { continue; } if( this.cache.containsKey( module.source() ) ) { this.result.addModuleRecord( this.cache.get( module.source() ) ); continue; } ModuleRecord p = parser.parse( module ); this.cache.put( p.source(), p ); crawlModule( p ); } return this.result; }</code><technical_language>a static method (you create module crawler right before)</technical_language>

Target:
private CrawlerResult crawl( ModuleRecord parentRecord ) throws ParserException, IOException, ModuleException { CrawlerResult result = new CrawlerResult(); Queue< ModuleSource > dependencies = new LinkedList<>(); result.addModuleRecord( parentRecord ); dependencies.addAll( this.crawlModule( parentRecord ) ); while( dependencies.peek() != null ) { ModuleSource module = dependencies.poll(); if( result.isRecordInResult( module.uri() ) ) { continue; } if( ModuleCrawler.inCache( module.uri() ) ) { result.addModuleRecord( ModuleCrawler.getRecordFromCache( module.uri() ) ); continue; } ModuleParser parser = new ModuleParser( parserConfiguration ); ModuleRecord p = parser.parse( module ); result.addModuleRecord( p ); dependencies.addAll( this.crawlModule( p ) ); } return result; }
Source:
<code>public io.confluent.connect.storage.format.RecordWriter getRecordWriter( final HdfsSinkConnectorConfig conf, final String filename ) { return new io.confluent.connect.storage.format.RecordWriter() { final CompressionCodecName compressionCodecName = CompressionCodecName.SNAPPY; final int blockSize = 256 * 1024 * 1024; final int pageSize = 64 * 1024; final Path path = new Path(filename); Schema schema = null; ParquetWriter<GenericRecord> writer = null; @Override public void write(SinkRecord record) { if (schema == null) { schema = record.valueSchema(); } if (writer == null) { try { log.info("Opening record writer for: {}", filename); org.apache.avro.Schema avroSchema = avroData.fromConnectSchema(schema); writer = new AvroParquetWriter<>( path, avroSchema, compressionCodecName, blockSize, pageSize, true, conf.getHadoopConfiguration() ); log.debug("Opened record writer for: {}", filename); } catch (IOException e) { <START> log.debug( <END> "Error creating AvroParquetWriter for file '{}', {}, and schema {}: ", filename, compressionCodecName, schema, e ); throw new ConnectException(e); } } log.trace("Sink record: {}", record.toString()); Object value = avroData.fromConnectData(record.valueSchema(), record.value()); try { writer.write((GenericRecord) value); } catch (IOException e) { throw new ConnectException(e); } } @Override public void close() { if (writer != null) { try { writer.close(); } catch (IOException e) { throw new ConnectException(e); } } } @Override public void commit() }; }</code><technical_language>sounds a warn level here</technical_language>

Target:
public io.confluent.connect.storage.format.RecordWriter getRecordWriter( final HdfsSinkConnectorConfig conf, final String filename ) { return new io.confluent.connect.storage.format.RecordWriter() { final CompressionCodecName compressionCodecName = CompressionCodecName.SNAPPY; final int blockSize = 256 * 1024 * 1024; final int pageSize = 64 * 1024; final Path path = new Path(filename); Schema schema = null; ParquetWriter<GenericRecord> writer = null; @Override public void write(SinkRecord record) { if (schema == null) { schema = record.valueSchema(); } if (writer == null) { try { log.info("Opening record writer for: {}", filename); org.apache.avro.Schema avroSchema = avroData.fromConnectSchema(schema); writer = new AvroParquetWriter<>( path, avroSchema, compressionCodecName, blockSize, pageSize, true, conf.getHadoopConfiguration() ); log.debug("Opened record writer for: {}", filename); } catch (IOException e) { log.warn( "Error creating for file '{}', {}, and schema {}: ", AvroParquetWriter.class.getSimpleName(), filename, compressionCodecName, schema, e ); throw new ConnectException(e); } } log.trace("Sink record: {}", record.toString()); Object value = avroData.fromConnectData(record.valueSchema(), record.value()); try { writer.write((GenericRecord) value); } catch (IOException e) { throw new ConnectException(e); } } @Override public void close() { if (writer != null) { try { writer.close(); } catch (IOException e) { throw new ConnectException(e); } } } @Override public void commit() }; }
Source:
<code>public ResponseEntity moveSampleListFolder(@PathVariable final String crop, @PathVariable final Integer folderId, @RequestParam final Integer newParentId) { <START> Map<String, Object> map; <END> try { map = this.sampleListService.moveSampleListFolder(folderId, newParentId); } catch (final MiddlewareException e) { final ErrorResponse response = new ErrorResponse(); response.addError("Something went wrong, please try again"); return new ResponseEntity<>(response, HttpStatus.CONFLICT); } return new ResponseEntity<>(map,HttpStatus.OK); }</code><technical_language>add final</technical_language>

Target:
public ResponseEntity moveSampleListFolder(@PathVariable final String crop, @PathVariable final Integer folderId, @RequestParam final Integer newParentId) { final Map<String, Object> map; try { map = this.sampleListService.moveSampleListFolder(folderId, newParentId); } catch (final MiddlewareException e) { final ErrorResponse response = new ErrorResponse(); response.addError("Something went wrong, please try again"); return new ResponseEntity<>(response, HttpStatus.CONFLICT); } return new ResponseEntity<>(map, HttpStatus.OK); }
Source:
<code>public void testCSRFEnabledAllowedMethodFromBrowser() throws Exception { StartupProperties.get().setProperty("falcon.security.csrf.enabled", "true"); mockHeader("Mozilla/5.0", null); mockGetMethod(); mockRunFilter(); <START> Mockito.verify(mockResponse, Mockito.never()).sendError(HttpServletResponse.SC_BAD_REQUEST, CSRF_ERROR_MESSAGE); <END> }</code><technical_language>SC_FORBIDDEN more appropriate</technical_language>

Target:
public void testCSRFEnabledAllowedMethodFromBrowser() throws Exception { StartupProperties.get().setProperty("falcon.security.csrf.enabled", "true"); mockHeader("Mozilla/5.0", null); mockGetMethod(); mockRunFilter(); Mockito.verify(mockResponse, Mockito.never()).sendError(HttpServletResponse.SC_FORBIDDEN, RestCsrfPreventionFilter.CSRF_ERROR_MESSAGE); }
Source:
<code>public void setUp() throws IOException { serverAddress += wireMock.port(); communicator = Mockito.mock(UrlCommunicator.class); tmcApi = new TmcApi(communicator, settings); settings.setUsername("username"); settings.setPassword("password"); HttpResult fakeResult = new HttpResult(ExampleJson.allCoursesExample, 200, true); <START> Mockito.when(communicator.makeGetRequestWithAuthentication(URI.create(Mockito.anyString()))) <END> .thenReturn(fakeResult); }</code><technical_language>any(URI.class)</technical_language>

Target:
public void setUp() throws IOException { serverAddress += wireMock.port(); communicator = Mockito.mock(UrlCommunicator.class); tmcApi = new TmcApi(communicator, settings); settings.setUsername("username"); settings.setPassword("password"); HttpResult fakeResult = new HttpResult(ExampleJson.allCoursesExample, 200, true); Mockito.when(communicator.makeGetRequestWithAuthentication(Mockito.any(URI.class))) .thenReturn(fakeResult); }
Source:
<code>public static IntervalList concatenate(final IntervalList list1, final IntervalList list2) { final SAMFileHeader header = list1.getHeader().clone(); header.setSortOrder(SAMFileHeader.SortOrder.unsorted); final IntervalList merged = new IntervalList(header); merged.addall(list1.getIntervals()); SequenceUtil.assertSequenceDictionariesEqual(merged.getHeader().getSequenceDictionary(), <START> list2.getHeader().getSequenceDictionary()); <END> merged.addall(list2.intervals); return merged; }</code><technical_language>Nit: this assert start of method delaying header cloned new interval list is created</technical_language>

Target:
public static IntervalList concatenate(final IntervalList list1, final IntervalList list2) { final SAMFileHeader header = list1.getHeader().clone(); return new IntervalList(header).addOther(list1).addOther(list2); }
Source:
<code>public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException { <START> Iterator<String> beanNames = beanFactory.getBeanNamesIterator(); <END> while (beanNames.hasNext()) { String beanName = beanNames.next(); if (beanFactory.containsBeanDefinition(beanName)) { BeanDefinition beanDefinition = beanFactory.getBeanDefinition(beanName); if (beanDefinition instanceof AnnotatedBeanDefinition) { AnnotatedBeanDefinition annotatedBeanDefinition = (AnnotatedBeanDefinition) beanDefinition; if (annotatedBeanDefinition.getMetadata().hasAnnotation(JGivenStage.class.getName())) { String className = beanDefinition.getBeanClassName(); Class<?> stageClass = createStageClass(beanName, className); beanDefinition.setBeanClassName(stageClass.getName()); } } } } }</code><technical_language>consider org.springframework.beans.factory.ListableBeanFactory.getBeanNamesForAnnotation(Class<? extends Annotation>) here? org.springframework.beans.factory.ListableBeanFactory.getBeanDefinitionNames() work is in Spring 3</technical_language>

Target:
public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException { String[] beanNames = beanFactory.getBeanDefinitionNames(); for (String beanName : beanNames) { if (beanFactory.containsBeanDefinition(beanName)) { BeanDefinition beanDefinition = beanFactory.getBeanDefinition(beanName); if (beanDefinition instanceof AnnotatedBeanDefinition) { AnnotatedBeanDefinition annotatedBeanDefinition = (AnnotatedBeanDefinition) beanDefinition; if (annotatedBeanDefinition.getMetadata().hasAnnotation(JGivenStage.class.getName())) { String className = beanDefinition.getBeanClassName(); Class<?> stageClass = createStageClass(beanName, className); beanDefinition.setBeanClassName(stageClass.getName()); } } } } }