auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void onClick(View v) { switch (v.getId()) { case R.id.facebookButton: v.startAnimation(buttonClick); <START> startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("<LINK_1>"))); <END> break; case R.id.websiteButton: v.startAnimation(buttonClick); startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("<LINK_0>"))); break; case R.id.twitterButton: v.startAnimation(buttonClick); startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("<LINK_2>"))); break; case R.id.youtubeButton: v.startAnimation(buttonClick); startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("<LINK_3>"))); break; default: break; } }</code><technical_language>@tbagz104 i guess links a string resource refer strings.xml file. please remove extra spacing present in this file</technical_language>

Target:
public void onClick(View v) { switch (v.getId()) { case R.id.facebookButton: v.startAnimation(buttonClick); startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(getString(R.string.facebook_url)))); break; case R.id.websiteButton: v.startAnimation(buttonClick); startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(getString(R.string.website_url)))); break; case R.id.twitterButton: v.startAnimation(buttonClick); startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(getString(R.string.twitter_url)))); break; case R.id.youtubeButton: v.startAnimation(buttonClick); startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(getString(R.string.youtube_url)))); break; default: break; } }
Source:
<code>public String render(ArrayList<ValueLabel<V>> widgets) { <START> StringBuilder formattedStr = new StringBuilder(""); END> for (int i = 0; i < widgets.size(); i++) { formattedStr.append(widgets.get(i).getElement().getInnerHTML()).append(" ").append(delimiters[i]); if (i < widgets.size() - 1) { formattedStr.append(", "); } } return formattedStr.toString(); }</code><technical_language>empty string is redundent</technical_language>

Target:
public String render(ArrayList<ValueLabel<V>> widgets) { StringBuilder formattedStr = new StringBuilder(); for (int i = 0; i < widgets.size(); i++) { formattedStr.append(widgets.get(i).getElement().getInnerHTML()).append(" ").append(delimiters[i]); if (i < widgets.size() - 1) { formattedStr.append(", "); } } return formattedStr.toString(); }
Source:
<code>public void addTest(Class<?> testClass) { <START> System.out.println("Adding class without a run: " + testClass.getName()); <END> allTestClasses.add(testClass); }</code><technical_language>logger</technical_language>

Target:
public void addTest(Class<?> testClass) { allTestClasses.add(testClass); }
Source:
<code>static boolean shouldServiceVersionBeTested(CertificateServiceVersion serviceVersion) { if (Configuration.getGlobalConfiguration().get(AZURE_TEST_SERVICE_VERSIONS) == null) { return CertificateServiceVersion.getLatest().equals(serviceVersion); } <START> return true; <END> }</code><technical_language>This check environment variable returning true</technical_language>

Target:
private static boolean shouldServiceVersionBeTested(CertificateServiceVersion serviceVersion) { if (CoreUtils.isNullOrEmpty(SERVICE_VERSION_FROM_ENV)) { return CertificateServiceVersion.getLatest().equals(serviceVersion); } if (AZURE_TEST_SERVICE_VERSIONS_VALUE_ALL.equalsIgnoreCase(SERVICE_VERSION_FROM_ENV)) { return true; } String[] configuredServiceVersionList = SERVICE_VERSION_FROM_ENV.split(","); return Arrays.stream(configuredServiceVersionList).anyMatch(configuredServiceVersion -> serviceVersion.toString().equals(configuredServiceVersion.trim())); }
Source:
<code>public IBlockState getBlockState(BlockPos pos) { if (((IMixinBlockPos) pos).isInvalidYPosition()) { return Blocks.AIR.getDefaultState(); } else { net.minecraft.world.chunk.Chunk chunk; <START> if (!this.activeConfig.getConfig().getWorld().getDenyTEChunkRequests()) { <END> final boolean forceChunkRequests = this.mixinChunkProviderServer.getForceChunkRequests(); final PhaseTracker phaseTracker = PhaseTracker.getInstance(); final IPhaseState<?> currentState = phaseTracker.getCurrentState(); if (currentState == TickPhase.Tick.TILE_ENTITY) { ((IMixinChunkProviderServer) this.getChunkProvider()).setForceChunkRequests(true); } chunk = this.getChunkFromBlockCoords(pos); this.mixinChunkProviderServer.setForceChunkRequests(forceChunkRequests); } else { chunk = this.getChunkFromBlockCoords(pos); } return chunk.getBlockState(pos); } }</code><technical_language>mentioned before, want check TileEntityType instead of a global flag. Global flags moved for configs for this</technical_language>

Target:
public IBlockState getBlockState(BlockPos pos) { if (((IMixinBlockPos) pos).isInvalidYPosition()) { return Blocks.AIR.getDefaultState(); } else { final boolean forceChunkRequests = ((IMixinChunkProviderServer) this.getChunkProvider()).getForceChunkRequests(); final PhaseTracker phaseTracker = PhaseTracker.getInstance(); final IPhaseState<?> currentState = phaseTracker.getCurrentState(); if (currentState == TickPhase.Tick.TILE_ENTITY) { ((IMixinChunkProviderServer) this.getChunkProvider()).setForceChunkRequests(true); } net.minecraft.world.chunk.Chunk chunk = this.getChunk(pos); ((IMixinChunkProviderServer) this.getChunkProvider()).setForceChunkRequests(forceChunkRequests); return chunk.getBlockState(pos); } }
Source:
<code>void givenBeanAnnotatedMethod_whenBindingProperties_thenAllFieldsAreSet() { <START> <END> assertEquals("192.168.0.2", configFactory.getDefaultConfigs().getAddress().getIp()); Map<String, String> expectedResourcesPath = new HashMap<>(); expectedResourcesPath.put("imgs", "/root/def/imgs"); assertEquals(expectedResourcesPath, configFactory.getDefaultConfigs().getResourcesPath()); }</code><technical_language>remove empty lines start of test method</technical_language>

Target:
void givenBeanAnnotatedMethod_whenBindingProperties_thenAllFieldsAreSet() { assertEquals("192.168.0.2", serverConfig.getAddress() .getIp()); Map<String, String> expectedResourcesPath = new HashMap<>(); expectedResourcesPath.put("imgs", "/root/def/imgs"); assertEquals(expectedResourcesPath, serverConfig.getResourcesPath()); }
Source:
<code>public EObject updateCreatedObject(EObject newObject, String loadedVersion) { if (Version.parseVersion(loadedVersion).compareTo(MIGRATION_VERSION) < 0 && newObject instanceof EdgeStyleDescription) { <START> if (newObject instanceof EdgeStyleDescription) { <END> ((EdgeStyleDescription) newObject).setSizeComputationExpression(NEW_SIZE_COMPUTATION_EXPRESSION); } } return newObject; }</code><technical_language>"instanceof EdgeStyleDescription" tested</technical_language>

Target:
public EObject updateCreatedObject(EObject newObject, String loadedVersion) { if (Version.parseVersion(loadedVersion).compareTo(MIGRATION_VERSION) < 0 && newObject instanceof EdgeStyleDescription) { ((EdgeStyleDescription) newObject).setSizeComputationExpression(OLD_SIZE_COMPUTATION_EXPRESSION_DEFAULT_VALUE); } return newObject; }
Source:
<code>public Collection<PhysicalAddress> fetchClusterMembers(String clusterName) { if (pingDao == null) { log.info("No PingDao set, returning empty set for current cluster members"); return Collections.emptyList(); } getAndSavePhysicalAddress(clusterName); final Map<Address, PhysicalAddress> existing_mbrs = pingDao.getAddresses(clusterName); <START> <END> return existing_mbrs.values(); }</code><technical_language>I agree change. I want list of existing members yourself. want send messages yourself</technical_language>

Target:
public Collection<PhysicalAddress> fetchClusterMembers(String clusterName) { if (pingDao == null) { log.info("No PingDao set, returning empty set for current cluster members"); return Collections.emptyList(); } final Map<Address, PhysicalAddress> existing_mbrs = pingDao.getAddresses(clusterName); getAndSavePhysicalAddress(clusterName); return existing_mbrs.values(); }
Source:
<code>NativeSchemaIndexPopulator<SpatialSchemaKey,NativeSchemaValue> createPopulator( IndexSamplingConfig samplingConfig ) { <START> fileLayout = new SpatialIndexFiles.SpatialFileLayout( CoordinateReferenceSystem.WGS84, settings, super.getIndexFile() ); <END> return new SpatialIndexPopulator.PartPopulator( pageCache, fs, fileLayout, monitor, schemaIndexDescriptor, indexId, samplingConfig, new StandardConfiguration() ); }</code><technical_language>final variable crs instead of CoordinateReferenceSystem.WGS84</technical_language>

Target:
NativeSchemaIndexPopulator<SpatialSchemaKey,NativeSchemaValue> createPopulator( IndexSamplingConfig samplingConfig ) { fileLayout = new SpatialIndexFiles.SpatialFileLayout( crs, settings, super.getIndexFile() ); return new SpatialIndexPopulator.PartPopulator( pageCache, fs, fileLayout, monitor, schemaIndexDescriptor, indexId, samplingConfig, new StandardConfiguration() ); }
Source:
<code><START> default void checkSqliteAndFileDataDirectoriesAreNotPossiblyShared() { <END> sqlitePersistence().ifPresent(sqlite -> { try { Preconditions.checkArgument(!sqlite.dataDirectory().equals(dataDirectory()), "SQLite and file-based data directories must be different!"); Preconditions.checkArgument(!sqlite.dataDirectory().getCanonicalPath().startsWith( dataDirectory().getCanonicalPath() + File.separator), "SQLite data directory can't be a subdirectory of the file-based data directory!" ); Preconditions.checkArgument(!dataDirectory().getCanonicalPath().startsWith( sqlite.dataDirectory().getCanonicalPath() + File.separator), "File-based data directory can't be a subdirectory of the SQLite data directory!" ); } catch (IOException e) { throw new RuntimeException(e); } }); }</code><technical_language>This is tedious, necessary</technical_language>

Target:
default void checkSqliteAndFileDataDirectoriesAreNotPossiblyShared() { try { Preconditions.checkArgument(!sqlitePersistence().dataDirectory().equals(dataDirectory()), "SQLite and file-based data directories must be different!"); Preconditions.checkArgument(!sqlitePersistence().dataDirectory().getCanonicalPath().startsWith( dataDirectory().getCanonicalPath() + File.separator), "SQLite data directory can't be a subdirectory of the file-based data directory!" ); Preconditions.checkArgument(!dataDirectory().getCanonicalPath().startsWith( sqlitePersistence().dataDirectory().getCanonicalPath() + File.separator), "File-based data directory can't be a subdirectory of the SQLite data directory!" ); } catch (IOException e) { throw new RuntimeException(e); } }
Source:
<code>public Collection<TimerJobInstance> getTimerJobInstances(long id) { Collection<TimerJobInstance> timers = new ArrayList<TimerJobInstance>(); List<GlobalJobHandle> jobs = timerJobsPerSession.get(id); { if (jobs != null) { for (GlobalJobHandle job : jobs) { JobContext jobContext = job.getTimerJobInstance().getJobContext(); jobContext = (jobContext instanceof SelfRemovalJobContext) ? ((SelfRemovalJobContext) jobContext).getJobContext() : jobContext; <START> if (job != null && schedulerService.isValid(job) && jobContext instanceof ProcessJobContext) { <END> timers.add(job.getTimerJobInstance()); } } } } logger.debug("Returning timers for session {}", timers, id); return timers; }</code><technical_language>this check of job is late, if null fail NPE lines</technical_language>

Target:
public Collection<TimerJobInstance> getTimerJobInstances(long id) { Collection<TimerJobInstance> timers = new ArrayList<TimerJobInstance>(); List<GlobalJobHandle> jobs = timerJobsPerSession.get(id); { if (jobs != null) { for (GlobalJobHandle job : jobs) { if (job == null) { continue; } JobContext jobContext = job.getTimerJobInstance().getJobContext(); jobContext = (jobContext instanceof SelfRemovalJobContext) ? ((SelfRemovalJobContext) jobContext).getJobContext() : jobContext; if (schedulerService.isValid(job) && jobContext instanceof ProcessJobContext) { timers.add(job.getTimerJobInstance()); } } } } logger.debug("Returning timers for session {}", timers, id); return timers; }
Source:
<code>public void sanitizingFile() throws IOException { File file = testFolder.newFile(); assertThatThrownBy(() -> PersistentStorageFactories.sanitizeStoragePath(file.getAbsolutePath())) <START> .isInstanceOf(SafeIllegalArgumentException.class); <END> }</code><technical_language>for this reasonable a hasMessageContaining(...) exception is want be</technical_language>

Target:
public void sanitizingFile() throws IOException { File file = testFolder.newFile(); assertThatThrownBy(() -> PersistentStorageFactories.sanitizeStoragePath(file.getAbsolutePath())) .isInstanceOf(SafeIllegalArgumentException.class) .hasMessageContaining("has to point to a directory"); }
Source:
<code>public Point indexCenterPoint(int index){ <START> if(index < 0 || index > Constants.INVENTORY_SIZE){ <END> throw new IndexOutOfBoundsException(); } final Point base = component().screenPoint(); final int x = base.x - 3 + (index % 4) * WIDTH; final int y = base.y - 2 + (index / 4) * HEIGHT; return new Point(x + WIDTH / 2, y + HEIGHT / 2); }</code><technical_language>index > Constants.INVENTORY_SIZE - 1 dealing index</technical_language>

Target:
public Point indexCenterPoint(int index){ if(index < 0 || index > Constants.INVENTORY_SIZE - 1){ throw new IndexOutOfBoundsException(); } final Point base = component().screenPoint(); final int x = base.x - 3 + (index % 4) * WIDTH; final int y = base.y - 2 + (index / 4) * HEIGHT; return new Point(x + WIDTH / 2, y + HEIGHT / 2); }
Source:
<code>public List<Integer> getProtectedSeqNums() { LeftToRightBitSet maskWithoutKBits = getMaskWithoutKBits(maskWithKBits); List<Integer> protectedSeqNums = new ArrayList<>(); for (int i = 0; i < this.sizeBytes * 8; ++i) { if (maskWithoutKBits.get(i)) { <START> protectedSeqNums.add(baseSeqNum + i); <END> } } return protectedSeqNums; }</code><technical_language>wrapping</technical_language>

Target:
public List<Integer> getProtectedSeqNums() { FlexFec03BitSet maskWithoutKBits = getMaskWithoutKBits(maskWithKBits); List<Integer> protectedSeqNums = new ArrayList<>(); for (int i = 0; i < maskWithoutKBits.sizeBits(); ++i) { if (maskWithoutKBits.get(i)) { protectedSeqNums.add(RTPUtils.applySequenceNumberDelta(baseSeqNum, i)); } } return protectedSeqNums; }
Source:
<code>public static BigDecimal convertToBigDecimal(String value) { BigDecimal result = null; if (value != null && !value.isEmpty() && !value.equalsIgnoreCase("N/A") && !value.equalsIgnoreCase("NA") <START> && !value.equals("-") && !value.equals("--")) { <END> result = new BigDecimal(value); } return result; }</code><technical_language>Please change this if (!(value == null || value.isEmpty() || value.equalsIgnoreCase(....)), this read</technical_language>

Target:
public static BigDecimal convertToBigDecimal(String value) { BigDecimal result = null; if (isValid(value)) { result = new BigDecimal(value.trim()); } return result; }
Source:
<code>private static boolean isJpeg(byte[] data) { <START> return (data[0] == (byte) 0xFF && data[1] == (byte) 0xD8 && data[data.length - 2] == (byte) 0xFF <END> && data[data.length - 1] == (byte) 0xD9); }</code><technical_language>Please check data buffer 2 bytes avoid a NPE</technical_language>

Target:
private static boolean isJpeg(byte[] data) { return (data.length >= 2 && data[0] == (byte) 0xFF && data[1] == (byte) 0xD8 && data[data.length - 2] == (byte) 0xFF && data[data.length - 1] == (byte) 0xD9); }
Source:
<code>public SystemContextMetric() { osName = System.getProperty("os.name"); osVersion = System.getProperty("os.version"); osArchitecture = System.getProperty("os.arch"); javaVendor = System.getProperty("java.vendor"); javaVersion = System.getProperty("java.version"); jvmName = System.getProperty("java.vm.name"); jvmVersion = System.getProperty("java.vm.version"); openGLVendor = GL11.glGetString(GL11.GL_VENDOR); openGLVersion = GL11.glGetString(GL11.GL_VERSION); openGLRenderer = GL11.glGetString(GL11.GL_RENDERER); processorNumbers = Runtime.getRuntime().availableProcessors(); long memoryMaxByte = Runtime.getRuntime().maxMemory(); <START> memoryMaxMb = (int) (memoryMaxByte / (1024 * 1024)); <END> }</code><technical_language>simply pass memoryMaxByte here. memoryMaxMb accurate enough introduces loss of precision rounding errors. bytes in e.g. a UI a report</technical_language>

Target:
public SystemContextMetric() { osName = System.getProperty("os.name"); osVersion = System.getProperty("os.version"); osArchitecture = System.getProperty("os.arch"); javaVendor = System.getProperty("java.vendor"); javaVersion = System.getProperty("java.version"); jvmName = System.getProperty("java.vm.name"); jvmVersion = System.getProperty("java.vm.version"); openGLVendor = GL11.glGetString(GL11.GL_VENDOR); openGLVersion = GL11.glGetString(GL11.GL_VERSION); openGLRenderer = GL11.glGetString(GL11.GL_RENDERER); processorNumbers = Runtime.getRuntime().availableProcessors(); memoryMaxByte = Runtime.getRuntime().maxMemory(); }
Source:
<code>protected void processValid(T tuple, Slice value) { <START> if (!orderedOutput || waitingEvents.isEmpty()) { <END> if (value == null) { managedState.put(getTime(tuple), getKey(tuple), getKey(tuple)); processUnique(tuple); } else { processDuplicate(tuple); } } else { processWaitingEvent(tuple, Futures.immediateFuture(value)); } }</code><technical_language>is waitingEvent condition required here</technical_language>

Target:
protected void processValid(T tuple, Slice value) { if (!preserveTupleOrder || waitingEvents.isEmpty()) { if (value == null) { managedState.put(getTime(tuple), getKey(tuple), new Slice(new byte[0])); processUnique(tuple); } else { processDuplicate(tuple); } } else { processWaitingEvent(tuple, Futures.immediateFuture(value)); } }
Source:
<code>public File userHome() { <START> if (userHome == null) { <END> userHome = userHomeImpl(); } return userHome; }</code><technical_language>This thread-safe, not. prior implementation relying class initialization ensure thread-safe initialization of userHome property. moved this instance member of this class, need modify this method some sort of thread-safe construct here. sufficient mark userHome volatile. java.io.File is immutable, initializing variable is inexpensive, concurrently multiple threads in event more thread needs time prepared issue</technical_language>

Target:
public File userHome() { return userHome; }
Source:
<code>public static InMemoryEvent toEvent(Event event) { <START> return event == null ? null : Mappers.getMapper(InMemoryEventMapper.class).map(event); <END> }</code><technical_language>Mappers stored in static final variables instead of rebuilding time</technical_language>

Target:
public static InMemoryEvent toEvent(Event event) { return event == null ? null : inMemoryEventMapper.map(event); }
Source:
<code>OverlordResourceTestClient( ObjectMapper jsonMapper, @TestClient HttpClient httpClient, IntegrationTestingConfig config ) { this.jsonMapper = jsonMapper; this.httpClient = httpClient; this.indexer = config.getIndexerUrl(); this.responseHandler = StatusResponseHandler.getInstance(); <START> } <END></code><technical_language>Please remove this field</technical_language>

Target:
OverlordResourceTestClient( ObjectMapper jsonMapper, @TestClient HttpClient httpClient, IntegrationTestingConfig config ) { this.jsonMapper = jsonMapper; this.httpClient = httpClient; this.indexer = config.getIndexerUrl(); }
Source:
<code>public void closeTable() throws IOException { try { if (table != null) { table.close(); } if (connection != null) { connection.close(); } } catch (IOException e) { <START> if (connection != null) { connection.close(); } throw e; <END> } finally { table = null; connection = null; } }</code><technical_language>duplicate close strange me. I @rmetzger gave a nice idea above. catch log error move close in a separate try block. org.apache.flink.connector.hbase.sink.HBaseSinkFunction#close example. clean</technical_language>

Target:
public void closeTable() { if (table != null) { try { table.close(); } catch (IOException e) { LOG.warn("Exception occurs while closing HBase Table.", e); } table = null; } if (connection != null) { try { connection.close(); } catch (IOException e) { LOG.warn("Exception occurs while closing HBase Connection.", e); } connection = null; } }
Source:
<code>public BoxArray() { super(); <START> mProperties.put(FIELD_ENTRIES, collection); <END> }</code><technical_language>"PUT_ARRAY" key</technical_language>

Target:
public BoxArray() { super(); }
Source:
<code>public static MethodReference getBuilderFinisherMethod(Method method, BuilderType builderType, MappingBuilderContext ctx) { Collection<ExecutableElement> buildMethods = builderType.getBuildMethods(); if ( buildMethods.isEmpty() ) { return null; } else if ( buildMethods.size() == 1 ) { return MethodReference.forMethodCall( first( buildMethods ).getSimpleName().toString() ); } else { BuilderMappingPrism builderMapping = builderMappingPrism( method, ctx ); <START> String buildMethodPattern = "build"; <END> if ( builderMapping != null ) { buildMethodPattern = builderMapping.builderFinisher(); } for ( ExecutableElement buildMethod : buildMethods ) { String methodName = buildMethod.getSimpleName().toString(); if ( methodName.matches( buildMethodPattern ) ) { return MethodReference.forMethodCall( methodName ); } } if ( builderMapping == null ) { ctx.getMessager().printMessage( method.getExecutable(), Message.BUILDER_MORE_THAN_ONE_BUILD_METHOD_DEFAULT_PATTERN, builderType.getBuilder(), builderType.getBuildingType(), Strings.join( buildMethods, ", " ) ); } else { ctx.getMessager().printMessage( method.getExecutable(), builderMapping.mirror, Message.BUILDER_MORE_THAN_ONE_BUILD_METHOD_DEFINED_PATTERN, builderType.getBuilder(), builderType.getBuildingType(), Strings.join( buildMethods, ", " ), buildMethodPattern ); } } return null; }</code><technical_language>constant?.. E.g. DEFAULT_BUILD_METHOD_NAME</technical_language>

Target:
public static MethodReference getBuilderFinisherMethod(Method method, BuilderType builderType, MappingBuilderContext ctx) { Collection<ExecutableElement> buildMethods = builderType.getBuildMethods(); if ( buildMethods.isEmpty() ) { return null; } BuilderPrism builderMapping = builderMappingPrism( method, ctx ); if ( builderMapping == null && buildMethods.size() == 1 ) { return MethodReference.forMethodCall( first( buildMethods ).getSimpleName().toString() ); } else { String buildMethodPattern = DEFAULT_BUILD_METHOD_NAME; if ( builderMapping != null ) { buildMethodPattern = builderMapping.buildMethod(); } for ( ExecutableElement buildMethod : buildMethods ) { String methodName = buildMethod.getSimpleName().toString(); if ( methodName.matches( buildMethodPattern ) ) { return MethodReference.forMethodCall( methodName ); } } if ( builderMapping == null ) { ctx.getMessager().printMessage( method.getExecutable(), Message.BUILDER_NO_BUILD_METHOD_FOUND_DEFAULT, buildMethodPattern, builderType.getBuilder(), builderType.getBuildingType(), Strings.join( buildMethods, ", " ) ); } else { ctx.getMessager().printMessage( method.getExecutable(), builderMapping.mirror, Message.BUILDER_NO_BUILD_METHOD_FOUND, buildMethodPattern, builderType.getBuilder(), builderType.getBuildingType(), Strings.join( buildMethods, ", " ) ); } } return null; }
Source:
<code>public IReconcilingStrategy getReconcilingStrategy(String contentType) { <START> return new CompositeReconcilerStrategy(fReconcilers, contentType); <END> }</code><technical_language>code of CompositeReconcilerStrategy constructor here, in case a single reconciler strategy, returned directly</technical_language>

Target:
public IReconcilingStrategy getReconcilingStrategy(String contentType) { if(fReconcilers.size() == 1) { return fReconcilers.get(0).getReconcilingStrategy(contentType); } List<IReconcilingStrategy> strategies = new ArrayList<>(); for (IReconciler iReconciler : fReconcilers) { IReconcilingStrategy strategy = iReconciler.getReconcilingStrategy(contentType); if(strategy != null) { strategies.add(strategy); } } return new CompositeReconcilerStrategy(strategies); }
Source:
<code>protected void AddDiskImageToDb(DiskImage image) { try { DbFacade.getInstance().getDiskImageDAO().save(image); DbFacade.getInstance().getImageVmMapDAO().save( new image_vm_map(image.getactive(), image.getId(), image.getvm_guid())); DiskImageDynamic diskDynamic = new DiskImageDynamic(); diskDynamic.setId(image.getId()); diskDynamic.setactual_size(image.getactual_size()); DbFacade.getInstance().getDiskImageDynamicDAO().save(diskDynamic); if (!DbFacade.getInstance().getDiskDao().exists(image.getimage_group_id())) { DbFacade.getInstance().getDiskDao().save(new Disk(image)); <START> } <END> } catch (RuntimeException ex) { log.error("AddDiskImageToDB::Failed adding new created snapshot into the db", ex); throw new VdcBLLException(VdcBllErrors.DB, ex); } }</code><technical_language>1. put condition in a protected method, for AddTemplateImagesFromImportCommand, instead write condition twice. 2. set a parameter initialized DbFacade.getInstance().getDiskDao(), instead calling twice</technical_language>

Target:
protected void AddDiskImageToDb(DiskImage image) { try { DbFacade.getInstance().getDiskImageDAO().save(image); DbFacade.getInstance().getImageVmMapDAO().save( new image_vm_map(image.getactive(), image.getId(), image.getvm_guid())); DiskImageDynamic diskDynamic = new DiskImageDynamic(); diskDynamic.setId(image.getId()); diskDynamic.setactual_size(image.getactual_size()); DbFacade.getInstance().getDiskImageDynamicDAO().save(diskDynamic); saveDiskIfNotExists(image); } catch (RuntimeException ex) { log.error("AddDiskImageToDB::Failed adding new created snapshot into the db", ex); throw new VdcBLLException(VdcBllErrors.DB, ex); } }
Source:
<code>protected static boolean CanAttachNonPrestartedVmToUser(Guid vm_guid) { <START> java.util.ArrayList<String> messages = new java.util.ArrayList<String>(); <END> return IsVmFree(vm_guid, messages); }</code><technical_language>rebase, pass a new ArrayList() IsVmfree need for variable</technical_language>

Target:
protected static boolean CanAttachNonPrestartedVmToUser(Guid vm_guid) { return IsVmFree(vm_guid, new java.util.ArrayList<String>()); }
Source:
<code>public static void diff(Collection<ArtifactDelta> artifactDeltas, String pathPrefix, Object... options) { CompareDataCollector collector = new NoOpCompareDataCollector(); IOperation operation = new DiffUsingRenderer(collector, artifactDeltas, pathPrefix, options); IProgressMonitor monitor = null; for (int i = 0; i < options.length; i += 2) { if (((String) options[i]).equals("Progress Monitor")) { monitor = (IProgressMonitor) options[i + 1]; break; } } if (monitor == null) { Operations.executeWork(operation); } else { Operations.executeWork(operation, monitor); <START> } <END> }</code><technical_language>Suggest Operations.executeWork(operation, monitor). If monitor is null a new NullProgressMonitor is created monitor is used</technical_language>

Target:
public static void diff(Collection<ArtifactDelta> artifactDeltas, String pathPrefix, Object... options) { CompareDataCollector collector = new NoOpCompareDataCollector(); IOperation operation = new DiffUsingRenderer(collector, artifactDeltas, pathPrefix, options); IProgressMonitor monitor = null; for (int i = 0; i < options.length; i += 2) { if (((String) options[i]).equals("Progress Monitor")) { monitor = (IProgressMonitor) options[i + 1]; break; } } Operations.executeWork(operation, monitor); }
Source:
<code>public void onChatMessage(ChatMessageEvent event) { Platform.runLater(() -> { ChatMessage message = event.getMessage(); if (message.getSource() != null && message.getSource().endsWith("'sParty")) return; <START> if (!message.isPrivate()) { <END> getOrCreateChannelTab(message.getSource()).onChatMessage(message); } else { addAndGetPrivateMessageTab(message.getSource()).onChatMessage(message); } }); }</code><technical_language>endsWith("'sParty") implicit semantical meaning put a dedicated method. guess boolean isOwnPartiesChannel(String name) comparing end of name sounds really... odd</technical_language>

Target:
public void onChatMessage(ChatMessageEvent event) { Platform.runLater(() -> { ChatMessage message = event.getMessage(); if (isMatchmakerPartyMessage(message)) return; if (!message.isPrivate()) { getOrCreateChannelTab(message.getSource()).onChatMessage(message); } else { addAndGetPrivateMessageTab(message.getSource()).onChatMessage(message); } }); }
Source:
<code>protected Map<String, String> getTemplateParameterList(ContractsGrantsInvoiceDocument document) { Map<String, String> templateParameters = super.getTemplateParameterList(document); ContractsGrantsInvoiceDetail totalCostInvoiceDetail = document.getTotalCostInvoiceDetail(); if (ObjectUtils.isNotNull(totalCostInvoiceDetail)) { Map<String, Object> parameterMap = new HashMap<String, Object>(); parameterMap.put(CuArPropertyConstants.ContractsAndGrantsBillingAwardFields.TOTAL_PROGRAM_OUTLAYS_TO_DATE, totalCostInvoiceDetail.getTotalAmountBilledToDate().add(document.getInvoiceGeneralDetail().getCostShareAmount())); Map<String, String> localParameterMap = new PdfFormattingMap(parameterMap); <START> templateParameters.putAll(new PdfFormattingMap(localParameterMap)); <END> } return templateParameters; }</code><technical_language>sub-map is wrapped PdfFormattingMap code above. I suggest wrapping PdfFormattingMap passing main map. Alternatively, convert total-program-outlays-to-date a String pass main map. This service a variable for ContractsGrantsBillingUtilityService, is needed for performing proper KualiDecimal-to-String conversion PdfFormattingMap does</technical_language>

Target:
protected Map<String, String> getTemplateParameterList(ContractsGrantsInvoiceDocument document) { Map<String, String> templateParameters = super.getTemplateParameterList(document); Map<String, Object> localParameterMap = new HashMap<String, Object>(); if (document.getInvoiceGeneralDetail().isFinalBillIndicator()) { localParameterMap.put(CuArPropertyConstants.ContractsAndGrantsBillingAwardFields.FINAL_BILL, CUKFSConstants.CAPITAL_X); localParameterMap.put(CuArPropertyConstants.ContractsAndGrantsBillingAwardFields.PARTIAL_BILL, StringUtils.EMPTY); } else { localParameterMap.put(CuArPropertyConstants.ContractsAndGrantsBillingAwardFields.FINAL_BILL, StringUtils.EMPTY); localParameterMap.put(CuArPropertyConstants.ContractsAndGrantsBillingAwardFields.PARTIAL_BILL, CUKFSConstants.CAPITAL_X); } ContractsGrantsInvoiceDetail totalCostInvoiceDetail = document.getTotalCostInvoiceDetail(); if (ObjectUtils.isNotNull(totalCostInvoiceDetail)) { localParameterMap.put(CuArPropertyConstants.ContractsAndGrantsBillingAwardFields.TOTAL_PROGRAM_OUTLAYS_TO_DATE, totalCostInvoiceDetail.getTotalAmountBilledToDate().add(document.getInvoiceGeneralDetail().getCostShareAmount())); } if (!localParameterMap.isEmpty()) { LOG.debug("getTemplateParameterList, there were local parameters, adding them to the returning map."); templateParameters.putAll(new PdfFormattingMap(localParameterMap)); } return templateParameters; }
Source:
<code>public void stop() { if (mJvmMonitorThread == null) { return; } mJvmMonitorThread.interrupt(); try { <START> mJvmMonitorThread.join(60 * 1000); <END> } catch (InterruptedException e) { Thread.currentThread().interrupt(); } mJvmMonitorThread = null; }</code><technical_language>I jvm monitor is much, need wait long. Maybe: 5 * Constants.SECOND_MS? Also, I thread while loop while (!Thread.currentThread().isInterrupted())</technical_language>

Target:
public void stop() { if (mJvmMonitorThread == null) { return; } mJvmMonitorThread.interrupt(); try { mJvmMonitorThread.join(5 * Constants.SECOND_MS); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } mJvmMonitorThread = null; }
Source:
<code>protected Class<?>[] getValidationGroups(Object action, String methodName) throws NoSuchMethodException { ValidateGroup validateGroup = MethodUtils.getAnnotation(getActionMethod(action.getClass(), methodName), ValidateGroup.class, true, true); <START> return validateGroup == null ? new Class[]{} : validateGroup.value(); <END> }</code><technical_language>default defined (as proposed Default.class) this check needed</technical_language>

Target:
protected Class<?>[] getValidationGroups(Object action, String methodName) throws NoSuchMethodException { ValidationGroup validationGroup = MethodUtils.getAnnotation(getActionMethod(action.getClass(), methodName), ValidationGroup.class, true, true); return validationGroup == null ? new Class[]{Default.class} : validationGroup.value(); }
Source:
<code>private void testContainerPlacementRequestMessage(ContainerPlacementRequestMessage requestMessage) throws IOException { ObjectMapper objectMapper = ContainerPlacementMessageObjectMapper.getObjectMapper(); ContainerPlacementMessage message = objectMapper.readValue(objectMapper.writeValueAsString(requestMessage), ContainerPlacementMessage.class); assertTrue(message instanceof ContainerPlacementRequestMessage); ContainerPlacementRequestMessage deserializedRequest = (ContainerPlacementRequestMessage) message; assertEquals(requestMessage, deserializedRequest); <START> assertEquals(deserializedRequest.getStatusCode(), ContainerPlacementMessage.StatusCode.CREATED); <END> }</code><technical_language>ContainerPlacementMessage.equals includes statusCode, this step is needed</technical_language>

Target:
private void testContainerPlacementRequestMessage(ContainerPlacementRequestMessage requestMessage) throws IOException { ObjectMapper objectMapper = ContainerPlacementMessageObjectMapper.getObjectMapper(); ContainerPlacementMessage message = objectMapper.readValue(objectMapper.writeValueAsString(requestMessage), ContainerPlacementMessage.class); assertTrue(message instanceof ContainerPlacementRequestMessage); ContainerPlacementRequestMessage deserializedRequest = (ContainerPlacementRequestMessage) message; assertEquals(requestMessage, deserializedRequest); }
Source:
<code>public Map<String, RestEntry> buildEntryMap(Map<String, Object> config){ <START> Map entries = new LinkedHashMap(); <END> for(Map.Entry<String, Object> entry: config.entrySet()){ RestEntry re = build(entry); if(re.getUrl().equals(RestEntry.MISSING) ){ logger.log(SystemProperties.DIAG, "{} was bypassed due by version check.", re.getName()); } else{ entries.put(re.getName(), re); } } return entries; }</code><technical_language>suggestion Map<String, RestEntry> entries = new LinkedHashMap<>();</technical_language>

Target:
public Map<String, RestEntry> buildEntryMap(Map<String, Object> config){ Map entries = new LinkedHashMap<>(); for(Map.Entry<String, Object> entry: config.entrySet()){ RestEntry re = build(entry); if(re.getUrl().equals(RestEntry.MISSING) ){ logger.log(SystemProperties.DIAG, "{} was bypassed due by version check.", re.getName()); } else{ entries.put(re.getName(), re); } } return entries; }
Source:
<code>private Object applyUpdateUnsafe(SMREntry entry, long timestamp) { log.trace("Apply[{}] of {}@{} ({})", this, entry.getSMRMethod(), Address.isAddress(entry.getGlobalAddress()) ? entry.getGlobalAddress() : "OPT", entry.getSMRArguments()); <START> if (SMREntry.isNOP(entry)) { <END> return null; } ICorfuSMRUpcallTarget<T> target = upcallTargetMap.get(entry.getSMRMethod()); if (target == null) { throw new RuntimeException("Unknown upcall " + entry.getSMRMethod()); } ICorfuExecutionContext.Context context = getContext(timestamp); if (!entry.isUndoable() || !Address.isAddress(entry.getGlobalAddress())) { IUndoRecordFunction<T> undoRecordTarget = undoRecordFunctionMap.get(entry.getSMRMethod()); if (undoRecordTarget != null) { entry.setUndoRecord(undoRecordTarget .getUndoRecord(object.getContext(context), entry.getSMRArguments())); log.trace("Apply[{}] Undo->{}", this, entry.getUndoRecord()); } else if (resetSet.contains(entry.getSMRMethod())) { entry.setUndoRecord(object); object.close(); object = newObjectFn.get(); log.trace("Apply[{}] Undo->RESET", this); } } return target.upcall(object.getContext(context), entry.getSMRArguments()); }</code><technical_language>move this caller? if a no-op, skip calling applyUpdateUnsafe</technical_language>

Target:
private Object applyUpdateUnsafe(SMREntry entry, long timestamp) { log.trace("Apply[{}] of {}@{} ({})", this, entry.getSMRMethod(), Address.isAddress(entry.getGlobalAddress()) ? entry.getGlobalAddress() : "OPT", entry.getSMRArguments()); ICorfuSMRUpcallTarget<T> target = upcallTargetMap.get(entry.getSMRMethod()); if (target == null) { throw new RuntimeException("Unknown upcall " + entry.getSMRMethod()); } ICorfuExecutionContext.Context context = getContext(timestamp); if (!entry.isUndoable() || !Address.isAddress(entry.getGlobalAddress())) { IUndoRecordFunction<T> undoRecordTarget = undoRecordFunctionMap.get(entry.getSMRMethod()); if (undoRecordTarget != null) { entry.setUndoRecord(undoRecordTarget .getUndoRecord(object.getContext(context), entry.getSMRArguments())); log.trace("Apply[{}] Undo->{}", this, entry.getUndoRecord()); } else if (resetSet.contains(entry.getSMRMethod())) { entry.setUndoRecord(object); object.close(); object = newObjectFn.get(); log.trace("Apply[{}] Undo->RESET", this); } } return target.upcall(object.getContext(context), entry.getSMRArguments()); }
Source:
<code>private static String resolveMessage(String message, Optional<ComponentLocation> originatingLocation, Optional<Exception> closerResponsible) { String openedByDescription = format("The cursor provider was open by %s", originatingLocation.map(cl -> cl.getLocation()) .orElse("unknown")); String responsibleDescription = closerResponsible.map(r -> { StringWriter stringWriter = new StringWriter(); r.printStackTrace(new PrintWriter(stringWriter)); return format("The cursor provider was closed by: \n %s", stringWriter.toString()); <START> }).orElse(format("Run with -M-D%s=true for more details", TRACK_CURSOR_PROVIDER_CLOSE)); <END> return format("%s: %s. %s.", message, openedByDescription, responsibleDescription); }</code><technical_language>mention setting a property. This is valid for command line, in CH runtime fabric set differently</technical_language>

Target:
private static String resolveMessage(String message, Optional<ComponentLocation> originatingLocation, Optional<Exception> closerResponsible) { String openedByDescription = format("The cursor provider was open by %s", originatingLocation.map(cl -> cl.getLocation()) .orElse("unknown")); String responsibleDescription = closerResponsible.map(r -> { StringWriter stringWriter = new StringWriter(); r.printStackTrace(new PrintWriter(stringWriter)); return format("The cursor provider was closed by: \n %s", stringWriter.toString()); }).orElse(format("Set SystemProperty '%s' in true for more details", TRACK_CURSOR_PROVIDER_CLOSE_PROPERTY)); return format("%s: %s. %s.", message, openedByDescription, responsibleDescription); }
Source:
<code>public StorageTraversal getStorageTraversal() { <START> Collection<IResource> resources = Arrays.asList(papyrusFile.getAssociatedResources()); <END> Set<IStorage> storages = getStorages(resources); return new StorageTraversal(storages); }</code><technical_language>I APIs arrays boring, I do dangerous transforming a List: - If getAssociatedResources() returns null, get a NullPointerException - turning a list iterate in private method, decided define a Collection parameter weel receive array parameter => I recommend array, check null case for security</technical_language>

Target:
public StorageTraversal getStorageTraversal() { IResource[] resources = papyrusFile.getAssociatedResources(); Set<IStorage> storages = getStorages(resources); return new StorageTraversal(storages); }
Source:
<code>public Explosion newExplosion(@Nullable net.minecraft.entity.Entity entityIn, double x, double y, double z, float strength, boolean isFlaming, boolean isSmoking) { Explosion explosion = new Explosion((WorldServer) (Object) this, entityIn, x, y, z, strength, isFlaming, isSmoking); <START> triggerExplosion((org.spongepowered.api.world.explosion.Explosion) explosion, Cause.of(NamedCause.source(entityIn == null ? this : entityIn))); <END> return explosion; }</code><technical_language>CauseTracker define for explosion source. source passed in Entity is entity ticking, in some cases a TileEntity passing null for explosions. want verify explosion optimization (not optimization, optimization for clients server due unperformant explosion packets entail) functions expected</technical_language>

Target:
public Explosion newExplosion(@Nullable net.minecraft.entity.Entity entityIn, double x, double y, double z, float strength, boolean isFlaming, boolean isSmoking) { Explosion explosion = new Explosion((WorldServer) (Object) this, entityIn, x, y, z, strength, isFlaming, isSmoking); explosion = triggerInternalExplosion((org.spongepowered.api.world.explosion.Explosion) explosion, e -> GeneralPhase.State.EXPLOSION .createPhaseContext() .explosion(e) .potentialExplosionSource((WorldServer) (Object) this, entityIn)); return explosion; }
Source:
<code>public static Map<String, Symbol> typeShedSymbols() { if (TypeShedVisitor.typeShedSymbols == null) { Map<String, Symbol> typeShedSymbols = Collections.emptyMap(); InputStream resource = TypeShedVisitor.class.getResourceAsStream("builtins.pyi"); try (BufferedReader reader = new BufferedReader(new InputStreamReader(resource, StandardCharsets.UTF_8))) { String builtins = reader.lines().collect(Collectors.joining("\n")); AstNode astNode = PythonParser.create().parse(builtins); FileInput fileInput = new PythonTreeMaker().fileInput(astNode); TypeShedVisitor typeShedVisitor = new TypeShedVisitor(); fileInput.accept(typeShedVisitor); typeShedSymbols = typeShedVisitor.symbolsByName; } catch (IOException | UncheckedIOException e) { <START> LOG.debug("Unable to read builtin types."); <END> } TypeShedVisitor.typeShedSymbols = Collections.unmodifiableMap(typeShedSymbols); } return typeShedSymbols; }</code><technical_language>I change info level add original exception: LOG.info("Unable read builtin types.", e);</technical_language>

Target:
public static Map<String, Symbol> typeShedSymbols() { if (TypeShedVisitor.typeShedSymbols == null) { Map<String, Symbol> typeShedSymbols = Collections.emptyMap(); InputStream resource = TypeShedVisitor.class.getResourceAsStream("builtins.pyi"); try (BufferedReader reader = new BufferedReader(new InputStreamReader(resource, StandardCharsets.UTF_8))) { String builtins = reader.lines().collect(Collectors.joining("\n")); AstNode astNode = PythonParser.create().parse(builtins); FileInput fileInput = new PythonTreeMaker().fileInput(astNode); TypeShedVisitor typeShedVisitor = new TypeShedVisitor(); fileInput.accept(typeShedVisitor); typeShedSymbols = typeShedVisitor.symbolsByName; } catch (IOException | UncheckedIOException e) { LOG.info("Unable to read builtin types.", e); } TypeShedVisitor.typeShedSymbols = Collections.unmodifiableMap(typeShedSymbols); } return typeShedSymbols; }
Source:
<code>public void testModuleExecution() { Document doc = getXmlDocumentFromFile(TmfXmlTestFiles.VALID_FILE.getFile()); assertNotNull(doc); NodeList stateproviderNodes = doc.getElementsByTagName(TmfXmlStrings.STATE_PROVIDER); Element node = (Element) stateproviderNodes.item(0); fModule = new XmlStateSystemModule(); String moduleId = node.getAttribute(TmfXmlStrings.ANALYSIS_ID); fModule.setId(moduleId); fModule.setXmlFile(new Path(TmfXmlTestFiles.VALID_FILE.getFile().getAbsolutePath())); NodeList head = node.getElementsByTagName(TmfXmlStrings.HEAD); XmlHeadInfo headInfo = null; if (head.getLength() == 1) { headInfo = new XmlHeadInfo(head.item(0)); } fModule.setHeadInfo(headInfo); try { assumeTrue(CtfTmfTestTrace.KERNEL.exists()); <START> ITmfTrace trace = CtfTmfTestTrace.KERNEL.getTrace(); <END> fModule.setTrace(trace); fModule.schedule(); assertTrue(fModule.waitForCompletion(new NullProgressMonitor())); } catch (TmfAnalysisException e) { fail("Cannot set trace " + e.getMessage()); } finally { CtfTmfTestTrace.KERNEL.dispose(); } }</code><technical_language>do assume start of test, skip if present</technical_language>

Target:
public void testModuleExecution() { assumeTrue(CtfTmfTestTrace.KERNEL.exists()); Document doc = getXmlDocumentFromFile(TmfXmlTestFiles.VALID_FILE.getFile()); assertNotNull(doc); NodeList stateproviderNodes = doc.getElementsByTagName(TmfXmlStrings.STATE_PROVIDER); Element node = (Element) stateproviderNodes.item(0); fModule = new XmlStateSystemModule(); String moduleId = node.getAttribute(TmfXmlStrings.ANALYSIS_ID); fModule.setId(moduleId); fModule.setXmlFile(new Path(TmfXmlTestFiles.VALID_FILE.getFile().getAbsolutePath())); NodeList head = node.getElementsByTagName(TmfXmlStrings.HEAD); XmlHeadInfo headInfo = null; if (head.getLength() == 1) { headInfo = new XmlHeadInfo(head.item(0)); } fModule.setHeadInfo(headInfo); try { ITmfTrace trace = CtfTmfTestTrace.KERNEL.getTrace(); fModule.setTrace(trace); fModule.schedule(); assertTrue(fModule.waitForCompletion(new NullProgressMonitor())); } catch (TmfAnalysisException e) { fail("Cannot set trace " + e.getMessage()); } finally { CtfTmfTestTrace.KERNEL.dispose(); } }
Source:
<code>public void createContainerWithShmPidsLimit() throws DockerException { final RemoteApiVersion apiVersion = getVersion(dockerClient); if (!apiVersion.isGreaterOrEqual(RemoteApiVersion.VERSION_1_23)) { throw new SkipException("API version should be >= 1.23"); } HostConfig hostConfig = new HostConfig().withPidsLimit(2L); CreateContainerResponse container = dockerClient.createContainerCmd(BUSYBOX_IMAGE) .withHostConfig(hostConfig).withCmd("true").exec(); LOG.info("Created container {}", container.toString()); assertThat(container.getId(), not(isEmptyString())); InspectContainerResponse inspectContainerResponse = dockerClient.inspectContainerCmd(container.getId()).exec(); <START> assertEquals(inspectContainerResponse.getHostConfig().getPidsLimit(), hostConfig.getPidsLimit()); <END> }</code><technical_language>please hamcrest matcher</technical_language>

Target:
public void createContainerWithShmPidsLimit() throws DockerException { final RemoteApiVersion apiVersion = getVersion(dockerClient); if (!apiVersion.isGreaterOrEqual(RemoteApiVersion.VERSION_1_23)) { throw new SkipException("API version should be >= 1.23"); } HostConfig hostConfig = new HostConfig().withPidsLimit(2L); CreateContainerResponse container = dockerClient.createContainerCmd(BUSYBOX_IMAGE) .withHostConfig(hostConfig).withCmd("true").exec(); LOG.info("Created container {}", container.toString()); assertThat(container.getId(), not(isEmptyString())); InspectContainerResponse inspectContainerResponse = dockerClient.inspectContainerCmd(container.getId()).exec(); assertThat(inspectContainerResponse.getHostConfig().getPidsLimit(), is(hostConfig.getPidsLimit())); }
Source:
<code>public Collection<MultiMapRecord> remove(Data dataKey, boolean copyOf) { MultiMapValue multiMapValue = multiMapValues.remove(dataKey); if (multiMapValue != null) { decrSize(multiMapValue.size()); return multiMapValue.getCollection(copyOf); <START> } else { <END> return null; } }</code><technical_language>Redundant else blocks</technical_language>

Target:
public Collection<MultiMapRecord> remove(Data dataKey, boolean copyOf) { MultiMapValue multiMapValue = multiMapValues.remove(dataKey); if (multiMapValue != null) { decrSize(multiMapValue.size()); return multiMapValue.getCollection(copyOf); } return null; }
Source:
<code>public int getLeftX() { try { <START> int x = (int) Math.round(Double.parseDouble(getPropertyValue(PROPERTY_NAME_X))); <END> if (originAtCenter) { return x - radius; } else { return x; } } catch (NumberFormatException e) { return 0; } }</code><technical_language>parse x/y values set time leftX topY properties need computed (which is more frequently property is set)</technical_language>

Target:
public int getLeftX() { return x - getXOffset(); }
Source:
<code>public void visitToken(DetailAST ast) { if (canBeOverridden(ast) && !hasEmptyImplementation(ast) && !hasJavadocComment(ast) <START> && !hasIgnoredAnnotation(ast, ignoredAnnotations)) { <END> final DetailAST containerDef = getNearestClassOrEnumDefinition(ast); if (canBeSubclassed(containerDef) && hasDefaultOrExplicitNonPrivateCtor(containerDef)) { final String methodName = ast.findFirstToken(TokenTypes.IDENT).getText(); log(ast.getLineNo(), ast.getColumnNo(), MSG_KEY, methodName); } } }</code><technical_language>please sort expression complexity of execution for performance reasons</technical_language>

Target:
public void visitToken(DetailAST ast) { if (!hasJavadocComment(ast) && (isNativeMethod(ast) || !hasEmptyImplementation(ast)) && canBeOverridden(ast) && !hasIgnoredAnnotation(ast, ignoredAnnotations)) { final DetailAST classDef = getNearestClassOrEnumDefinition(ast); if (canBeSubclassed(classDef)) { final String className = classDef.findFirstToken(TokenTypes.IDENT).getText(); final String methodName = ast.findFirstToken(TokenTypes.IDENT).getText(); log(ast.getLineNo(), ast.getColumnNo(), MSG_KEY, className, methodName); } } }