auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void onMouseRelease(int guiLeft, int guiTop, int xSize, int ySize, int state, int mouseX, int mouseY) { if (getTabs().size() == 1 && container.getClass().equals(GuiInventory.class)) return; if (state == 0) { int x = mouseX - guiLeft; int y = mouseY - guiTop; int start = page * 12; int end = Math.min(getTabs().size(), (page + 1) * 12); for (GuiTab tab : getTabs()) { int index = tab.getTabIndex(); if (index >= start && index < end) { if (tab != null && this.isMouseOverTab(tab, x, y, xSize, ySize)) { tab.onTabClicked(Minecraft.getMinecraft().thePlayer); return; } } } } }

Target:
public void onMouseRelease(int guiLeft, int guiTop, int xSize, int ySize, int state, int mouseX, int mouseY) { if (getTabs().size() == 1 && guiContainer instanceof GuiInventory) return; if (state == 0) { int x = mouseX - guiLeft; int y = mouseY - guiTop; int start = page * maxTabsPerPage; int end = Math.min(getTabs().size(), (page + 1) * maxTabsPerPage); for (GuiTab tab : getTabs()) { int index = tab.getTabIndex(); if (index >= start && index < end && this.isMouseOverTab(tab, x, y, xSize, ySize)) { tab.onTabClicked(Minecraft.getMinecraft().thePlayer); return; } } } }
Source:
public InternalScanner preFlushScannerOpen(ObserverContext<RegionCoprocessorEnvironment> c, Store store, KeyValueScanner memstoreScanner, InternalScanner s) throws IOException { TransactionSnapshot snapshot = cache.getLatestState(); if (snapshot == null) { if (LOG.isDebugEnabled()) { LOG.debug("Region " + c.getEnvironment().getRegion().getRegionNameAsString() + ", no current transaction state found, defaulting to normal flush scanner"); } return null; } Transaction dummyTx = TxUtils.createDummyTransaction(snapshot); LOG.info("Filtering flush with dummy tx " + dummyTx.toString()); Scan scan = new Scan(); scan.setMaxVersions(dummyTx.excludesSize() + 1); FilterList filterList = new FilterList(FilterList.Operator.MUST_PASS_ONE); filterList.addFilter(getTransactionFilter(dummyTx)); filterList.addFilter(new IncludeInProgressFilter(dummyTx.getVisibilityUpperBound(), snapshot.getInvalid())); scan.setFilter(filterList); return new StoreScanner(store, store.getScanInfo(), scan, Collections.singletonList(memstoreScanner), ScanType.MINOR_COMPACT, c.getEnvironment().getRegion().getSmallestReadPoint(), HConstants.OLDEST_TIMESTAMP); }

Target:
public InternalScanner preFlushScannerOpen(ObserverContext<RegionCoprocessorEnvironment> c, Store store, KeyValueScanner memstoreScanner, InternalScanner s) throws IOException { return createStoreScanner(c.getEnvironment(), "flush", cache.getLatestState(), store, Collections.singletonList(memstoreScanner), ScanType.MINOR_COMPACT, HConstants.OLDEST_TIMESTAMP); }
Source:
public synchronized final long position() throws IOException { return 0; }

Target:
public synchronized final long position() throws IOException { return position; }
Source:
private String getFileName(File file) { return file != null ? file.getAbsolutePath() : "null"; }

Target:
private String getFileName(File file) { return file != null ? file.getAbsolutePath() : "N/A"; }
Source:
public Optional<CommandMapping> register(Object plugin, CommandCallable<Boolean> callable, List<String> aliases, Function<List<String>, List<String>> callback) { checkNotNull(plugin); Optional<PluginContainer> containerOptional = pluginManager.fromInstance(plugin); if (!containerOptional.isPresent()) { throw new IllegalArgumentException("The provided plugin object does not have an associated plugin container " + "(in other words, is 'plugin' actually your plugin object?"); } PluginContainer container = containerOptional.get(); synchronized (lock) { List<String> aliasesWithPrefix = new ArrayList<String>(aliases.size() * 2); for (String alias : aliases) { aliasesWithPrefix.add(alias); aliasesWithPrefix.add(container.getId() + ":" + alias); } Optional<CommandMapping> mapping = dispatcher.register(callable, aliasesWithPrefix, callback); if (mapping.isPresent()) { owners.put(container, mapping.get()); } return mapping; } }

Target:
public Optional<CommandMapping> register(Object plugin, CommandCallable<Boolean> callable, List<String> aliases, Function<List<String>, List<String>> callback) { checkNotNull(plugin); Optional<PluginContainer> containerOptional = this.pluginManager.fromInstance(plugin); if (!containerOptional.isPresent()) { throw new IllegalArgumentException("The provided plugin object does not have an associated plugin container " + "(in other words, is 'plugin' actually your plugin object?"); } PluginContainer container = containerOptional.get(); synchronized (this.lock) { List<String> aliasesWithPrefix = new ArrayList<String>(aliases.size() * 2); for (String alias : aliases) { aliasesWithPrefix.add(alias); aliasesWithPrefix.add(container.getId() + ":" + alias); } Optional<CommandMapping> mapping = this.dispatcher.register(callable, aliasesWithPrefix, callback); if (mapping.isPresent()) { this.owners.put(container, mapping.get()); } return mapping; } }
Source:
public LanguageServerWrapper(@Nullable IProject project, @NonNull LanguageServerDefinition serverDefinition) { this.initialProject = project; this.allWatchedProjects = new HashSet<>(); this.serverDefinition = serverDefinition; this.lspStreamProvider = serverDefinition.createConnectionProvider(); if (this.lspStreamProvider == null) { throw new IllegalStateException(Messages.LanguageServerWrapper_initializationException); } this.connectedDocuments = new HashMap<>(); }

Target:
public LanguageServerWrapper(@Nullable IProject project, @NonNull LanguageServerDefinition serverDefinition) { this.initialProject = project; this.allWatchedProjects = new HashSet<>(); this.serverDefinition = serverDefinition; this.connectedDocuments = new HashMap<>(); }
Source:
RealmObjectSchema getSchemaForClass(Class<? extends RealmModel> clazz) { RealmObjectSchema classSchema = classToSchema.get(clazz); if (classSchema == null) { Class<? extends RealmModel> originalClass = Util.getOriginalModelClass(clazz); if (originalClass != clazz) { classSchema = classToSchema.get(originalClass); } if (classSchema == null) { Table table = getTable(clazz); classSchema = new RealmObjectSchema(realm, table, columnIndices.getColumnInfo(originalClass).getIndicesMap()); classToSchema.put(originalClass, classSchema); } if (originalClass != clazz) { classToSchema.put(clazz, classSchema); } } return classSchema; }

Target:
RealmObjectSchema getSchemaForClass(Class<? extends RealmModel> clazz) { RealmObjectSchema classSchema = classToSchema.get(clazz); if (classSchema == null) { Class<? extends RealmModel> originalClass = Util.getOriginalModelClass(clazz); if (isProxyClass(originalClass, clazz)) { classSchema = classToSchema.get(originalClass); } if (classSchema == null) { Table table = getTable(clazz); classSchema = new RealmObjectSchema(realm, table, columnIndices.getColumnInfo(originalClass).getIndicesMap()); classToSchema.put(originalClass, classSchema); } if (isProxyClass(originalClass, clazz)) { classToSchema.put(clazz, classSchema); } } return classSchema; }
Source:
public Map<String, Construct> evaluate(BindableEvent e) throws EventException { MCBlockBreakEvent event = (MCBlockBreakEvent) e; Map<String, Construct> map = evaluate_helper(event); map.put("player", new CString(event.getPlayer().getName(), Target.UNKNOWN)); CArray blk = new CArray(Target.UNKNOWN); blk.set("type", new CInt(event.getBlock().getTypeId(), Target.UNKNOWN)); blk.set("data", new CInt(event.getBlock().getData(), Target.UNKNOWN)); blk.set("X", new CInt(event.getBlock().getX(), Target.UNKNOWN)); blk.set("Y", new CInt(event.getBlock().getY(), Target.UNKNOWN)); blk.set("Z", new CInt(event.getBlock().getZ(), Target.UNKNOWN)); blk.set("world", new CString(event.getBlock().getWorld().getName(), Target.UNKNOWN)); map.put("block", blk); CArray drops = new CArray(Target.UNKNOWN); Collection<ItemStack> items = event.getBlock().getDrops(); for(Iterator<ItemStack> iter = items.iterator(); iter.hasNext();) { ItemStack stack = (ItemStack)iter.next(); CArray item = new CArray(Target.UNKNOWN); item.set("amount", Integer.toString(stack.getAmount())); item.set("type", new CInt(stack.getTypeId(), Target.UNKNOWN)); item.set("durability", new CInt(stack.getDurability(), Target.UNKNOWN)); drops.push(item); } map.put("drops", drops); return map; }

Target:
public Map<String, Construct> evaluate(BindableEvent e) throws EventException { MCBlockBreakEvent event = (MCBlockBreakEvent) e; Map<String, Construct> map = evaluate_helper(event); map.put("player", new CString(event.getPlayer().getName(), Target.UNKNOWN)); CArray blk = new CArray(Target.UNKNOWN); int blktype = event.getBlock().getTypeId(); blk.set("type", new CInt(blktype, Target.UNKNOWN)); int blkdata = event.getBlock().getData(); blk.set("data", new CInt(blkdata, Target.UNKNOWN)); blk.set("X", new CInt(event.getBlock().getX(), Target.UNKNOWN)); blk.set("Y", new CInt(event.getBlock().getY(), Target.UNKNOWN)); blk.set("Z", new CInt(event.getBlock().getZ(), Target.UNKNOWN)); blk.set("world", new CString(event.getBlock().getWorld().getName(), Target.UNKNOWN)); map.put("block", blk); CArray drops = new CArray(Target.UNKNOWN); Collection<ItemStack> items = event.getBlock().getDrops(); for(Iterator<ItemStack> iter = items.iterator(); iter.hasNext();) { MCItemStack stack = new BukkitMCItemStack((ItemStack)iter.next()); CArray item = (CArray)ObjectGenerator.GetGenerator().item(stack, Target.UNKNOWN); drops.push(item); } map.put("drops", drops); return map; }
Source:
public AttributesNode load() throws IOException { AttributesNode r = new AttributesNode(); FS fs = repository.getFS(); String path = repository.getConfig().get(CoreConfig.KEY) .getAttributesFile(); if (path != null) { File attributesFile; if (path.startsWith("~/")) attributesFile = fs.resolve(fs.userHome(), path.substring(2)); else attributesFile = fs.resolve(null, path); FileRepository.AttributesNodeProviderImpl.loadRulesFromFile(r, attributesFile); } return r.getRules().isEmpty() ? null : r; }

Target:
public AttributesNode load() throws IOException { AttributesNode r = new AttributesNode(); FS fs = repository.getFS(); String path = repository.getConfig().get(CoreConfig.KEY) .getAttributesFile(); if (path != null) { File attributesFile; if (path.startsWith("~/")) { attributesFile = fs.resolve(fs.userHome(), path.substring(2)); } else { attributesFile = fs.resolve(null, path); } FileRepository.AttributesNodeProviderImpl.loadRulesFromFile(r, attributesFile); } return r.getRules().isEmpty() ? null : r; }
Source:
@Override public String toString() { if (mFileName != null) { return getName(); } else { return "InMemoryDexFile[cookie=" + Arrays.toString((long[]) mCookie) + "]"; } }

Target:
@Override public String toString() { if (mFileName != null) { return getName(); } else { mCookieLock.lock(); try { return "InMemoryDexFile[cookie=" + Arrays.toString((long[]) mCookie) + "]"; } finally { mCookieLock.unlock(); } } }
Source:
private void cleanUpWorkspaceResources(String deploymentName) throws IOException { Deployment deployment = getDeploymentByName(deploymentName); Service service = getCheServiceBySelector(OPENSHIFT_DEPLOYMENT_LABEL, deploymentName); if (service != null) { LOG.info("Removing OpenShift Service {}", service.getMetadata().getName()); openShiftClient.resource(service).delete(); } if (deployment != null) { LOG.info("Removing OpenShift Deployment {}", deployment.getMetadata().getName()); openShiftClient.resource(deployment).delete(); } List<Pod> pods = openShiftClient.pods() .inNamespace(openShiftCheProjectName) .withLabel(OPENSHIFT_DEPLOYMENT_LABEL, deploymentName) .list() .getItems(); try { boolean podsTerminated = false; while (!podsTerminated) { Thread.sleep(OPENSHIFT_WAIT_POD_DELAY); podsTerminated = true; for (Pod pod : pods) { String podName = pod.getMetadata().getName(); podsTerminated &= (openShiftClient.pods() .inNamespace(openShiftCheProjectName) .withName(podName) .get() == null); } } } catch (InterruptedException e) { Thread.currentThread().interrupt(); LOG.info("Thread interrupted while cleaning up workspace"); } }

Target:
private void cleanUpWorkspaceResources(String deploymentName) throws IOException { Deployment deployment = getDeploymentByName(deploymentName); Service service = getCheServiceBySelector(OPENSHIFT_DEPLOYMENT_LABEL, deploymentName); if (service != null) { LOG.info("Removing OpenShift Service {}", service.getMetadata().getName()); openShiftClient.resource(service).delete(); } if (deployment != null) { LOG.info("Removing OpenShift Deployment {}", deployment.getMetadata().getName()); openShiftClient.resource(deployment).delete(); } try { for (int waitCount = 0; waitCount < OPENSHIFT_WAIT_POD_TIMEOUT; waitCount++) { List<Pod> pods = openShiftClient.pods() .inNamespace(openShiftCheProjectName) .withLabel(OPENSHIFT_DEPLOYMENT_LABEL, deploymentName) .list() .getItems(); if (pods.size() == 0) { return; } Thread.sleep(OPENSHIFT_WAIT_POD_DELAY); } } catch (InterruptedException e) { Thread.currentThread().interrupt(); LOG.info("Thread interrupted while cleaning up workspace"); } throw new OpenShiftException("Timeout while waiting for pods to terminate"); }
Source:
public Object evaluate(DeferredObject[] arguments) throws HiveException { result.clear(); try { if (arguments.length == 1 && argumentOI != null && arguments[0] != null) { String ip = ((StringObjectInspector) argumentOI).getPrimitiveJavaObject(arguments[0].get()); Map<String, Object> geoDataResult = geocode.getGeocodedData(ip); if (geoDataResult != null) { for (String field : geoDataResult.keySet()) { result.put(field, geoDataResult.get(field).toString()); } } } } catch (Exception ex) { LOG.error(ex); } return result; }

Target:
public Object evaluate(DeferredObject[] arguments) throws HiveException { result.clear(); if (arguments.length == 1 && argumentOI != null && arguments[0] != null) { String ip = ((StringObjectInspector) argumentOI).getPrimitiveJavaObject(arguments[0].get()); Map<String, Object> geoDataResult = geocode.getGeocodedData(ip); if (geoDataResult != null) { for (String field : geoDataResult.keySet()) { result.put(field, geoDataResult.get(field).toString()); } } } return result; }
Source:
public boolean isNaN() { return this.doubleValue() != this.doubleValue(); }

Target:
public boolean isNaN() { return Double.isNaN( this.doubleValue() ); }
Source:
public boolean equals(Object obj) { if (obj == null) { return false; } if (!(obj instanceof InterpolationVariable)) { return false; } InterpolationVariable that = (InterpolationVariable) obj; return equalOrNull(this.varName, that.varName) && equalOrNull(this.dataType, that.dataType) && equalOrNull(this.factType, that.factType) && equalOrNull(this.factField, that.factField) && equalOrNull(this.operator, that.operator); }

Target:
public boolean equals(Object obj) { if (obj == null) { return false; } if (!(obj instanceof InterpolationVariable)) { return false; } InterpolationVariable that = (InterpolationVariable) obj; return Objects.equals(this.varName, that.varName) && Objects.equals(this.dataType, that.dataType) && Objects.equals(this.factType, that.factType) && Objects.equals(this.factField, that.factField) && Objects.equals(this.operator, that.operator); }
Source:
public static void verifyTags(String tagsString) { final Pattern pattern = Pattern.compile("^([a-z0-9-_.]+)$"); final List<String> verifyTags = filterStringToList(tagsString); for (String verifyTag : verifyTags) { if (!pattern.matcher(verifyTag).matches()) { throw new IllegalArgumentException("Tag " + verifyTag + " doesn't match ^([a-z0-9-_.]+)$"); } } }

Target:
public static void verifyTags(String tagsString) { final List<String> verifyTags = filterStringToList(tagsString); for (String verifyTag : verifyTags) { if (!VALID_REPO_PATTERN.matcher(verifyTag).matches()) { throw new IllegalArgumentException("Tag " + verifyTag + " doesn't match ^([a-z0-9-_.]+)$"); } } }
Source:
private Flow flowFromLearnedAssociation(LearnedAssociation learnedAssociation, ExplodedGraph.Node node) { ProgramState programState = node.programState; Preconditions.checkState(programState != null, "Learned association with null state in parent node of the edge."); Symbol rhsSymbol = symbolFromStack(learnedAssociation.symbolicValue(), programState); if (rhsSymbol != null) { return Flow.of(location(node, String.format(IMPLIES_SAME_VALUE, learnedAssociation.symbol().name(), rhsSymbol.name()))); } Flow.Builder flowBuilder = Flow.builder(); ConstraintsByDomain allConstraints = programState.getConstraints(learnedAssociation.symbolicValue()); Collection<Constraint> constraints = filterByDomains(allConstraints); boolean isBoolean = learnedAssociation.symbol.type().is("boolean"); for (Constraint constraint : constraints) { if (isBoolean && constraint == ObjectConstraint.NOT_NULL) { continue; } String symbolName = learnedAssociation.symbol().name(); String msg; if (assigningNullFromTernary(node) || (assigningFromMethodInvocation(node) && assignedFromYieldWithUncertainResult(constraint, node))) { msg = IMPLIES_CAN_BE_MSG; } else { msg = IMPLIES_IS_MSG; } flowBuilder.add(location(node, String.format(msg, symbolName, constraint.valueAsString()))); } return flowBuilder.build(); }

Target:
private Flow flowFromLearnedAssociation(LearnedAssociation learnedAssociation, ExplodedGraph.Node node) { ProgramState programState = node.programState; Preconditions.checkState(programState != null, "Learned association with null state in parent node of the edge."); Symbol rhsSymbol = symbolFromStack(learnedAssociation.symbolicValue(), programState); if (rhsSymbol != null) { return Flow.of(location(node, String.format(IMPLIES_SAME_VALUE, learnedAssociation.symbol().name(), rhsSymbol.name()))); } Flow.Builder flowBuilder = Flow.builder(); ConstraintsByDomain allConstraints = programState.getConstraints(learnedAssociation.symbolicValue()); Collection<Constraint> constraints = filterByDomains(allConstraints); boolean isPrimitive = learnedAssociation.symbol.type().isPrimitive(); for (Constraint constraint : constraints) { if (isPrimitive && constraint == ObjectConstraint.NOT_NULL) { continue; } String symbolName = learnedAssociation.symbol().name(); String msg; if (assigningNullFromTernary(node) || (assigningFromMethodInvocation(node) && assignedFromYieldWithUncertainResult(constraint, node))) { msg = IMPLIES_CAN_BE_MSG; } else { msg = IMPLIES_IS_MSG; } flowBuilder.add(location(node, String.format(msg, symbolName, constraint.valueAsString()))); } return flowBuilder.build(); }
Source:
protected void doSetUp() throws Exception { super.doSetUp(); flow = createAndRegisterFlow(muleContext, APPLE_FLOW, componentLocator); untilSuccessful = buildUntilSuccessful("100"); if (tx) { getInstance().bindTransaction(mock(Transaction.class)); } }

Target:
protected void doSetUp() throws Exception { super.doSetUp(); flow = createAndRegisterFlow(muleContext, APPLE_FLOW, componentLocator); untilSuccessful = buildUntilSuccessful(MILLIS_BETWEEN_RETRIES); if (tx) { getInstance().bindTransaction(mock(Transaction.class)); } }
Source:
public void setUp() throws Exception { BrickTestUtils.createProjectAndGetStartScript("PhiroMoveMotorForwardBrickTest") .addBrick(new PhiroMotorMoveForwardBrick( PhiroMotorMoveForwardBrick.Motor.MOTOR_RIGHT, SET_SPEED_INITIALLY)); brickPosition = 1; baseActivityTestRule.launchActivity(null); }

Target:
public void setUp() { PhiroMotorMoveForwardBrick phiroMotorMoveForwardBrick = new PhiroMotorMoveForwardBrick(PhiroMotorMoveForwardBrick.Motor .MOTOR_RIGHT, initialSpeed); BrickTestUtils.createProjectAndGetStartScript("PhiroMoveMotorForwardBrickTest") .addBrick(phiroMotorMoveForwardBrick); brickPosition = 1; baseActivityTestRule.launchActivity(null); }
Source:
private ControlDecoration installAttributeDiffDecoration(String taskSummary, Control control, TaskAttributeDiff diff) { ControlDecoration controlDecoration = new ControlDecoration(control, (SWT.TOP | SWT.RIGHT)); controlDecoration.setImage(CommonImages.OVERLAY_SYNC_INCOMMING.createImage()); StringBuffer diffText = new StringBuffer(TaskDiffUtil.toString(diff)); diffText.append("\n\nClick to view a full comparison."); controlDecoration.setDescriptionText(diffText.toString()); controlDecoration.addSelectionListener(new SelectionListener() { public void widgetSelected(SelectionEvent e) { String name; if (diff.getLabel() == null || diff.getLabel().isEmpty()) { name = "attribute of " + taskSummary; } else { name = TaskDiffUtil.getName(diff) + " of " + taskSummary; } CompareConfiguration configuration = new CompareConfiguration(); configuration.setLeftLabel("Previous Value"); configuration.setRightLabel("Incoming Value"); CompareEditorInput editorInput = new CompareEditorInput(configuration) { @Override public String getTitle() { return "Compare " + name; } @Override protected Object prepareInput(IProgressMonitor monitor) { return new TaskAttributeDiffNode(Differencer.CHANGE, diff); } }; CompareUI.openCompareEditor(editorInput); } public void widgetDefaultSelected(SelectionEvent e) { } }); return controlDecoration; }

Target:
private ControlDecoration installAttributeDiffDecoration(String taskSummary, Control control, TaskAttributeDiff diff) { ControlDecoration controlDecoration = new ControlDecoration(control, (SWT.TOP | SWT.RIGHT)); controlDecoration.setImage(TasksUiImages.INSPECT_ATTRIBUTE_DIFF.createImage()); StringBuffer diffText = new StringBuffer(TaskDiffUtil.toString(diff)); if (TaskDiffUtil.requiresTrim(diff)) { diffText.append("\n\n"); diffText.append(Messages.AttributeEditorToolkit_Click_To_View_A_Full_Comparison); controlDecoration.addSelectionListener(new SelectionListener() { public void widgetSelected(SelectionEvent e) { String name; if (diff.getLabel() == null || diff.getLabel().isEmpty()) { name = Messages.AttributeEditorToolkit_Attribute_Of + taskSummary; } else { name = TaskDiffUtil.getName(diff) + Messages.AttributeEditorToolkit_Of + taskSummary; } CompareConfiguration configuration = new CompareConfiguration(); configuration.setLeftLabel(Messages.AttributeEditorToolkit_Previous_Value); configuration.setRightLabel(Messages.AttributeEditorToolkit_Incoming_Value); CompareEditorInput editorInput = new CompareEditorInput(configuration) { @Override public String getTitle() { return Messages.AttributeEditorToolkit_Compare + name; } @Override protected Object prepareInput(IProgressMonitor monitor) { return new TaskAttributeDiffNode(Differencer.CHANGE, diff); } }; CompareUI.openCompareEditor(editorInput); } public void widgetDefaultSelected(SelectionEvent e) { } }); } controlDecoration.setDescriptionText(diffText.toString()); return controlDecoration; }
Source:
public void fromRange(Range r) { range = range == null ? null : new CommentRange(range.startLine, range.startCharacter, range.endLine, range.endCharacter); }

Target:
public void fromRange(Range r) { range = r == null ? null : new CommentRange(range.startLine, range.startCharacter, range.endLine, range.endCharacter); }
Source:
public void GIICompletesSuccessfullyWhenRunningDuringClear() { initDataStores(NUM_SERVERS); configureServers(regionShortcut); verifyRegionSizes(DATA_SIZE); dataStores[1].invoke(new SerializableRunnable() { @Override public void run() { PauseDuringGIICallback myAfterReceivedImageReply = new PauseDuringGIICallback( InitialImageOperation.GIITestHookType.AfterReceivedRequestImage, "_B__testPR_9"); InitialImageOperation.setGIITestHook(myAfterReceivedImageReply); } }); cluster.stop(2); createDelta(50); restartServerOnVM(2); AsyncInvocation async = createRegionAsync(dataStores[1]); invokeClear(dataStores[0]); dataStores[1].invoke(() -> InitialImageOperation.resetGIITestHook( InitialImageOperation.GIITestHookType.AfterReceivedRequestImage, true)); try { async.getResult(30000); } catch (InterruptedException ex) { Assert.fail("Async create interupted" + ex.getMessage()); } verifyRegionSizes(0); }

Target:
public void GIICompletesSuccessfullyWhenRunningDuringClear() { startServers(NUM_SERVERS); verifyRegionSizes(DATA_SIZE); serverVMs[1].invoke(() -> { PauseDuringGIICallback myAfterReceivedImageReply = new PauseDuringGIICallback( InitialImageOperation.GIITestHookType.AfterReceivedImageReply, "_B__testPR_9"); InitialImageOperation.setGIITestHook(myAfterReceivedImageReply); }); cluster.stop(2); createDelta(50); restartServerOnVM(2); serverVMs[1].invoke(() -> { DistributionMessageObserver.setInstance(new PauseDuringClearDistributionMessageObserver()); }); AsyncInvocation async = createRegionAsync(serverVMs[1]); invokeClearAsync(serverVMs[0]); waitForCallbackStarted(serverVMs[1], InitialImageOperation.GIITestHookType.AfterReceivedImageReply); serverVMs[1].invoke(() -> InitialImageOperation.resetGIITestHook( InitialImageOperation.GIITestHookType.AfterReceivedImageReply, true)); serverVMs[1].invoke(() -> { PauseDuringClearDistributionMessageObserver observer = (PauseDuringClearDistributionMessageObserver) DistributionMessageObserver.getInstance(); DistributionMessageObserver.setInstance(null); observer.latch.countDown(); }); try { async.getResult(30000); } catch (InterruptedException ex) { Assert.fail("Async create interupted" + ex.getMessage()); } verifyRegionSizes(0); }
Source:
public long writeTo(int index, WritableByteChannel channel, long relativeOffset, long maxSize) throws IOException { validateIndex(index); long written = 0; BlobReadInfo blobReadInfo = blobReadInfoList.get(index); String blobIdStr = blobReadInfo.getBlobId().getID(); try { if (!blobReadInfo.isBlobDownloaded()) { blobReadInfo.downloadBlob(blobStore); } ByteBuf outputBuf = blobReadInfo.getBlobContent().duplicate(); long sizeToRead = Math.min(maxSize, blobReadInfo.getBlobSize() - relativeOffset); byte[] array = new byte[(int) sizeToRead]; outputBuf.readerIndex((int) (relativeOffset)); outputBuf.readBytes(array); written = channel.write(ByteBuffer.wrap(array)); } catch (StoreException ex) { throw new IOException("Write of cloud blob " + blobIdStr + " failed", ex); } logger.trace("Downloaded bytes to the write channel from the cloud blob : {}", written, blobIdStr); return written; }

Target:
public long writeTo(int index, WritableByteChannel channel, long relativeOffset, long maxSize) throws IOException { validateIndex(index); long written = 0; BlobReadInfo blobReadInfo = blobReadInfoList.get(index); String blobIdStr = blobReadInfo.getBlobId().getID(); try { if (!blobReadInfo.isBlobDownloaded()) { blobReadInfo.downloadBlob(blobStore); } ByteBuf outputBuf = blobReadInfo.getBlobContent().duplicate(); long sizeToRead = Math.min(maxSize, blobReadInfo.getBlobSize() - relativeOffset); outputBuf.setIndex((int) (relativeOffset), (int) (relativeOffset + sizeToRead)); written = channel.write(outputBuf.nioBuffer()); } catch (StoreException ex) { throw new IOException("Write of cloud blob " + blobIdStr + " failed", ex); } logger.trace("Downloaded bytes to the write channel from the cloud blob : {}", written, blobIdStr); return written; }
Source:
public void updateAdmins(final List<Permission> newAdmins) { if (featureToggleService.isFeatureEnabled(FeatureToggleService.Feature.DISABLE_DB_WRITE_OPERATIONS)) { throw new DbWriteOperationsBlockedException("Cannot update admins: write operations on DB " + "are blocked by feature flag."); } validateAllAdmins(newAdmins); final List<Permission> currentAdmins = authorizationDbRepository.listAdmins(); final List<Permission> add = removeDefaultAdmin(newAdmins.stream() .filter(p -> !currentAdmins.stream().anyMatch(Predicate.isEqual(p))).collect(Collectors.toList())); final List<Permission> delete = removeDefaultAdmin(currentAdmins.stream() .filter(p -> !newAdmins.stream().anyMatch(Predicate.isEqual(p))).collect(Collectors.toList())); authorizationDbRepository.update(add, delete); }

Target:
public void updateAdmins(final List<Permission> newAdmins) throws DbWriteOperationsBlockedException { if (featureToggleService.isFeatureEnabled(FeatureToggleService.Feature.DISABLE_DB_WRITE_OPERATIONS)) { throw new DbWriteOperationsBlockedException("Cannot update admins: write operations on DB " + "are blocked by feature flag."); } validateAllAdmins(newAdmins); final List<Permission> currentAdmins = authorizationDbRepository.listAdmins(); final List<Permission> add = removeDefaultAdmin(newAdmins.stream() .filter(p -> !currentAdmins.stream().anyMatch(Predicate.isEqual(p))).collect(Collectors.toList())); final List<Permission> delete = removeDefaultAdmin(currentAdmins.stream() .filter(p -> !newAdmins.stream().anyMatch(Predicate.isEqual(p))).collect(Collectors.toList())); authorizationDbRepository.update(add, delete); }
Source:
protected void setup(Binder binder) { bindAuthenticationModule( config -> config.getDruidAuthenticationType() == DruidConfig.DruidAuthenticationType.NONE, noneAuthenticationModule()); bindAuthenticationModule( config -> config.getDruidAuthenticationType() == DruidConfig.DruidAuthenticationType.BASIC, basicAuthenticationModule()); }

Target:
protected void setup(Binder binder) { bindAuthenticationModule( config -> config.getDruidAuthenticationType() == NONE, noneAuthenticationModule()); bindAuthenticationModule( config -> config.getDruidAuthenticationType() == BASIC, basicAuthenticationModule()); bindAuthenticationModule( config -> config.getDruidAuthenticationType() == KERBEROS, kerberosbAuthenticationModule()); }
Source:
public void checkDigit_shouldChangeWhenAdjacentCharsAreTransposed() { VerhoeffIdentifierValidator v = new VerhoeffIdentifierValidator(); String test; int checkDigit; String pre; String post; int failures = 0; StringBuilder failureMsg = new StringBuilder(); char c; char d; final String lineSeparator = System.getProperty("line.separator"); for (String allowedIdentifier: allowedIdentifiers) { for (int i = 0; i < allowedIdentifier.length(); i++) { checkDigit = v.getCheckDigit(allowedIdentifier); for (int j = 1; j < allowedIdentifier.length(); j++) { c = allowedIdentifier.charAt(j - 1); d = allowedIdentifier.charAt(j); if (c != d) { pre = allowedIdentifier.substring(0, j - 1); post = allowedIdentifier.substring(j + 1); test = pre + d + c + post; if (checkDigit == v.getCheckDigit(test)) { failureMsg.append("Check digits for '"); failureMsg.append(allowedIdentifier); failureMsg.append("' and '"); failureMsg.append(test); failureMsg.append("' should be different, both were "); failureMsg.append(checkDigit); failureMsg.append(lineSeparator); failures++; } } } allowedIdentifier = allowedIdentifier.substring(1, allowedIdentifier.length()) + allowedIdentifier.charAt(0); } } assertTrue(failures + " transposed digits were not detected:\n" + failureMsg, failures == 0); }

Target:
public void checkDigit_shouldChangeWhenAdjacentCharsAreTransposed() { VerhoeffIdentifierValidator validator = new VerhoeffIdentifierValidator(); String test; int checkDigit; String pre; String post; int failures = 0; StringBuilder failureMsg = new StringBuilder(); char c; char d; final String lineSeparator = System.getProperty("line.separator"); for (String allowedIdentifier: allowedIdentifiers) { for (int i = 0; i < allowedIdentifier.length(); i++) { checkDigit = validator.getCheckDigit(allowedIdentifier); for (int j = 1; j < allowedIdentifier.length(); j++) { c = allowedIdentifier.charAt(j - 1); d = allowedIdentifier.charAt(j); if (c != d) { pre = allowedIdentifier.substring(0, j - 1); post = allowedIdentifier.substring(j + 1); test = pre + d + c + post; if (checkDigit == validator.getCheckDigit(test)) { failureMsg.append("Check digits for '"); failureMsg.append(allowedIdentifier); failureMsg.append("' and '"); failureMsg.append(test); failureMsg.append("' should be different, both were "); failureMsg.append(checkDigit); failureMsg.append(lineSeparator); failures++; } } } allowedIdentifier = allowedIdentifier.substring(1, allowedIdentifier.length()) + allowedIdentifier.charAt(0); } } assertTrue(failures + " transposed digits were not detected:\n" + failureMsg, failures == 0); }
Source:
public MqttConnectOptions getConnectionInfo() { MqttConnectOptions options = this.clientFactory.getConnectionOptions(); if (options.getServerURIs() == null && getUrl() != null) { if (options.getServerURIs() == null && getUrl() != null) { options = MqttUtils.cloneConnectOptions(options); options.setServerURIs(new String[] { getUrl() }); } options.setServerURIs(new String[] { getUrl() }); } return options; }

Target:
public MqttConnectOptions getConnectionInfo() { MqttConnectOptions options = this.clientFactory.getConnectionOptions(); if (options.getServerURIs() == null) { String url = getUrl(); if (url != null) { options = MqttUtils.cloneConnectOptions(options); options.setServerURIs(new String[] { url }); } } return options; }
Source:
public Builder useResourceOwnerMaskedPassword(String userName, String maskedPassword, String algorithm, String initialKeyMaterial, int iterationCount, String salt, String initializationVector) throws NoSuchAlgorithmException, InvalidKeySpecException { Assert.assertNotNull(maskedPassword); Assert.checkMinimumParameter("iterationCount", 1, iterationCount); Assert.assertNotNull(salt); byte[] finalMaskedSecretBytes = CodePointIterator.ofString(maskedPassword).base64Decode().drain(); if (algorithm == null) algorithm = MaskedPassword.ALGORITHM_MASKED_MD5_DES; char[] finalInitialKeyMaterial = initialKeyMaterial == null ? "somearbitrarycrazystringthatdoesnotmatter".toCharArray() : initialKeyMaterial.toCharArray(); byte[] finalSalt = CodePointIterator.ofString(salt).asUtf8().drain(); byte[] finalInitializationVector = initializationVector == null ? null : CodePointIterator.ofString(initializationVector).base64Decode().drain(); MaskedPasswordSpec spec = new MaskedPasswordSpec(finalInitialKeyMaterial, iterationCount, finalSalt, finalMaskedSecretBytes, finalInitializationVector); PasswordFactory factory = PasswordFactory.getInstance(algorithm); MaskedPassword password = factory.generatePassword(spec).castAs(MaskedPassword.class); ClearPasswordSpec clearSpec = factory.getKeySpec(password, ClearPasswordSpec.class); String finalPassword = String.valueOf(clearSpec.getEncodedPassword()); configureAuthenticationHandler(parameters -> configureResourceOwnerCredentialsParameters(parameters, userName, finalPassword)); return this; }

Target:
public Builder useResourceOwnerMaskedPassword(String userName, String maskedPassword, String algorithm, String initialKeyMaterial, int iterationCount, String salt, String initializationVector) throws NoSuchAlgorithmException, InvalidKeySpecException { String password = convertMaskedPasswordToClearText(maskedPassword, algorithm, initialKeyMaterial, iterationCount, salt, initializationVector); configureAuthenticationHandler(parameters -> configureResourceOwnerCredentialsParameters(parameters, userName, password)); return this; }
Source:
public int compare(Object o1, Object o2) { if (o1 instanceof StagingEntry) { if (o2 instanceof StagingEntry) { StagingEntry e1 = (StagingEntry) o1; StagingEntry e2 = (StagingEntry) o2; if (fileNameMode) return e1.getName().compareTo(e2.getName()); return e1.getPath().compareTo(e2.getPath()); } else { return 1; } } else if (o1 instanceof StagingFolderEntry) { if (o2 instanceof StagingFolderEntry) { StagingFolderEntry f1 = (StagingFolderEntry) o1; StagingFolderEntry f2 = (StagingFolderEntry) o2; return f1.getPath().toString() .compareTo(f2.getPath().toString()); } else { return -1; } } else { return 0; } }

Target:
public int compare(Object o1, Object o2) { if (o1 instanceof StagingEntry) { if (o2 instanceof StagingEntry) { StagingEntry e1 = (StagingEntry) o1; StagingEntry e2 = (StagingEntry) o2; if (fileNameMode) { int result = e1.getName().compareTo(e2.getName()); if (result != 0) return result; else return e1.getParentPath().toString() .compareTo(e2.getParentPath().toString()); } return e1.getPath().compareTo(e2.getPath()); } else { return 1; } } else if (o1 instanceof StagingFolderEntry) { if (o2 instanceof StagingFolderEntry) { StagingFolderEntry f1 = (StagingFolderEntry) o1; StagingFolderEntry f2 = (StagingFolderEntry) o2; return f1.getPath().toString() .compareTo(f2.getPath().toString()); } else { return -1; } } else { return 0; } }
Source:
public void start(Stage primaryStage) { final int w = (int) OriginalImage.getWidth(); final int h = (int) OriginalImage.getHeight(); final int zoom = 5; ImageView iv1 = new ImageView(); iv1.setImage(OriginalImage); iv1.setFitHeight( zoom* h); iv1.setFitWidth(zoom*w); ImageView iv2 = new ImageView(); iv2.setImage(composition); iv2.setFitHeight( zoom* h); iv2.setFitWidth(zoom*w); HBox root = new HBox(); Scene scene = new Scene(root); root.getChildren().addAll(iv1, iv2); primaryStage.setTitle("Neural Network Drawing Demo."); primaryStage.setScene(scene); primaryStage.show(); Platform.setImplicitExit(true); Platform.runLater(this::onCalc); }

Target:
public void start(Stage primaryStage) { final int w = (int) originalImage.getWidth(); final int h = (int) originalImage.getHeight(); final int zoom = 5; ImageView iv1 = new ImageView(); iv1.setImage(originalImage); iv1.setFitHeight( zoom* h); iv1.setFitWidth(zoom*w); ImageView iv2 = new ImageView(); iv2.setImage(composition); iv2.setFitHeight( zoom* h); iv2.setFitWidth(zoom*w); HBox root = new HBox(); Scene scene = new Scene(root); root.getChildren().addAll(iv1, iv2); primaryStage.setTitle("Neural Network Drawing Demo."); primaryStage.setScene(scene); primaryStage.show(); Platform.setImplicitExit(true); Platform.runLater(this::onCalc); }
Source:
protected String convertJsonToCSV(String jsonStr) { if (jsonStr == null) { return null; } StringBuilder str = new StringBuilder(); try { new JSONObject(jsonStr); JFlat flatMe = new JFlat(jsonStr); List<Object[]> json2csv = flatMe.json2Sheet().headerSeparator("_").getJsonAsSheet(); for (Object[] obj : json2csv) { str.append(Arrays.toString(obj)); } } catch (JSONException e) { log.error("Exception: {}", e); } catch (PathNotFoundException e) { log.error("Exception: {}", e); } catch (Exception e) { log.error("Exception: {}", e); } return str.toString(); }

Target:
protected String convertJsonToCSV(String jsonStr) { if (jsonStr == null) { return null; } StringBuilder str = new StringBuilder(); JFlat flatMe = new JFlat(jsonStr); List<Object[]> json2csv; try { json2csv = flatMe.json2Sheet().headerSeparator("_").getJsonAsSheet(); for (Object[] obj : json2csv) { String objString = Arrays.toString(obj); if (objString != null) { objString = objString.substring(1, objString.length() - 1); } str.append(objString); str.append(System.getProperty("line.separator")); } } catch (Exception e) { log.debug("Exception while converting to CSV: {}", e.getMessage()); throw new IllegalStateException(e); } return str.toString(); }
Source:
private static boolean orderIsDeterminedByOrderColumns(AbstractParsedStmt stmt, List<ParsedColInfo> orderColumns) { if (orderColumns.isEmpty()) { return false; } if (stmt instanceof ParsedSelectStmt) { ParsedSelectStmt selectStmt = (ParsedSelectStmt) stmt; ArrayList<AbstractExpression> nonOrdered = new ArrayList<AbstractExpression>(); return selectStmt.orderByColumnsDetermineAllDisplayColumns(selectStmt.displayColumns(), orderColumns, nonOrdered); } else { ParsedUnionStmt setOpStmt = (ParsedUnionStmt) stmt; switch (setOpStmt.m_unionType) { case EXCEPT: case EXCEPT_ALL: case INTERSECT: case INTERSECT_ALL: return orderIsDeterminedByOrderColumns(setOpStmt.m_children.get(0), orderColumns); default: return false; } } }

Target:
private static boolean orderIsDeterminedByOrderColumns(AbstractParsedStmt stmt, List<ParsedColInfo> orderColumns) { if (orderColumns.isEmpty()) { return false; } if (stmt instanceof ParsedSelectStmt) { ParsedSelectStmt selectStmt = (ParsedSelectStmt) stmt; ArrayList<AbstractExpression> nonOrdered = new ArrayList<AbstractExpression>(); return selectStmt.orderByColumnsDetermineAllDisplayColumns(selectStmt.displayColumns(), orderColumns, nonOrdered); } else { ParsedUnionStmt setOpStmt = (ParsedUnionStmt) stmt; switch (setOpStmt.m_unionType) { case EXCEPT: case EXCEPT_ALL: case INTERSECT: case INTERSECT_ALL: return orderIsDeterminedByOrderColumns(setOpStmt.m_children.get(0), orderColumns); case UNION: case UNION_ALL: return setOpStmt.getLeftmostSelectStmt().orderByColumnsDetermineAllDisplayColumnsForUnion(orderColumns); default: return false; } } }
Source:
public void testReleaseAndClaim() throws Exception { Long processInstanceId = processClient.startProcess(CONTAINER_ID, PROCESS_ID_USERTASK); assertNotNull(processInstanceId); assertTrue(processInstanceId.longValue() > 0); try { List<TaskSummary> taskList = taskClient.findTasksAssignedAsPotentialOwner(USER_YODA, 0, 10); assertNotNull(taskList); assertEquals(1, taskList.size()); TaskSummary taskSummary = taskList.get(0); checkTaskNameAndStatus(taskSummary, "First task", Status.Reserved); taskClient.releaseTask(CONTAINER_ID, taskSummary.getId(), USER_YODA); taskList = taskClient.findTasksAssignedAsPotentialOwner(USER_YODA, 0, 10); assertNotNull(taskList); assertEquals(1, taskList.size()); taskSummary = taskList.get(0); checkTaskNameAndStatus(taskSummary, "First task", Status.Ready); taskClient.claimTask(CONTAINER_ID, taskSummary.getId(), USER_YODA); taskList = taskClient.findTasksAssignedAsPotentialOwner(USER_YODA, 0, 10); assertNotNull(taskList); assertEquals(1, taskList.size()); taskSummary = taskList.get(0); checkTaskNameAndStatus(taskSummary, "First task", Status.Reserved); taskClient.claimTask(CONTAINER_ID, taskSummary.getId(), USER_JOHN); } catch(KieServicesHttpException e) { assertEquals(Response.Status.FORBIDDEN.getStatusCode(), e.getHttpCode().intValue()); } catch(KieServicesException e) { } finally { processClient.abortProcessInstance(CONTAINER_ID, processInstanceId); } }

Target:
public void testReleaseAndClaim() throws Exception { Long processInstanceId = processClient.startProcess(CONTAINER_ID, PROCESS_ID_USERTASK); assertNotNull(processInstanceId); assertTrue(processInstanceId.longValue() > 0); try { List<TaskSummary> taskList = taskClient.findTasksAssignedAsPotentialOwner(USER_YODA, 0, 10); assertNotNull(taskList); assertEquals(1, taskList.size()); TaskSummary taskSummary = taskList.get(0); checkTaskNameAndStatus(taskSummary, "First task", Status.Reserved); taskClient.releaseTask(CONTAINER_ID, taskSummary.getId(), USER_YODA); taskList = taskClient.findTasksAssignedAsPotentialOwner(USER_YODA, 0, 10); assertNotNull(taskList); assertEquals(1, taskList.size()); taskSummary = taskList.get(0); checkTaskNameAndStatus(taskSummary, "First task", Status.Ready); taskClient.claimTask(CONTAINER_ID, taskSummary.getId(), USER_YODA); taskList = taskClient.findTasksAssignedAsPotentialOwner(USER_YODA, 0, 10); assertNotNull(taskList); assertEquals(1, taskList.size()); taskSummary = taskList.get(0); checkTaskNameAndStatus(taskSummary, "First task", Status.Reserved); Long taskId = taskList.get(0).getId(); assertClientException( () -> taskClient.claimTask(CONTAINER_ID, taskId, USER_JOHN), 403, "User '[UserImpl:'"+ USER_JOHN +"']' was unable to execute operation 'Claim' on task id "+ taskId +" due to a no 'current status' match"); } finally { processClient.abortProcessInstance(CONTAINER_ID, processInstanceId); } }
Source:
public void setType(RabbitTypes type) { this.type = type; if (rabbit != null) { ((EntityRabbit)((CraftRabbit)rabbit).getHandle()).r(type.type); } }

Target:
public void setType(RabbitTypes type) { this.type = type; if (rabbit != null && rabbit.isValid()) { ((EntityRabbit)((CraftRabbit)rabbit).getHandle()).r(type.type); } }
Source:
public UserDetailsService userDetailsService() { UserDetails userDetails = User.builder() .passwordEncoder(rawPassword -> "{noop}" + rawPassword) .username("user") .password("password") .roles("USER") .build(); return new InMemoryUserDetailsManager(userDetails); }

Target:
public UserDetailsService userDetailsService() { UserDetails userDetails = User.withDefaultPasswordEncoder() .username("user") .password("password") .roles("USER") .build(); return new InMemoryUserDetailsManager(userDetails); }
Source:
private void maybeSendRequestToNextProcessor(Request request) throws RequestProcessorException { if (request.isFromLearner() && skipLearnerRequestToNextProcessor) { ServerMetrics.getMetrics().SKIP_LEARNER_REQUEST_TO_NEXT_PROCESSOR_COUNT.add(1); } else { nextProcessor.processRequest(request); } }

Target:
private void maybeSendRequestToNextProcessor(Request request) throws RequestProcessorException { if (skipLearnerRequestToNextProcessor && request.isFromLearner()) { ServerMetrics.getMetrics().SKIP_LEARNER_REQUEST_TO_NEXT_PROCESSOR_COUNT.add(1); } else { nextProcessor.processRequest(request); } }
Source:
private void validateBucketizedEnabled(String path, boolean isRead) { if (!BUCKETIZE_ZNRECORD_ENABLED) { throw new HelixMetaDataAccessException( "Can't " + (isRead ? "read" : "write") + " bucktized ZNode " + path + " because Bucktize feature is not enabled. Please check ZK system property 'zk.bucketize.znrecord.enabled' ."); } }

Target:
private void validateBucketizedEnabled(String path, boolean isRead) { if (!ZNRECORD_BUCKETIZE_ENABLED) { throw new HelixMetaDataAccessException( "Can't " + (isRead ? "read" : "write") + " bucktized ZNode " + path + " because Bucktize feature is not enabled. Please check ZK system property: " + ZkSystemPropertyKeys.ZK_ZNRECORD_BUCKETIZE_ENABLED); } }
Source:
public void testChainedMethodWithBracketOnNewLine() throws Exception { final DefaultConfiguration checkConfig = createModuleConfig(IndentationCheck.class); checkConfig.addAttribute("arrayInitIndent", "2"); checkConfig.addAttribute("basicOffset", "2"); checkConfig.addAttribute("braceAdjustment", "0"); checkConfig.addAttribute("caseIndent", "2"); checkConfig.addAttribute("forceStrictCondition", "false"); checkConfig.addAttribute("lineWrappingIndentation", "4"); checkConfig.addAttribute("tabWidth", "2"); checkConfig.addAttribute("throwsIndent", "2"); final String[] expected = CommonUtil.EMPTY_STRING_ARRAY; final String fileName = "InputIndentationChainedMethodWithBracketOnNewLine.java"; verifyWarns(checkConfig, getPath(fileName), expected); }

Target:
public void testChainedMethodWithBracketOnNewLine() throws Exception { final DefaultConfiguration checkConfig = createModuleConfig(IndentationCheck.class); checkConfig.addAttribute("arrayInitIndent", "2"); checkConfig.addAttribute("basicOffset", "2"); checkConfig.addAttribute("braceAdjustment", "0"); checkConfig.addAttribute("caseIndent", "2"); checkConfig.addAttribute("forceStrictCondition", "false"); checkConfig.addAttribute("lineWrappingIndentation", "4"); checkConfig.addAttribute("tabWidth", "2"); checkConfig.addAttribute("throwsIndent", "2"); final String[] expected = { "44: " + getCheckMessage(MSG_CHILD_ERROR, "method call", 6, 8), "45: " + getCheckMessage(MSG_CHILD_ERROR, "method call", 8, 10), "47: " + getCheckMessage(MSG_ERROR, "method call rparen", 6, 8), "61: " + getCheckMessage(MSG_ERROR, "foo", 5, 8), "82: " + getCheckMessage(MSG_ERROR, "if rcurly", 4, 6), "84: " + getCheckMessage(MSG_CHILD_ERROR, "method def", 2, 4), }; final String fileName = "InputIndentationChainedMethodWithBracketOnNewLine.java"; verifyWarns(checkConfig, getPath(fileName), expected); }
Source:
private void removeEventListener(ClientDescriptor clientDescriptor, ServerSideServerStore cacheStore) { synchronized (eventListeners) { boolean wasEmpty = eventListeners.isEmpty(); eventListeners.remove(clientDescriptor); if (!wasEmpty && eventListeners.isEmpty()) { cacheStore.enableEvents(false); } } }

Target:
private void removeEventListener(ClientDescriptor clientDescriptor, ServerSideServerStore cacheStore) { synchronized (eventListeners) { if (eventListeners.remove(clientDescriptor) && eventListeners.isEmpty()) { cacheStore.enableEvents(false); } } }
Source:
public void testQueryCumulativeTable() { computeActual("SELECT * FROM \"*:*\""); computeActual("SELECT * FROM \"java.util.logging:*\""); assertTrue(computeActual("SELECT * FROM \"java.lang:*\"").getRowCount() > 0); assertTrue(computeActual("SELECT * FROM \"jAVA.LANg:*\"").getRowCount() > 0); }

Target:
public void testQueryCumulativeTable() { computeActual("SELECT * FROM \"*:*\""); computeActual("SELECT * FROM \"java.util.logging:*\""); assertTrue(computeActual("SELECT * FROM \"java.lang:*\"").getRowCount() > 1); assertTrue(computeActual("SELECT * FROM \"jAVA.LANg:*\"").getRowCount() > 1); }