auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>void listUsersSuccessfully() throws Exception { MvcResult result = mvc() .perform(get("/api/users")) <START> .andExpect(MockMvcResultMatchers.status().isOk()) <END> .andDo(document("users/list")) .andReturn(); GetUserResponse[] users = fromJson(result.getResponse().getContentAsString(), GetUserResponse[].class); Assertions.assertEquals(1, users.length); Assertions.assertEquals("username", users[0].getUsername()); }</code><technical_language>static import for status method here. If change it, changed in other occurances, too</technical_language>

Target:
void listUsersSuccessfully() throws Exception { MvcResult result = mvc() .perform(get("/api/users")) .andExpect(status().isOk()) .andDo(document("users/list")) .andReturn(); GetUserResponse[] users = fromJson(result.getResponse().getContentAsString(), GetUserResponse[].class); Assertions.assertEquals(1, users.length); Assertions.assertEquals("username", users[0].getUsername()); }
Source:
<code>public RequestIdPolicy(String requestIdHeaderName) { this.requestIdHeaderName = Objects.requireNonNull(requestIdHeaderName, <START> "messageIdHeaderName can not be null."); <END> }</code><technical_language>variable is named messageIdHeaderName</technical_language>

Target:
public RequestIdPolicy(String requestIdHeaderName) { this.requestIdHeaderName = Objects.requireNonNull(requestIdHeaderName, "requestIdHeaderName can not be null."); }
Source:
<code>private void updatePath() { mBorderPath.reset(); mRootBounds.inset(mBorderWidth / 2, mBorderWidth / 2); if (mIsCircle) { mBorderPath.addCircle( mRootBounds.centerX(), mRootBounds.centerY(), Math.min(mRootBounds.width(), mRootBounds.height())/2, Path.Direction.CW); } else { mBorderRadii[0] = mBorderRadii[1] = mCornerRadii[0] + mPadding - mBorderWidth/2; mBorderRadii[2] = mBorderRadii[3] = mCornerRadii[2] + mPadding - mBorderWidth/2; mBorderRadii[4] = mBorderRadii[5] = mCornerRadii[4] + mPadding - mBorderWidth/2; mBorderRadii[6] = mBorderRadii[7] = mCornerRadii[6] + mPadding - mBorderWidth/2; mBorderPath.addRoundRect(mRootBounds, mBorderRadii, Path.Direction.CW); } mRootBounds.inset(-mBorderWidth / 2, -mBorderWidth/2); <START> <END> if (mIsPathDirty) { mPath.reset(); mRootBounds.inset(mPadding, mPadding); if (mIsCircle) { mPath.addCircle( mRootBounds.centerX(), mRootBounds.centerY(), Math.min(mRootBounds.width(), mRootBounds.height())/2, Path.Direction.CW); } else { mPath.addRoundRect(mRootBounds, mCornerRadii, Path.Direction.CW); } mRootBounds.inset(-(mPadding), -(mPadding)); mPath.setFillType(Path.FillType.WINDING); mIsPathDirty = false; } }</code><technical_language>Do this if mIsPathDirty</technical_language>

Target:
private void updatePath() { if (mIsPathDirty) { mBorderPath.reset(); mRootBounds.inset(mBorderWidth/2, mBorderWidth/2); if (mIsCircle) { float radius = Math.min(mRootBounds.width(), mRootBounds.height())/2; mBorderPath.addCircle(mRootBounds.centerX(), mRootBounds.centerY(), radius, Path.Direction.CW); } else { for (int i = 0; i < mBorderRadii.length; i++) { mBorderRadii[i] = mCornerRadii[i] + mPadding - mBorderWidth/2; } mBorderPath.addRoundRect(mRootBounds, mBorderRadii, Path.Direction.CW); } mRootBounds.inset(-mBorderWidth/2, -mBorderWidth/2); mPath.reset(); mRootBounds.inset(mPadding, mPadding); if (mIsCircle) { mPath.addCircle( mRootBounds.centerX(), mRootBounds.centerY(), Math.min(mRootBounds.width(), mRootBounds.height())/2, Path.Direction.CW); } else { mPath.addRoundRect(mRootBounds, mCornerRadii, Path.Direction.CW); } mRootBounds.inset(-(mPadding), -(mPadding)); mPath.setFillType(Path.FillType.WINDING); mIsPathDirty = false; } }
Source:
<code>private void setupSubformTest() { FormDefinition subform = getFormDefinition("Subform.frm"); FormDefinition creationForm = getFormDefinition("CreationForm.frm"); FormDefinition editionForm = getFormDefinition("EditionForm.frm"); Map<String, FormDefinition> availableForms = new HashMap<String, FormDefinition>() {{ <START> put("f31d37ce-8155-4478-a464-456c013236c6", subform); <END> put("6544f16e-c765-451e-882d-8202f6ea824c", creationForm); put("dd1451bf-4f38-495b-8f16-b74711246797", editionForm); }}; when(context.getRenderingContext()).thenReturn(mapModelRenderingContext); when(mapModelRenderingContext.getAvailableForms()).thenReturn(availableForms); when(context.getClassLoader()).thenReturn(this.getClass().getClassLoader()); }</code><technical_language>Also, I declare subform etc. this put values directly. reusing afterwards, method shorter losing clarity</technical_language>

Target:
private void setupSubformTest() throws IOException { final String SUBFORM_ID = "f31d37ce-8155-4478-a464-456c013236c6", CREATIONFORM_ID = "6544f16e-c765-451e-882d-8202f6ea824c", EDITIONFORM_ID = "dd1451bf-4f38-495b-8f16-b74711246797"; Map<String, FormDefinition> availableForms = new HashMap<String, FormDefinition>() {{ put(SUBFORM_ID, getFormDefinition("Subform.frm")); put(CREATIONFORM_ID, getFormDefinition("CreationForm.frm")); put(EDITIONFORM_ID, getFormDefinition("EditionForm.frm")); }}; when(context.getRenderingContext()).thenReturn(mapModelRenderingContext); when(mapModelRenderingContext.getAvailableForms()).thenReturn(availableForms); when(context.getClassLoader()).thenReturn(this.getClass().getClassLoader()); }
Source:
<code><START> public void randomWrite(long pos, byte[] b, int off, int len) throws IOException <END> { if (readonly) throw new IOException("Remote file is read only."); long oldPosition = remoteOffset; remoteOffset = pos; try { write(b, off, len); } finally { remoteOffset = oldPosition; } }</code><technical_language>This synchronized changing remoteOffset in this method changed in synchronized methods. (of totally asking for trouble if a file stream anyways...but hey...correctness :) )</technical_language>

Target:
public synchronized void randomWrite(long pos, byte[] b, int off, int len) throws IOException { if (readonly) throw new IOException("Remote file is read only."); long oldPosition = remoteOffset; remoteOffset = pos; try { write(b, off, len); } finally { remoteOffset = oldPosition; } }
Source:
<code>public void run(){ boolean matchR = false; try { synchronized(this){ while(true){ System.out.println("wait hit"); this.wait(); System.out.println("RESUMED"); if(!TaskBar.myTextArray.isEmpty()){ TaskBar.trayIcon.displayMessage("New Message", TaskBar.myTextArray.get(0).getSender().getFirstName() + " " + TaskBar.myTextArray.get(0).getSender().getLastName(), MessageType.INFO); matchR = false; for(int i=0; i < TaskBar.smallChatWindows.size(); i++){ if(TaskBar.myTextArray.get(0).getSender().getPhoneNumber().equals(TaskBar.smallChatWindows.get(i).getFromContact().getPhoneNumber())){ try { TaskBar.smallChatWindows.get(i).receivedText(TaskBar.myTextArray.get(0)); } catch (BadLocationException e) { <START> e.printStackTrace(); <END> } TaskBar.myTextArray.remove(0); matchR = true; break; } } if(!matchR){ TaskBar.smallChatWindows.add(new SmallChat(TaskBar.myTextArray.get(0).getReceiver(), TaskBar.myTextArray.get(0).getSender())); try { TaskBar.smallChatWindows.get(TaskBar.smallChatWindows.size()-1).receivedText(TaskBar.myTextArray.get(0)); System.out.println("small chat window created!"); } catch (BadLocationException e) { e.printStackTrace(); } TaskBar.myTextArray.remove(0); } } } } } catch (InterruptedException e) { e.printStackTrace(); } }</code><technical_language>add some sort meaningful message instead of dumping stack trace system.out? throw in a quick description of caused this exception in addition printing stack trace</technical_language>

Target:
public void run(){ boolean matchR = false; try { synchronized(this){ while(true){ System.out.println("wait hit"); this.wait(); System.out.println("RESUMED"); if(!TaskBar.myTextArray.isEmpty()){ TaskBar.trayIcon.displayMessage("New Message", TaskBar.myTextArray.get(0).getSender().getFirstName() + " " + TaskBar.myTextArray.get(0).getSender().getLastName(), MessageType.INFO); matchR = false; for(int i=0; i < TaskBar.smallChatWindows.size(); i++){ if(TaskBar.myTextArray.get(0).getSender().getPhoneNumber().equals(TaskBar.smallChatWindows.get(i).getFromContact().getPhoneNumber())){ try { TaskBar.smallChatWindows.get(i).receivedText(TaskBar.myTextArray.get(0)); } catch (BadLocationException e) { e.printStackTrace(); System.out.println("Updating a small chat conversation -FAILED"); } TaskBar.myTextArray.remove(0); matchR = true; break; } } if(!matchR){ TaskBar.smallChatWindows.add(new SmallChat(TaskBar.myTextArray.get(0).getReceiver(), TaskBar.myTextArray.get(0).getSender())); try { TaskBar.smallChatWindows.get(TaskBar.smallChatWindows.size()-1).receivedText(TaskBar.myTextArray.get(0)); System.out.println("small chat window created!"); } catch (BadLocationException e) { e.printStackTrace(); System.out.println("Small chat window creation -FAILED"); } TaskBar.myTextArray.remove(0); } } } } } catch (InterruptedException e) { e.printStackTrace(); System.out.println("Synchronized method block -FAILED"); } }
Source:
<code>public byte[] getCacheKey() { return new CacheKeyBuilder(AggregatorUtil.ARRAY_OF_DOUBLES_SKETCH_CACHE_TYPE_ID).appendString(name) <START> .appendString(fieldName).appendInt(nominalEntries).appendStrings(metricColumns).appendInt(numberOfValues) <END> .build(); }</code><technical_language>Format single call a line</technical_language>

Target:
public byte[] getCacheKey() { final CacheKeyBuilder builder = new CacheKeyBuilder(AggregatorUtil.ARRAY_OF_DOUBLES_SKETCH_CACHE_TYPE_ID) .appendString(name) .appendString(fieldName) .appendInt(nominalEntries) .appendInt(numberOfValues); if (metricColumns != null) { builder.appendStrings(metricColumns); } return builder.build(); }
Source:
<code>private String[][] getAvailableMergeStrategies() { IConfigurationElement[] elements = Platform.getExtensionRegistry() .getConfigurationElementsFor( "org.eclipse.egit.core.modelMergeStrategy"); List<String[]> strategies = new ArrayList<>(); strategies.add(new String[] { UIText.GitPreferenceRoot_defaultMergeStrategyLabel, <START> MergeStrategy.RECURSIVE.getName() }); <END> for (IConfigurationElement element : elements) { try { Object ext = element.createExecutableExtension("class"); if (ext instanceof MergeStrategy) { strategies.add(new String[] { element.getAttribute("label"), ((MergeStrategy) ext).getName() }); } } catch (CoreException e) { Activator .logError( UIText.GitPreferenceRoot_modelMergeStrategyLoadError, e); } } return strategies.toArray(new String[strategies.size()][2]); }</code><technical_language>default hardcoded</technical_language>

Target:
private String[][] getAvailableMergeStrategies() { org.eclipse.egit.core.Activator coreActivator = org.eclipse.egit.core.Activator .getDefault(); List<String[]> strategies = new ArrayList<>(); strategies.add(new String[] { UIText.GitPreferenceRoot_defaultMergeStrategyLabel, "" }); for (MergeStrategyDescriptor strategy : coreActivator .getRegisteredMergeStrategies()) { strategies.add(new String[] { strategy.getLabel(), strategy.getName() }); } return strategies.toArray(new String[strategies.size()][2]); }
Source:
<code>public void writeExternal(ObjectOutput out) throws IOException { out.writeBoolean(isNull); if (isNull) { <START> if (precision >= 0 || scale >= 0) { <END> out.writeBoolean(!isNull); out.writeByte(precision); out.writeByte(scale); } else { out.writeBoolean(isNull); } return; } int scale; byte[] byteArray; if (value != null) { scale = value.scale(); if (scale < 0) { scale = 0; setValue(value.setScale(0)); } BigInteger bi = value.unscaledValue(); byteArray = bi.toByteArray(); } else { scale = rawScale; byteArray = rawData; } if (SanityManager.DEBUG) { if (scale < 0) SanityManager.THROWASSERT("DECIMAL scale at writeExternal is negative " + scale + " value " + toString()); } out.writeByte(scale); out.writeByte(byteArray.length); out.write(byteArray); }</code><technical_language>I write precision scale unconditionally here. Right for a NULL SQLDecimal precision set, 4 bytes (null flag, prec/scale flag, precision, scale), for a NULL SQLDecimal prec/scale 2 bytes (null flag, prec/scale flag). If write unconditionally 3 bytes always</technical_language>

Target:
public void writeExternal(ObjectOutput out) throws IOException { out.writeBoolean(isNull); if (isNull) { out.writeByte(precision); out.writeByte(scale); return; } int scale; byte[] byteArray; if (value != null) { scale = value.scale(); if (scale < 0) { scale = 0; setValue(value.setScale(0)); } BigInteger bi = value.unscaledValue(); byteArray = bi.toByteArray(); } else { scale = rawScale; byteArray = rawData; } if (SanityManager.DEBUG) { if (scale < 0) SanityManager.THROWASSERT("DECIMAL scale at writeExternal is negative " + scale + " value " + toString()); } out.writeByte(scale); out.writeByte(byteArray.length); out.write(byteArray); }
Source:
<code>private Configuration getConfiguration() throws Exception { System.out.println( "Starting " + getClass().getCanonicalName() + "#" + name.getMethodName() + "."); StateBackendEnum stateBackendEnum = getStateBackend(); if (ROCKSDB_INCREMENTAL_ZK.equals(stateBackendEnum)) { zkServer = new TestingServer(); zkServer.start(); } Configuration config = createClusterConfig(); switch (stateBackendEnum) { case MEM: this.stateBackend = new MemoryStateBackend(MAX_MEM_STATE_SIZE, false); break; case FILE: { String backups = tempFolder.newFolder().getAbsolutePath(); this.stateBackend = new FsStateBackend("file://" + backups, false); break; } case MEM_ASYNC: this.stateBackend = new MemoryStateBackend(MAX_MEM_STATE_SIZE, true); break; case FILE_ASYNC: { String backups = tempFolder.newFolder().getAbsolutePath(); this.stateBackend = new FsStateBackend("file://" + backups, true); break; } case ROCKSDB_FULLY_ASYNC: { setupRocksDB(config, -1, false); break; } case ROCKSDB_INCREMENTAL: config.setString( <START> RocksDBOptions.TIMER_SERVICE_FACTORY.key(), <END> RocksDBStateBackend.PriorityQueueStateType.ROCKSDB.toString()); setupRocksDB(config, 16, true); break; case ROCKSDB_INCREMENTAL_ZK: { setupRocksDB(config, 16, true); break; } default: throw new IllegalStateException("No backend selected."); } return config; }</code><technical_language>config.set(RocksDBOptions.TIMER_SERVICE_FACTORY, ...) work</technical_language>

Target:
private Configuration getConfiguration() throws Exception { System.out.println( "Starting " + getClass().getCanonicalName() + "#" + name.getMethodName() + "."); StateBackendEnum stateBackendEnum = getStateBackend(); if (ROCKSDB_INCREMENTAL_ZK.equals(stateBackendEnum)) { zkServer = new TestingServer(); zkServer.start(); } Configuration config = createClusterConfig(); switch (stateBackendEnum) { case MEM: this.stateBackend = new MemoryStateBackend(MAX_MEM_STATE_SIZE, false); break; case FILE: { String backups = tempFolder.newFolder().getAbsolutePath(); this.stateBackend = new FsStateBackend("file://" + backups, false); break; } case MEM_ASYNC: this.stateBackend = new MemoryStateBackend(MAX_MEM_STATE_SIZE, true); break; case FILE_ASYNC: { String backups = tempFolder.newFolder().getAbsolutePath(); this.stateBackend = new FsStateBackend("file://" + backups, true); break; } case ROCKSDB_FULLY_ASYNC: { setupRocksDB(config, -1, false); break; } case ROCKSDB_INCREMENTAL: config.set(RocksDBOptions.TIMER_SERVICE_FACTORY, RocksDBStateBackend.PriorityQueueStateType.ROCKSDB); setupRocksDB(config, 16, true); break; case ROCKSDB_INCREMENTAL_ZK: { setupRocksDB(config, 16, true); break; } default: throw new IllegalStateException("No backend selected."); } return config; }
Source:
<code>public void testCorrectUser() throws Exception { try (CLIWrapper cli = new CLIWrapper(true)) { StringBuilder configuration = new StringBuilder("throwException").append("=").append(false); cli.sendLine( String.format( "/subsystem=elytron/custom-credential-security-factory=%s:write-attribute(name=configuration, value={%s})", CUSTOM_CRED_SEC_FACTORY_NAME, configuration)); <START> cli.sendLine("reload"); <END> } CoreUtils.makeCallWithBasicAuthn(createSimpleManagementOperationUrl(), USER, CORRECT_PASSWORD, SC_OK); }</code><technical_language>ServerReload utility</technical_language>

Target:
public void testCorrectUser() throws Exception { try (CLIWrapper cli = new CLIWrapper(true)) { StringBuilder configuration = new StringBuilder("throwException").append("=").append(false); cli.sendLine(String.format( "/subsystem=elytron/custom-credential-security-factory=%s:write-attribute(name=configuration, value={%s})", CUSTOM_CRED_SEC_FACTORY_NAME, configuration)); ServerReload.executeReloadAndWaitForCompletion(CONTROLLER.getClient().getControllerClient()); } CoreUtils.makeCallWithBasicAuthn(createSimpleManagementOperationUrl(), USER, CORRECT_PASSWORD, SC_OK); }
Source:
<code>public void tearDown() throws Exception { workspaceServiceClient.delete(PROJECT_WS_NAME, defaultTestUser.getName()); workspaceServiceClient.delete(NO_PROJECT_WS_NAME, defaultTestUser.getName()); <START> List<String> listFactory = <END> Arrays.asList( FACTORY_NAME_EXIST, MINIMAL_TEMPLATE_FACTORY_NAME, COMPLETE_TEMPLATE_FACTORY_NAME, FACTORY_CREATED_FROM_WORKSPACE_NAME, FACTORY_CREATED_FROM_CONFIG, FACTORY_CREATED_FROM_GIT, FACTORY_CREATED_FROM_USER_JSON); for (String factory : listFactory) { factoryServiceClient.deleteFactory(factory); } }</code><technical_language>listFactory > factoryList</technical_language>

Target:
public void tearDown() throws Exception { workspaceServiceClient.delete(PROJECT_WS_NAME, defaultTestUser.getName()); workspaceServiceClient.delete(NO_PROJECT_WS_NAME, defaultTestUser.getName()); List<String> factoryList = Arrays.asList( FACTORY_NAME_EXIST, MINIMAL_TEMPLATE_FACTORY_NAME, COMPLETE_TEMPLATE_FACTORY_NAME, FACTORY_CREATED_FROM_WORKSPACE_NAME, FACTORY_CREATED_FROM_CONFIG_NAME, FACTORY_CREATED_FROM_GIT_NAME, FACTORY_CREATED_FROM_USER_JSON_NAME); for (String factory : factoryList) { factoryServiceClient.deleteFactory(factory); } }
Source:
<code>public void soundFor105IsPlingPlangPlong() { <START> assertEquals("PlingPlangPong", raindropConverter.convert(105)); <END> }</code><technical_language>here, a typo pong -> plong</technical_language>

Target:
public void soundFor105IsPlingPlangPlong() { assertEquals("PlingPlangPlong", raindropConverter.convert(105)); }
Source:
<code>public void testCallsiteAnalysis() { TmfXmlKernelTraceStub trace = fTrace; assertNotNull(trace); TmfCpuAspect cpuAspect = null; for (ITmfEventAspect<?> oaspect : trace.getEventAspects()) { if (oaspect instanceof TmfCpuAspect) { cpuAspect = (TmfCpuAspect) oaspect; } } <START> assertNotNull(cpuAspect); <END> CallsiteAnalysis module = TmfTraceUtils.getAnalysisModuleOfClass(trace, CallsiteAnalysis.class, CallsiteAnalysis.ID); assertNotNull(module); assertTrue(module.schedule().isOK()); assertTrue(module.waitForCompletion()); String uuid = String.valueOf(fTrace.getUUID()); String cpu = cpuAspect.getDeviceType(); List<@NonNull ITmfCallsite> cs = module.getCallsites(uuid, cpu, "0", 42); assertEquals(EXPECTED, cs); assertEquals(Collections.emptyList(), module.getCallsites("Hello", cpu, "0", 42)); assertEquals(Collections.emptyList(), module.getCallsites(uuid, cpu, "1", 42)); assertEquals(Collections.emptyList(), module.getCallsites(uuid, cpu, "0", 12)); assertEquals(EXPECTED, module.getCallsites(uuid, cpu, "0", 55)); assertEquals(Collections.emptyList(), module.getCallsites(uuid, cpu, "..", 42)); assertEquals(Collections.emptyList(), module.getCallsites(uuid, cpu, "..", 42)); }</code><technical_language>string literal for "cpu" below</technical_language>

Target:
public void testCallsiteAnalysis() { TmfXmlKernelTraceStub trace = fTrace; assertNotNull(trace); CallsiteAnalysis module = TmfTraceUtils.getAnalysisModuleOfClass(trace, CallsiteAnalysis.class, CallsiteAnalysis.ID); assertNotNull(module); assertTrue(module.schedule().isOK()); assertTrue(module.waitForCompletion()); String uuid = String.valueOf(fTrace.getUUID()); String cpu = "cpu"; List<@NonNull ITmfCallsite> cs = module.getCallsites(uuid, cpu, "0", 42); assertEquals(EXPECTED, cs); assertEquals(Collections.emptyList(), module.getCallsites("Hello", cpu, "0", 42)); assertEquals(Collections.emptyList(), module.getCallsites(uuid, cpu, "1", 42)); assertEquals(Collections.emptyList(), module.getCallsites(uuid, cpu, "0", 12)); assertEquals(EXPECTED, module.getCallsites(uuid, cpu, "0", 55)); assertEquals(Collections.emptyList(), module.getCallsites(uuid, cpu, "..", 42)); assertEquals(Collections.emptyList(), module.getCallsites(uuid, cpu, "..", 42)); }
Source:
<code>public String getName() { if (this == STRING) { return "String"; } else { return "List"; } <START> } <END></code><technical_language>give names part of enum constructor? Java STRING("String"), LIST("List"); private final String _name; private RemovedMatchesType(String name){ _name = name; } @Override public String getName(){ return _name;} logic, better. get added bonus of change _if_ _if-else_ a _switch_ if other types added</technical_language>

Target:
public String getName() { return _name; }
Source:
<code>public void progress() { if (this.firstTime) { if (this.bPlayer.isOnCooldown("JetBlaze") && !this.bPlayer.isAvatarState()) { this.remove(); return; } this.bPlayer.addCooldown("JetBlaze", this.cooldown); this.firstTime = false; } else if (System.currentTimeMillis() - this.time > this.duration) { this.remove(); return; } else if (hasAbility(this.player, FireJet.class)) { this.direction = this.player.getVelocity().clone().multiply(-1); final FireJet fj = getAbility(this.player, FireJet.class); fj.setSpeed(this.speed); fj.setDuration(this.duration); final FireComboStream fs = new FireComboStream(this.player, this, this.direction, this.player.getLocation(), 5, 1); fs.setDensity(8); fs.setSpread(1.0F); fs.setUseNewParticles(true); <START> fs.setCollisionRadius(2); <END> fs.setParticleEffect(ParticleEffect.SMOKE_LARGE); fs.setDamage(this.damage); fs.setFireTicks(this.fireTicks); fs.runTaskTimer(ProjectKorra.plugin, 0, 1L); this.tasks.add(fs); if (this.progressCounter % 4 == 0) { this.player.getWorld().playSound(this.player.getLocation(), Sound.ENTITY_CREEPER_PRIMED, 1, 0F); } } }</code><technical_language>this configurable</technical_language>

Target:
public void progress() { if (this.firstTime) { if (this.bPlayer.isOnCooldown("JetBlaze") && !this.bPlayer.isAvatarState()) { this.remove(); return; } this.firstTime = false; } else if (System.currentTimeMillis() - this.time > this.duration) { this.remove(); return; } else if (hasAbility(this.player, FireJet.class)) { this.direction = this.player.getVelocity().clone().multiply(-1); final FireJet fj = getAbility(this.player, FireJet.class); fj.setSpeed(this.speed); fj.setDuration(this.duration); final FireComboStream fs = new FireComboStream(this.player, this, this.direction, this.player.getLocation(), 5, 1); fs.setDensity(8); fs.setSpread(1.0F); fs.setUseNewParticles(true); fs.setCollisionRadius(2); fs.setParticleEffect(ParticleEffect.SMOKE_LARGE); fs.setDamage(this.damage); fs.setFireTicks(this.fireTicks); fs.runTaskTimer(ProjectKorra.plugin, 0, 1L); this.tasks.add(fs); if (this.progressCounter % 4 == 0) { this.player.getWorld().playSound(this.player.getLocation(), Sound.ENTITY_CREEPER_PRIMED, 1, 0F); } } }
Source:
<code>public Emitter getEmitter( Supplier<ParametrizedUriEmitterConfig> config, @Nullable SSLContext sslContext, Lifecycle lifecycle, ObjectMapper jsonMapper ) { final DefaultAsyncHttpClientConfig.Builder builder = new DefaultAsyncHttpClientConfig.Builder(); <START> if (sslContext != null) { <END> builder.setSslContext(new JdkSslContext(sslContext, true, ClientAuth.NONE)); } builder.setThreadFactory(new DefaultThreadFactory("parametrized-emitter-http-client", true)); final AsyncHttpClient client = new DefaultAsyncHttpClient(builder.build()); lifecycle.addCloseableInstance(client); return new ParametrizedUriEmitter(config.get(), client, jsonMapper); }</code><technical_language>this common logic shared in HttpEmitterModule ParametrizedUriEmitterModule</technical_language>

Target:
public Emitter getEmitter( Supplier<ParametrizedUriEmitterConfig> config, @Nullable SSLContext sslContext, Lifecycle lifecycle, ObjectMapper jsonMapper ) { return new ParametrizedUriEmitter( config.get(), lifecycle.addCloseableInstance( HttpEmitterModule.createAsyncHttpClient("ParmetrizedUriEmitter-AsyncHttpClient-%d", sslContext) ), jsonMapper ); }
Source:
<code>public static boolean delete(File file) { if (!file.exists()) return true; if (file.isDirectory()) { File[] children = file.listFiles(); for (File <START> children1 : <END> children) { delete(children1); } } return file.delete(); }</code><technical_language>child</technical_language>

Target:
public static boolean delete(File file) { if (!file.exists()) return true; if (file.isDirectory()) { File[] children = file.listFiles(); for (File child : children) { delete(child); } } return file.delete(); }
Source:
<code>private <T extends Trade> ValueWithFailures<List<T>> parseFile(CharSource charSource, Class<T> tradeType) { try (CsvIterator csv = CsvIterator.of(charSource, true)) { if (!csv.headers().contains(TYPE_FIELD)) { return ValueWithFailures.of(ImmutableList.of(), <START> FailureItem.of(FailureReason.PARSING, "CSV file does not contain '" + TYPE_FIELD + "' header: {}", charSource)); <END> } return parseFile(csv, tradeType); } catch (RuntimeException ex) { return ValueWithFailures.of(ImmutableList.of(), FailureItem.of(FailureReason.PARSING, ex, "CSV file could not be parsed: {}", charSource)); } }</code><technical_language>this be: FailureItem.of(FailureReason.PARSING, "CSV file '{}' header: {}", TYPE_FIELD, charSource));</technical_language>

Target:
private <T extends Trade> ValueWithFailures<List<T>> parseFile(CharSource charSource, Class<T> tradeType) { try (CsvIterator csv = CsvIterator.of(charSource, true)) { if (!csv.headers().contains(TYPE_FIELD)) { return ValueWithFailures.of(ImmutableList.of(), FailureItem.of(FailureReason.PARSING, "CSV file does not contain '{}' header: {}", TYPE_FIELD, charSource)); } return parseFile(csv, tradeType); } catch (RuntimeException ex) { return ValueWithFailures.of(ImmutableList.of(), FailureItem.of(FailureReason.PARSING, ex, "CSV file could not be parsed: {}", charSource)); } }
Source:
<code>public void testReadJdbcDriver() throws Exception { String h2DriverName = "h2backup"; final ModelNode addrAddH2DriverAddr = new ModelNode(); addrAddH2DriverAddr.add("subsystem", "datasources").add("jdbc-driver", h2DriverName); final ModelNode addH2DriverOp = new ModelNode(); addH2DriverOp.get(OP).set("add"); addH2DriverOp.get(OP_ADDR).set(addrAddH2DriverAddr); addH2DriverOp.get("driver-name").set(h2DriverName); addH2DriverOp.get("driver-module-name").set("com.h2database.h2"); executeOperation(addH2DriverOp); try { final ModelNode address = new ModelNode(); address.add("subsystem", "datasources"); address.protect(); final ModelNode operation = new ModelNode(); operation.get(OP).set("get-installed-driver"); operation.get(OP_ADDR).set(address); operation.get("driver-name").set(h2DriverName); final ModelNode result = executeOperation(operation).get(0); Assert.assertEquals(h2DriverName, result.get("driver-name").asString()); Assert.assertEquals("com.h2database.h2", result.get("driver-module-name").asString()); } finally { <START> remove(addrAddH2DriverAddr); <END> } }</code><technical_language>@gaol test 'driver-xa-datasource-class-name' equals "" well</technical_language>

Target:
public void testReadJdbcDriver() throws Exception { String h2DriverName = "h2backup"; final ModelNode addrAddH2DriverAddr = new ModelNode(); addrAddH2DriverAddr.add("subsystem", "datasources").add("jdbc-driver", h2DriverName); final ModelNode addH2DriverOp = new ModelNode(); addH2DriverOp.get(OP).set("add"); addH2DriverOp.get(OP_ADDR).set(addrAddH2DriverAddr); addH2DriverOp.get("driver-name").set(h2DriverName); addH2DriverOp.get("driver-module-name").set("com.h2database.h2"); executeOperation(addH2DriverOp); try { final ModelNode address = new ModelNode(); address.add("subsystem", "datasources"); address.protect(); final ModelNode operation = new ModelNode(); operation.get(OP).set("get-installed-driver"); operation.get(OP_ADDR).set(address); operation.get("driver-name").set(h2DriverName); final ModelNode result = executeOperation(operation).get(0); Assert.assertEquals(h2DriverName, result.get("driver-name").asString()); Assert.assertEquals("com.h2database.h2", result.get("driver-module-name").asString()); Assert.assertEquals("", result.get("driver-xa-datasource-class-name").asString()); } finally { remove(addrAddH2DriverAddr); } }
Source:
<code>public void testStarStarredTool() throws ApiException, IOException, TimeoutException { ApiClient client = getWebClient(); ContainersApi containersApi = new ContainersApi(client); DockstoreTool container = containersApi.getContainerByToolPath("quay.io/test_org/test2"); long containerId = container.getId(); assertEquals(2, containerId); StarRequest request = SwaggerUtility.createStarRequest(true); containersApi.starEntry(containerId, request); List<User> starredUsers = containersApi.getStarredUsers(container.getId()); Assert.assertEquals(1, starredUsers.size()); <START> starredUsers.forEach(user -> Assert.assertNull("User profile is not lazy loaded in starred users", user.getUserProfile())); <END> containersApi.starEntry(containerId, request); }</code><technical_language>question: is user profile is lazy loaded for starring requests, avatars displayed properly for stargazers page</technical_language>

Target:
public void testStarStarredTool() throws ApiException, IOException, TimeoutException { ApiClient client = getWebClient(); ContainersApi containersApi = new ContainersApi(client); DockstoreTool container = containersApi.getContainerByToolPath("quay.io/test_org/test2"); Assert.assertTrue("There should be at least one user of the workflow", container.getUsers().size() > 0); Assert.assertNotNull("Upon checkUser(), a container with lazy loaded users should still get users", container.getUsers()); long containerId = container.getId(); assertEquals(2, containerId); StarRequest request = SwaggerUtility.createStarRequest(true); containersApi.starEntry(containerId, request); List<User> starredUsers = containersApi.getStarredUsers(container.getId()); Assert.assertEquals(1, starredUsers.size()); starredUsers.forEach(user -> Assert.assertNull("User profile is not lazy loaded in starred users", user.getUserProfiles())); containersApi.starEntry(containerId, request); }
Source:
<code>private void assertRoutesAdded(int netId, RouteInfo... routes) throws Exception { for (int i = 0; i < routes.length; i++) { <START> verify(mNetworkManagementService).addRoute(eq(netId), eq(routes[i])); <END> } }</code><technical_language>This verify order of addRoute, pass l.5962. IIUC want verify order wrong order command failed. If so, do want verify InOrder</technical_language>

Target:
private void assertRoutesAdded(int netId, RouteInfo... routes) throws Exception { InOrder inOrder = inOrder(mNetworkManagementService); for (int i = 0; i < routes.length; i++) { inOrder.verify(mNetworkManagementService).addRoute(eq(netId), eq(routes[i])); } }
Source:
<code>protected void doHealthCheck(Health.Builder builder) throws Exception { Collection<Node> nodes = this.session.getMetadata().getNodes().values(); boolean atLeastOneUp = nodes.stream().map(Node::getState).anyMatch((state) -> state == NodeState.UP); if (atLeastOneUp) { builder.up(); } else { builder.down(); } nodes.stream().map(Node::getCassandraVersion).filter(Objects::nonNull).findFirst() <START> .ifPresent((version) -> builder.withDetail("version", version)); <END> }</code><technical_language>reasons for a node report a version? I map operation return node information provided node</technical_language>

Target:
protected void doHealthCheck(Health.Builder builder) throws Exception { Collection<Node> nodes = this.session.getMetadata().getNodes().values(); Optional<Node> nodeUp = nodes.stream().filter((node) -> node.getState() == NodeState.UP).findAny(); builder.status(nodeUp.isPresent() ? Status.UP : Status.DOWN); nodeUp.map(Node::getCassandraVersion).ifPresent((version) -> builder.withDetail("version", version)); }
Source:
<code>public void editFilenameTest() { when(binaryObj.getFilename()).thenReturn("Old file name"); String label = "a brand-new title!"; service.editLabel(agent, pid, label); <START> verify(repoObjFactory).createExclusiveRelationship(eq(binaryObj), eq(Ebucore.filename), any(Resource.class)); <END> verify(repoObjFactory).createExclusiveRelationship(eq(binaryObj), eq(Ebucore.filename), labelCaptor.capture()); verify(premisLogger).buildEvent(eq(Premis.FilenameChange)); verify(eventBuilder).addEventDetail(labelCaptor.capture()); assertEquals(labelCaptor.getValue(), "Object renamed from Old file name to " + label); verify(eventBuilder).writeAndClose(); verify(messageSender).sendUpdateDescriptionOperation(anyString(), pidCaptor.capture()); assertEquals(pid, pidCaptor.getValue().get(0)); }</code><technical_language>need verify this method called in a row, able get rid of this line. I verify is overwritten line 156 verify it. verify(repoObjFactory).createExclusiveRelationship(eq(binaryObj), eq(Ebucore.filename), eq(label)) ? If work, need another assertEquals for label right this capture. want changes in other test</technical_language>

Target:
public void editFilenameTest() { when(binaryObj.getFilename()).thenReturn("Old file name"); String label = "a brand-new title!"; service.editLabel(agent, pid, label); verify(repoObjFactory).createExclusiveRelationship(eq(binaryObj), eq(Ebucore.filename), eq(label)); verify(premisLogger).buildEvent(eq(Premis.FilenameChange)); verify(eventBuilder).addEventDetail(labelCaptor.capture()); assertEquals(labelCaptor.getValue(), "Object renamed from Old file name to " + label); verify(eventBuilder).writeAndClose(); verify(messageSender).sendUpdateDescriptionOperation(anyString(), pidCaptor.capture()); assertEquals(pid, pidCaptor.getValue().get(0)); }
Source:
<code>protected void channelRead0(ChannelHandlerContext ctx, FullHttpRequest msg) { ByteBuf dup = msg.content().retainedDuplicate(); try { requestResponseChannel.sendRequest(new NettyServerRequest(ctx, dup)); } catch (InterruptedException e) { http2ServerMetrics.requestResponseChannelErrorCount.inc(); <START> logger.warn("Can't send NettyServerRequest to requestResponseChannel. Cause: ", e); <END> } }</code><technical_language>release dup if exception occurs</technical_language>

Target:
protected void channelRead0(ChannelHandlerContext ctx, FullHttpRequest msg) { ByteBuf dup = msg.content().retainedDuplicate(); try { requestResponseChannel.sendRequest(new NettyServerRequest(ctx, dup)); } catch (InterruptedException e) { dup.release(); http2ServerMetrics.requestResponseChannelErrorCount.inc(); logger.warn("Can't send NettyServerRequest to requestResponseChannel. Cause: ", e); } }
Source:
<code>static NBTTagCompound write(final Cube cube) { NBTTagCompound cubeNbt = new NBTTagCompound(); NBTTagCompound level = new NBTTagCompound(); cubeNbt.setTag("Level", level); cubeNbt.setInteger("DataVersion", MINECRAFT_CHUNK_DATA_VERSION); FMLCommonHandler.instance().getDataFixer().writeVersionData(cubeNbt); writeBaseCube(cube, level); <START> writeBlocks(cube, level); <END> writeEntities(cube, level); writeTileEntities(cube, level); writeScheduledTicks(cube, level); writeLightingInfo(cube, level); return cubeNbt; }</code><technical_language>compatible, cube data needs in array, pretend a Cube is a chunk section</technical_language>

Target:
static NBTTagCompound write(final Cube cube) { NBTTagCompound cubeNbt = new NBTTagCompound(); NBTTagCompound level = new NBTTagCompound(); cubeNbt.setTag("Level", level); cubeNbt.setInteger("DataVersion", FMLCommonHandler.instance().getDataFixer().version); FMLCommonHandler.instance().getDataFixer().writeVersionData(cubeNbt); writeBaseCube(cube, level); writeBlocks(cube, level); writeEntities(cube, level); writeTileEntities(cube, level); writeScheduledTicks(cube, level); writeLightingInfo(cube, level); return cubeNbt; }
Source:
<code>private static Version getApplicationVersion(final String part, final String appName) { try { return new RpmVersion(part, getAppName(part, appName), true); } catch (Exception e) { <START> log.debug("Failed to create rpm version object, part '{}' appName '{}', error: {}", <END> part, appName, e.getMessage()); log.debug("Exception", e); return null; } }</code><technical_language>s/, error//</technical_language>

Target:
private static Version getApplicationVersion(final String part, final String appName) { try { return new RpmVersion(part, getAppName(part, appName), true); } catch (Exception e) { log.debug("Failed to create rpm version object, part '{}' appName '{}': {}", part, appName, e.getMessage()); log.debug("Exception", e); return null; } }
Source:
<code>public MainTabVirtualMachinePresenter(EventBus eventBus, ViewDef view, ProxyDef proxy, PlaceManager placeManager, MainModelProvider<VM, VmListModel> modelProvider, ConsoleManager consoleManager, ConsoleUtils consoleUtils, ErrorPopupManager errorPopupManager) { super(eventBus, view, proxy, placeManager, modelProvider); this.consoleManager = consoleManager; this.errorPopupManager = errorPopupManager; <START> getModel().getConsoleConnectEvent().addListener(new IEventListener() { <END> @Override public void eventRaised(Event ev, Object sender, EventArgs args) { String errorMessage = MainTabVirtualMachinePresenter.this.consoleManager.connectToConsole(getModel()); if (errorMessage != null) { MainTabVirtualMachinePresenter.this.errorPopupManager.show(errorMessage); } } }); }</code><technical_language>careful - this work logout-login cycle models re-created presenters singletons, this presenter listen model. need listen UiCommonInitEvent do in it. for example SubTabVirtualMachineGeneralPresenter</technical_language>

Target:
public MainTabVirtualMachinePresenter(EventBus eventBus, ViewDef view, ProxyDef proxy, PlaceManager placeManager, MainModelProvider<VM, VmListModel> modelProvider, ConsoleManager consoleManager, ConsoleUtils consoleUtils, ErrorPopupManager errorPopupManager) { super(eventBus, view, proxy, placeManager, modelProvider); this.consoleManager = consoleManager; this.errorPopupManager = errorPopupManager; }
Source:
<code>public static String getResourceName(int category) { <START> return CATEGORY_NAMES[category - 1]; <END> }</code><technical_language>a check getName in getResourceName. Why</technical_language>

Target:
public static String getResourceName(int category) { return (category > 0 && category < CATEGORY_NAMES_ID.length + 1) ? CATEGORY_NAMES[category - 1] : null; }
Source:
<code>public ResponseEntity<?> delete(@PathVariable("id") Long id, HttpServletRequest request, HttpServletResponse response, UriComponentsBuilder uriBuilder) throws IOException { Study study = studyService.get(id); if (study == null) { <START> return new ResponseEntity<>(HttpStatus.NOT_FOUND); <END> } studyService.delete(study); return new ResponseEntity<>(HttpStatus.OK); }</code><technical_language>throw RestException Status.NOT_FOUND instead</technical_language>

Target:
public void delete(@PathVariable("id") Long id, HttpServletRequest request, HttpServletResponse response, UriComponentsBuilder uriBuilder) throws IOException { Study study = studyService.get(id); if (study == null) { throw new RestException("Study not found.", Status.NOT_FOUND); } studyService.delete(study); }
Source:
<code>public FilterResource getSubResource(String id) { <START> return inject(new BackendFilterResource(id, getPolicyUnit(id))); <END> }</code><technical_language>do fetch object here, provide BackendFilterResource, fetching object in context else in API; i.e, in get() method of BackendFilterResource</technical_language>

Target:
public FilterResource getSubResource(String id) { return inject(new BackendFilterResource(id)); }
Source:
<code>public void validate(KubernetesEnvironment env) throws ValidationException { <START> checkArgument(!env.getPodsData().isEmpty(), "Environment should contain at least 1 pod"); <END> Set<String> missingMachines = new HashSet<>(env.getMachines().keySet()); for (PodData pod : env.getPodsData().values()) { if (pod.getSpec() != null && pod.getSpec().getContainers() != null) { for (Container container : pod.getSpec().getContainers()) { missingMachines.remove(Names.machineName(pod, container)); } } } checkArgument( missingMachines.isEmpty(), "Environment contains machines that are missing in recipe: %s", Joiner.on(", ").join(missingMachines)); }</code><technical_language>suggestion checkArgument(!env.getPodsData().isEmpty(), "Environment 1 pod deployment");</technical_language>

Target:
public void validate(KubernetesEnvironment env) throws ValidationException { checkArgument( !env.getPodsData().isEmpty(), "Environment should contain at least 1 pod or deployment"); Set<String> missingMachines = new HashSet<>(env.getMachines().keySet()); for (PodData pod : env.getPodsData().values()) { if (pod.getSpec() != null && pod.getSpec().getContainers() != null) { for (Container container : pod.getSpec().getContainers()) { missingMachines.remove(Names.machineName(pod, container)); } } } checkArgument( missingMachines.isEmpty(), "Environment contains machines that are missing in recipe: %s", Joiner.on(", ").join(missingMachines)); }
Source:
<code>public void initialize(Scene schemaObject) { for (SceneElement se : schemaObject.getChildren()) { addActor(se); } <START> sceneElementTags.clear(); <END> addChildrenTagsTo(this); }</code><technical_language>is this needed</technical_language>

Target:
public void initialize(Scene schemaObject) { for (SceneElement se : schemaObject.getChildren()) { addActor(se); } }
Source:
<code>public void create(final EventTypeBase eventType) throws TopicCreationException, InternalNakadiException, NoSuchPartitionStrategyException, DuplicatedEventTypeNameException, InvalidEventTypeException { setDefaultEventTypeOptions(eventType); validateSchema(eventType); enrichment.validate(eventType); partitionResolver.validate(eventType); authorizationValidator.validateAuthorization(eventType.getAuthorization()); eventTypeRepository.saveEventType(eventType); try { timelineService.createDefaultTimeline(eventType.getName(), partitionsCalculator.getBestPartitionsCount(eventType.getDefaultStatistic()), eventType.getOptions().getRetentionTime()); } catch (final Exception e) { try { eventTypeRepository.removeEventType(eventType.getName()); } catch (final NoSuchEventTypeException e1) { LOG.error("Error creating event type {}", eventType, e1); } throw e; } try { nakadiKpiPublisher.publish(etLogEventType, () -> new JSONObject() .put("event_type", eventType.getName()) .put("status", "created") .put("category", eventType.getCategory().toString())); <START> } catch (final Exception e) { <END> LOG.error("Exception occurred when submitting KPI metrics event", e); } }</code><technical_language>throws exceptions, wrap in catch</technical_language>

Target:
public void create(final EventTypeBase eventType) throws TopicCreationException, InternalNakadiException, NoSuchPartitionStrategyException, DuplicatedEventTypeNameException, InvalidEventTypeException { setDefaultEventTypeOptions(eventType); validateSchema(eventType); enrichment.validate(eventType); partitionResolver.validate(eventType); authorizationValidator.validateAuthorization(eventType.getAuthorization()); eventTypeRepository.saveEventType(eventType); try { timelineService.createDefaultTimeline(eventType.getName(), partitionsCalculator.getBestPartitionsCount(eventType.getDefaultStatistic()), eventType.getOptions().getRetentionTime()); } catch (final Exception e) { try { eventTypeRepository.removeEventType(eventType.getName()); } catch (final NoSuchEventTypeException e1) { LOG.error("Error creating event type {}", eventType, e1); } throw e; } nakadiKpiPublisher.publish(etLogEventType, () -> new JSONObject() .put("event_type", eventType.getName()) .put("status", "created") .put("category", eventType.getCategory())); }
Source:
<code>private boolean isBufferFilled() { int available = fileBuffer.size(); <START> return available > 0 && available >= Math.min(MIN_BYTES_READ_IN, this.fileBytesLeft); <END> }</code><technical_language>surround return in parenthesis</technical_language>

Target:
private boolean isBufferFilled() { int available = fileBuffer.size(); return available > 0 && available >= MIN_BYTES_READ_IN; }
Source:
<code>private ObjectId locateBlobObjectId() throws CoreException { try { final GitIndex idx = db.getIndex(); final Entry e = idx.getEntry(path); if (e == null) throw new CoreException(new Status(IStatus.ERROR, path, <START> CoreText.IndexFileRevision_indexEntryNotFound, null)); <END> return e.getObjectId(); } catch (IOException e) { throw new CoreException(new Status(IStatus.ERROR, path, CoreText.IndexFileRevision_errorLookingUpPath, e)); } }</code><technical_language>parameter of Status is pluginId. pass path here</technical_language>

Target:
private ObjectId locateBlobObjectId() throws CoreException { try { final GitIndex idx = db.getIndex(); final Entry e = idx.getEntry(path); if (e == null) throw new CoreException(Activator.error(NLS.bind( CoreText.IndexFileRevision_indexEntryNotFound, path), null)); return e.getObjectId(); } catch (IOException e) { throw new CoreException(Activator.error(NLS.bind( CoreText.IndexFileRevision_errorLookingUpPath, path), e)); } }
Source:
<code>private String getProcessName(String tid) { String execName = fProcessNameMap.get(tid); if (execName != null) { return execName; } ITmfTrace trace = checkNotNull(getTrace()); ITmfStateSystem kernelSs = checkNotNull(TmfStateSystemAnalysisModule.getStateSystem(trace, KernelAnalysisModule.ID)); try { int cpusNode = kernelSs.getQuarkAbsolute(Attributes.THREADS); List<Integer> cpuNodes = kernelSs.getSubAttributes(cpusNode, false); execName = getCurrentIntervalStateValue(tid, kernelSs, cpuNodes); if(!execName.equals("nonExecName")) { return execName; } } catch (AttributeNotFoundException e) { } <START> return tid; <END> }</code><technical_language>patchset 6</technical_language>

Target:
private String getProcessName(String tid) { String execName = fProcessNameMap.get(tid); if (execName != null) { return execName; } ITmfTrace trace = checkNotNull(getTrace()); ITmfStateSystem kernelSs = checkNotNull(TmfStateSystemAnalysisModule.getStateSystem(trace, KernelAnalysisModule.ID)); try { int cpusNode = kernelSs.getQuarkAbsolute(Attributes.THREADS); List<Integer> cpuNodes = kernelSs.getSubAttributes(cpusNode, false); execName = getCurrentIntervalStateValue(tid, kernelSs, cpuNodes); if(execName != null) { return execName; } } catch (AttributeNotFoundException e) { } return tid; }
Source:
<code>public V get(Object o) { K key = (K)o; long storeBucket = bucket; if (cache.getRemovedKeys().contains(key)) { return null; } V val = cache.get(key); if (val != null) { return val; } <START> if (timeExtractor != null) { <END> storeBucket = timeExtractor.getTime(key); } Slice valSlice = store.getSync(storeBucket, keyValueSerdeManager.serializeDataKey(key, false)); if (valSlice == null || valSlice == BucketedState.EXPIRED || valSlice.length == 0) { return null; } tmpInput.setBuffer(valSlice.buffer, valSlice.offset, valSlice.length); return keyValueSerdeManager.deserializeValue(tmpInput); }</code><technical_language>put this in a method? java private long getBucket(K key) { return timeExtractor != null ? timeExtractor.getTime(key) : bucket; } I this pattern in multiple other places I suggesting making this a method</technical_language>

Target:
public V get(Object o) { K key = (K)o; if (cache.getRemovedKeys().contains(key)) { return null; } V val = cache.get(key); if (val != null) { return val; } Slice valSlice = store.getSync(getBucket(key), keyValueSerdeManager.serializeDataKey(key, false)); if (valSlice == null || valSlice == BucketedState.EXPIRED || valSlice.length == 0) { return null; } tmpInput.setBuffer(valSlice.buffer, valSlice.offset, valSlice.length); return keyValueSerdeManager.deserializeValue(tmpInput); }
Source:
<code>File getFile() { if(temp == null) { try { <START> temp = File.createTempFile("jquery_preview", ".html"); <END> url = temp.toURI().toURL().toString(); } catch (IOException e) { e.printStackTrace(); } } return temp; }</code><technical_language>This function is called updatepreviewcontent - meaning create a new temporary file edit/change - this file put in a queue for deletion jvm. Do need create a new tempfile in _every_ preview ? reuse file dialog delete dialog closes</technical_language>

Target:
File getFile() { if(sourceFile == null) { try { sourceFile = File.createTempFile("jquery_preview", ".html"); sourceURL = sourceFile.toURI().toURL().toString(); } catch (IOException e) { WebUiPlugin.getDefault().logError(e); } } return sourceFile; }