auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code><START> public void setUp() { <END> if (CASE_DIRECTORY_PATH.toFile().exists()) { try { FileUtils.deleteDirectory(CASE_DIRECTORY_PATH.toFile()); } catch (IOException ex) { Exceptions.printStackTrace(ex); Assert.fail(ex); } } assertFalse("Unable to delete existing test directory", CASE_DIRECTORY_PATH.toFile().exists()); CASE_DIRECTORY_PATH.toFile().mkdirs(); assertTrue("Unable to create test directory", CASE_DIRECTORY_PATH.toFile().exists()); try { Case.createAsCurrentCase(Case.CaseType.SINGLE_USER_CASE, CASE_DIRECTORY_PATH.toString(), new CaseDetails("EmbeddedFileTest")); } catch (CaseActionException ex) { Exceptions.printStackTrace(ex); Assert.fail(ex); } assertTrue(CASE_DIR.exists()); ImageDSProcessor dataSourceProcessor = new ImageDSProcessor(); try { DataSourceProcessorRunner.ProcessorCallback callBack = DataSourceProcessorRunner.runDataSourceProcessor(dataSourceProcessor, IMAGE_PATH); List<Content> dataSourceContent = callBack.getDataSourceContent(); assertEquals(1, dataSourceContent.size()); List<String> errorMessages = callBack.getErrorMessages(); assertEquals(0, errorMessages.size()); } catch (AutoIngestDataSourceProcessor.AutoIngestDataSourceProcessorException | InterruptedException ex) { Exceptions.printStackTrace(ex); Assert.fail(ex); } try { openCase = Case.getOpenCase(); runIngestJob(openCase.getDataSources()); } catch (NoCurrentCaseException | TskCoreException ex) { Exceptions.printStackTrace(ex); Assert.fail(ex); } }</code><technical_language>duplication of code in ingest file filters tests. creating some new utility methods for creating deleting a case</technical_language>

Target:
public void setUp() { CaseUtils.createCase(CASE_DIRECTORY_PATH); ImageDSProcessor dataSourceProcessor = new ImageDSProcessor(); IngestUtils.addDataSource(dataSourceProcessor, IMAGE_PATH); try { openCase = Case.getOpenCase(); } catch (NoCurrentCaseException ex) { Exceptions.printStackTrace(ex); Assert.fail(ex); } IngestModuleTemplate embeddedTemplate = IngestUtils.getIngestModuleTemplate(new EmbeddedFileExtractorModuleFactory()); IngestModuleTemplate hashLookupTemplate = IngestUtils.getIngestModuleTemplate(new HashLookupModuleFactory()); ArrayList<IngestModuleTemplate> templates = new ArrayList<>(); templates.add(embeddedTemplate); templates.add(hashLookupTemplate); IngestJobSettings ingestJobSettings = new IngestJobSettings(EmbeddedFileTest.class.getCanonicalName(), IngestType.FILES_ONLY, templates); try { IngestUtils.runIngestJob(openCase.getDataSources(), ingestJobSettings); } catch (TskCoreException ex) { Exceptions.printStackTrace(ex); Assert.fail(ex); } }
Source:
<code>public void handleEvent(Event event) { Object element = event.getProperty(IEventBroker.DATA); if (!(element instanceof MApplication)) { return; } List<Object> unusedResources = new ArrayList<Object>(); Set<IResourcesRegistry> processedRegistries = new HashSet<IResourcesRegistry>(); for (MWindow window : ((MApplication) element).getChildren()) { <START> CSSEngine engine = getEngine(window); <END> if (engine != null) { IResourcesRegistry registry = engine.getResourcesRegistry(); if (!processedRegistries.contains(registry)) { unusedResources.addAll(removeResources(registry)); processedRegistries.add(registry); } engine.reapply(); } } for (Object resource : unusedResources) { disposeResource(resource); } }</code><technical_language>I CSSEngine, want do multiple windows (or track of engines re-apply multiple times)</technical_language>

Target:
public void handleEvent(Event event) { Object element = event.getProperty(IEventBroker.DATA); if (!(element instanceof MApplication)) { return; } List<Object> unusedResources = new ArrayList<Object>(); Set<CSSEngine> engines = new HashSet<CSSEngine>(); for (MWindow window : ((MApplication) element).getChildren()) { CSSEngine engine = getEngine(window); if (engine != null) { engines.add(engine); } } for (CSSEngine engine : engines) { unusedResources.addAll(removeResources(engine .getResourcesRegistry())); engine.reapply(); } for (Object resource : unusedResources) { disposeResource(resource); } }
Source:
<code>private String updateRecorderToDefaultOption() { final String envVar = System.getenv("RECORDER"); final String recorder = System.getProperty("RECORDER"); <START> if ((envVar != null && !"".equals(envVar)) || (recorder != null && !"".equals(recorder))) { <END> System.setProperty("RECORDER", TestRecorderRule.FAILURES); return recorder; } return null; }</code><technical_language>String.isEmpty</technical_language>

Target:
private String updateRecorderToDefaultOption() { final String envVar = System.getenv("RECORDER"); final String recorder = System.getProperty("RECORDER"); if ((envVar != null && !envVar.isEmpty()) || (recorder != null && !recorder.isEmpty())) { System.setProperty("RECORDER", TestRecorderRule.FAILURES); return recorder; } return null; }
Source:
<code>private AjaxLink<String> trucateAllLink(String id) { AjaxLink<String> trunkAlllink = new AjaxLink<String>(id) { @Override public void onClick(AjaxRequestTarget target) { dialog.setTitle( new ParamResourceModel( "confirmGwcTruncateTitle", CachedLayersPage.this)); dialog.setDefaultModel(getDefaultModel()); dialog.showOkCancel( target, new GeoServerDialog.DialogDelegate() { private static final long serialVersionUID = 1L; private TruncateAllRequest truncateAllRequest; @Override protected Component getContents(final String id) { Label confirmLabel = <START> new Label( <END> id, "You are about to wipe GWC cache clean, Do you want to continue?"); confirmLabel.setEscapeModelStrings( false); return confirmLabel; } @Override protected boolean onSubmit( final AjaxRequestTarget target, final Component contents) { GWC facade = GWC.get(); try { truncateAllRequest = facade.truncateAll(); } catch (Exception e) { error(e.getMessage()); log.error("An Error while clearing GWC cache", e); return false; } return true; } @Override public void onClose(final AjaxRequestTarget target) { target.add(table); if (truncateAllRequest != null) if (truncateAllRequest.getTrucatedLayers().length() == 0) warn("GWC Cache already empty"); else info( "Cleared GWC cache for " + truncateAllRequest .getTrucatedLayersList()); else error("There was a problem, check logs"); setResponsePage(getPage()); } }); } }; return trunkAlllink; }</code><technical_language>This internationalized (like UI messages)</technical_language>

Target:
private AjaxLink<String> trucateAllLink(String id) { AjaxLink<String> trunkAlllink = new AjaxLink<String>(id) { @Override public void onClick(AjaxRequestTarget target) { dialog.setTitle( new ParamResourceModel( "confirmGwcTruncateTitle", CachedLayersPage.this)); dialog.setDefaultModel(getDefaultModel()); dialog.showOkCancel( target, new GeoServerDialog.DialogDelegate() { private static final long serialVersionUID = 1L; private TruncateAllRequest truncateAllRequest; @Override protected Component getContents(final String id) { Label confirmLabel = new Label( id, new ParamResourceModel( "confirmGWCClean", CachedLayersPage.this)); confirmLabel.setEscapeModelStrings( false); return confirmLabel; } @Override protected boolean onSubmit( final AjaxRequestTarget target, final Component contents) { GWC facade = GWC.get(); try { truncateAllRequest = facade.truncateAll(); } catch (Exception e) { error( new ParamResourceModel( "confirmGWCClean", CachedLayersPage.this) .getString()); log.error("An Error while clearing GWC cache", e); return false; } return true; } @Override public void onClose(final AjaxRequestTarget target) { target.add(table); if (truncateAllRequest != null) if (truncateAllRequest.getTrucatedLayers().length() == 0) warn( new ParamResourceModel( "warnGWCClean", CachedLayersPage.this) .getString()); else info( new ParamResourceModel( "confirmGWCCleanInfo", CachedLayersPage.this) .getString()); else error( new ParamResourceModel( "errorGWCClean2", CachedLayersPage.this) .getString()); setResponsePage(getPage()); } }); } }; return trunkAlllink; }
Source:
<code>public Dataset find(Object pk) { <START> return chooseEM(session.getUser()).find(Dataset.class, pk); <END> }</code><technical_language>getEntityManager is a name</technical_language>

Target:
public Dataset find(Object pk) { return emBean.getEntityManager().find(Dataset.class, pk); }
Source:
<code>public <START> ArrayList<String> <END> getAliases() { try { return Collections.list(keyStore.aliases()); } catch (KeyStoreException e) { System.out.println("Keystore not initialized"); return null; } }</code><technical_language>interface instead of concrete class. List<String> more general Collection<String> return type</technical_language>

Target:
public Collection<String> getAliases() throws ScriptSignatureException{ try { return Collections.list(fKeyStore.aliases()); } catch (KeyStoreException e) { throw new ScriptSignatureException("Keystore not initialized properly. Exiting...", e.getCause(), true); } }
Source:
<code>T toObject(ProtobufCodec<T> codec, Provider<T> provider) { if (codec == null) { return null; } <START> if (data instanceof byte[]) { <END> this.codec = codec; if (provider == null) { data = codec.decode((byte[]) data); } else { T tmp = provider.get(); codec.mergeFrom((byte[]) data, tmp); data = tmp; } } return (T) data; }</code><technical_language>need copy data a local variable</technical_language>

Target:
T toObject(ProtobufCodec<T> codec, Provider<T> provider) { if (codec == null) { return null; } Object d = data; if (d instanceof byte[]) { this.codec = codec; if (provider == null) { d = codec.decode((byte[]) data); } else { T tmp = provider.get(); codec.mergeFrom((byte[]) data, tmp); d = tmp; } } data = d; return (T) data; }
Source:
<code>public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) { boolean toggled = false; boolean enabled = true; for (Plugin playerparticles : TotalFreedomMod.server.getPluginManager().getPlugins()) { if (playerparticles.getName().equalsIgnoreCase("playerparticles")) { if (playerparticles.isEnabled()) { playerparticles.getPluginLoader().disablePlugin(playerparticles); enabled = false; } else { playerparticles.getPluginLoader().enablePlugin(playerparticles); enabled = true; } toggled = true; } } <START> if (toggled) { <END> if (!enabled) { TFM_Util.adminAction(sender.getName(), "Disabling PlayerParticles", true); } else { TFM_Util.adminAction(sender.getName(), "Enabling PlayerParticles", false); } } return true; }</code><technical_language>Merge this If statement in previous for loop please</technical_language>

Target:
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) { for (Plugin p : TotalFreedomMod.server.getPluginManager().getPlugins()) { if (p.getName().equalsIgnoreCase("PlayerParticles")) { if (p.isEnabled()) { p.getPluginLoader().disablePlugin(p); TFM_Util.adminAction(sender.getName(), "Disabled PlayerParticles", false); } else { p.getPluginLoader().enablePlugin(p); TFM_Util.adminAction(sender.getName(), "Enabled PlayerParticles", false); } } } return true; }
Source:
<code>public void testEndBytes() { byte[] expectedEndBytes = new byte[] {0, 0, (byte) 0xF3}; byte[] endBytes = fileGenerator.getFileEndBytes(); <START> boolean fileBytesEquality = Arrays.equals(expectedEndBytes, endBytes); <END> assertTrue(fileBytesEquality); }</code><technical_language>please assertArrayEquals</technical_language>

Target:
public void testEndBytes() { final byte[] expectedEndBytes = new byte[] {0, 0, (byte) 0xF3}; byte[] endBytes = fileGenerator.getFileEndBytes(); assertArrayEquals(expectedEndBytes, endBytes); }
Source:
<code>public PackingPlan repack(PackingPlan currentPackingPlan, Map<String, Integer> componentChanges) { int adjustments = 0; this.numAdjustments = 0; this.numContainers = currentPackingPlan.getContainers().size(); <START> this.containerId = 1; <END> int additionalContainers = computeNumAdditionalContainers(componentChanges, currentPackingPlan); increaseNumContainers(additionalContainers); LOG.info(String.format("Allocated " + "%s additional containers for repack bring the number of containers to %s.", additionalContainers, this.numContainers)); Optional<Map<Integer, List<InstanceId>>> resourceCompliantRRAllocation = getResourceCompliantRRAllocation(currentPackingPlan, componentChanges); while (!resourceCompliantRRAllocation.isPresent()) { if (this.numAdjustments > adjustments) { adjustments++; resourceCompliantRRAllocation = getResourceCompliantRRAllocation(currentPackingPlan, componentChanges); } else { return null; } } Map<String, Long> ramMap = TopologyUtils.getComponentRamMapConfig(topology); Set<PackingPlan.ContainerPlan> containerPlans = PackingUtils.buildContainerPlans( resourceCompliantRRAllocation.get(), ramMap, defaultInstanceResources, paddingPercentage); return new PackingPlan(topology.getId(), containerPlans); }</code><technical_language>this.containerId represent is 1 starting a repack</technical_language>

Target:
public PackingPlan repack(PackingPlan currentPackingPlan, Map<String, Integer> componentChanges) { int adjustments = 0; this.numContainers = currentPackingPlan.getContainers().size(); resetState(); int additionalContainers = computeNumAdditionalContainers(componentChanges, currentPackingPlan); increaseNumContainers(additionalContainers); LOG.info(String.format("Allocated " + "%s additional containers for repack bring the number of containers to %s.", additionalContainers, this.numContainers)); Optional<Map<Integer, List<InstanceId>>> resourceCompliantRRAllocation = getResourceCompliantRRAllocation(currentPackingPlan, componentChanges); while (!resourceCompliantRRAllocation.isPresent()) { if (this.numAdjustments > adjustments) { adjustments++; resourceCompliantRRAllocation = getResourceCompliantRRAllocation(currentPackingPlan, componentChanges); } else { return null; } } Map<String, Long> ramMap = TopologyUtils.getComponentRamMapConfig(topology); Set<PackingPlan.ContainerPlan> containerPlans = PackingUtils.buildContainerPlans( resourceCompliantRRAllocation.get(), ramMap, defaultInstanceResources, paddingPercentage); return new PackingPlan(topology.getId(), containerPlans); }
Source:
<code>public void refresh(IResource[] resources, int depth, IProgressMonitor monitor) throws TeamException { for (IResource resource : resources) { if (resource.getType() == IResource.ROOT) { GitSyncCache newCache = GitSyncCache.getAllData(gsds, monitor); <START> cache.merge(newCache, null); <END> super.refresh(resources, depth, monitor); return; } } Map<GitSynchronizeData, Collection<String>> updateRequests = new HashMap<GitSynchronizeData, Collection<String>>(); Collection<String> allUpdateRequestPaths = new LinkedHashSet<String>(); for (IResource resource : resources) { IProject project = resource.getProject(); GitSynchronizeData data = gsds.getData(project.getName()); if (data != null) { RepositoryMapping mapping = RepositoryMapping .getMapping(project); if (mapping != null) { Collection<String> paths = updateRequests.get(data); if (paths == null) { paths = new ArrayList<String>(); updateRequests.put(data, paths); } String path = mapping.getRepoRelativePath(resource); if (path == null) path = ""; paths.add(path); allUpdateRequestPaths.add(path); } } } if (!updateRequests.isEmpty()) { GitSyncCache newCache = GitSyncCache.getAllData(updateRequests, monitor); cache.merge(newCache, allUpdateRequestPaths); } super.refresh(resources, depth, monitor); }</code><technical_language>I this lead NPEs. Replaced fully replacing cache in next patch set</technical_language>

Target:
public void refresh(IResource[] resources, int depth, IProgressMonitor monitor) throws TeamException { for (IResource resource : resources) { if (resource.getType() == IResource.ROOT) { cache = GitSyncCache.getAllData(gsds, monitor); super.refresh(resources, depth, monitor); return; } } Map<GitSynchronizeData, Collection<String>> updateRequests = new HashMap<GitSynchronizeData, Collection<String>>(); for (IResource resource : resources) { IProject project = resource.getProject(); GitSynchronizeData data = gsds.getData(project.getName()); if (data != null) { RepositoryMapping mapping = RepositoryMapping .getMapping(project); if (mapping != null) { Collection<String> paths = updateRequests.get(data); if (paths == null) { paths = new ArrayList<String>(); updateRequests.put(data, paths); } String path = mapping.getRepoRelativePath(resource); if (path == null) path = ""; paths.add(path); } } } if (!updateRequests.isEmpty()) { GitSyncCache.mergeAllDataIntoCache(updateRequests, monitor, cache); } super.refresh(resources, depth, monitor); }
Source:
<code>public static Properties defaultProperties() { Properties properties = ProfitBricksApiMetadata.defaultProperties(); properties.setProperty(PROPERTY_REGIONS, "DE,US"); properties.setProperty(PROPERTY_REGION + ".DE.FKB." + ISO3166_CODES, "DE-FKB"); properties.setProperty(PROPERTY_REGION + ".DE.FRA." + ISO3166_CODES, "DE-FRA"); properties.setProperty(PROPERTY_REGION + ".US.LAS." + ISO3166_CODES, "US-LAS"); <START> properties.setProperty(PROPERTY_REGION + ".US.LASDEV." + ISO3166_CODES, "US-LASDEV"); <END> return properties; }</code><technical_language>provider zones regions. I assume region IDs "DE" "US", zone IDs "FKB, "FRA", "LAS". right configure this in jclouds is follows: java properties.setProperty(PROPERTY_ISO3166_CODES, "US-NV,DE-HE,DE-BW"); properties.setProperty(PROPERTY_REGIONS, "DE,US"); properties.setProperty(PROPERTY_REGION + ".DE.zones", "FKB,FRA") properties.setProperty(PROPERTY_REGION + ".US.zones", "LAS"); properties.setProperty(PROPERTY_ZONES, "FKB,FRA,LAS"); properties.setProperty(PROPERTY_ZONE + ".FKB." + ISO3166_CODES, "DE-BW"); properties.setProperty(PROPERTY_ZONE + ".FRA." + ISO3166_CODES, "DE-HE"); properties.setProperty(PROPERTY_ZONE + ".LAS." + ISO3166_CODES, "US-NV"); Note fixed ISO codes right ones. Also, zone IDs regions IDs you. Feel free change more user-friendly, "FKB/FRA/LAS" is users "locationId" choosing want deploy VMs</technical_language>

Target:
public static Properties defaultProperties() { Properties properties = ProfitBricksApiMetadata.defaultProperties(); properties.setProperty(PROPERTY_ISO3166_CODES, "US-NV,DE-HE,DE-BW"); properties.setProperty(PROPERTY_REGIONS, "DE,US"); properties.setProperty(PROPERTY_REGION + ".DE.zones", "FKB,FRA"); properties.setProperty(PROPERTY_REGION + ".US.zones", "LAS,LASDEV"); properties.setProperty(PROPERTY_ZONES, "FKB,FRA,LAS,LASDEV"); properties.setProperty(PROPERTY_ZONE + ".FKB." + ISO3166_CODES, "DE-BW"); properties.setProperty(PROPERTY_ZONE + ".FRA." + ISO3166_CODES, "DE-HE"); properties.setProperty(PROPERTY_ZONE + ".LAS." + ISO3166_CODES, "US-NV"); properties.setProperty(PROPERTY_ZONE + ".LASDEV." + ISO3166_CODES, "US-NV"); return properties; }
Source:
<code>public void testDesktopDestroy() { F85_ZK_1148FileDealer.writeMsg("", false); DesktopAgent da = connect(); da.destroy(); <START> Assert.assertEquals("DestroyD is called!DestroyC is called!IncludeVM is called!", F85_ZK_1148FileDealer.readMsg()); <END> F85_ZK_1148FileDealer.close(); }</code><technical_language><LINK_0> forgot potential issue</technical_language>

Target:
public void testDesktopDestroy() { F85_ZK_1148FileDealer.writeMsg("", false); DesktopAgent da = connect(); da.destroy(); try { Assert.assertEquals("DestroyD is called!DestroyC is called!IncludeVM is called!", F85_ZK_1148FileDealer.readMsg()); } finally { F85_ZK_1148FileDealer.close(); } }
Source:
<code>public static org.ovirt.engine.core.common.businessentities.FencingPolicy map(FencingPolicy model, org.ovirt.engine.core.common.businessentities.FencingPolicy template) { org.ovirt.engine.core.common.businessentities.FencingPolicy entity = template != null ? template : new org.ovirt.engine.core.common.businessentities.FencingPolicy(); entity.setFencingEnabled(model.isEnabled()); if (model.isSetSkipIfSdActive()) { entity.setSkipFencingIfSDActive(model.getSkipIfSdActive().isEnabled()); } if (model.isSetSkipIfConnectivityBroken()) { entity.setSkipFencingIfConnectivityBroken(model.getSkipIfConnectivityBroken().isEnabled()); if (model.getSkipIfConnectivityBroken().getThreshold() != null) { entity.setHostsWithBrokenConnectivityThreshold(model.getSkipIfConnectivityBroken().getThreshold()); } else { entity.setHostsWithBrokenConnectivityThreshold(50); } } <START> entity.setSkipFencingIfGlusterBricksUp(model.isSkipIfGlusterBricksUp()); <END> entity.setSkipFencingIfGlusterQuorumNotMet(model.isSkipIfGlusterQuorumNotMet().isEnabled()); return entity; }</code><technical_language>I this call "entity.setSkipFencing..." done if user of API provided a value: if (model.isSetSkipIfGlusterBricksUp()) { entity.setSkipFencing...(); } Otherwise, changing default user of API provide it</technical_language>

Target:
public static org.ovirt.engine.core.common.businessentities.FencingPolicy map(FencingPolicy model, org.ovirt.engine.core.common.businessentities.FencingPolicy template) { org.ovirt.engine.core.common.businessentities.FencingPolicy entity = template != null ? template : new org.ovirt.engine.core.common.businessentities.FencingPolicy(); entity.setFencingEnabled(model.isEnabled()); if (model.isSetSkipIfSdActive()) { entity.setSkipFencingIfSDActive(model.getSkipIfSdActive().isEnabled()); } if (model.isSetSkipIfConnectivityBroken()) { entity.setSkipFencingIfConnectivityBroken(model.getSkipIfConnectivityBroken().isEnabled()); if (model.getSkipIfConnectivityBroken().getThreshold() != null) { entity.setHostsWithBrokenConnectivityThreshold(model.getSkipIfConnectivityBroken().getThreshold()); } else { entity.setHostsWithBrokenConnectivityThreshold(50); } } if (model.isSetSkipIfGlusterBricksUp()) { entity.setSkipFencingIfGlusterBricksUp(model.isSkipIfGlusterBricksUp()); } if (model.isSetSkipIfGlusterQuorumNotMet()) { entity.setSkipFencingIfGlusterQuorumNotMet(model.isSkipIfGlusterQuorumNotMet()); } return entity; }
Source:
<code>public static int[] unsignedByteToIntArray(Object array) { if (array instanceof int[]) <START> return (int[])array; <END> else if (array instanceof byte[]) return unsignedByteToIntArray((byte[])array); else return new int[0]; }</code><technical_language>Please add for one-liners</technical_language>

Target:
public static int[] unsignedByteToIntArray(Object array) { if (array instanceof int[]) { return (int[]) array; } else if (array instanceof byte[]) { return unsignedByteToIntArray((byte[])array); } else { return new int[0]; } }
Source:
<code>public void stop() { synchronized (lock) { if (stopped) { return; } stopped = true; for (SegmentHolder holder : segmentsToDrop.values()) { <START> holder.requestCompleted(false, null); <END> } for (SegmentHolder holder : segmentsToLoad.values()) { holder.requestCompleted(false, null); } segmentsToDrop.clear(); segmentsToLoad.clear(); queuedSize.set(0L); failedAssignCount.set(0); } }</code><technical_language>This is acting requests succeeded, is correct do</technical_language>

Target:
public void stop() { synchronized (lock) { if (stopped) { return; } stopped = true; for (SegmentHolder holder : segmentsToDrop.values()) { holder.requestSucceeded(); } for (SegmentHolder holder : segmentsToLoad.values()) { holder.requestSucceeded(); } segmentsToDrop.clear(); segmentsToLoad.clear(); queuedSize.set(0L); failedAssignCount.set(0); } }
Source:
<code>private byte[] serialize(String topic, GenericRecord avroRecord) { if (avroRecord == null) { return null; } <START> topic = "kipling" + topic + "-value"; <END> Schema schema = avroRecord.getSchema(); try { int schemaId = s_schemaRegistryClient.register(topic, schema); ByteArrayOutputStream out = new ByteArrayOutputStream(); out.write(0); out.write(ByteBuffer.allocate(4).putInt(schemaId).array()); BinaryEncoder encoder = s_encoderFactory.directBinaryEncoder(out, null); DatumWriter<GenericRecord> writer = new GenericDatumWriter<>(schema); writer.write(avroRecord, encoder); encoder.flush(); byte[] bytes = out.toByteArray(); out.close(); return bytes; } catch (IOException e) { throw new SerializationException("Error serializing Avro message", e); } catch (RestClientException e) { throw new SerializationException("Error registering Avro schema: " + schema, e); } }</code><technical_language>is a bit strange reassign a topic is longer name of topic</technical_language>

Target:
private byte[] serialize(String topic, GenericRecord avroRecord) { if (avroRecord == null) { return null; } String schemaName = "kipling-" + topic + "-value"; Schema schema = avroRecord.getSchema(); try { int schemaId = m_schemaRegistryClient.register(schemaName, schema); ByteArrayOutputStream out = new ByteArrayOutputStream(); out.write(0); out.write(ByteBuffer.allocate(4).putInt(schemaId).array()); BinaryEncoder encoder = m_encoderFactory.directBinaryEncoder(out, null); DatumWriter<GenericRecord> writer = new GenericDatumWriter<>(schema); writer.write(avroRecord, encoder); encoder.flush(); byte[] bytes = out.toByteArray(); out.close(); return bytes; } catch (IOException e) { throw new SerializationException("Error serializing Avro message", e); } catch (RestClientException e) { throw new SerializationException("Error registering Avro schema: " + schema, e); } }
Source:
<code>public void testNoOpConfigurationFailsFilterInit() throws ServletException { final RequestParameterPolicyEnforcementFilter filter = new RequestParameterPolicyEnforcementFilter(); final Set<String> initParameterNames = new HashSet<String>(); initParameterNames.add(RequestParameterPolicyEnforcementFilter.ALLOW_MULTI_VALUED_PARAMETERS); initParameterNames.add(RequestParameterPolicyEnforcementFilter.CHARACTERS_TO_FORBID); final Enumeration parameterNamesEnumeration = Collections.enumeration(initParameterNames); final FilterConfig filterConfig = Mockito.mock(FilterConfig.class); <START> Mockito.when(filterConfig.getInitParameterNames()).thenReturn(parameterNamesEnumeration); <END> Mockito.when(filterConfig.getInitParameter(RequestParameterPolicyEnforcementFilter.ALLOW_MULTI_VALUED_PARAMETERS)) .thenReturn("true"); Mockito.when(filterConfig.getInitParameter(RequestParameterPolicyEnforcementFilter.CHARACTERS_TO_FORBID)) .thenReturn("none"); Mockito.when(filterConfig.getInitParameter(RequestParameterPolicyEnforcementFilter.PARAMETERS_TO_CHECK)) .thenReturn(null); filter.init(filterConfig); }</code><technical_language>add a static import avoid typing Mockito. time wanna utilize when. import static org.mockito.Mockito.when;</technical_language>

Target:
public void testNoOpConfigurationFailsFilterInit() throws ServletException { final RequestParameterPolicyEnforcementFilter filter = new RequestParameterPolicyEnforcementFilter(); final Set<String> initParameterNames = new HashSet<String>(); initParameterNames.add(RequestParameterPolicyEnforcementFilter.ALLOW_MULTI_VALUED_PARAMETERS); initParameterNames.add(RequestParameterPolicyEnforcementFilter.CHARACTERS_TO_FORBID); final Enumeration parameterNamesEnumeration = Collections.enumeration(initParameterNames); final FilterConfig filterConfig = mock(FilterConfig.class); when(filterConfig.getInitParameterNames()).thenReturn(parameterNamesEnumeration); when(filterConfig.getInitParameter(RequestParameterPolicyEnforcementFilter.ALLOW_MULTI_VALUED_PARAMETERS)) .thenReturn("true"); when(filterConfig.getInitParameter(RequestParameterPolicyEnforcementFilter.CHARACTERS_TO_FORBID)) .thenReturn("none"); when(filterConfig.getInitParameter(RequestParameterPolicyEnforcementFilter.PARAMETERS_TO_CHECK)) .thenReturn(null); filter.init(filterConfig); }
Source:
<code>public String connect(InetSocketAddress address, int sendBufferSize, int receiveBufferSize, PortType portType) throws IOException { SocketChannel channel = SocketChannel.open(); channel.configureBlocking(false); Socket socket = channel.socket(); socket.setKeepAlive(true); socket.setSendBufferSize(sendBufferSize); socket.setReceiveBufferSize(receiveBufferSize); socket.setTcpNoDelay(true); try { channel.connect(address); } catch (UnresolvedAddressException e) { channel.close(); throw new IOException("Can't resolve address: " + address, e); } catch (IOException e) { channel.close(); throw e; } String connectionId = generateConnectionId(channel); SelectionKey key = channel.register(this.nioSelector, SelectionKey.OP_CONNECT); Transmission transmission = TransmissionFactory <START> .getChannelWrapper(connectionId, channel, key, address.getHostName(), address.getPort(), time, metrics, logger, <END> portType, sslFactory, SSLFactory.Mode.CLIENT); key.attach(transmission); this.keyMap.put(connectionId, key); activeConnections.set(this.keyMap.size()); return connectionId; }</code><technical_language>is this called channelwrapper</technical_language>

Target:
public String connect(InetSocketAddress address, int sendBufferSize, int receiveBufferSize, PortType portType) throws IOException { SocketChannel channel = SocketChannel.open(); channel.configureBlocking(false); Socket socket = channel.socket(); socket.setKeepAlive(true); socket.setSendBufferSize(sendBufferSize); socket.setReceiveBufferSize(receiveBufferSize); socket.setTcpNoDelay(true); try { channel.connect(address); } catch (UnresolvedAddressException e) { channel.close(); throw new IOException("Can't resolve address: " + address, e); } catch (IOException e) { channel.close(); throw e; } String connectionId = generateConnectionId(channel); SelectionKey key = channel.register(this.nioSelector, SelectionKey.OP_CONNECT); Transmission transmission = TransmissionFactory .getTransmission(connectionId, channel, key, address.getHostName(), address.getPort(), time, metrics, portType, sslFactory, SSLFactory.Mode.CLIENT); key.attach(transmission); this.keyMap.put(connectionId, key); activeConnections.set(this.keyMap.size()); return connectionId; }
Source:
<code>public Long createDispoSet(ArtifactReadable author, BranchId branch, DispoSet descriptor) { TransactionBuilder tx = getTxFactory().createTransaction(branch, author, "Create Dispo Set"); ArtifactId creatdArtId = tx.createArtifact(DispoConstants.DispoSet, descriptor.getName()); tx.setSoleAttributeValue(creatdArtId, DispoConstants.ImportPath, descriptor.getImportPath()); tx.setSoleAttributeValue(creatdArtId, DispoConstants.ImportState, descriptor.getImportState()); tx.setSoleAttributeValue(creatdArtId, DispoConstants.DispoType, descriptor.getDispoType()); try { <START> String notes = JsonUtil.getMapper().writer().writeValueAsString(descriptor.getNotesList()); <END> tx.setSoleAttributeValue(creatdArtId, DispoConstants.DispoNotesJson, notes); } catch (Exception ex) { throw new OseeCoreException("Could not parse Notes Json", ex); } tx.setSoleAttributeValue(creatdArtId, DispoConstants.DispoCiSet, descriptor.getCiSet()); tx.setSoleAttributeValue(creatdArtId, DispoConstants.DispoRerunList, descriptor.getRerunList()); tx.setSoleAttributeValue(creatdArtId, DispoConstants.DispoTime, descriptor.getTime()); tx.commit(); return creatdArtId.getUuid(); }</code><technical_language>is this done here</technical_language>

Target:
public Long createDispoSet(ArtifactReadable author, BranchId branch, DispoSet descriptor) { TransactionBuilder tx = getTxFactory().createTransaction(branch, author, "Create Dispo Set"); ArtifactId creatdArtId = tx.createArtifact(DispoConstants.DispoSet, descriptor.getName()); tx.setSoleAttributeValue(creatdArtId, DispoConstants.ImportPath, descriptor.getImportPath()); tx.setSoleAttributeValue(creatdArtId, DispoConstants.ImportState, descriptor.getImportState()); tx.setSoleAttributeValue(creatdArtId, DispoConstants.DispoType, descriptor.getDispoType()); tx.setSoleAttributeValue(creatdArtId, DispoConstants.DispoNotesJson, JsonUtil.toJson(descriptor.getNotesList())); tx.setSoleAttributeValue(creatdArtId, DispoConstants.DispoCiSet, descriptor.getCiSet()); tx.setSoleAttributeValue(creatdArtId, DispoConstants.DispoRerunList, descriptor.getRerunList()); tx.setSoleAttributeValue(creatdArtId, DispoConstants.DispoTime, descriptor.getTime()); tx.commit(); return creatdArtId.getUuid(); }
Source:
<code>public void writeObject(ObjectOutput output, T collection) throws IOException { <START> Optional<Object> found = Optional.empty(); <END> for (Object o : collection) { found = Optional.of(o); break; } output.writeObject(found.get()); }</code><technical_language>output.writeObject(collection.iterator().next());</technical_language>

Target:
public void writeObject(ObjectOutput output, T collection) throws IOException { output.writeObject(collection.iterator().next()); }
Source:
<code>public static void main(String[] args) { if (args.length != 3) printUsage(); try { Version version = parseVersionString(args[0]); if (version == null) { System.err.println( "Invalid version number format, must be \"x.y.z(-.*)?\""); System.exit(1); } String rev = args[1]; if (rev == null || rev.trim().isEmpty()) { rev = "-1"; <START> } <END> generateFile(new File("."), version, rev, args[2]); } catch (NumberFormatException e) { System.err.println( "All version-related parameters must be valid integers!"); throw e; } }</code><technical_language>Else block is missing. add rev.trim() function</technical_language>

Target:
public static void main(String[] args) { if (args.length != 3) printUsage(); try { Version version = parseVersionString(args[0]); if (version == null) { System.err.println( "Invalid version number format, must be \"x.y.z(-.*)?\""); System.exit(1); } String rev = args[1]; if (rev == null || rev.trim().isEmpty()) { rev = "-1"; } else { rev = rev.trim(); } generateFile(new File("."), version, rev, args[2]); } catch (NumberFormatException e) { System.err.println( "All version-related parameters must be valid integers!"); throw e; } }
Source:
<code>public CommandResponse run(ZooKeeperServer zkServer, Map<String, String> kwargs) { CommandResponse response = initializeResponse(); if (zkServer instanceof QuorumZooKeeperServer) { QuorumPeer peer = ((QuorumZooKeeperServer) zkServer).self; <START> response.put("current_config", peer.getVotingView()); <END> } else { response.put("current_config", ""); } return response; }</code><technical_language>create explicit bean for representation this endpoint (that is a JSON based API) If change internal class change this API notice. Thoughts</technical_language>

Target:
public CommandResponse run(ZooKeeperServer zkServer, Map<String, String> kwargs) { CommandResponse response = initializeResponse(); if (zkServer instanceof QuorumZooKeeperServer) { QuorumPeer peer = ((QuorumZooKeeperServer) zkServer).self; VotingView votingView = new VotingView(peer.getVotingView()); response.put("current_config", votingView); } else { response.put("current_config", Collections.emptyMap()); } return response; }
Source:
<code>public void setAsText(String name) throws IllegalArgumentException { String text = name; if (performTrimming) { text = name.trim(); } if (text.contains(" ")) { <START> text = text.replaceAll(REPEATING_SPACES_REGEXP, " "); <END> } setValue(text); }</code><technical_language>AFAIR replaceAll compile regexp method's invocation. Pattern compile regexp once</technical_language>

Target:
public void setAsText(String name) throws IllegalArgumentException { String text = name; if (performTrimming) { text = name.trim(); } if (text.contains(" ")) { text = REPEATING_SPACES.matcher(text).replaceAll(" "); } setValue(text); }
Source:
<code>void bucketAccessed(long bucketId) { <START> accessedBucketIds.add(bucketId); <END> if (System.currentTimeMillis() - lastUpdateAccessTime > updateAccessTimeInterval) { synchronized (this) { Iterator<BucketIdTimeWrapper> bucketIter = bucketHeapForAccess.iterator(); while (bucketIter.hasNext()) { if (accessedBucketIds.contains(bucketIter.next().bucketId)) { bucketIter.remove(); } } for (long id : accessedBucketIds) { bucketHeapForAccess.add(new BucketIdTimeWrapper(id)); } } accessedBucketIds.clear(); lastUpdateAccessTime = System.currentTimeMillis(); } }</code><technical_language>accessBucketIds is a ConcurrentSet. this create a problem multiple threads call this method</technical_language>

Target:
void bucketAccessed(long bucketId) { long now = System.currentTimeMillis(); if (accessedBucketIds.add(bucketId) || now - lastUpdateAccessTime > updateAccessTimeInterval) { synchronized (bucketLastAccess) { for (long id : accessedBucketIds) { MutableLong lastAccessTime = bucketLastAccess.get(id); if (lastAccessTime != null) { lastAccessTime.setValue(now); } else { bucketLastAccess.put(id, new MutableLong(now)); } } } accessedBucketIds.clear(); lastUpdateAccessTime = now; } }
Source:
<code>private ItemStack getOveralls(Entity entity) { if (entity instanceof EntityPlayer) { EntityPlayer player = ((EntityPlayer) entity); ItemStack pants = player.getItemStackFromSlot(EntityEquipmentSlot.LEGS); <START> if (pants != InvTools.emptyStack() && RailcraftItems.OVERALLS.isInstance(pants) && !((EntityPlayer) entity).capabilities.isCreativeMode) <END> return pants; } return InvTools.emptyStack(); }</code><technical_language>!InvTools.isEmpty(pants)</technical_language>

Target:
private ItemStack getOveralls(Entity entity) { if (entity instanceof EntityPlayer) { EntityPlayer player = ((EntityPlayer) entity); ItemStack pants = player.getItemStackFromSlot(EntityEquipmentSlot.LEGS); if (!InvTools.isEmpty(pants) && RailcraftItems.OVERALLS.isInstance(pants) && !((EntityPlayer) entity).capabilities.isCreativeMode) return pants; } return InvTools.emptyStack(); }
Source:
<code>public void setConf(final Configuration conf) { super.setConf(conf); try { long cacheRefreshPeriod = conf.getLong(HFILE_CACHE_REFRESH_PERIOD_CONF_KEY, DEFAULT_HFILE_CACHE_REFRESH_PERIOD); final FileSystem fs = CommonFSUtils.getCurrentFileSystem(conf); Path rootDir = CommonFSUtils.getRootDir(conf); Path workingDir = SnapshotDescriptionUtils.getWorkingSnapshotDir(rootDir, conf); FileSystem workingFs = workingDir.getFileSystem(conf); cache = new SnapshotFileCache(fs, rootDir, workingFs, workingDir, cacheRefreshPeriod, cacheRefreshPeriod, "snapshot-hfile-cleaner-cache-refresher", new SnapshotFileCache.SnapshotFileInspector() { @Override <START> public Collection<String> filesUnderSnapshot(final FileSystem workingFs, <END> final Path snapshotDir) throws IOException { return SnapshotReferenceUtil.getHFileNames(conf, workingFs, snapshotDir); } }); } catch (IOException e) { LOG.error("Failed to create cleaner util", e); } }</code><technical_language>This fs workingFs fs passed in</technical_language>

Target:
public void setConf(final Configuration conf) { super.setConf(conf); try { long cacheRefreshPeriod = conf.getLong(HFILE_CACHE_REFRESH_PERIOD_CONF_KEY, DEFAULT_HFILE_CACHE_REFRESH_PERIOD); final FileSystem fs = CommonFSUtils.getCurrentFileSystem(conf); Path rootDir = CommonFSUtils.getRootDir(conf); Path workingDir = SnapshotDescriptionUtils.getWorkingSnapshotDir(rootDir, conf); FileSystem workingFs = workingDir.getFileSystem(conf); cache = new SnapshotFileCache(fs, rootDir, workingFs, workingDir, cacheRefreshPeriod, cacheRefreshPeriod, "snapshot-hfile-cleaner-cache-refresher", new SnapshotFileCache.SnapshotFileInspector() { @Override public Collection<String> filesUnderSnapshot(final FileSystem fs, final Path snapshotDir) throws IOException { return SnapshotReferenceUtil.getHFileNames(conf, fs, snapshotDir); } }); } catch (IOException e) { LOG.error("Failed to create cleaner util", e); } }
Source:
<code>protected void inflateBaseMenu(Context context, PopupMenu menu) { <START> if (PreferenceManager.getDefaultSharedPreferences(context).getBoolean("replace-app-history-with-favs", false)) { <END> if (context instanceof MainActivity) { menu.getMenuInflater().inflate(R.menu.menu_item_favorite_add, menu.getMenu()); } } }</code><technical_language>i this is leftover code ;)</technical_language>

Target:
protected void inflateBaseMenu(Context context, PopupMenu menu) { String favApps = PreferenceManager.getDefaultSharedPreferences(context). getString("favorite-apps-list", ""); if (!favApps.contains(this.pojo.id + ";")) { menu.getMenuInflater().inflate(R.menu.menu_item_favorite_add, menu.getMenu()); } }
Source:
<code><START> private void initialize() { <END> try { AccessController.doPrivileged(new PrivilegedExceptionAction<Void>() { @Override public synchronized Void run() { if (threadPool == null) { threadPool = createThreadPool("common", minThreadsShared, maxThreadsShared, keepAliveTimeoutShared); } if (sharedHttpClient == null) { sharedHttpClient = createHttpClientInternal("common", null); sharedHttpClientFacade = new HttpClientDelegate(sharedHttpClient); logger.info("jetty shared http client created"); } return null; } }); } catch (PrivilegedActionException e) { Throwable cause = e.getCause(); if (cause instanceof RuntimeException) { throw (RuntimeException) cause; } else { throw new RuntimeException(cause); } } }</code><technical_language>I some kind of synchronization/locking avoid threads requesting client concurrently executing initialize method in parallel</technical_language>

Target:
private synchronized void initialize() { if (threadPool == null || commonHttpClient == null) { try { AccessController.doPrivileged(new PrivilegedExceptionAction<Void>() { @Override public Void run() { if (threadPool == null) { threadPool = createThreadPool("common", minThreadsShared, maxThreadsShared, keepAliveTimeoutShared); } if (commonHttpClient == null) { commonHttpClient = createHttpClientInternal("common", null); commonHttpClientFacade = new HttpClientDelegate(commonHttpClient); logger.info("jetty shared http client created"); } return null; } }); } catch (PrivilegedActionException e) { Throwable cause = e.getCause(); if (cause instanceof RuntimeException) { throw (RuntimeException) cause; } else { throw new RuntimeException(cause); } } } }
Source:
<code>protected void enqueue(Collection<?> col) { assert Thread.holdsLock(this); <START> if(limit <= 0 || total.addAndGet(col.size()) <= limit) { <END> queue.add((Collection<R>)col); cnt.addAndGet(col.size()); } else { int toAdd = col.size() - total.get() + limit; queue.add(new ArrayList(col).subList(0, toAdd)); cnt.addAndGet(toAdd); } }</code><technical_language>Is rewrite this adding 'total' field, CAS-loop cnt.getAndUpdate()</technical_language>

Target:
protected void enqueue(Collection<?> col) { assert Thread.holdsLock(this); if (limitDisabled) { queue.add((Collection<R>)col); cnt.addAndGet(col.size()); } else { if (capacity >= col.size()) { queue.add((Collection<R>)col); capacity -= col.size(); cnt.addAndGet(col.size()); } else if (capacity > 0) { queue.add(new ArrayList<>((Collection<R>)col).subList(0, capacity)); capacity = 0; cnt.addAndGet(capacity); } } }
Source:
<code><START> public int hashCode() { <END> final int prime = 31; int result = 1; result = prime * result + ((key == null) ? 0 : key.hashCode()); result = prime * result + ((value == null) ? 0 : value.hashCode()); return result; }</code><technical_language>guava</technical_language>

Target:
public int hashCode() { return Objects.hashCode(key, value); }
Source:
<code>private boolean showDeletionNotification(Context context, Media media, boolean result) { String message; String title = context.getString(R.string.delete_helper_show_deletion_notification_title); if (result) { title += context.getString(R.string.delete_helper_show_deletion_notification_title_if); message = context.getString(R.string.delete_helper_show_deletion_notification_message_if_1)+ " " + media.getDisplayTitle() + context.getString(R.string.delete_helper_show_deletion_notification_message_if_2); } else { <START> title += context.getString(R.string.delete_helper_show_deletion_notification_title_else); <END> message = context.getString(R.string.delete_helper_show_deletion_notification_message_else); } String urlForDelete = BuildConfig.COMMONS_URL + "/wiki/Commons:Deletion_requests/" + media.getFilename(); Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(urlForDelete)); notificationHelper.showNotification(context, title, message, NOTIFICATION_DELETE, browserIntent); return result; }</code><technical_language>Ideally this string "Failed" operation shuld ": "+[string]</technical_language>

Target:
private boolean showDeletionNotification(Context context, Media media, boolean result) { String message; String title = context.getString(R.string.delete_helper_show_deletion_title); if (result) { title += ": " + context.getString(R.string.delete_helper_show_deletion_title_success); message = context.getString((R.string.delete_helper_show_deletion_message_if),media.getDisplayTitle()); } else { title += ": " + context.getString(R.string.delete_helper_show_deletion_title_failed); message = context.getString(R.string.delete_helper_show_deletion_message_else) ; } String urlForDelete = BuildConfig.COMMONS_URL + "/wiki/Commons:Deletion_requests/" + media.getFilename(); Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(urlForDelete)); notificationHelper.showNotification(context, title, message, NOTIFICATION_DELETE, browserIntent); return result; }
Source:
<code>public void callPrivateMethodWithBigIntegerParam() { Assert.assertNull(controller.getModel().getBigIntegerValue()); <START> BigInteger value = BigInteger.TEN; <END> controller.invoke(PUBLIC_WITH_BIGINTEGER_PARAM_ACTION, new Param(PARAM_NAME, value)); Assert.assertEquals(controller.getModel().getBigIntegerValue(), value); }</code><technical_language>final for vars do change</technical_language>

Target:
public void callPrivateMethodWithBigIntegerParam() { Assert.assertNull(controller.getModel().getBigIntegerValue()); final BigInteger value = BigInteger.TEN; controller.invoke(PUBLIC_WITH_BIGINTEGER_PARAM_ACTION, new Param(PARAM_NAME, value)); Assert.assertEquals(controller.getModel().getBigIntegerValue(), value); }
Source:
<code>private void testTrackerAtKey(CloudBigtableIO.Reader<Result> underTest, ByteKeyRangeTracker tracker, final String key, final int count) throws IOException { setRowKey(key); tracker.tryReturnRecordAt(false, ByteKey.copyFrom(key.getBytes())); Assert.assertTrue(underTest.start()); Assert.assertEquals(count, underTest.getRowsReadCount()); Assert.assertEquals(tracker.getFractionConsumed(), underTest.getFractionConsumed().doubleValue(), .001d); <START> } <END></code><technical_language>golden standard for correctness thread-safety splitAtFractionExhaustive test. spins multiple threads read records split in parallel expose threading bugs. <LINK_0></technical_language>

Target:
private void testTrackerAtKey(CloudBigtableIO.Reader<Result> underTest, ByteKeyRangeTracker tracker, final String key, final int count) throws IOException { setRowKey(key); tracker.tryReturnRecordAt(true, ByteKey.copyFrom(key.getBytes())); Assert.assertTrue(underTest.start()); Assert.assertEquals(count, underTest.getRowsReadCount()); Assert.assertEquals(tracker.getFractionConsumed(), underTest.getFractionConsumed().doubleValue(), .001d); }
Source:
<code>public boolean canInsert( final ItemStack stack ) { if( stack.isEmpty() || stack.getItem() == Items.AIR ) { return false; } try { final IMEMonitor<IAEItemStack> inv = this.getProxy().getStorage().getInventory( AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) ); final IAEItemStack out = inv.injectItems( this.lastItemChecked = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createStack( stack ), Actionable.SIMULATE, this.source ); if( out == null ) { return true; } return out.getStackSize() != stack.getCount(); } <START> catch( GridAccessException ex ) <END> { return false; } }</code><technical_language>![MAJOR](<LINK_1> 'Severity: MAJOR') log rethrow this exception. [![rule](<LINK_2>](<LINK_0></technical_language>

Target:
public boolean canInsert( final ItemStack stack ) { if( stack.isEmpty() || stack.getItem() == Items.AIR ) { return false; } try { final IMEMonitor<IAEItemStack> inv = this.getProxy().getStorage().getInventory( AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) ); final IAEItemStack out = inv.injectItems( AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createStack( stack ), Actionable.SIMULATE, this.source ); if( out == null ) { return true; } return out.getStackSize() != stack.getCount(); } catch( GridAccessException ex ) { return false; } }
Source:
<code>public void addRuleConfig (String key, String defaultValue, String value) { <START> this.ruleConfigs.put(key, new RuleConfig(key, defaultValue, value)); <END> }</code><technical_language>add rule config file</technical_language>

Target:
public void addRuleConfig (String key, String defaultValue, String value) { this.ruleConfigs.put(key, new RuleConfig(key, defaultValue, value)); if (! this.getConfig().containsKey(key)) { this.getConfig().setProperty(key, value); } }