auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void testQueryTimeout() throws Exception { try (Connection connection = createConnection("blackhole", "blackhole"); Statement statement = connection.createStatement()) { statement.executeUpdate("CREATE TABLE test_query_timeout (key BIGINT) " + "WITH (" + " split_count = 1, " + " pages_per_split = 1, " + " rows_per_page = 1, " + " page_processing_delay = '1m'" + ")"); } CountDownLatch queryStarted = new CountDownLatch(1); CountDownLatch queryFinished = new CountDownLatch(1); AtomicReference<String> queryId = new AtomicReference<>(); AtomicReference<Throwable> queryFailure = new AtomicReference<>(); Future<?> queryFuture = executorService.submit(() -> { try (Connection connection = createConnection("blackhole", "default"); Statement statement = connection.createStatement()) { statement.setQueryTimeout(1); try (ResultSet resultSet = statement.executeQuery("SELECT * FROM test_query_timeout")) { queryId.set(resultSet.unwrap(PrestoResultSet.class).getQueryId()); queryStarted.countDown(); try { resultSet.next(); } catch (SQLException t) { queryFailure.set(t); } finally { queryFinished.countDown(); } } } return null; }); <START> assertTrue(queryStarted.await(2, SECONDS)); <END> assertNotNull(queryId.get()); assertFalse(getQueryState(queryId.get()).isDone()); assertTrue(queryFinished.await(2, SECONDS)); assertTrue(queryFailure.get().getMessage().contains("Query exceeded maximum time limit of 1.00s")); assertEquals(getQueryState(queryId.get()), FAILED); try (Connection connection = createConnection("blackhole", "blackhole"); Statement statement = connection.createStatement()) { statement.executeUpdate("DROP TABLE test_query_timeout"); } }</code><technical_language>remove this check, queryStarted latch queryId. care is fails "exceeded time limit" error</technical_language>

Target:
public void testQueryTimeout() throws Exception { try (Connection connection = createConnection("blackhole", "blackhole"); Statement statement = connection.createStatement()) { statement.executeUpdate("CREATE TABLE test_query_timeout (key BIGINT) " + "WITH (" + " split_count = 1, " + " pages_per_split = 1, " + " rows_per_page = 1, " + " page_processing_delay = '1m'" + ")"); } CountDownLatch queryFinished = new CountDownLatch(1); AtomicReference<Throwable> queryFailure = new AtomicReference<>(); executorService.submit(() -> { try (Connection connection = createConnection("blackhole", "default"); Statement statement = connection.createStatement()) { statement.setQueryTimeout(1); try (ResultSet resultSet = statement.executeQuery("SELECT * FROM test_query_timeout")) { try { resultSet.next(); } catch (SQLException t) { queryFailure.set(t); } finally { queryFinished.countDown(); } } } return null; }); assertTrue(queryFinished.await(2, SECONDS)); assertNotNull(queryFailure.get()); assertContains(queryFailure.get().getMessage(), "Query exceeded maximum time limit of 1.00s"); try (Connection connection = createConnection("blackhole", "blackhole"); Statement statement = connection.createStatement()) { statement.executeUpdate("DROP TABLE test_query_timeout"); } }
Source:
<code>private static void printClass( @BinaryName String classname, AClass aClass, BaseTypeChecker checker, PrintWriter printWriter) { String basename = basenamePart(classname); String innermostClassname = basename.contains("$") ? basename.substring(basename.lastIndexOf('$') + 1) : basename; String pkg = packagePart(classname); if (pkg != null) { printWriter.println("package " + pkg + ";"); } int curlyCount = printClassDefinitions(basename, aClass, printWriter); String indentLevel = indents(curlyCount); List<VariableElement> enumConstants = aClass.getEnumConstants(); if (enumConstants != null) { StringJoiner sj = new StringJoiner(", "); for (VariableElement enumConstant : enumConstants) { sj.add(enumConstant.getSimpleName()); } printWriter.println(indentLevel + " printWriter.println(); printWriter.println(indentLevel + sj.toString() + ";"); printWriter.println(); } printFields(aClass, printWriter, indentLevel); if (!aClass.getMethods().isEmpty()) { printWriter.println(indentLevel + " printWriter.println(); for (Map.Entry<String, AMethod> methodEntry : aClass.getMethods().entrySet()) { printMethodDeclaration( methodEntry.getValue(), innermostClassname, printWriter, indentLevel, <START> checker.getTypeFactory()); <END> } } for (int i = 0; i < curlyCount; i++) { printWriter.println(indents(curlyCount - i - 1) + "}"); } }</code><technical_language>pass AnnotatedTypeFactory instead of checker</technical_language>

Target:
private static void printClass( @BinaryName String classname, AClass aClass, BaseTypeChecker checker, PrintWriter printWriter) { String basename = basenamePart(classname); String innermostClassname = basename.contains("$") ? basename.substring(basename.lastIndexOf('$') + 1) : basename; String pkg = packagePart(classname); if (pkg != null) { printWriter.println("package " + pkg + ";"); } int curlyCount = printClassDefinitions(basename, aClass, printWriter, checker); String indentLevel = indents(curlyCount); List<VariableElement> enumConstants = aClass.getEnumConstants(); if (enumConstants != null) { StringJoiner sj = new StringJoiner(", "); for (VariableElement enumConstant : enumConstants) { sj.add(enumConstant.getSimpleName()); } printWriter.println(indentLevel + " printWriter.println(); printWriter.println(indentLevel + sj.toString() + ";"); printWriter.println(); } printFields(aClass, printWriter, indentLevel); if (!aClass.getMethods().isEmpty()) { printWriter.println(indentLevel + " printWriter.println(); for (Map.Entry<String, AMethod> methodEntry : aClass.getMethods().entrySet()) { printMethodDeclaration( methodEntry.getValue(), innermostClassname, printWriter, indentLevel, checker.getTypeFactory()); } } for (int i = 0; i < curlyCount; i++) { printWriter.println(indents(curlyCount - i - 1) + "}"); } }
Source:
<code>public void addNotification(Notification notification) { <START> if(this.notifications != null) { <END> this.notifications.add(notification); } }</code><technical_language>do want create a new list if null</technical_language>

Target:
public void addNotification(Notification notification) { if(notification != null) { this.notifications.add(notification); } }
Source:
<code>private ProcessHandler startTestProcess(IJavaProject javaProject, TestExecutionContext context) { JavaParameters parameters = new JavaParameters(); <START> parameters.setJavaExecutable(System.getProperties().getProperty("java.home") + "/bin/java"); <END> parameters.setMainClassName(MAIN_CLASS_NAME); parameters.setWorkingDirectory(workspacePath + javaProject.getPath()); List<String> classPath = new ArrayList<>(); Set<String> projectClassPath = classpathProvider.getProjectClassPath(javaProject); classPath.addAll(projectClassPath); classPath.add(ClasspathUtil.getJarPathForClass(CheJUnitCoreRunner.class)); parameters.getClassPath().addAll(classPath); List<String> suite = createTestSuite( context, javaProject, JavaTestAnnotations.JUNIT4X_TEST.getName(), JavaTestAnnotations.JUNIT4X_RUN_WITH.getName()); for (String element : suite) { parameters.getParametersList().add(element); } if (context.isDebugModeEnable()) { generateDebuggerPort(); parameters.getVmParameters().add("-Xdebug"); parameters .getVmParameters() .add("-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=" + getDebugPort()); } CommandLine command = parameters.createCommand(); try { return new ProcessHandler(command.createProcess()); } catch (ExecutionException e) { LOG.error("Can't run JUnit JVM", e); } return null; }</code><technical_language>Please revise this statement</technical_language>

Target:
private ProcessHandler startTestProcess(IJavaProject javaProject, TestExecutionContext context) { JavaParameters parameters = new JavaParameters(); parameters.setJavaExecutable(System.getProperty("java.home") + "/bin/java"); parameters.setMainClassName(MAIN_CLASS_NAME); parameters.setWorkingDirectory(workspacePath + javaProject.getPath()); List<String> classPath = new ArrayList<>(); Set<String> projectClassPath = classpathProvider.getProjectClassPath(javaProject); classPath.addAll(projectClassPath); classPath.add(ClasspathUtil.getJarPathForClass(CheJUnitCoreRunner.class)); parameters.getClassPath().addAll(classPath); List<String> suite = createTestSuite( context, javaProject, JavaTestAnnotations.JUNIT4X_TEST.getName(), JavaTestAnnotations.JUNIT4X_RUN_WITH.getName()); for (String element : suite) { parameters.getParametersList().add(element); } if (context.isDebugModeEnable()) { generateDebuggerPort(); parameters.getVmParameters().add("-Xdebug"); parameters .getVmParameters() .add("-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=" + getDebugPort()); } CommandLine command = parameters.createCommand(); try { return new ProcessHandler(command.createProcess()); } catch (ExecutionException e) { LOG.error("Can't run JUnit JVM", e); } return null; }
Source:
<code>static Part findPartById(Part searchRoot, long partId) { Stack<Part> partStack = new Stack<>(); partStack.add(searchRoot); while (!partStack.empty()) { Part part = partStack.pop(); if (part instanceof LocalBodyPart) { LocalBodyPart localBodyPart = (LocalBodyPart) part; if (localBodyPart.getId() == partId) { return localBodyPart; } } <START> if (part instanceof LocalMessage) { <END> LocalMessage localMessage = (LocalMessage) part; if (localMessage.getMessagePartId() == partId) { return localMessage; } } if (part instanceof LocalMimeMessage) { LocalMimeMessage localMessage = (LocalMimeMessage) part; if (localMessage.getId() == partId) { return localMessage; } } Body body = part.getBody(); if (body instanceof Multipart) { Multipart innerMultipart = (Multipart) body; for (BodyPart innerPart : innerMultipart.getBodyParts()) { partStack.add(innerPart); } } if (body instanceof MimeMessage) { partStack.add((MimeMessage) body); } } return null; }</code><technical_language>this true for root message move loop</technical_language>

Target:
static Part findPartById(Part searchRoot, long partId) { if (searchRoot instanceof LocalMessage) { LocalMessage localMessage = (LocalMessage) searchRoot; if (localMessage.getMessagePartId() == partId) { return localMessage; } } Stack<Part> partStack = new Stack<>(); partStack.add(searchRoot); while (!partStack.empty()) { Part part = partStack.pop(); if (part instanceof LocalPart) { LocalPart localBodyPart = (LocalPart) part; if (localBodyPart.getId() == partId) { return part; } } Body body = part.getBody(); if (body instanceof Multipart) { Multipart innerMultipart = (Multipart) body; for (BodyPart innerPart : innerMultipart.getBodyParts()) { partStack.add(innerPart); } } if (body instanceof Part) { partStack.add((Part) body); } } return null; }
Source:
<code>public void testDs3S3ObjectResponseAddsPagingMember() throws ParseException { final ImmutableList<Ds3Element> elementsList = ImmutableList.of( new Ds3Element("objects", "S3Object", null, false) ); final Ds3Type ds3Type = new Ds3Type("testDs3Type", elementsList); final Struct testStruct = StructConverter.toStruct(ds3Type, ImmutableSet.of(), ImmutableSet.of(), ImmutableSet.of(), ImmutableSet.of()); assertThat(testStruct.getStructMembers().size(), is(2)); boolean foundPaging = false; for (final StructMember sm : testStruct.getStructMembers()) { if (sm.getName().equals("paging") <START> && sm.getType().getTypeName().equals("ds3_paging") <END> && !sm.getType().isPrimitive()) { foundPaging = true; } } assertTrue(foundPaging); }</code><technical_language>indentation correct</technical_language>

Target:
public void testDs3S3ObjectResponseAddsPagingMember() throws ParseException { final ImmutableList<Ds3Element> elementsList = ImmutableList.of( new Ds3Element("objects", "S3Object", null, false) ); final Ds3Type ds3Type = new Ds3Type("testDs3Type", elementsList); final Struct testStruct = StructConverter.toStruct(ds3Type, ImmutableSet.of(), ImmutableSet.of(), ImmutableSet.of(), ImmutableSet.of()); assertThat(testStruct.getStructMembers().size(), is(2)); assertTrue(testStruct.getStructMembers().stream() .filter(sm -> sm.getName().equals("paging")) .filter(sm -> sm.getType().getTypeName().equals("ds3_paging")) .anyMatch(sm -> !sm.getType().isPrimitive())); }
Source:
<code>public int[] compute(final LienzoLayer layer, final CanvasExportSettings settings) { final int[] result = new int[2]; if (settings.hasSize()) { result[0] = settings.getWide(); result[1] = settings.getHigh(); } else { final Bounds bounds = LienzoLayerUtils.computeBounds(layer); result[0] = (int) (bounds.getX() + bounds.getWidth()); <START> result[1] = (int) (bounds.getY() + bounds.getHeight()); <END> } return new int[]{result[0] + PADDING, result[1] + PADDING}; }</code><technical_language>New method covered</technical_language>

Target:
public int[] compute(final LienzoLayer layer, final CanvasExportSettings settings) { final int[] result = new int[4]; final Bounds bounds = LienzoLayerUtils.computeBounds(layer); result[0] = (int) bounds.getX(); result[1] = (int) bounds.getY(); if (settings.hasSize()) { result[2] = settings.getWide(); result[3] = settings.getHigh(); } else { result[2] = Math.round((float) (bounds.getX() + bounds.getWidth())); result[3] = Math.round((float) (bounds.getY() + bounds.getHeight())); } return new int[]{result[0], result[1], result[2] + PADDING, result[3] + PADDING}; }
Source:
<code><START> public static synchronized void setCompressionFactory(final CompressorFactory compFactory) { <END> Preconditions.checkNotNull(compFactory, "Compressor Factory cannot be null"); if (null != compressorFactory) { compressorFactory.close(); } compressorFactory = compFactory; }</code><technical_language>AtomicReference, remove synchronization close previous get getAndSet(V) method</technical_language>

Target:
public static void setCompressionFactory(final CompressorFactory compFactory) { Objects.requireNonNull(compFactory, "Compressor Factory cannot be null"); if (null != compressorFactory.get()) { compressorFactory.get().close(); } compressorFactory.set(compFactory); }
Source:
<code>protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); ArcGISScene scene = new ArcGISScene(); scene.setBasemap(Basemap.createImagery()); mSceneView = findViewById(R.id.sceneView); mSceneView.setScene(scene); Surface surface = new Surface(); <START> ArcGISTiledElevationSource elevationSource = new ArcGISTiledElevationSource("R.string.elevation_image_service"); <END> surface.getElevationSources().add(elevationSource); scene.setBaseSurface(surface); Camera camera = new Camera(64.416919, -14.483728, 100, 318, 105, 0); mSceneView.setViewpointCamera(camera); }</code><technical_language>be: new ArcGISTiledElevationSource(getString(R.string.elevation_image_service));</technical_language>

Target:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); ArcGISScene scene = new ArcGISScene(); scene.setBasemap(Basemap.createImagery()); mSceneView = findViewById(R.id.sceneView); mSceneView.setScene(scene); Surface surface = new Surface(); ArcGISTiledElevationSource elevationSource = new ArcGISTiledElevationSource(getString(R.string.elevation_image_service)); surface.getElevationSources().add(elevationSource); scene.setBaseSurface(surface); Camera camera = new Camera(64.416919, -14.483728, 100, 318, 105, 0); mSceneView.setViewpointCamera(camera); }
Source:
<code>public int countChargesAwaitingCaptureRetry(Duration notAttemptedWithin) { String query = "SELECT count(c) FROM ChargeEntity c WHERE (c.status=:captureApprovedStatus OR c.status=:captureApprovedRetryStatus)"+ "AND EXISTS (" + " SELECT ce FROM ChargeEventEntity ce WHERE " + " ce.chargeEntity = c AND " + " ce.status = :eventStatus AND " + " ce.updated >= :cutoffDate " + ") "; Number count = (Number) entityManager.get() .createQuery(query) <START> .setParameter("captureApprovedStatus", CAPTURE_APPROVED.getValue()) <END> .setParameter("captureApprovedRetryStatus", CAPTURE_APPROVED_RETRY.getValue()) .setParameter("eventStatus", CAPTURE_APPROVED_RETRY) .setParameter("cutoffDate", ZonedDateTime.now().minus(notAttemptedWithin)) .getSingleResult(); return count.intValue(); }</code><technical_language>I need this: if a payment a CAPTURE APPROVED RETRY event, status CAPTURE APPROVED</technical_language>

Target:
public int countChargesAwaitingCaptureRetry(Duration notAttemptedWithin) { String query = "SELECT count(c) FROM ChargeEntity c WHERE c.status=:captureApprovedRetryStatus "+ "AND EXISTS (" + " SELECT ce FROM ChargeEventEntity ce WHERE " + " ce.chargeEntity = c AND " + " ce.status = :eventStatus AND " + " ce.updated >= :cutoffDate " + ") "; Number count = (Number) entityManager.get() .createQuery(query) .setParameter("captureApprovedRetryStatus", CAPTURE_APPROVED_RETRY.getValue()) .setParameter("eventStatus", CAPTURE_APPROVED_RETRY) .setParameter("cutoffDate", ZonedDateTime.now().minus(notAttemptedWithin)) .getSingleResult(); return count.intValue(); }
Source:
<code>protected final void releaseLocksForCompletedTransaction(LocalTransaction localTransaction, boolean committedInOnePhase) { <START> boolean isOptimistic = !isPessimisticLocking && !isTotalOrder; <END> if (committedInOnePhase && isOptimistic) return; final GlobalTransaction gtx = localTransaction.getGlobalTransaction(); txTable.removeLocalTransaction(localTransaction); if (isClustered()) { removeTransactionInfoRemotely(localTransaction, gtx); } }</code><technical_language>total order do this</technical_language>

Target:
protected final void releaseLocksForCompletedTransaction(LocalTransaction localTransaction, boolean committedInOnePhase) { final GlobalTransaction gtx = localTransaction.getGlobalTransaction(); txTable.removeLocalTransaction(localTransaction); log.tracef("Committed in onePhase? %s isOptimistic? %s", committedInOnePhase, isOptimisticCache()); if (committedInOnePhase && isOptimisticCache()) return; if (isClustered()) { removeTransactionInfoRemotely(localTransaction, gtx); } }
Source:
<code>static String copyZipLocation(String sourceZipLocation, String targetZipName) throws IOException { TestPlugin plugin = TestPlugin.getDefault(); <START> if (plugin == null) { throw new IllegalStateException("TestPlugin default reference is null"); } <END> URL fullPathString = plugin.getBundle().getResource(WS_DATA_PREFIX + "/" + sourceZipLocation + ".zip"); URI fileURI = null; try { fileURI = FileLocator.resolve(fullPathString).toURI(); } catch (URISyntaxException e) { throw new IllegalArgumentException(); } File origin = new File(fileURI); if (!origin.exists()) { throw new IllegalArgumentException(); } File destination = new File(FileSystemHelper.getRandomLocation(FileSystemHelper.getTempDir()).toOSString() + File.separator + targetZipName + ".zip"); FileTool.copy(origin, destination); return destination.getAbsolutePath(); }</code><technical_language>I need explicitly test this here</technical_language>

Target:
static String copyZipLocation(String sourceZipLocation, String targetZipName) throws IOException { TestPlugin plugin = TestPlugin.getDefault(); File origin = FileTool.getFileInPlugin(plugin, new Path(WS_DATA_PREFIX + "/" + sourceZipLocation + ".zip")); File destination = new File(FileSystemHelper.getRandomLocation(FileSystemHelper.getTempDir()).toOSString() + File.separator + targetZipName + ".zip"); FileTool.copy(origin, destination); return destination.getAbsolutePath(); }
Source:
<code>public Map<String, String> load(final CollectionResource resource) { return sessionUtils.withReadOnlyTransaction(() -> { final Map<String, String> tags = new HashMap<>(); addTag(tags, MetaTagKey.resourceLabel, Optional.ofNullable(resource.getInterfaceLabel()).orElse(null)); if (resource.getResourceTypeName().equals(CollectionResource.RESOURCE_TYPE_NODE)) { String nodeCriteria = getNodeCriteriaFromResource(resource); mapNode(tags, nodeCriteria); } else if (resource.getResourceTypeName().equals(CollectionResource.RESOURCE_TYPE_IF)) { String nodeCriteria = getNodeCriteriaFromResource(resource); if (!Strings.isNullOrEmpty(nodeCriteria)) { mapNode(tags, nodeCriteria); } <START> addTag(tags, MetaTagKey.ifDescr, resource.getInterfaceLabel()); END> } else if (resource.getResourceTypeName().equals(CollectionResource.RESOURCE_TYPE_LATENCY)) { mapResponseTimeResource(resource, tags); } else { String nodeCriteria = getNodeCriteriaFromResource(resource); if (!Strings.isNullOrEmpty(nodeCriteria)) { mapNode(tags, nodeCriteria); } } return tags; }); }</code><technical_language>need extract ifIndex resource able get need</technical_language>

Target:
public Map<String, String> load(final CollectionResource resource) { return sessionUtils.withReadOnlyTransaction(() -> { final Map<String, String> tags = new HashMap<>(); List<Scope> scopes = new ArrayList<>(); String nodeCriteria = getNodeCriteriaFromResource(resource); Optional<OnmsNode> nodeOptional = getNode(nodeCriteria); if(nodeOptional.isPresent()) { OnmsNode node = nodeOptional.get(); scopes.add(this.entityScopeProvider.getScopeForNode(node.getId())); if (resource.getResourceTypeName().equals(CollectionResource.RESOURCE_TYPE_IF)) { try { int ifIndex = Integer.parseInt(resource.getInstance()); scopes.add(this.entityScopeProvider.getScopeForInterfaceByIfIndex(node.getId(), ifIndex)); } catch(NumberFormatException nfe) { } } } Scope scope = new FallbackScope(scopes); Map<String, String> configuredMetaTags = this.config.getConfiguredMetaTags(); for(Map.Entry<String, String> entry: configuredMetaTags.entrySet()) { final String value = Interpolator.interpolate(entry.getValue(), scope); if (Strings.isNullOrEmpty(value)) { continue; } tags.put(entry.getKey(), value); } nodeOptional.ifPresent(onmsNode -> mapCategories(tags, onmsNode)); return tags; }); }
Source:
<code><START> public String getDefaultCatalogName() { <END> return defaultCatalogName; }</code><technical_language>public instead of protected</technical_language>

Target:
protected String getDefaultCatalogName() { return defaultCatalogName; }
Source:
<code>public void doesNotFire() { RuleApplication ruleApplication = applyRule(); <START> if (ruleApplication.result.isPresent()) { <END> fail(String.format( "Expected %s to not fire for:\n%s", rule.getClass().getName(), inTransaction(session -> PlanPrinter.textLogicalPlan(plan, ruleApplication.types, metadata, costCalculator, session, 2)))); } }</code><technical_language>replace result.isPresent() higher abstract level, wasRuleApplied()</technical_language>

Target:
public void doesNotFire() { RuleApplication ruleApplication = applyRule(); if (ruleApplication.wasRuleApplied()) { fail(String.format( "Expected %s to not fire for:\n%s", rule.getClass().getName(), inTransaction(session -> PlanPrinter.textLogicalPlan(plan, ruleApplication.types, metadata, costCalculator, session, 2)))); } }
Source:
<code>public void run(final FlowTrigger trigger, Map data) { VmInstanceSpec spec = (VmInstanceSpec) data.get(VmInstanceConstant.Params.VmInstanceSpec.toString()); final boolean deleteDataDisk = VmGlobalConfig.DELETE_DATA_VOLUME_ON_VM_DESTROY.value(Boolean.class); if (spec.getVmInventory().getAllVolumes().size() > 1) { detachDataVolumes(spec); } final VmInstanceDeletionPolicy deletionPolicy = (VmInstanceDeletionPolicy) data.get(Params.DeletionPolicy); if (deletionPolicy == VmInstanceDeletionPolicy.DBOnly) { <START> trigger.next(); <END> } List<VolumeDeletionStruct> ctx = CollectionUtils.transformToList(spec.getVmInventory().getAllVolumes(), new Function<VolumeDeletionStruct, VolumeInventory>() { @Override public VolumeDeletionStruct call(VolumeInventory arg) { if (VolumeType.Data.toString().equals(arg.getType()) && !deleteDataDisk) { return null; } VolumeDeletionStruct s = new VolumeDeletionStruct(); s.setInventory(arg); if (VolumeType.Root.toString().equals(arg.getType())) { s.setDeletionPolicy(deletionPolicy.toString()); } return s; } }); final String issuer = VolumeVO.class.getSimpleName(); casf.asyncCascade(CascadeConstant.DELETION_FORCE_DELETE_CODE, issuer, ctx, new Completion(trigger) { @Override public void success() { trigger.next(); } @Override public void fail(ErrorCode errorCode) { trigger.fail(errorCode); } }); }</code><technical_language>missing return</technical_language>

Target:
public void run(final FlowTrigger trigger, Map data) { VmInstanceSpec spec = (VmInstanceSpec) data.get(VmInstanceConstant.Params.VmInstanceSpec.toString()); final boolean deleteDataDisk = VmGlobalConfig.DELETE_DATA_VOLUME_ON_VM_DESTROY.value(Boolean.class); if (spec.getVmInventory().getAllVolumes().size() > 1) { detachDataVolumes(spec); } final VmInstanceDeletionPolicy deletionPolicy = (VmInstanceDeletionPolicy) data.get(Params.DeletionPolicy); if (deletionPolicy == VmInstanceDeletionPolicy.DBOnly) { trigger.next(); return; } List<VolumeDeletionStruct> ctx = CollectionUtils.transformToList(spec.getVmInventory().getAllVolumes(), new Function<VolumeDeletionStruct, VolumeInventory>() { @Override public VolumeDeletionStruct call(VolumeInventory arg) { if (VolumeType.Data.toString().equals(arg.getType()) && !deleteDataDisk) { return null; } VolumeDeletionStruct s = new VolumeDeletionStruct(); s.setInventory(arg); if (VolumeType.Root.toString().equals(arg.getType())) { s.setDeletionPolicy(deletionPolicy.toString()); } return s; } }); final String issuer = VolumeVO.class.getSimpleName(); casf.asyncCascade(CascadeConstant.DELETION_FORCE_DELETE_CODE, issuer, ctx, new Completion(trigger) { @Override public void success() { trigger.next(); } @Override public void fail(ErrorCode errorCode) { trigger.fail(errorCode); } }); }
Source:
<code>public void setUp() <START> throws Exception { <END> setFixture(ModelelementsFactory.eINSTANCE.createElementGroup()); model = SysMLTestResources.createSysMLModel(houseKeeper.createResourceSet()); if(model == null) { fail("The model is not created."); } if(model.getAppliedProfiles().isEmpty()) { fail(" the Sysml profil has not be applied."); } defaultComment= model.createOwnedComment(); default_elementgroup = (ElementGroup)StereotypeApplicationHelper.getInstance(null).applyStereotype(defaultComment, ModelelementsPackage.eINSTANCE.getElementGroup()); defaultComment.setBody(criterion); class1 = model.createOwnedClass("Class1", false); class2 = model.createOwnedClass("Class2", false); defaultComment.getAnnotatedElements().add(class1); defaultComment.getAnnotatedElements().add(class2); }</code><technical_language>necessary</technical_language>

Target:
public void setUp() { setFixture(ModelelementsFactory.eINSTANCE.createElementGroup()); model = SysMLTestResources.createSysMLModel(houseKeeper.createResourceSet()); if(model.getAppliedProfiles().isEmpty()) { fail(" the Sysml profil has not be applied."); } defaultComment= model.createOwnedComment(); default_elementgroup = (ElementGroup)StereotypeApplicationHelper.getInstance(null).applyStereotype(defaultComment, ModelelementsPackage.eINSTANCE.getElementGroup()); defaultComment.setBody(criterion); class1 = model.createOwnedClass("Class1", false); class2 = model.createOwnedClass("Class2", false); defaultComment.getAnnotatedElements().add(class1); defaultComment.getAnnotatedElements().add(class2); }
Source:
<code><START> void execute(RevWalk rw, List<Command> todo) throws IOException { <END> if (apply(todo) && nextId != null) { commit(rw); } }</code><technical_language>a 2nd statusless execute function? of safety in overridden execute() above</technical_language>

Target:
void execute(RevWalk rw, List<Command> todo) throws IOException { if (apply(todo) && nextId != null) { commit(rw, todo); } }
Source:
<code>public void testGetSuggestedDiskAliasNotNullAliasDisk() { <START> disk.setDiskAlias("someAlias"); <END> assertEquals("existing disk alias was wrongfully overwritten", disk.getDiskAlias(), ImagesHandler.getSuggestedDiskAlias(disk, prefix, 1)); }</code><technical_language>for mentioning in patchset ..but I this test, I more correct == equals return true in case of new string want avoid create</technical_language>

Target:
public void testGetSuggestedDiskAliasNotNullAliasDisk() { disk.setDiskAlias("someAlias"); assertEquals("a new alias was generated instead of returning the pre-difined one", disk.getDiskAlias(), ImagesHandler.getSuggestedDiskAlias(disk, prefix, 1)); }
Source:
<code>private IProject getSingleProject() { IProject result= null; for (IPackageFragment <START> fPackageFragment : <END> fPackageFragments) { if (result == null) { result= fPackageFragment.getJavaProject().getProject(); } else if (!result.equals(fPackageFragment.getJavaProject().getProject())) { return null; } } return result; }</code><technical_language>rename pack</technical_language>

Target:
private IProject getSingleProject() { IProject result= null; for (IPackageFragment pack : fPackageFragments) { if (result == null) { result= pack.getJavaProject().getProject(); } else if (!result.equals(pack.getJavaProject().getProject())) { return null; } } return result; }
Source:
<code><START> public CompletableFuture<List<SnapshotDescription>> listSnapshots() { <END> throw new UnsupportedOperationException("updateConfiguration"); }</code><technical_language>this method implementable</technical_language>

Target:
public CompletableFuture<List<SnapshotDescription>> listSnapshots() { throw new UnsupportedOperationException("listSnapshots"); }
Source:
<code>public void testLayoutUnregister() throws Exception { LayoutDefinition l = service.getLayoutDefinition("testCategory", "testLayout"); assertNotNull(l); assertEquals(4, l.getRows().length); deployContrib("org.nuxeo.ecm.platform.forms.layout.core.tests", "layouts-core-test-override-contrib.xml"); applyInlineDeployments(); <START> postSetUp(); <END> l = service.getLayoutDefinition("testCategory", "testLayout"); assertNotNull(l); assertEquals(0, l.getRows().length); removeInlineDeployments(); postSetUp(); l = service.getLayoutDefinition("testCategory", "testLayout"); assertNotNull(l); assertEquals(4, l.getRows().length); }</code><technical_language>postSetUp called applyInlineDeployments - pushInlineDeployments ? - of deployContrib a test contribution</technical_language>

Target:
public void testLayoutUnregister() throws Exception { LayoutDefinition l = service.getLayoutDefinition("testCategory", "testLayout"); assertNotNull(l); assertEquals(4, l.getRows().length); pushInlineDeployments("org.nuxeo.ecm.platform.forms.layout.core.tests:layouts-core-test-override-contrib.xml"); l = service.getLayoutDefinition("testCategory", "testLayout"); assertNotNull(l); assertEquals(0, l.getRows().length); removeInlineDeployments(); l = service.getLayoutDefinition("testCategory", "testLayout"); assertNotNull(l); assertEquals(4, l.getRows().length); }
Source:
<code>public Intent getSendIntentWithSubject(Context context) { if (context != null && mSendIntent != null && mSendIntent.getStringExtra(Intent.EXTRA_SUBJECT) != null) { <START> if (getClient() == null || getClient().getCredentials().getUsername() == null) { <END> mSendIntent.putExtra( Intent.EXTRA_SUBJECT, context.getString(R.string.subject_shared_with_you, mFileName) ); } else { mSendIntent.putExtra( Intent.EXTRA_SUBJECT, context.getString( R.string.subject_user_shared_with_you, getClient().getCredentials().getUsername(), mFileName ) ); } } return mSendIntent; }</code><technical_language>if this happen null checks a credentials is null scenario (in case getCredentials null)</technical_language>

Target:
public Intent getSendIntentWithSubject(Context context) { if (context != null && mSendIntent != null && mSendIntent.getStringExtra(Intent.EXTRA_SUBJECT) != null) { if (getClient() == null || getClient().getCredentials() == null || getClient().getCredentials().getUsername() == null) { mSendIntent.putExtra( Intent.EXTRA_SUBJECT, context.getString(R.string.subject_shared_with_you, mFileName) ); } else { mSendIntent.putExtra( Intent.EXTRA_SUBJECT, context.getString( R.string.subject_user_shared_with_you, getClient().getCredentials().getUsername(), mFileName ) ); } } return mSendIntent; }
Source:
<code>void pause() throws StoreException, IOException { hardDeleteLock.lock(); try { if (paused.compareAndSet(false, true)) { <START> logger.info("HardDelete thread has been paused "); index.persistIndex(); <END> } } finally { hardDeleteLock.unlock(); } }</code><technical_language>this pause method undelete lock, performHardDelete complete token persisted already</technical_language>

Target:
void pause() throws StoreException, IOException { hardDeleteLock.lock(); try { if (paused.compareAndSet(false, true)) { logger.info("HardDelete thread has been paused "); index.persistIndex(); persistFileLock.lock(); try { pruneHardDeleteRecoveryRange(); persistCleanupToken(); } finally { persistFileLock.unlock(); } } } finally { hardDeleteLock.unlock(); } }
Source:
<code>private void createDllFromWsdl() throws MojoExecutionException { getLog().info("Execute WSDl to cs command"); wsdlCommand(); getLog().info("Execute cs to dll command"); cscCommand(); if (generateNugetPackage) { if (!windowsModus) { <START> throw new MojoExecutionException( <END> "At this point, mono and nuget does not work so well together." + "Please execute the plugin with nuget"); } nugetLib = nugetFolder + "lib"; getLog().info("Create Nuget folder structure"); createNugetStructure(); getLog().info("Copy the dlls to the nuget structure"); copyFilesToNuget(); getLog().info("Generate " + namespace + " .nuspec"); generateNugetPackedFile(); getLog().info("Pack .nuspec to a nuget package"); nugetPackCommand(); } }</code><technical_language>this error message is kind of ambitious. I do? :-)</technical_language>

Target:
private void createDllFromWsdl() throws MojoExecutionException { getLog().info("Execute WSDl to cs command"); wsdlCommand(); getLog().info("Execute cs to dll command"); cscCommand(); if (generateNugetPackage) { if (isLinux()) { throw new MojoExecutionException( "At this point, mono and nuget does not work so well together." + "Please execute the plugin with nuget under Windows"); } nugetLib = nugetFolder + "lib"; getLog().info("Create Nuget folder structure"); createNugetStructure(); getLog().info("Copy the dlls to the nuget structure"); copyFilesToNuget(); getLog().info("Generate " + namespace + " .nuspec"); generateNugetPackedFile(); getLog().info("Pack .nuspec to a nuget package"); nugetPackCommand(); } }
Source:
<code><START> protected static EntityResolver defaultResolver() { <END> Hints hints = GeoTools.getDefaultHints(); if( hints != null && hints.containsKey(Hints.ENTITY_RESOLVER)){ Object hint = hints.get(Hints.ENTITY_RESOLVER); if( hint instanceof EntityResolver){ return (EntityResolver) hint; } if( hint instanceof String ){ try { Class<?> type = Class.forName((String)hint); Object value = type.newInstance(); if( value instanceof EntityResolver){ return (EntityResolver) value; } } catch (ClassNotFoundException | InstantiationException | IllegalAccessException e) { LOGGER.log(Level.FINER, "Unable to instanciate ENTITY_RESOLVER: "+ e.getMessage(), e); } } } return PreventLocalEntityResolver.INSTANCE; }</code><technical_language>if this - generic code useful for a resolver. put else</technical_language>

Target:
protected static EntityResolver defaultResolver() { Hints hints = GeoTools.getDefaultHints(); if( hints != null && hints.containsKey(Hints.ENTITY_RESOLVER)){ Object hint = hints.get(Hints.ENTITY_RESOLVER); if( hint instanceof EntityResolver){ return (EntityResolver) hint; } if( hint instanceof String ){ try { Class<?> type = Class.forName((String)hint); Object value = type.newInstance(); if( value instanceof EntityResolver){ return (EntityResolver) value; } } catch (ClassNotFoundException | InstantiationException | IllegalAccessException e) { LOGGER.log(Level.FINER, "Unable to instantiate ENTITY_RESOLVER: "+ e.getMessage(), e); } } } return PreventLocalEntityResolver.INSTANCE; }
Source:
<code>public boolean handleServerHandshake(C00Handshake packet, NetworkManager manager) { if (!shouldAllowPlayerLogins()) { TextComponentString text = new TextComponentString("Server is still starting! Please wait before reconnecting."); FMLLog.log.info("Disconnecting Player: {}", text.getUnformattedText()); manager.sendPacket(new SPacketDisconnect(text)); manager.closeChannel(text); return false; } if (packet.getRequestedState() == EnumConnectionState.LOGIN && (!NetworkRegistry.INSTANCE.isVanillaAccepted(Side.CLIENT) && !packet.hasFMLMarker())) { manager.setConnectionState(EnumConnectionState.LOGIN); TextComponentString text = new TextComponentString("This server has mods that require FML/Forge to be installed on the client. Contact your server admin for more details."); Collection<String> modNames = NetworkRegistry.INSTANCE.getModNamesThatDoNotAcceptVanilla(Side.CLIENT); <START> FMLLog.log.info("Disconnecting Player: This server has mods that require FML/Forge to be installed on the client:\n{}", modNames); <END> manager.sendPacket(new SPacketDisconnect(text)); manager.closeChannel(text); return false; } manager.channel().attr(NetworkRegistry.FML_MARKER).set(packet.hasFMLMarker()); return true; }</code><technical_language>put a tab new line messages together. fine me. method name is pretty big, 'getRequiredMods(SIDE)'</technical_language>

Target:
public boolean handleServerHandshake(C00Handshake packet, NetworkManager manager) { if (!shouldAllowPlayerLogins()) { TextComponentString text = new TextComponentString("Server is still starting! Please wait before reconnecting."); FMLLog.log.info("Disconnecting Player: {}", text.getUnformattedText()); manager.sendPacket(new SPacketDisconnect(text)); manager.closeChannel(text); return false; } if (packet.getRequestedState() == EnumConnectionState.LOGIN && (!NetworkRegistry.INSTANCE.isVanillaAccepted(Side.CLIENT) && !packet.hasFMLMarker())) { manager.setConnectionState(EnumConnectionState.LOGIN); TextComponentString text = new TextComponentString("This server has mods that require FML/Forge to be installed on the client. Contact your server admin for more details."); Collection<String> modNames = NetworkRegistry.INSTANCE.getRequiredMods(Side.CLIENT); FMLLog.log.info("Disconnecting Player: This server has mods that require FML/Forge to be installed on the client: {}", modNames); manager.sendPacket(new SPacketDisconnect(text)); manager.closeChannel(text); return false; } manager.channel().attr(NetworkRegistry.FML_MARKER).set(packet.hasFMLMarker()); return true; }
Source:
<code>public URI writeSchema(Schema schema) { Path previous = newestFile(); Map<Integer, Schema> schemas = getSchemas(); <START> for (Schema oldSchema: schemas.values()) { <END> if (!SchemaValidationUtil.canRead(oldSchema, schema)) { throw new IncompatibleSchemaException("Schema cannot read data " + "written using existing schema. Schema: " + schema.toString(true) + "\nPrevious schema: " + oldSchema.toString(true)); } } Path schemaPath = null; if (previous == null) { schemaPath = new Path(schemaDirectory, "1.avsc"); } else { String previousName = previous.getName() .substring(0, previous.getName().indexOf('.')); int i = Integer.parseInt(previousName) + 1; schemaPath = new Path(schemaDirectory, Integer.toString(i) + ".avsc"); } FSDataOutputStream outputStream = null; boolean threw = true; try { outputStream = rootFileSystem.create(schemaPath, false); outputStream.write(schema.toString(true) .getBytes(Charsets.UTF_8)); outputStream.flush(); threw = false; } catch (IOException e) { throw new DatasetIOException( "Unable to save schema file: " + schemaPath, e); } finally { try { Closeables.close(outputStream, threw); } catch (IOException e) { throw new DatasetIOException("Cannot close", e); } } return schemaPath.toUri(); }</code><technical_language>this check if schema is present in manager latest version? If so, return</technical_language>

Target:
public URI writeSchema(Schema schema) { Path previousPath = newestFile(); if (previousPath != null) { Schema previousSchema = loadSchema(previousPath); if (schema.equals(previousSchema)) { return rootFileSystem.makeQualified(previousPath).toUri(); } } Map<Integer, Schema> schemas = getSchemas(); for (Schema oldSchema: schemas.values()) { if (!SchemaValidationUtil.canRead(oldSchema, schema)) { throw new IncompatibleSchemaException("Schema cannot read data " + "written using existing schema. Schema: " + schema.toString(true) + "\nPrevious schema: " + oldSchema.toString(true)); } } Path schemaPath = null; if (previousPath == null) { schemaPath = new Path(schemaDirectory, "1.avsc"); } else { String previousName = previousPath.getName() .substring(0, previousPath.getName().indexOf('.')); int i = Integer.parseInt(previousName) + 1; schemaPath = new Path(schemaDirectory, Integer.toString(i) + ".avsc"); } FSDataOutputStream outputStream = null; boolean threw = true; try { outputStream = rootFileSystem.create(schemaPath, false); outputStream.write(schema.toString(true) .getBytes(Charsets.UTF_8)); outputStream.flush(); threw = false; } catch (IOException e) { throw new DatasetIOException( "Unable to save schema file: " + schemaPath, e); } finally { try { Closeables.close(outputStream, threw); } catch (IOException e) { throw new DatasetIOException("Cannot close", e); } } return rootFileSystem.makeQualified(schemaPath).toUri(); }
Source:
<code>public Heap(final int estimatedSize, final int limit) { <START> super(limit, estimatedSize); <END> }</code><technical_language>wrong arg order</technical_language>

Target:
public Heap(final int estimatedSize, final int limit) { super(estimatedSize, limit); }
Source:
<code>public Set<T> toSet() { if (this.data.hasher != HashTable.equalityHasher()) { <START> throw new RuntimeException("Cannot call ImmutableSet::toSet on a ImmutableSet without equality hashing."); <END> } Set<T> set = new HashSet<>(); this.forEach(set::add); return set; }</code><technical_language>I UnsupportedOperationException more appropriate</technical_language>

Target:
public Set<T> toSet() { if (this.data.hasher != HashTable.equalityHasher()) { throw new UnsupportedOperationException("Cannot call ImmutableSet::toSet on a ImmutableSet without equality hashing."); } Set<T> set = new HashSet<>(); this.forEach(set::add); return set; }
Source:
<code><START> protected void unsetUsbSerialDiscovery(UsbSerialDiscovery usbSerialDiscovery) { <END> usbSerialDiscovery.stopBackgroundScanning(); usbSerialDiscovery.unregisterDiscoveryListener(this); this.usbSerialDiscovery = null; }</code><technical_language>Dynamic service reference is a bit tricky in OSGi strict ordering of execution is followed. If implementations of UsbSerialDiscovery (let's A B), binding callbacks called unbinding callbacks. is, order set(A) set(B) unset(A) unset is executed this.usbSerialDiscovery null is expected field null, if injected instance (in this scenario, B) is deinjected. situation worse, if multiple threads start invoking callbacks together. OSGi a container restrict ordering for dynamic service references, proper synchronization needs introduced consumer. I personally pattern (but necessarily, to. idea suitable functionality suffices need. For example, AtomicReference is a good fit in this scenario.) java private volatile IA a; protected (synchronized) void setA(IA a) { .... } protected (synchronized) void unsetA(IA a) { if (this.a == a) { .... this.a = null; } }</technical_language>

Target:
protected synchronized void unsetUsbSerialDiscovery(UsbSerialDiscovery usbSerialDiscovery) { usbSerialDiscovery.stopBackgroundScanning(); usbSerialDiscovery.unregisterDiscoveryListener(this); this.usbSerialDiscovery = null; this.previouslyDiscovered.clear(); }
Source:
<code>public synchronized void flush() throws IOException { if (buf.position() > 0) { buf.flip(); <START> String contents = buf.toString(); <END> String filtered = contentFilter.filter(contents); out.write(filtered.getBytes(charset)); buf.clear(); if (buf.capacity() > DEFAULT_DECODER_CAPACITY) { buf = CharBuffer.allocate(DEFAULT_DECODER_CAPACITY); } } out.flush(); }</code><technical_language>this incorrect if a component calls flush written a full line? I filterFlushLines leave partially buffered lines buffered</technical_language>

Target:
public synchronized void flush() throws IOException { ensureOpen(); if (decodedBuf.position() > 0) { decodedBuf.flip(); String contents = decodedBuf.toString(); String filtered = contentFilter.filter(contents); out.write(filtered.getBytes(charset)); decodedBuf.clear(); } out.flush(); }
Source:
<code>public static ClassLoader getCustomClassloader(Collection<String> entries) { List<URL> urls = new ArrayList<>(); File file; if (entries != null) { for (String classPathEntry : entries) { file = new File(classPathEntry); if (!file.exists()) { LOG.warn("classPathEntry " + classPathEntry + " not exists!" ); <START> continue; <END> } try { urls.add(file.toURI().toURL()); } catch (MalformedURLException e) { throw new RuntimeException(getString( "RuntimeError.9", classPathEntry)); } } } ClassLoader parent = Thread.currentThread().getContextClassLoader(); return new URLClassLoader(urls.toArray(new URL[urls .size()]), parent); }</code><technical_language>Please change this follow pattern of externalized string</technical_language>

Target:
public static ClassLoader getCustomClassloader(Collection<String> entries) { List<URL> urls = new ArrayList<>(); File file; if (entries != null) { for (String classPathEntry : entries) { file = new File(classPathEntry); if (!file.exists()) { LOG.warn(getString("Warning.31", classPathEntry)); continue; } try { urls.add(file.toURI().toURL()); } catch (MalformedURLException e) { throw new RuntimeException(getString( "RuntimeError.9", classPathEntry)); } } } ClassLoader parent = Thread.currentThread().getContextClassLoader(); return new URLClassLoader(urls.toArray(new URL[urls .size()]), parent); }
Source:
<code>public static UsbPolicy getUsbPolicy(Usb usb, VDSGroup vdsGroup) { UsbPolicy usbPolicy = null; if (usb != null && usb.isSetEnabled()) { usbPolicy = UsbPolicy.DISABLED; if (usb.isEnabled()) { UsbType usbType = null; if (usb.getType() != null) { usbType = UsbType.fromValue(usb.getType()); } if (usbType != null) { if (usbType.equals(UsbType.LEGACY)) { usbPolicy = UsbPolicy.ENABLED_LEGACY; } else if (usbType.equals(UsbType.NATIVE)) { usbPolicy = UsbPolicy.ENABLED_NATIVE; } } if (usbPolicy.equals(UsbPolicy.DISABLED)) { if (vdsGroup.getcompatibility_version().compareTo(Version.v3_1) >= 0) { usbPolicy = UsbPolicy.ENABLED_NATIVE; } else { usbPolicy = UsbPolicy.ENABLED_LEGACY; } } } } <START> return usbPolicy; <END> }</code><technical_language>a bit hard follow flow; this simplified a bit? a must</technical_language>

Target:
public static UsbPolicy getUsbPolicy(Usb usb, VDSGroup vdsGroup) { UsbPolicy usbPolicy = null; if (usb == null || !usb.isSetEnabled() || !usb.isEnabled()) { usbPolicy = UsbPolicy.DISABLED; } else{ UsbType usbType = usb.getType() != null ? UsbType.fromValue(usb.getType()) : null; if (usbType == null) { if (vdsGroup.getcompatibility_version().compareTo(Version.v3_1) >= 0) { usbPolicy = UsbPolicy.ENABLED_NATIVE; } else { usbPolicy = UsbPolicy.ENABLED_LEGACY; } } else { if (usbType.equals(UsbType.LEGACY)) { usbPolicy = UsbPolicy.ENABLED_LEGACY; } else if (usbType.equals(UsbType.NATIVE)) { usbPolicy = UsbPolicy.ENABLED_NATIVE; } } } return usbPolicy; }