auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void writeData(FeatureCollectionResponse featureCollection, OutputStream output, Operation getFeature) throws IOException, ServiceException { BufferedWriter w = new BufferedWriter(new OutputStreamWriter(output, this.gs.getGlobal().getSettings().getCharset())); FeatureCollection<?, ?> fc = (FeatureCollection)featureCollection.getFeature().get(0); Object att; SimpleFeatureType ft = (SimpleFeatureType)((FeatureCollection)fc).getSchema(); w.write("FID,"); for(int i = 0; i < ft.getAttributeCount(); ++i) { AttributeDescriptor ad = ft.getDescriptor(i); w.write(this.prepCSVField(ad.getLocalName())); if (i < ft.getAttributeCount() - 1) { w.write(","); } } w.write("\r\n"); NumberFormat coordFormatter = NumberFormat.getInstance(Locale.US); coordFormatter.setMaximumFractionDigits(this.getInfo().getGeoServer().getSettings().getNumDecimals()); coordFormatter.setGroupingUsed(false); FeatureIterator i = ((FeatureCollection)fc).features(); try { for(; i.hasNext(); w.write("\r\n")) { Feature f = i.next(); w.write(this.prepCSVField(f.getIdentifier().getID())); w.write(","); for(int j = 0; j < ((SimpleFeature)f).getAttributeCount(); ++j) { att = ((SimpleFeature)f).getAttribute(j); if (att != null) { String value = formatToString(att, coordFormatter); w.write(this.prepCSVField(value)); } if (j < ((SimpleFeature)f).getAttributeCount() - 1) { w.write(","); } } } } finally { i.close(); } w.flush(); }

Target:
public void writeData(FeatureCollectionResponse featureCollection, OutputStream output, Operation getFeature) throws IOException, ServiceException { BufferedWriter w = new BufferedWriter(new OutputStreamWriter(output, this.gs.getGlobal().getSettings().getCharset())); FeatureCollection<?, ?> fc = (FeatureCollection)featureCollection.getFeature().get(0); Object att; SimpleFeatureType ft = (SimpleFeatureType)((FeatureCollection)fc).getSchema(); w.write("FID,"); for(int i = 0; i < ft.getAttributeCount(); ++i) { AttributeDescriptor ad = ft.getDescriptor(i); w.write(this.prepCSVField(ad.getLocalName())); if (i < ft.getAttributeCount() - 1) { w.write(","); } } w.write("\r\n"); NumberFormat coordFormatter = NumberFormat.getInstance(Locale.US); coordFormatter.setMaximumFractionDigits(this.getInfo().getGeoServer().getSettings().getNumDecimals()); coordFormatter.setGroupingUsed(false); FeatureIterator i = ((FeatureCollection)fc).features(); try { while (i.hasNext()) { Feature f = i.next(); w.write(this.prepCSVField(f.getIdentifier().getID())); w.write(","); for(int j = 0; j < ((SimpleFeature)f).getAttributeCount(); ++j) { att = ((SimpleFeature)f).getAttribute(j); if (att != null) { String value = formatToString(att, coordFormatter); w.write(this.prepCSVField(value)); } if (j < ((SimpleFeature)f).getAttributeCount() - 1) { w.write(","); } } w.write("\r\n"); } } finally { i.close(); } w.flush(); }
Source:
public void dropRowRange(String tableId, String rowKeyPrefix) { DropRowRangeRequest.Builder dropRequestProtoBuilder = DropRowRangeRequest.newBuilder() .setName(instanceName.toTableNameStr(tableId)) .setDeleteAllDataFromTable(true); if(!Strings.isNullOrEmpty(rowKeyPrefix)){ dropRequestProtoBuilder .setDeleteAllDataFromTable(false) .setRowKeyPrefix(ByteString.copyFromUtf8(rowKeyPrefix)); } adminClient.dropRowRange(dropRequestProtoBuilder.build()); }

Target:
public void dropRowRange(String tableId, String rowKeyPrefix) { adminClient.dropRowRange(buildDropRowRangeRequest(tableId, rowKeyPrefix)); }
Source:
protected void addMemberCheckNull(Object member, boolean addSeparator) { IfStatement ifStatement= fAst.newIfStatement(); ifStatement.setExpression(createInfixExpression(createMemberAccessExpression(member, true, true), Operator.NOT_EQUALS, fAst.newNullLiteral())); Block thenBlock= fAst.newBlock(); flushTemporaryExpression(); for (String a : getContext().getTemplateParser().getBody()) { addElement(processElement(a, member), thenBlock); } if (addSeparator) addElement(getContext().getTemplateParser().getSeparator(), thenBlock); flushTemporaryExpression(); if (thenBlock.statements().size() == 1 && !getContext().isForceBlocks()) { ifStatement.setThenStatement((Statement)ASTNode.copySubtree(fAst, (ASTNode)thenBlock.statements().get(0))); } else { ifStatement.setThenStatement(thenBlock); } toStringMethod.getBody().statements().add(ifStatement); }

Target:
protected void addMemberCheckNull(Object member, boolean addSeparator) { IfStatement ifStatement= fAst.newIfStatement(); ifStatement.setExpression(createInfixExpression(createMemberAccessExpression(member, true, true), Operator.NOT_EQUALS, fAst.newNullLiteral())); Block thenBlock= fAst.newBlock(); flushTemporaryExpression(); for (String s : getContext().getTemplateParser().getBody()) { addElement(processElement(s, member), thenBlock); } if (addSeparator) addElement(getContext().getTemplateParser().getSeparator(), thenBlock); flushTemporaryExpression(); if (thenBlock.statements().size() == 1 && !getContext().isForceBlocks()) { ifStatement.setThenStatement((Statement)ASTNode.copySubtree(fAst, (ASTNode)thenBlock.statements().get(0))); } else { ifStatement.setThenStatement(thenBlock); } toStringMethod.getBody().statements().add(ifStatement); }
Source:
public void send(HttpServletResponse resp) throws IOException { output.setRequestId(Config.getRequestId()); resp.setStatus(getStatusCode()); resp.setContentType("application/json"); PrintWriter pw = resp.getWriter(); pw.print(JsonUtils.toJson(output)); }

Target:
public void send(HttpServletResponse resp) throws IOException { output.setRequestId(Config.getRequestId()); for (Cookie cookie : cookies) { resp.addCookie(cookie); } resp.setStatus(getStatusCode()); resp.setContentType("application/json"); PrintWriter pw = resp.getWriter(); pw.print(JsonUtils.toJson(output)); }
Source:
private GitSubscriberParticipant getParticipant(GitSynchronizeDataSet data) { ISynchronizeManager synchronizeManager = TeamUI.getSynchronizeManager(); ISynchronizeParticipantReference[] participants = synchronizeManager .get(GitSubscriberParticipant.PARTICIPANT_NAME); GitSubscriberParticipant participant; if (participants.length == 0) { participant = createDefaultParticipant(data); } else { try { participant = (GitSubscriberParticipant) participants[0].getParticipant(); participant.reset(data); } catch (TeamException e1) { participant = createDefaultParticipant(data); } } return participant; }

Target:
private GitSubscriberParticipant getParticipant(GitSynchronizeDataSet data) { ISynchronizeManager synchronizeManager = TeamUI.getSynchronizeManager(); ISynchronizeParticipantReference[] participants = synchronizeManager .get(GitSubscriberParticipant.PARTICIPANT_NAME); GitSubscriberParticipant participant; if (participants.length == 0) { participant = createDefaultParticipant(data); } else { try { participant = (GitSubscriberParticipant) participants[0].getParticipant(); participant.reset(data); } catch (TeamException e) { participant = createDefaultParticipant(data); } } return participant; }
Source:
public Response clearCache() { Response response = null; try { CacheConfiguration ehConfig = new CacheConfiguration() .name(cacheName) .memoryStoreEvictionPolicy(MemoryStoreEvictionPolicy.LRU) .persistence(new PersistenceConfiguration() .strategy(PersistenceConfiguration.Strategy.LOCALTEMPSWAP)) .clearOnFlush(true); Configuration managerConfig = new Configuration() .diskStore(new DiskStoreConfiguration().path(cacheLocation)) .dynamicConfig(false) .cache(ehConfig); CacheManager cacheManager = CacheManager.create(managerConfig); Ehcache ehcache = cacheManager.getEhcache(cacheName); if (ehcache != null) { ehcache.flush(); ehcache.removeAll(); response = Response.ok().build(); } else { response = Response.serverError().entity("Error location cache to clear").build(); } } catch (Exception e) { log.error("Unable to clear cache", e); response = Response.serverError().entity("Error location cache to clear").build(); } return response; }

Target:
public Response clearCache() { Response response = null; try { CacheConfiguration ehConfig = new CacheConfiguration() .name(cacheName) .memoryStoreEvictionPolicy(MemoryStoreEvictionPolicy.LRU) .persistence(new PersistenceConfiguration() .strategy(PersistenceConfiguration.Strategy.LOCALTEMPSWAP)) .clearOnFlush(true); Configuration managerConfig = new Configuration() .diskStore(new DiskStoreConfiguration().path(cacheLocation)) .dynamicConfig(false) .cache(ehConfig); CacheManager cacheManager = CacheManager.create(managerConfig); Ehcache ehcache = cacheManager.getEhcache(cacheName); if (ehcache != null) { ehcache.flush(); ehcache.removeAll(); response = Response.ok().build(); } else { response = Response.serverError().entity("Error locating cache to clear").build(); } } catch (Exception e) { log.error("Unable to clear cache", e); response = Response.serverError().entity("Unable to clear cache").build(); } return response; }
Source:
void shutdown() { logger.info("OperationController is shutting down"); boolean cleanShutdown = false; try { if (shutDownLatch.await(SHUTDOWN_WAIT_MS, TimeUnit.MILLISECONDS)) { cleanShutdown = true; } } catch (InterruptedException e) { logger.trace("Exception while shuttind down"); } finally { if (!cleanShutdown) { logger.error("RequestResponseHandler did not shut down gracefully, forcing shut down"); } } selector.close(); }

Target:
void shutdown() { logger.info("OperationController is shutting down"); try { if (shutDownLatch.await(SHUTDOWN_WAIT_MS, TimeUnit.MILLISECONDS)) { logger.error("RequestResponseHandler thread did not shut down gracefully, forcing shut down"); } } catch (InterruptedException e) { logger.error("Exception while shutting down, forcing shutdown", e); } selector.close(); }
Source:
private ApiResponseSet addonToSet(AddOn ao) { Map<String, String> map = new HashMap<>(); map.put("id", String.valueOf(ao.getId())); map.put("name", String.valueOf(ao.getName())); map.put("author", String.valueOf(ao.getAuthor())); map.put("changes", String.valueOf(ao.getChanges())); map.put("description", String.valueOf(ao.getDescription())); map.put("hash", String.valueOf(ObjectUtils.toString(ao.getHash()))); map.put("info", String.valueOf(ObjectUtils.toString(ao.getInfo()))); map.put("sizeInBytes", String.valueOf(ao.getSize())); map.put("status", String.valueOf(ao.getStatus().toString())); map.put("url", String.valueOf(ObjectUtils.toString(ao.getUrl()))); Version version = ao.getVersion(); if (version != null) { map.put("version", String.valueOf(ao.getVersion().toString())); } return new ApiResponseSet("addon", map); }

Target:
private ApiResponseSet addonToSet(AddOn ao) { Map<String, String> map = new HashMap<>(); map.put("id", ao.getId()); map.put("name", ao.getName()); map.put("author", ao.getAuthor()); map.put("changes", ao.getChanges()); map.put("description", ao.getDescription()); map.put("hash", ObjectUtils.toString(ao.getHash())); map.put("infoUrl", ObjectUtils.toString(ao.getInfo())); map.put("sizeInBytes", String.valueOf(ao.getSize())); map.put("status", ao.getStatus().toString()); map.put("url", ObjectUtils.toString(ao.getUrl())); map.put("fileVersion", String.valueOf(ao.getFileVersion())); map.put("version", ObjectUtils.toString(ao.getVersion())); return new ApiResponseSet("addon", map); }
Source:
public void testImportVMFromConfigurationXMLCouldNotGetParsed() { OvfEntityData ovfEntity = getOvfEntityData(); ovfEntity.setOvfData("This is not a valid XML"); initCommand(ovfEntity); when(unregisteredOVFDataDao.getByEntityIdAndStorageDomain(vmId, storageDomainId)).thenReturn(ovfEntity); assertFalse(cmd.canDoAction()); Assert.assertTrue(cmd.getReturnValue() .getCanDoActionMessages() .contains(VdcBllMessages.ACTION_TYPE_FAILED_OVF_CONFIGURATION_NOT_SUPPORTED.toString())); }

Target:
public void testImportVMFromConfigurationXMLCouldNotGetParsed() { OvfEntityData ovfEntity = getOvfEntityData(); ovfEntity.setOvfData("This is not a valid XML"); initCommand(ovfEntity); when(unregisteredOVFDataDao.getByEntityIdAndStorageDomain(vmId, storageDomainId)).thenReturn(ovfEntity); assertFalse(cmd.canDoAction()); assertTrue(cmd.getReturnValue() .getCanDoActionMessages() .contains(VdcBllMessages.ACTION_TYPE_FAILED_OVF_CONFIGURATION_NOT_SUPPORTED.toString())); }
Source:
public MainPresenter(MainActivity mainActivity, DatabaseHandler databaseHandler) { db = databaseHandler; Log.i("msg::", "initiated db object"); if (db.getUser(1) == null) { mainActivity.startHelloActivity(); } else { mainActivity.getLocaleHelper().updateLanguage(mainActivity, db.getUser(1).getPreferred_language()); } }

Target:
public MainPresenter(MainActivity mainActivity, DatabaseHandler databaseHandler) { dB = databaseHandler; Log.i("msg::", "initiated dB object"); if (dB.getUser(1) == null) { mainActivity.startHelloActivity(); } else { mainActivity.getLocaleHelper().updateLanguage(mainActivity, dB.getUser(1).getPreferred_language()); } }
Source:
private void commitFiles() { projectExplorer.selectItem(PROJECT_NAME); menu.runCommand(TestMenuCommandsConstants.Git.GIT, TestMenuCommandsConstants.Git.COMMIT); git.waitAndRunCommit(COMMIT_MSG); git.waitGitStatusBarWithMess(TestGitConstants.COMMIT_MESSAGE_SUCCESS); events.clickEventLogBtn(); events.waitExpectedMessage(TestGitConstants.COMMIT_MESSAGE_SUCCESS); }

Target:
private void commitFiles() { projectExplorer.selectItem(PROJECT_NAME); menu.runCommand(TestMenuCommandsConstants.Git.GIT, TestMenuCommandsConstants.Git.COMMIT); git.waitAndRunCommit(COMMIT_MSG); git.waitGitStatusBarWithMess(TestGitConstants.COMMIT_MESSAGE_SUCCESS); eventsPanel.clickEventLogBtn(); eventsPanel.waitExpectedMessage(TestGitConstants.COMMIT_MESSAGE_SUCCESS); }
Source:
public void testFloatingPointCalcChunkPos() { org.joml.Vector3i temp = new org.joml.Vector3i(); assertTrue(ChunkMath.calcChunkPos(31.9f, 64.1f, 32.5f, temp).equals(0, 1, 1), temp.toString()); assertTrue(ChunkMath.calcChunkPos(32.9f, 63.9f, 32.9f, temp).equals(1, 0, 1), temp.toString()); assertTrue(ChunkMath.calcChunkPos(31.3f, 63.9f, 31.9f, temp).equals(0, 0, 0), temp.toString()); assertTrue(ChunkMath.calcChunkPos(31.6f, 64.5f, 32.1f, temp).equals(0, 1, 1), temp.toString()); }

Target:
public void testFloatingPointCalcChunkPos() { org.joml.Vector3i temp = new org.joml.Vector3i(); assertTrue(ChunkMath.calcChunkPos(31.9f, 64.1f, 32.5f, temp).equals(0, 1, 1), temp.toString()); assertTrue(ChunkMath.calcChunkPos(32.9f, 63.9f, 32.9f, temp).equals(1, 0, 1), temp.toString()); assertTrue(ChunkMath.calcChunkPos(31.3f, 63.9f, 31.9f, temp).equals(0, 0, 0), temp.toString()); assertTrue(ChunkMath.calcChunkPos(31.6f, 64.5f, 32.1f, temp).equals(0, 1, 1), temp.toString()); assertTrue(ChunkMath.calcChunkPos(.1f, -.2f, -.8f, temp).equals(0, -1, -1), temp.toString()); assertTrue(ChunkMath.calcChunkPos(-.1f, -.99f, 2f, temp).equals(-1, -1, 0), temp.toString()); }
Source:
public void getExecutionDurationPercentilesTest() { NoThreadSchedulerStatisticTracker scheduler = new NoThreadSchedulerStatisticTracker(); assertEquals(0, scheduler.getExecutionDurationPercentiles(50).get(50.), 0); scheduler.execute(new ClockUpdateRunnable()); scheduler.tick(null); assertEquals(1, scheduler.getExecutionDurationPercentiles(50).get(50.), 1); scheduler.execute(new ClockUpdateRunnable()); scheduler.execute(new ClockUpdateRunnable()); scheduler.execute(new ClockUpdateRunnable()); scheduler.execute(new ClockUpdateRunnable(DELAY_TIME)); scheduler.tick(null); assertEquals(1, scheduler.getExecutionDurationPercentiles(75).get(75.), 1); System.out.println(scheduler.getExecutionDurationPercentiles(90).get(90.)); assertTrue(scheduler.getExecutionDurationPercentiles(90).get(90.) >= (DELAY_TIME-ALLOWED_VARIANCE)); }

Target:
public void getExecutionDurationPercentilesTest() { NoThreadSchedulerStatisticTracker scheduler = new NoThreadSchedulerStatisticTracker(); assertEquals(0, scheduler.getExecutionDurationPercentiles(50).get(50.), 0); scheduler.execute(new ClockUpdateRunnable()); scheduler.tick(null); assertEquals(1, scheduler.getExecutionDurationPercentiles(50).get(50.), 1); scheduler.execute(new ClockUpdateRunnable()); scheduler.execute(new ClockUpdateRunnable()); scheduler.execute(new ClockUpdateRunnable()); scheduler.execute(new ClockUpdateRunnable(DELAY_TIME)); scheduler.tick(null); assertEquals(1, scheduler.getExecutionDurationPercentiles(75).get(75.), 1); assertTrue(scheduler.getExecutionDurationPercentiles(90).get(90.) >= (DELAY_TIME-ALLOWED_VARIANCE)); }
Source:
public void setup() throws InvalidSyntaxException { bundleContext = mock(BundleContext.class); transformerLocator = new TransformerLocatorTest(bundleContext); serviceMap = new HashMap<>(); when(bundleContext.getServiceReferences(isA(Class.class), anyString())) .thenAnswer( (Answer<Collection<ServiceReference>>) invocationOnMock -> { Class<?> clazz = (Class<?>) invocationOnMock.getArguments()[0]; String filter = (String) invocationOnMock.getArguments()[1]; if (filter != null) { Filter f = FrameworkUtil.createFilter(filter); return serviceMap .get(clazz) .stream() .filter(f::match) .collect(Collectors.toList()); } if (serviceMap.containsKey(clazz)) { return serviceMap.get(clazz); } return null; }); }

Target:
public void setup() throws InvalidSyntaxException { bundleContext = mock(BundleContext.class); transformerLocator = new TransformerLocatorTest(bundleContext); serviceMap = new HashMap<>(); when(bundleContext.getServiceReferences(isA(Class.class), anyString())) .thenAnswer( (Answer<Collection<ServiceReference>>) invocationOnMock -> { Class<?> clazz = (Class<?>) invocationOnMock.getArguments()[0]; String filter = (String) invocationOnMock.getArguments()[1]; if (filter != null) { Filter f = FrameworkUtil.createFilter(filter); return serviceMap .get(clazz) .stream() .filter(f::match) .collect(Collectors.toList()); } return serviceMap.get(clazz); }); }
Source:
public KeyStore loadKeyStore() throws IOException, GeneralSecurityException { KeyStore ks = keyStoreInstance(); InputStream inputStream = null; try { inputStream = new FileInputStream(new File(keyStorePath)); ks.load(inputStream, passwordStringToCharArray(keyStorePassword)); return ks; } finally { forceClose(inputStream); } }

Target:
public KeyStore loadKeyStore() throws IOException, GeneralSecurityException { try (InputStream inputStream = new FileInputStream(new File(keyStorePath))) { KeyStore ks = keyStoreInstance(); ks.load(inputStream, passwordStringToCharArray(keyStorePassword)); return ks; } }
Source:
public LeanNode add(long nanos, FrameInfo child, boolean last) { data.add(nanos, false); return childMap.compute( child, (k, v) -> v == null ? (last ? new LeanNode(child, nanos, this) : new LeanNode(child, this)) : (last ? v.addSelf(nanos) : v)); }

Target:
public LeanNode add(long nanos, FrameInfo child, boolean last) { data.add(nanos, false); LeanNode childNode = childMap.computeIfAbsent(child, k -> new LeanNode(k, this)); if (last) { childNode.addSelf(nanos); } return childNode; }
Source:
private static void initApiToMongoDocNameMap() { apiToMongoDocNameMap = new HashMap<>(); apiToMongoDocNameMap.put("sourceEntries", "files"); apiToMongoDocNameMap.put("sourceEntries.statistics", "st"); apiToMongoDocNameMap.put("annotation.statistics", "annot"); }

Target:
private static Map<String, String> initApiToMongoDocNameMap() { Map<String, String> map = new HashMap<>(); map.put("sourceEntries", "files"); map.put("sourceEntries.statistics", "st"); map.put("annotation", "annot"); map.put("sourceEntries.attributes", "files.attrs"); return map; }
Source:
public void launch(ILaunchConfiguration configuration, String mode, ILaunch launch, IProgressMonitor monitor) throws CoreException { RunScriptByPathAction action = new RunScriptByPathAction(); String path = configuration.getAttribute(SystemTapScriptLaunchConfigurationTab.SCRIPT_PATH_ATTR, ""); action.init(PlatformUI.getWorkbench().getActiveWorkbenchWindow(), path); String userName = configuration.getAttribute(SystemTapScriptLaunchConfigurationTab.USER_NAME_ATTR, ""); ConsoleLogPlugin.getDefault().getPreferenceStore().setValue(ConsoleLogPreferenceConstants.SCP_USER, userName); String password = configuration.getAttribute(SystemTapScriptLaunchConfigurationTab.USER_PASS_ATTR, ""); ConsoleLogPlugin.getDefault().getPreferenceStore().setValue(ConsoleLogPreferenceConstants.SCP_PASSWORD, password); boolean runAsCurrentUser = configuration.getAttribute(SystemTapScriptLaunchConfigurationTab.CURRENT_USER_ATTR, true); boolean runLocal = configuration.getAttribute(SystemTapScriptLaunchConfigurationTab.LOCAL_HOST_ATTR, true); action.setLocalScript(runLocal && runAsCurrentUser); String hostName = configuration.getAttribute(SystemTapScriptLaunchConfigurationTab.HOST_NAME_ATTR, "localhost"); ConsoleLogPlugin.getDefault().getPreferenceStore().setValue(ConsoleLogPreferenceConstants.HOST_NAME, hostName); action.run(); }

Target:
public void launch(ILaunchConfiguration configuration, String mode, ILaunch launch, IProgressMonitor monitor) throws CoreException { RunScriptByPathAction action = new RunScriptByPathAction(); IPreferenceStore preferenceStore = ConsoleLogPlugin.getDefault().getPreferenceStore(); String path = configuration.getAttribute(SystemTapScriptLaunchConfigurationTab.SCRIPT_PATH_ATTR, ""); action.init(PlatformUI.getWorkbench().getActiveWorkbenchWindow(), path); String userName = configuration.getAttribute(SystemTapScriptLaunchConfigurationTab.USER_NAME_ATTR, ""); preferenceStore.setValue(ConsoleLogPreferenceConstants.SCP_USER, userName); String password = configuration.getAttribute(SystemTapScriptLaunchConfigurationTab.USER_PASS_ATTR, ""); preferenceStore.setValue(ConsoleLogPreferenceConstants.SCP_PASSWORD, password); boolean runAsCurrentUser = configuration.getAttribute(SystemTapScriptLaunchConfigurationTab.CURRENT_USER_ATTR, true); boolean runLocal = configuration.getAttribute(SystemTapScriptLaunchConfigurationTab.LOCAL_HOST_ATTR, true); action.setLocalScript(runLocal && runAsCurrentUser); String hostName = configuration.getAttribute(SystemTapScriptLaunchConfigurationTab.HOST_NAME_ATTR, "localhost"); preferenceStore.setValue(ConsoleLogPreferenceConstants.HOST_NAME, hostName); action.run(); }
Source:
private List<InterpreterCompletion> callCompletion(CompletionRequest req) throws LivyException { List<InterpreterCompletion> candidates = new ArrayList<>(); try { CompletionResponse resp = CompletionResponse.fromJson( callRestAPI("/sessions/" + sessionInfo.id + "/completion", "POST", req.toJson())); for (String candidate : resp.candidates) { candidates.add(new InterpreterCompletion(candidate, candidate, StringUtils.EMPTY)); } } catch (APINotFoundException e) { logger.debug("completion api seems not to be availabele. (available from livy 0.5)", e); } return candidates; }

Target:
private List<InterpreterCompletion> callCompletion(CompletionRequest req) throws LivyException { List<InterpreterCompletion> candidates = new ArrayList<>(); try { CompletionResponse resp = CompletionResponse.fromJson( callRestAPI("/sessions/" + sessionInfo.id + "/completion", "POST", req.toJson())); for (String candidate : resp.candidates) { candidates.add(new InterpreterCompletion(candidate, candidate, StringUtils.EMPTY)); } } catch (APINotFoundException e) { logger.debug("completion api seems not to be available. (available from livy 0.5)", e); } return candidates; }
Source:
public void drawText(CharSequence text, int x, int y, int maxWidth, int lineHeight, Color color, TextAlign align) { if (isDisposed()) throw new ObjectDisposedException(); Rectangle bounds = measureText(text, lineHeight); bounds.width = maxWidth; mAwtGraphics2D.clipRect(x, y, bounds.width, bounds.height); final TextLayout layout = new TextLayout(text.toString(), mAwtTextFont, mAwtFontRenderContext); mAwtGraphics2D.setColor(convertToAwtColor(color)); layout.draw(mAwtGraphics2D, x, y); mAwtGraphics2D.clipRect(0, 0, mImage.getWidth(), mImage.getHeight()); }

Target:
public void drawText(CharSequence text, int x, int y, int maxWidth, int lineHeight, Color color, TextAlign align) { if (isDisposed()) throw new ObjectDisposedException(); if (maxWidth != -1) { final Rectangle bounds = measureText(text, lineHeight); bounds.width = maxWidth; mAwtGraphics2D.clipRect(x, y, bounds.width, bounds.height); } final TextLayout layout = new TextLayout(text.toString(), mAwtTextFont, mAwtFontRenderContext); mAwtGraphics2D.setColor(convertToAwtColor(color)); layout.draw(mAwtGraphics2D, x, y); if (maxWidth != -1) { mAwtGraphics2D.clipRect(0, 0, mImage.getWidth(), mImage.getHeight()); } }
Source:
public String getHowTo() { return "This actionlet allows you to add a comment on the workflow task."; }

Target:
public String getHowTo() { String name = "This actionlet allows you to add a comment on the workflow task."; try { name = LanguageUtil.get("Workflow-Comment-on-workflow-howto"); } catch (LanguageException e) { name = "This actionlet allows you to add a comment on the workflow task."; } return name; }
Source:
public void onEvent(InstanceStateEvent event) { if ((event.getType() == OOM) || (event.getType() == DIE)) { try { final Instance machine = getMachine(event.getMachineId()); String message = "Machine is destroyed."; if (event.getType() == OOM) { message = message + "The processes in this machine need more RAM. This machine started with " + machine.getMemorySize() + "MB. Create a new machine configuration that allocates additional RAM or increase " + "the workspace RAM limit in the user dashboard."; } cleanupOnDestroy(machine, message); } catch (NotFoundException | MachineException ignore) { } } }

Target:
public void onEvent(InstanceStateEvent event) { if ((event.getType() == OOM) || (event.getType() == DIE)) { try { final Instance machine = getMachine(event.getMachineId()); String message = "Machine is destroyed."; if (event.getType() == OOM) { message = message + "The processes in this machine need more RAM. This machine started with " + machine.getMemorySize() + "MB. Create a new machine configuration that allocates additional RAM or increase " + "the workspace RAM limit in the user dashboard."; } cleanupOnDestroy(machine, message); } catch (NotFoundException | MachineException e) { LOG.debug(e.getLocalizedMessage(), e); } } }
Source:
public AvoidReassigningLoopVariablesRule() { definePropertyDescriptor(FOREACH_REASSIGN); definePropertyDescriptor(FOR_REASSIGN); }

Target:
public AvoidReassigningLoopVariablesRule() { definePropertyDescriptor(FOREACH_REASSIGN); definePropertyDescriptor(FOR_REASSIGN); addRuleChainVisit(ASTLocalVariableDeclaration.class); }
Source:
Options(String[] args) throws CmdLineException { CmdLineParser parser = new CmdLineParser(this); parser.parseArgument(args); if (filesToConvert.size() != 0 && sourcesManifest != null) { throw new CmdLineException( parser, "Don't specify a sources manifest file and source files at the same time."); } if (arguments.size() != 0 && dependenciesManifest != null) { throw new CmdLineException( parser, "Don't specify a dependencies manifest file and dependency files at the same time."); } if (sourcesManifest != null) { try { filesToConvert = Files.readAllLines(Paths.get(sourcesManifest), UTF_8); } catch (IOException e) { throw new CmdLineException( parser, "sources manifest file " + sourcesManifest + " not found.", e); } } if (dependenciesManifest == null) { srcFiles.addAll(arguments); } else { try { srcFiles.addAll(Files.readAllLines(Paths.get(dependenciesManifest), UTF_8)); } catch (IOException e) { throw new CmdLineException( parser, "dependencies manifest file " + dependenciesManifest + " not found.", e); } } srcFiles.addAll(filesToConvert); if (srcFiles.isEmpty()) { throw new CmdLineException(parser, "No files were given"); } try { externsMap = getExternsMap(); } catch (IOException e) { throw new CmdLineException(parser, "externs file " + externsMapFile + " not found.", e); } }

Target:
Options(String[] args) throws CmdLineException { CmdLineParser parser = new CmdLineParser(this); parser.parseArgument(args); if (filesToConvert.size() != 0 && sourcesManifest != null) { throw new CmdLineException( parser, "Don't specify a sources manifest file and source files (\"--convert\") at the same time."); } if (arguments.size() != 0 && dependenciesManifest != null) { throw new CmdLineException( parser, "Don't specify a dependencies manifest file and dependency files as arguments at the same time."); } if (sourcesManifest != null) { try { filesToConvert = Files.readAllLines(Paths.get(sourcesManifest), UTF_8); } catch (IOException e) { throw new CmdLineException( parser, "sources manifest file " + sourcesManifest + " not found.", e); } } if (dependenciesManifest == null) { srcFiles.addAll(arguments); } else { try { srcFiles.addAll(Files.readAllLines(Paths.get(dependenciesManifest), UTF_8)); } catch (IOException e) { throw new CmdLineException( parser, "dependencies manifest file " + dependenciesManifest + " not found.", e); } } srcFiles.addAll(filesToConvert); if (srcFiles.isEmpty()) { throw new CmdLineException(parser, "No files were given"); } try { externsMap = getExternsMap(); } catch (IOException e) { throw new CmdLineException(parser, "externs file " + externsMapFile + " not found.", e); } }
Source:
private boolean formingCyclicGraph(OnmsAlarm situation, OnmsAlarm relatedAlarm) { if (situation.getReductionKey().equals(relatedAlarm.getReductionKey())) { return true; } if (!relatedAlarm.getRelatedAlarms().isEmpty()) { for (OnmsAlarm alarm : relatedAlarm.getRelatedAlarms()) { boolean matched = formingCyclicGraph(situation, alarm); if (!matched) { continue; } return matched; } } return false; }

Target:
private boolean formingCyclicGraph(OnmsAlarm situation, OnmsAlarm relatedAlarm) { return situation.getReductionKey().equals(relatedAlarm.getReductionKey()) || relatedAlarm.getRelatedAlarms().stream().anyMatch(ra -> formingCyclicGraph(situation, ra)); }
Source:
public boolean performNextOperation(int completedChildCount) { switch(getParameters().getImportPhase()) { case CREATE_DISKS: getParameters().setImportPhase(Phase.CONVERT); if (getParameters().getProxyHostId() == null) { getParameters().setProxyHostId(selectProxyHost()); } break; case CONVERT: if (EnumSet.of(OriginType.KVM, OriginType.OVIRT).contains(getVm().getOrigin())) { deleteV2VJob(); return false; } getParameters().setImportPhase(Phase.POST_CONVERT); break; case POST_CONVERT: return false; default: } persistCommandIfNeeded(); executeNextOperation(); return true; }

Target:
public boolean performNextOperation(int completedChildCount) { switch(getParameters().getImportPhase()) { case CREATE_DISKS: getParameters().setImportPhase(Phase.CONVERT); if (getParameters().getProxyHostId() == null) { getParameters().setProxyHostId(selectProxyHost()); } break; case CONVERT: if (EnumSet.of(OriginType.OVIRT).contains(getVm().getOrigin())) { return false; } getParameters().setImportPhase(Phase.POST_CONVERT); break; case POST_CONVERT: return false; default: } persistCommandIfNeeded(); executeNextOperation(); return true; }
Source:
static void registerMethod(MetricsRegistry metricsRegistry, Object osBean, String methodName, String name) { if (OperatingSystemMXBeanSupport.GET_FREE_PHYSICAL_MEMORY_SIZE_DISABLED || methodName.equals("getFreePhysicalMemorySize")) { metricsRegistry.registerStaticProbe(osBean, name, MANDATORY, (LongProbeFunction<Object>) source -> -1); } else { registerMethod(metricsRegistry, osBean, methodName, name, 1); } }

Target:
static void registerMethod(MetricsRegistry metricsRegistry, Object osBean, String methodName, String name) { if (OperatingSystemMXBeanSupport.GET_FREE_PHYSICAL_MEMORY_SIZE_DISABLED && methodName.equals("getFreePhysicalMemorySize")) { metricsRegistry.registerStaticProbe(osBean, name, MANDATORY, (LongProbeFunction<Object>) source -> -1); } else { registerMethod(metricsRegistry, osBean, methodName, name, 1); } }
Source:
public static Metric<Double> nullsFraction(String columnName) { return new Metric<Double>() { @Override public Optional<Double> getValueFromPlanNodeEstimate(PlanNodeStatsEstimate planNodeStatsEstimate, StatsContext statsContext) { return asOptional(getSymbolStatistics(planNodeStatsEstimate, columnName, statsContext).getNullsFraction()); } @Override public Optional<Double> getValueFromAggregationQueryResult(Object value) { return Optional.of(((Number) value).doubleValue()); } @Override public String getComputingAggregationSql() { return "(count(*) filter(where " + columnName + " is null)) / cast(count(*) as double)"; } @Override public String getName() { return "NULLS_FRACTION(" + columnName + ")"; } }; }

Target:
public static Metric nullsFraction(String columnName) { return new Metric() { @Override public OptionalDouble getValueFromPlanNodeEstimate(PlanNodeStatsEstimate planNodeStatsEstimate, StatsContext statsContext) { return asOptional(getSymbolStatistics(planNodeStatsEstimate, columnName, statsContext).getNullsFraction()); } @Override public OptionalDouble getValueFromAggregationQueryResult(Object value) { return OptionalDouble.of(((Number) value).doubleValue()); } @Override public String getComputingAggregationSql() { return "(count(*) filter(where " + columnName + " is null)) / cast(count(*) as double)"; } @Override public String toString() { return "NULLS_FRACTION(" + columnName + ")"; } }; }
Source:
private boolean isAllowedToClone(Object value) { if(value == null){ System.out.print("null"); } return Objects.nonNull(value) && ((value instanceof String) || (classUtils.isPrimitiveClass(value.getClass()))); }

Target:
private boolean isAllowedToClone(Object value) { return Objects.nonNull(value) && ((value instanceof String) || (classUtils.isPrimitiveClass(value.getClass()))); }
Source:
private void createSkipLine(int row, SkippedLine line, boolean isWholeFile) { FlowPanel p = new FlowPanel(); InlineLabel l1 = new InlineLabel(" " + PatchUtil.C.patchSkipRegionStart() + " "); InlineLabel l2 = new InlineLabel(" " + PatchUtil.C.patchSkipRegionEnd() + " "); Anchor all = new Anchor(String.valueOf(line.getSize())); all.addClickHandler(expandAllListener); all.setStyleName(Gerrit.RESOURCES.css().skipLine()); if (line.getSize() > 30 && isWholeFile) { Anchor b = new Anchor(PatchUtil.M.expandBefore(NUM_ROWS_TO_EXPAND), true); Anchor a = new Anchor(PatchUtil.M.expandAfter(NUM_ROWS_TO_EXPAND), true); b.addClickHandler(expandBeforeListener); a.addClickHandler(expandAfterListener); b.setStyleName(Gerrit.RESOURCES.css().skipLine()); a.setStyleName(Gerrit.RESOURCES.css().skipLine()); p.add(b); p.add(l1); p.add(all); p.add(l2); p.add(a); } else if(isWholeFile) { p.add(l1); p.add(all); p.add(l2); } else { p.add(l1); InlineLabel allLabel = new InlineLabel(" " + String.valueOf(line.getSize()) + " "); p.add(allLabel); p.add(l2);; } table.setWidget(row, 1, p); }

Target:
private void createSkipLine(int row, SkippedLine line, boolean isWholeFile) { FlowPanel p = new FlowPanel(); InlineLabel l1 = new InlineLabel(" " + PatchUtil.C.patchSkipRegionStart() + " "); InlineLabel l2 = new InlineLabel(" " + PatchUtil.C.patchSkipRegionEnd() + " "); Anchor all = new Anchor(String.valueOf(line.getSize())); all.addClickHandler(expandAllListener); all.setStyleName(Gerrit.RESOURCES.css().skipLine()); if (line.getSize() > 30 && isWholeFile) { Anchor b = new Anchor(PatchUtil.M.expandBefore(NUM_ROWS_TO_EXPAND), true); Anchor a = new Anchor(PatchUtil.M.expandAfter(NUM_ROWS_TO_EXPAND), true); b.addClickHandler(expandBeforeListener); a.addClickHandler(expandAfterListener); b.setStyleName(Gerrit.RESOURCES.css().skipLine()); a.setStyleName(Gerrit.RESOURCES.css().skipLine()); p.add(b); p.add(l1); p.add(all); p.add(l2); p.add(a); } else if (isWholeFile) { p.add(l1); p.add(all); p.add(l2); } else { p.add(l1); p.add(new InlineLabel(" " + line.getSize() + " ")); p.add(l2); } table.setWidget(row, 1, p); }
Source:
public boolean apply(Game game, Ability source) { Player player = game.getPlayer(source.getControllerId()); return player != null && !player.discard(amount.calculate(game, source, this), false, source, game).isEmpty(); }

Target:
public boolean apply(Game game, Ability source) { Player player = game.getPlayer(source.getControllerId()); return player != null && !player.discard(amount.calculate(game, source, this), randomDiscard, source, game).isEmpty(); }
Source:
private FreeStyleJob status_thresholds_step7(final FreeStyleJob job, final TaskScannerAction action) { job.configure(); job.addShellStep("NEW=\"CLOSED\"\n" + "for t in \"todo\" \"TODO\" \"XXX\" \"fixme\" \"FIXME\" \"Deprecated\"\n" + "do\n" + " OLD=$t\n" + " for f in `ls`\n" + " do\n" + " if [ -f $f -a -r $f ]; then\n" + " if [ $f = ${f%.java*}.java ]; then\n" + " sed \"s/$OLD/$NEW/\" \"$f\" > \"${f}.new\"\n" + " mv \"${f}.new\" \"$f\"\n" + " else\n" + " echo \"Info: $f is not a *.java file. Skipped.\"\n" + " fi" + " else\n" + " echo \"Error: Cannot read $f\"\n" + " fi\n" + " done\n" + "done"); job.save(); Build lastBuild = buildSuccessfulJob(job); lastBuild.open(); assertThatOpenTaskCountLinkIs(action, 1, 17); assertThatNewOpenTaskCountLinkIs(action, 1); assertThatClosedTaskCountLinkIs(action, 3); action.open(); assertThat(action.getNumberOfWarnings(), is(1)); assertThat(action.getNumberOfNewWarnings(), is(1)); assertThat(action.getNumberOfFixedWarnings(), is(3)); assertThat(action.getNumberOfWarningsWithHighPriority(), is(0)); assertThat(action.getNumberOfWarningsWithNormalPriority(), is(0)); assertThat(action.getNumberOfWarningsWithLowPriority(), is(1)); assertThat(action.getPluginResult(lastBuild), is("Plug-in Result: SUCCESS - no threshold has been exceeded (Reference build: #1)")); return job; }

Target:
private FreeStyleJob status_thresholds_step7(final FreeStyleJob job, final TaskScannerAction action) { job.configure(); job.addShellStep("NEW=\"CLOSED\"\n" + "for t in \"todo\" \"TODO\" \"XXX\" \"fixme\" \"FIXME\" \"Deprecated\"\n" + "do\n" + " OLD=$t\n" + " for f in `ls *.java`\n" + " do\n" + " if [ -f $f -a -r $f ]; then\n" + " sed \"s/$OLD/$NEW/\" \"$f\" > \"${f}.new\"\n" + " mv \"${f}.new\" \"$f\"\n" + " else\n" + " echo \"Error: Cannot read $f\"\n" + " fi\n" + " done\n" + "done"); job.save(); Build lastBuild = buildSuccessfulJob(job); lastBuild.open(); assertThatOpenTaskCountLinkIs(action, 1, 17); assertThatNewOpenTaskCountLinkIs(action, 1); assertThatClosedTaskCountLinkIs(action, 3); action.open(); assertThat(action.getNumberOfWarnings(), is(1)); assertThat(action.getNumberOfNewWarnings(), is(1)); assertThat(action.getNumberOfFixedWarnings(), is(3)); assertThat(action.getNumberOfWarningsWithHighPriority(), is(0)); assertThat(action.getNumberOfWarningsWithNormalPriority(), is(0)); assertThat(action.getNumberOfWarningsWithLowPriority(), is(1)); assertThat(action.getPluginResult(lastBuild), is("Plug-in Result: SUCCESS - no threshold has been exceeded (Reference build: #1)")); return job; }
Source:
public synchronized void count(String type) { Integer count = this.counts.get(type); if (count == null) count = 0; count++; this.counts.put(type, count); if (COUNT_PROGRESS.contains(type) && count % PROGRESS_INTERVAL == 0) { String message = this.resources.getString(type); message = MessageFormat.format(message, count); logger.info(message); } }

Target:
public void count(String type) { AtomicInteger count = this.counts.computeIfAbsent(type, k -> new AtomicInteger(0)); int c = count.incrementAndGet(); if (COUNT_PROGRESS.contains(type) && c % PROGRESS_INTERVAL == 0) { String message = this.resources.getString(type); message = MessageFormat.format(message, c); logger.info(message); } }
Source:
private void updateRequiresAndRefines(Comparison comparison) { Iterator<Diff> multiplicityChanges = Iterators.filter(comparison.getDifferences().iterator(), IS_MULTIPLICITY_CHANGE); while (multiplicityChanges.hasNext()) { MultiplicityElementChange refChange = (MultiplicityElementChange)multiplicityChanges.next(); for (Diff refines : refChange.getRefinedBy()) { ArrayList<Diff> refinedChangesToUpdate = new ArrayList<Diff>(); for (Diff refined : refines.getRefines()) { if (refined != refChange) { refinedChangesToUpdate.add(refined); } } for (Diff refined : refinedChangesToUpdate) { refined.getRefinedBy().remove(refines); refined.getRefinedBy().add(refChange); if (refined.getRequires().contains(refChange)) { refined.getRequires().remove(refChange); } } } } }

Target:
private void updateRequiresAndRefines(Comparison comparison) { Iterator<Diff> multiplicityChanges = Iterators.filter(comparison.getDifferences().iterator(), IS_MULTIPLICITY_CHANGE); while (multiplicityChanges.hasNext()) { MultiplicityElementChange refChange = (MultiplicityElementChange)multiplicityChanges.next(); for (Diff refines : refChange.getRefinedBy()) { ArrayList<Diff> refinedChangesToUpdate = new ArrayList<Diff>(); for (Diff refined : refines.getRefines()) { if (refined != refChange) { refinedChangesToUpdate.add(refined); } } for (Diff refined : refinedChangesToUpdate) { refined.getRefinedBy().remove(refines); refined.getRefinedBy().add(refChange); refined.getRequires().remove(refChange); } } } }
Source:
public NullSafeFieldAccessExpr setName(final SimpleName name) { assertNotNull(name); if (name == this.name) { return (NullSafeFieldAccessExpr) this; } notifyPropertyChange(ObservableProperty.NAME, this.name, name); if (this.name != null) this.name.setParentNode(null); this.name = name; setAsParentNodeOf(name); return this; }

Target:
public NullSafeFieldAccessExpr setName(final SimpleName name) { assertNotNull(name); if (name == this.name) { return (NullSafeFieldAccessExpr) this; } notifyPropertyChange(ObservableProperty.NAME, this.name, name); if (this.name != null) { this.name.setParentNode(null); } this.name = name; setAsParentNodeOf(name); return this; }
Source:
public ManagedChannel shutdownNow() { Counter counter = getActiveChannelCounter(); for (ChannelAndMetrics channelWrapper : channels.get()) { ManagedChannel channel = channelWrapper.channel; if (!channel.isTerminated()) { channel.shutdownNow(); counter.dec(); } } return this; }

Target:
public ManagedChannel shutdownNow() { for (InstrumentedChannel channel : channels.get()) { if (!channel.isTerminated()) { channel.shutdownNow(); } } return this; }
Source:
protected Message<?> doPollForMessage(String groupIdKey) { List<Message<?>> messages = jdbcTemplate.query(getQuery(Query.POLL_FROM_GROUP), new Object[] { groupIdKey, region, groupIdKey }, mapper); Assert.isTrue(messages.size() == 0 || messages.size() == 1); if (messages.size() > 0){ return messages.get(0); } return null; }

Target:
protected Message<?> doPollForMessage(String groupIdKey) { List<Message<?>> messages = jdbcTemplate.query(getQuery(Query.POLL_FROM_GROUP), new Object[] { groupIdKey, region, groupIdKey, region }, mapper); Assert.isTrue(messages.size() == 0 || messages.size() == 1); if (messages.size() > 0){ return messages.get(0); } return null; }
Source:
private void unblockControls() { mControlBlocked = ControlBlock.NONE; mCardFrame.setEnabled(true); mFlipCardLayout.setEnabled(true); switch (mCurrentEase) { case EASE_1: mEase1Layout.setClickable(true); mEase2Layout.setEnabled(true); mEase3Layout.setEnabled(true); mEase4Layout.setEnabled(true); break; case EASE_2: mEase1Layout.setEnabled(true); mEase2Layout.setClickable(true); mEase3Layout.setEnabled(true); mEase4Layout.setEnabled(true); break; case EASE_3: mEase1Layout.setEnabled(true); mEase2Layout.setEnabled(true); mEase3Layout.setClickable(true); mEase4Layout.setEnabled(true); break; case EASE_4: mEase1Layout.setEnabled(true); mEase2Layout.setEnabled(true); mEase3Layout.setEnabled(true); mEase4Layout.setClickable(true); break; default: mEase1Layout.setEnabled(true); mEase2Layout.setEnabled(true); mEase3Layout.setEnabled(true); mEase4Layout.setEnabled(true); break; } if (mPrefWhiteboard && mWhiteboard != null) { mWhiteboard.setEnabled(true); } if (typeAnswer()) { mAnswerField.setEnabled(true); } mTouchLayer.setVisibility(View.VISIBLE); mInAnswer = false; invalidateOptionsMenu(); }

Target:
private void unblockControls() { mControlBlocked = ControlBlock.UNBLOCKED; mCardFrame.setEnabled(true); mFlipCardLayout.setEnabled(true); switch (mCurrentEase) { case EASE_1: mEase1Layout.setClickable(true); mEase2Layout.setEnabled(true); mEase3Layout.setEnabled(true); mEase4Layout.setEnabled(true); break; case EASE_2: mEase1Layout.setEnabled(true); mEase2Layout.setClickable(true); mEase3Layout.setEnabled(true); mEase4Layout.setEnabled(true); break; case EASE_3: mEase1Layout.setEnabled(true); mEase2Layout.setEnabled(true); mEase3Layout.setClickable(true); mEase4Layout.setEnabled(true); break; case EASE_4: mEase1Layout.setEnabled(true); mEase2Layout.setEnabled(true); mEase3Layout.setEnabled(true); mEase4Layout.setClickable(true); break; default: mEase1Layout.setEnabled(true); mEase2Layout.setEnabled(true); mEase3Layout.setEnabled(true); mEase4Layout.setEnabled(true); break; } if (mPrefWhiteboard && mWhiteboard != null) { mWhiteboard.setEnabled(true); } if (typeAnswer()) { mAnswerField.setEnabled(true); } mTouchLayer.setVisibility(View.VISIBLE); mInAnswer = false; invalidateOptionsMenu(); }
Source:
private void reloadContent() { final List<EditedStyleItem> rawAttributes = ThemeEditorUtils.resolveAllAttributes(mySelectedStyle); myAttributes.clear(); myLabels = AttributesSorter.generateLabels(rawAttributes, myAttributes); fireTableDataChanged(); }

Target:
private void reloadContent() { final List<EditedStyleItem> rawAttributes = ThemeEditorUtils.resolveAllAttributes(mySelectedStyle); myAttributes.clear(); myLabels = AttributesSorter.generateLabels(rawAttributes, myAttributes); fireTableStructureChanged(); }
Source:
private void dealWithResponse(CollectCoordinationResponse<T> response, long responseOffset) { String responseVersion = response.getVersion(); long responseLastCheckpointedOffset = response.getLastCheckpointedOffset(); List<T> results; try { results = response.getResults(serializer); } catch (IOException e) { LOG.warn("An exception occurs when deserializing query results. Some results might be lost.", e); results = Collections.emptyList(); } if (responseLastCheckpointedOffset > lastCheckpointedOffset) { userTail += responseLastCheckpointedOffset - lastCheckpointedOffset; lastCheckpointedOffset = responseLastCheckpointedOffset; } if (!version.equals(responseVersion)) { for (long i = 0; i < offset - responseLastCheckpointedOffset; i++) { buffer.removeLast(); } version = responseVersion; offset = responseLastCheckpointedOffset; } if (!results.isEmpty()) { int addStart = (int) (offset - responseOffset); List<T> addedResults = results.subList(addStart, results.size()); buffer.addAll(addedResults); offset += addedResults.size(); } sanityCheck(); }

Target:
private void dealWithResponse(CollectCoordinationResponse<T> response, long responseOffset) throws IOException { String responseVersion = response.getVersion(); long responseLastCheckpointedOffset = response.getLastCheckpointedOffset(); List<T> results = response.getResults(serializer); if (!version.equals(responseVersion)) { for (long i = 0; i < offset - responseLastCheckpointedOffset; i++) { buffer.removeLast(); } version = responseVersion; offset = responseLastCheckpointedOffset; } if (responseLastCheckpointedOffset > userVisibleTail) { userVisibleTail = responseLastCheckpointedOffset; } if (!results.isEmpty()) { int addStart = (int) (offset - responseOffset); List<T> addedResults = results.subList(addStart, results.size()); buffer.addAll(addedResults); offset += addedResults.size(); } sanityCheck(); }
Source:
public void testSubscriptionTrackingSettingSerialization() throws Exception { SubscriptionTrackingSetting setting = new SubscriptionTrackingSetting(); setting.setEnable(false); String jsonTwo = mapper.writeValueAsString(setting); System.out.println(jsonTwo); Assert.assertEquals(jsonTwo, "{\"enable\":false}"); }

Target:
public void testSubscriptionTrackingSettingSerialization() throws Exception { SubscriptionTrackingSetting setting = new SubscriptionTrackingSetting(); setting.setEnable(false); String json = mapper.writeValueAsString(setting); System.out.println(json); Assert.assertEquals(json, "{\"enable\":false}"); }