auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void basicTest() { DiagnosticsStreamMessage diagnosticsStreamMessage = getDiagnosticsStreamMessage(); Collection<DiagnosticsExceptionEvent> exceptionEventList = getExceptionList(); diagnosticsStreamMessage.addDiagnosticsExceptionEvents(exceptionEventList); diagnosticsStreamMessage.addProcessorStopEvents(getProcessorStopEventList()); diagnosticsStreamMessage.addContainerModels(getSampleContainerModels()); <START> Assert.assertTrue(diagnosticsStreamMessage.getContainerMb().equals(1024)); <END> Assert.assertTrue(diagnosticsStreamMessage.getContainerNumCores().equals(2)); Assert.assertTrue(diagnosticsStreamMessage.getNumStoresWithChangelog().equals(3)); Assert.assertTrue(exceptionEventList.equals(diagnosticsStreamMessage.getExceptionEvents())); Assert.assertEquals(getSampleContainerModels(), diagnosticsStreamMessage.getContainerModels()); Assert.assertEquals(diagnosticsStreamMessage.getProcessorStopEvents(), getProcessorStopEventList()); }</code><technical_language>Minor: Assert.assertEquals</technical_language>

Target:
public void basicTest() { DiagnosticsStreamMessage diagnosticsStreamMessage = getDiagnosticsStreamMessage(); Collection<DiagnosticsExceptionEvent> exceptionEventList = getExceptionList(); diagnosticsStreamMessage.addDiagnosticsExceptionEvents(exceptionEventList); diagnosticsStreamMessage.addProcessorStopEvents(getProcessorStopEventList()); diagnosticsStreamMessage.addContainerModels(getSampleContainerModels()); Assert.assertEquals(1024, (int) diagnosticsStreamMessage.getContainerMb()); Assert.assertEquals(2, (int) diagnosticsStreamMessage.getContainerNumCores()); Assert.assertEquals(3, (int) diagnosticsStreamMessage.getNumStoresWithChangelog()); Assert.assertEquals(exceptionEventList, diagnosticsStreamMessage.getExceptionEvents()); Assert.assertEquals(getSampleContainerModels(), diagnosticsStreamMessage.getContainerModels()); Assert.assertEquals(diagnosticsStreamMessage.getProcessorStopEvents(), getProcessorStopEventList()); }
Source:
<code><START> public void saveValidityBackup() throws IOException { <END> final String backupValidityKey = _sessionIdFormat.createBackupKey( _validityKey ); final int maxInactiveInterval = _session.getMaxInactiveInterval(); final int expiration = maxInactiveInterval <= 0 ? 0 : maxInactiveInterval; _memcached.set( backupValidityKey, toMemcachedExpiration(expiration), _validityData ); }</code><technical_language>This block</technical_language>

Target:
public void saveValidityBackup() { final String backupValidityKey = _sessionIdFormat.createBackupKey( _validityKey ); final int maxInactiveInterval = _session.getMaxInactiveInterval(); final int expiration = maxInactiveInterval <= 0 ? 0 : maxInactiveInterval; _memcached.set( backupValidityKey, toMemcachedExpiration(expiration), _validityData ); }
Source:
<code>private static TemporalType find( int temporalType ) { <START> if ( temporalType < TYPES.length ) <END> { return TYPES[temporalType]; } else { return TEMPORAL_INVALID; } }</code><technical_language>&& temporalType >= 0</technical_language>

Target:
private static TemporalType find( int temporalType ) { if ( temporalType < TYPES.length && temporalType >= 0 ) { return TYPES[temporalType]; } else { return TEMPORAL_INVALID; } }
Source:
<code>public static <T> Class<T> classForName(ResourceLoader resourceLoader, String className) { try { return cast(resourceLoader.classForName(className)); } catch (Exception e) { CommonLogger.LOG.cannotLoadClassUsingResourceLoader(className); CommonLogger.LOG.catchingTrace(e); } try { return cast(Class.forName(className)); <START> } catch (Exception e) { <END> throw CommonLogger.LOG.cannotLoadClass(className, e); } catch (LinkageError e) { throw new ResourceLoadingException("Error loading class " + className, e); } }</code><technical_language>catch (Exception | LinkageError e) {...</technical_language>

Target:
public static <T> Class<T> classForName(ResourceLoader resourceLoader, String className) { try { return cast(resourceLoader.classForName(className)); } catch (Exception e) { CommonLogger.LOG.cannotLoadClassUsingResourceLoader(className); CommonLogger.LOG.catchingTrace(e); } try { return cast(Class.forName(className)); } catch (Exception | LinkageError e) { throw CommonLogger.LOG.cannotLoadClass(className, e); } }
Source:
<code><START> Mono<Response<ConfigurationSetting>> setReadOnly(ConfigurationSetting setting, Context context) { <END> validateSetting(setting); return service.lockKeyValue(serviceEndpoint, setting.getKey(), setting.getLabel(), null, null, context) .doOnRequest(ignoredValue -> logger.info("Setting read only ConfigurationSetting - {}", setting)) .doOnSuccess(response -> logger.info("Set read only ConfigurationSetting - {}", response.getValue())) .doOnError(error -> logger.info("Failed to set read only ConfigurationSetting - {}", setting, error)); }</code><technical_language>package private private</technical_language>

Target:
Mono<Response<ConfigurationSetting>> setReadOnly(ConfigurationSetting setting, Context context) { validateSetting(setting); return service.lockKeyValue(serviceEndpoint, setting.getKey(), setting.getLabel(), null, null, context) .doOnSubscribe(ignoredValue -> logger.verbose("Setting read only ConfigurationSetting - {}", setting)) .doOnSuccess(response -> logger.info("Set read only ConfigurationSetting - {}", response.getValue())) .doOnError(error -> logger.warning("Failed to set read only ConfigurationSetting - {}", setting, error)); }
Source:
<code>protected void executeVmCommand() { ImagesHandler.setDiskAlias(getParameters().getDiskInfo(), getVm()); if (resizeDiskImageRequested()) { extendDiskImageSize(); } else { try { performDiskUpdate(false); List<Pair<VM, VmDevice>> vmsForDisk = getVmDAO().getVmsWithPlugInfo(getParameters().getDiskId()); <START> for (Pair<VM, VmDevice> pair : vmsForDisk) { <END> getVmStaticDAO().incrementDbGeneration(pair.getFirst().getId()); } } finally { freeLock(); } } }</code><technical_language>getVmsDiskPluggedTo()</technical_language>

Target:
protected void executeVmCommand() { ImagesHandler.setDiskAlias(getParameters().getDiskInfo(), getVm()); if (resizeDiskImageRequested()) { extendDiskImageSize(); } else { try { performDiskUpdate(false); } finally { freeLock(); } } }
Source:
<code>public boolean canHandleType(Class<?> payloadType) { return inspector.getHandlers(listenerType) <START> .filter(messageHandler -> !messageHandler.hasAnnotation(ResetHandler.class)) <END> .anyMatch(handler -> handler.canHandleType(payloadType)); }</code><technical_language>idea of meta-annotations is check actual annotation used. Instead, check MessageHandler annotation declares a type of message is compatible EventMessage</technical_language>

Target:
public boolean canHandleType(Class<?> payloadType) { return inspector.getHandlers(listenerType) .filter(this::handlesEventMessage) .anyMatch(handler -> handler.canHandleType(payloadType)); }
Source:
<code>public void cleanup() { <START> buildConfigs.forEach(bc -> cleanUpResource(client, bc)); <END> cleanUpResource(client, project); }</code><technical_language>able delete project if dont want individual calls</technical_language>

Target:
public static void cleanup() { cleanUpResource(client, project); }
Source:
<code>public Long getLimit(String capability) { <START> Long val = capabilityLimitMap.get(capability); <END> if (capability.equals(CAPABILITY_OFFHEAP) && isSubscriptionBasedLicense()) { if (val != null) { return val; } return UNLIMITED_STORAGE_AMT_IN_MB; } return val; }</code><technical_language>this clearer as: java if (capability.equals(CAPABILITY_OFFHEAP) && isSubscriptionBasedLicense()) { return capabilityLimitMap.getOrDefault(capability, UNLIMITED_STORAGE_AMT_IN_MB); } else { return capabilityLimitMap.get(capability); } This captures logic of subscription licenses unlimited offheap default succinctly I think</technical_language>

Target:
public Long getLimit(String capability) { return capabilityLimitMap.get(capability); }
Source:
<code>public void close() { <START> enabled.set(false); <END> if (indexScanner != null) { indexScanner.cancel(); } if (queueProcessor != null) { queueProcessor.cancel(); } }</code><technical_language>compareAndSet() need execute rest of statements if this is false, right</technical_language>

Target:
public void close() { if (enabled.compareAndSet(true, false)) { if (indexScanner != null) { indexScanner.cancel(); } if (queueProcessor != null) { queueProcessor.cancel(); } } }
Source:
<code>public void testMarkerColor() { RGBAColor rgbaColor; RGBA rgbaColorToCompare; String[] testColors = X11TestColors.getColors(); for (int i = 0; i < testColors.length; i++) { TraceMarker traceMarker = new TraceMarker("Marker" + String.valueOf(i), null, fTrace.getStartTime().toNanos(), fTrace.getEndTime().toNanos(), testColors[i]); <START> String hexColor = X11ColorUtils.toHexColor(testColors[i]); <END> if (hexColor != null) { rgbaColor = new RGBAColor(Integer.parseInt(hexColor.substring(1), 16)); rgbaColorToCompare = new RGBA(rgbaColor.getRed(), rgbaColor.getGreen(), rgbaColor.getBlue(), ALPHA); assertTrue(traceMarker.getRGBAColor().equals(rgbaColorToCompare)); } else { fail(X11_COLOR_ERROR_MESSAGE); } } TraceMarker traceMarker = new TraceMarker("", "", fTrace.getStartTime().toNanos(), fTrace.getEndTime().toNanos(), ""); String hexColor = X11ColorUtils.toHexColor(DEFAULT_COLOR); if (hexColor != null) { rgbaColor = new RGBAColor(Integer.parseInt(hexColor.substring(1), 16)); rgbaColorToCompare = new RGBA(rgbaColor.getRed(), rgbaColor.getGreen(), rgbaColor.getBlue(), ALPHA); assertTrue(traceMarker.getRGBAColor().equals(rgbaColorToCompare)); traceMarker = new TraceMarker("", "", fTrace.getStartTime().toNanos(), fTrace.getEndTime().toNanos(), "invalid"); assertTrue(traceMarker.getRGBAColor().equals(rgbaColorToCompare)); traceMarker = new TraceMarker("", "", fTrace.getStartTime().toNanos(), fTrace.getEndTime().toNanos(), null); assertTrue(traceMarker.getRGBAColor().equals(rgbaColorToCompare)); } else { fail(X11_COLOR_ERROR_MESSAGE); } }</code><technical_language>need test X11ColorUtils class, is job of scripting test. Assume this works a colors examples</technical_language>

Target:
public void testMarkerColor() { RGBAColor rgbaColor; RGBA rgbaColorToCompare; for (int i = 0; i < TEST_COLORS.length; i++) { TraceMarker traceMarker = new TraceMarker("Marker" + String.valueOf(i), null, fTrace.getStartTime().toNanos(), fTrace.getEndTime().toNanos(), TEST_COLORS[i]); String hexColor = X11ColorUtils.toHexColor(TEST_COLORS[i]); assertNotNull(hexColor); rgbaColor = new RGBAColor(Integer.parseInt(hexColor.substring(1), 16)); rgbaColorToCompare = new RGBA(rgbaColor.getRed(), rgbaColor.getGreen(), rgbaColor.getBlue(), ALPHA); assertTrue(traceMarker.getRGBAColor().equals(rgbaColorToCompare)); } TraceMarker traceMarker = new TraceMarker("", "", fTrace.getStartTime().toNanos(), fTrace.getEndTime().toNanos(), ""); String hexColor = X11ColorUtils.toHexColor(DEFAULT_COLOR); assertNotNull(hexColor); rgbaColor = new RGBAColor(Integer.parseInt(hexColor.substring(1), 16)); rgbaColorToCompare = new RGBA(rgbaColor.getRed(), rgbaColor.getGreen(), rgbaColor.getBlue(), ALPHA); assertTrue(traceMarker.getRGBAColor().equals(rgbaColorToCompare)); traceMarker = new TraceMarker("", "", fTrace.getStartTime().toNanos(), fTrace.getEndTime().toNanos(), "invalid"); assertTrue(traceMarker.getRGBAColor().equals(rgbaColorToCompare)); traceMarker = new TraceMarker("", "", fTrace.getStartTime().toNanos(), fTrace.getEndTime().toNanos(), null); assertTrue(traceMarker.getRGBAColor().equals(rgbaColorToCompare)); }
Source:
<code>public Deregistration removeRegistration(String registrationId) { try (Jedis j = pool.getResource()) { byte[] regKey = toRegIdKey(registrationId); byte[] ep = j.get(regKey); if (ep == null) { return null; } byte[] data = j.get(toEndpointKey(ep)); if (data == null) { return null; } Registration r = deserializeReg(data); <START> deleteClient(j, r); <END> Collection<Observation> obsRemoved = unsafeRemoveAllObservations(j, r.getId()); return new Deregistration(r, obsRemoved); } }</code><technical_language>boom:</technical_language>

Target:
public Deregistration removeRegistration(String registrationId) { try (Jedis j = pool.getResource()) { byte[] regKey = toRegIdKey(registrationId); byte[] ep = j.get(regKey); if (ep == null) { return null; } byte[] data = j.get(toEndpointKey(ep)); if (data == null) { return null; } Registration r = deserializeReg(data); deleteRegistration(j, r); Collection<Observation> obsRemoved = unsafeRemoveAllObservations(j, r.getId()); return new Deregistration(r, obsRemoved); } }
Source:
<code>public void visitIfStatement(IfStatementTree tree) { super.visitIfStatement(tree); boolean elseClauseReturnsBoolean = tree.elseClause() != null && returnsBoolean(getStatement(tree.elseClause().statements())); boolean mainClauseReturnsBoolean = returnsBoolean(getStatement(tree.statements())); <START> if (tree.elseifClauses().isEmpty() && mainClauseReturnsBoolean && elseClauseReturnsBoolean) { <END> context().newIssue(KEY, MESSAGE).tree(tree); } }</code><technical_language>@vilchik-elena Minor performance improvement: currently evaluate 3 boolean expressions, avoid that</technical_language>

Target:
public void visitIfStatement(IfStatementTree tree) { super.visitIfStatement(tree); if (!tree.elseifClauses().isEmpty() || tree.elseClause() == null) { return; } if (returnsBoolean(getSingleStatement(tree.statements())) && returnsBoolean(getSingleStatement(tree.elseClause().statements()))) { context().newIssue(KEY, MESSAGE).tree(tree); } }
Source:
<code>public void uploadAttachment(UploadedFile file) throws IOException { Attachment attachment = new Attachment(file, loggedUser.getCurrent(), clientIp.get()); attachments.save(attachment); <START> fileStorage.save(attachment); <END> result.use(json()).withoutRoot().from(attachment).serialize(); }</code><technical_language>This forget save attachments filesystem database. I guess a repository approach here: attachments.add(attachment) both: save database filesystem</technical_language>

Target:
public void uploadAttachment(UploadedFile file) throws IOException { Attachment attachment = new Attachment(file, loggedUser.getCurrent(), clientIp.get()); attachments.save(attachment); result.use(json()).withoutRoot().from(attachment).serialize(); }
Source:
<code>public ConjurerFirehoseFactory( @JsonProperty("startTime") Long startTime, @JsonProperty("stopTime") Long stopTime, @JsonProperty("linesPerSec") Integer linesPerSec, @JsonProperty("maxLines") Long maxLines, @JsonProperty("filePath") String filePath ) { <START> this(Conjurer.getBuilder().withStartTime(startTime).withStopTime(stopTime).withMaxLines(maxLines).withFilePath(filePath).withLinesPerSec(linesPerSec).withCustomSchema(true)); <END> }</code><technical_language>formatting</technical_language>

Target:
public ConjurerFirehoseFactory( @JsonProperty("startTime") Long startTime, @JsonProperty("stopTime") Long stopTime, @JsonProperty("linesPerSec") Integer linesPerSec, @JsonProperty("maxLines") Long maxLines, @JsonProperty("filePath") String filePath ) { this( Conjurer.getBuilder() .withStartTime(startTime) .withStopTime(stopTime) .withMaxLines(maxLines) .withFilePath(filePath) .withLinesPerSec(linesPerSec) ); }
Source:
<code>public void onNext(M message, MessageCollector collector, TaskCoordinator coordinator) { K key = thisPartialJoinFn.getKey(message); thisPartialJoinFn.getState().put(key, new PartialJoinMessage<>(message, System.currentTimeMillis())); PartialJoinMessage<JM> otherMessage = otherPartialJoinFn.getState().get(key); if (otherMessage != null) { <START> RM joinResult = thisPartialJoinFn.apply(message, otherMessage.getMessage()); <END> this.propagateResult(joinResult, collector, coordinator); } }</code><technical_language>a lazy removal of buffered messages, skip expired messages in join result well</technical_language>

Target:
public void onNext(M message, MessageCollector collector, TaskCoordinator coordinator) { K key = thisPartialJoinFn.getKey(message); thisPartialJoinFn.getState().put(key, new PartialJoinMessage<>(message, System.currentTimeMillis())); PartialJoinMessage<JM> otherMessage = otherPartialJoinFn.getState().get(key); long now = System.currentTimeMillis(); if (otherMessage != null && otherMessage.getReceivedTimeMs() > now - ttlMs) { RM joinResult = thisPartialJoinFn.apply(message, otherMessage.getMessage()); this.propagateResult(joinResult, collector, coordinator); } }
Source:
<code>public void init() { if (entityViewManager.isUnsatisfied()) { this.entityViewAwareObjectMapper = null; } else { ObjectMapper mapper = null; ContextResolver<ObjectMapper> resolver; if (providers != null && (resolver = providers.getContextResolver(ObjectMapper.class, MediaType.APPLICATION_JSON_TYPE)) != null) { mapper = resolver.getContext(EntityViewMessageBodyReader.class); } if (mapper == null) { if (objectMapper.isUnsatisfied()) { mapper = new ObjectMapper(); } else { mapper = objectMapper.get(); } } <START> this.entityViewAwareObjectMapper = new EntityViewAwareObjectMapper(new LazyEntityViewManager(), new ObjectMapper(), new EntityViewIdValueAccessor() { <END> @Override public <T> T getValue(JsonParser jsonParser, Class<T> idType) { String value = idValueHolder.get(); if (value == null || String.class.equals(idType)) { return (T) value; } else { ParamConverter<T> paramConverter = null; for (ParamConverterProvider paramConverterProvider : paramConverterProviders) { if ((paramConverter = paramConverterProvider.getConverter(idType, idType, null)) != null) { break; } } if (paramConverter == null) { paramConverter = FROM_STRING_PARAM_CONVERTER_PROVIDER.getConverter(idType, idType, null); } if (paramConverter == null) { throw new RuntimeException("No " + ParamConverter.class.getName() + " could be found to convert to type " + idType.getName()); } else { return paramConverter.fromString(value); } } } }); } }</code><technical_language>suggestion this.entityViewAwareObjectMapper = new EntityViewAwareObjectMapper(new LazyEntityViewManager(), mapper, new EntityViewIdValueAccessor() {</technical_language>

Target:
public void init() { if (entityViewManager.isUnsatisfied()) { this.entityViewAwareObjectMapper = null; } else { ObjectMapper mapper = null; ContextResolver<ObjectMapper> resolver; if (providers != null && (resolver = providers.getContextResolver(ObjectMapper.class, MediaType.APPLICATION_JSON_TYPE)) != null) { mapper = resolver.getContext(EntityViewMessageBodyReader.class); } if (mapper == null) { if (objectMapper.isUnsatisfied()) { mapper = new ObjectMapper(); } else { mapper = objectMapper.get(); } } this.entityViewAwareObjectMapper = new EntityViewAwareObjectMapper(new LazyEntityViewManager(), mapper, new EntityViewIdValueAccessor() { @Override public <T> T getValue(JsonParser jsonParser, Class<T> idType) { String value = idValueHolder.get(); if (value == null || String.class.equals(idType)) { return (T) value; } else { ParamConverter<T> paramConverter = null; for (ParamConverterProvider paramConverterProvider : paramConverterProviders) { if ((paramConverter = paramConverterProvider.getConverter(idType, idType, null)) != null) { break; } } if (paramConverter == null) { paramConverter = FROM_STRING_PARAM_CONVERTER_PROVIDER.getConverter(idType, idType, null); } if (paramConverter == null) { throw new RuntimeException("No " + ParamConverter.class.getName() + " could be found to convert to type " + idType.getName()); } else { return paramConverter.fromString(value); } } } }); } }
Source:
<code>public Prefab getPrefab(String name) { if (!name.isEmpty()) { <START> Preconditions.checkArgument(!Strings.isNullOrEmpty(name)); <END> return assetManager.getAsset(name, Prefab.class).orElse(null); } return null; }</code><technical_language>Uh, put this if(!name.isEmpty()) block? I put Preconditions.checkNotNull outside, name null</technical_language>

Target:
public Prefab getPrefab(String name) { if (Strings.isNullOrEmpty(name)) { return null; } return assetManager.getAsset(name, Prefab.class).orElse(null); }
Source:
<code>public void testAddPort() throws InterruptedException { List<MonitoringPolicy.Port.AddPort> ports = new ArrayList<MonitoringPolicy.Port.AddPort>(); MonitoringPolicy.Port.AddPort port = MonitoringPolicy.Port.AddPort.create(80, Types.AlertIfType.RESPONDING, true, Types.ProtocolType.TCP); ports.add(port); MonitoringPolicy response = monitoringPolicyApi().addPort(currentPolicy.id(), MonitoringPolicy.Port.CreatePort.create(ports)); currentPort = response.ports().get(0); <START> assertNotNull(response); <END> }</code><technical_language>Assert reading port</technical_language>

Target:
public void testAddPort() throws InterruptedException { List<MonitoringPolicy.Port.AddPort> ports = new ArrayList<MonitoringPolicy.Port.AddPort>(); MonitoringPolicy.Port.AddPort port = MonitoringPolicy.Port.AddPort.create(80, Types.AlertIfType.RESPONDING, true, Types.ProtocolType.TCP); ports.add(port); MonitoringPolicy response = monitoringPolicyApi().addPort(currentPolicy.id(), MonitoringPolicy.Port.CreatePort.create(ports)); assertNotNull(response); assertNotNull(response.ports().get(0)); currentPort = response.ports().get(0); }
Source:
<code>public static void addRunFacet(@Nonnull ContainerRecord record, @Nonnull Run<?,?> run) throws IOException { String imageId = record.getImageId(); <START> if (imageId == null) { <END> throw new IllegalArgumentException("Invalid ContainerRecord instance. ContainerRecords passed to addRunFacet must have an image ID."); } Fingerprint f = make(run, imageId); Collection<FingerprintFacet> facets = f.getFacets(); DockerRunFingerprintFacet runFacet = null; for (FingerprintFacet facet : facets) { if (facet instanceof DockerRunFingerprintFacet) { runFacet = (DockerRunFingerprintFacet) facet; break; } } BulkChange bc = new BulkChange(f); try { if (runFacet == null) { runFacet = new DockerRunFingerprintFacet(f, System.currentTimeMillis(), imageId); facets.add(runFacet); } runFacet.add(record); runFacet.addFor(run); bc.commit(); } finally { bc.abort(); } }</code><technical_language>True, I suffice for contract defined in ContainerRecord itself, assumed non-null here</technical_language>

Target:
public static void addRunFacet(@Nonnull ContainerRecord record, @Nonnull Run<?,?> run) throws IOException { String imageId = record.getImageId(); Fingerprint f = make(run, imageId); Collection<FingerprintFacet> facets = f.getFacets(); DockerRunFingerprintFacet runFacet = null; for (FingerprintFacet facet : facets) { if (facet instanceof DockerRunFingerprintFacet) { runFacet = (DockerRunFingerprintFacet) facet; break; } } BulkChange bc = new BulkChange(f); try { if (runFacet == null) { runFacet = new DockerRunFingerprintFacet(f, System.currentTimeMillis(), imageId); facets.add(runFacet); } runFacet.add(record); runFacet.addFor(run); bc.commit(); } finally { bc.abort(); } }
Source:
<code>private Injector setupEarlyInjector() throws Exception { final List<Module> modules = Lists.newArrayList(); modules.add(new AbstractModule() { @Singleton @Provides public Map<String, FilterDeserializer.PartialDeserializer> filters() { final Map<String, FilterDeserializer.PartialDeserializer> filters = new HashMap<>(); filters.put("key", new MatchKey.Deserializer()); filters.put("=", new MatchTag.Deserializer()); filters.put("true", new TrueFilter.Deserializer()); <START> filters.put("false", new NotFilter.Deserializer()); <END> filters.put("and", new AndFilter.Deserializer()); filters.put("or", new OrFilter.Deserializer()); filters.put("not", new NotFilter.Deserializer()); filters.put("type", new TypeFilter.Deserializer()); return filters; } @Singleton @Provides @Named("config") public SimpleModule configModule( Map<String, FilterDeserializer.PartialDeserializer> filters ) { final SimpleModule module = new SimpleModule(); module.addDeserializer(Filter.class, new FilterDeserializer(filters)); return module; } @Override protected void configure() { bind(PluginContext.class).toInstance(new PluginContextImpl()); } }); final Injector injector = Guice.createInjector(modules); for (final FastForwardModule m : loadModules(injector)) { log.info("Setting up {}", m); try { m.setup(); } catch (Exception e) { throw new Exception("Failed to call #setup() for module: " + m, e); } } return injector; }</code><technical_language>Wrong filter, FalseFilter</technical_language>

Target:
private Injector setupEarlyInjector() throws Exception { final List<Module> modules = Lists.newArrayList(); modules.add(new AbstractModule() { @Singleton @Provides public Map<String, FilterDeserializer.PartialDeserializer> filters() { final Map<String, FilterDeserializer.PartialDeserializer> filters = new HashMap<>(); filters.put("key", new MatchKey.Deserializer()); filters.put("=", new MatchTag.Deserializer()); filters.put("true", new TrueFilter.Deserializer()); filters.put("false", new FalseFilter.Deserializer()); filters.put("and", new AndFilter.Deserializer()); filters.put("or", new OrFilter.Deserializer()); filters.put("not", new NotFilter.Deserializer()); filters.put("type", new TypeFilter.Deserializer()); return filters; } @Singleton @Provides @Named("config") public SimpleModule configModule( Map<String, FilterDeserializer.PartialDeserializer> filters ) { final SimpleModule module = new SimpleModule(); module.addDeserializer(Filter.class, new FilterDeserializer(filters)); return module; } @Override protected void configure() { bind(PluginContext.class).toInstance(new PluginContextImpl()); } }); final Injector injector = Guice.createInjector(modules); for (final FastForwardModule m : loadModules(injector)) { log.info("Setting up {}", m); try { m.setup(); } catch (Exception e) { throw new Exception("Failed to call #setup() for module: " + m, e); } } return injector; }
Source:
<code>HazelcastSession(MapSession cached) { <START> Assert.notNull("MapSession cannot be null"); <END> this.delegate = cached; }</code><technical_language>be: java Assert.notNull(cached, "MapSession null");</technical_language>

Target:
HazelcastSession(MapSession cached) { Assert.notNull(cached, "MapSession cannot be null"); this.delegate = cached; }
Source:
<code>public ListenableFuture<Image> createImage(ImageTemplate template) { checkState(template instanceof CloneImageTemplate, "profitbricks only supports creating images through cloning."); final CloneImageTemplate cloneTemplate = (CloneImageTemplate) template; String serverId = cloneTemplate.getSourceNodeId(); Server server = api.serverApi().getServer(serverId); Storage bootDevice = Iterables.find(server.storages(), matchBootDevice); final Snapshot requested = api.snapshotApi().createSnapshot( Snapshot.Request.creatingBuilder() .storageId(bootDevice.id()) .name(template.getName()) .description(template.getName() + " (created with jclouds)") .build()); <START> <END> return userExecutor.submit(new Callable<Image>() { @Override public Image call() throws Exception { if (snapshotAvailablePredicate.apply(requested.id())) { Snapshot built = api.snapshotApi().getSnapshot(requested.id()); return imageTransformer.apply(built); } throw new UncheckedTimeoutException("Image was not created within the time limit: " + cloneTemplate.getName()); } }); }</code><technical_language>this is takes time, add a log message image is created</technical_language>

Target:
public ListenableFuture<Image> createImage(ImageTemplate template) { checkState(template instanceof CloneImageTemplate, "profitbricks only supports creating images through cloning."); final CloneImageTemplate cloneTemplate = (CloneImageTemplate) template; String serverId = cloneTemplate.getSourceNodeId(); Server server = api.serverApi().getServer(serverId); Storage bootDevice = Iterables.find(server.storages(), matchBootDevice); final Snapshot requested = api.snapshotApi().createSnapshot( Snapshot.Request.creatingBuilder() .storageId(bootDevice.id()) .name(template.getName()) .description(template.getName() + " (created with jclouds)") .build()); logger.info(">> creating a snapshot from storage: %s", bootDevice.id()); return userExecutor.submit(new Callable<Image>() { @Override public Image call() throws Exception { if (snapshotAvailablePredicate.apply(requested.id())) { Snapshot built = api.snapshotApi().getSnapshot(requested.id()); Image newImage = imageTransformer.apply(built); logger.info(">> registering new image (%s) to cache", newImage.getId()); images.registerImage(newImage); return newImage; } throw new UncheckedTimeoutException("Image was not created within the time limit: " + cloneTemplate.getName()); } }); }
Source:
<code>public String[] getTraceNames() { return TmfTraceManager.getTraceSet(fTrace).stream() .map(trace <START> -> trace.getName()) <END> .toArray(String[]::new); }</code><technical_language>method reference</technical_language>

Target:
public String[] getTraceNames() { return TmfTraceManager.getTraceSet(fTrace).stream() .map(ITmfTrace::getName) .toArray(String[]::new); }
Source:
<code>public boolean blockActivated(EntityPlayer player, EnumHand hand, @Nullable ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) { if (super.blockActivated(player, hand, heldItem, side, hitX, hitY, hitZ)) return true; if (player.isSneaking()) return false; <START> if (heldItem == null || hand == EnumHand.OFF_HAND) <END> return false; EnumColor color = EnumColor.dyeColorOf(heldItem); if (color == null || color == this.color) { return false; } if (!player.capabilities.isCreativeMode) player.setHeldItem(hand, InvTools.depleteItem(heldItem)); this.color = color; markDirty(); return true; }</code><technical_language>InvTools.isEmpty(heldItem)</technical_language>

Target:
public boolean blockActivated(EntityPlayer player, EnumHand hand, @Nullable ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) { if (super.blockActivated(player, hand, heldItem, side, hitX, hitY, hitZ)) return true; if (player.isSneaking()) return false; if (InvTools.isEmpty(heldItem) || hand == EnumHand.OFF_HAND) return false; EnumColor color = EnumColor.dyeColorOf(heldItem); if (color == null || color == this.color) { return false; } if (!player.capabilities.isCreativeMode) player.setHeldItem(hand, InvTools.depleteItem(heldItem)); this.color = color; markDirty(); return true; }
Source:
<code>public MainTabBasicDetailsView(ApplicationResources resources) { <START> operatingSystem = new EnumLabel<VmOsType>(); <END> initWidget(ViewUiBinder.uiBinder.createAndBindUi(this)); Driver.driver.initialize(this); ViewIdHandler.idHandler.generateAndSetIds(this); }</code><technical_language>In this case need create instance - remove (provided = true) declaration, remove this operatingSystem = new EnumLabel<VmOsType>(); completely MainTabBasicDetailsView.ui.xml declare a new namespace like: xmlns:l="urn:import:org.ovirt.engine.ui.common.widget.label" replace <g:ValueLabel ui:field="operatingSystem"... <l:EnumLabel ui:field="operatingSystem" ..</technical_language>

Target:
public MainTabBasicDetailsView(ApplicationResources resources) { initWidget(ViewUiBinder.uiBinder.createAndBindUi(this)); Driver.driver.initialize(this); ViewIdHandler.idHandler.generateAndSetIds(this); }
Source:
<code>public BackupState doBackup( OnlineBackupContext onlineBackupContext ) { wrappedAsRuntimeException( backupStrategyImplementation::init ); wrappedAsRuntimeException( backupStrategyImplementation::start ); <START> BackupState state = performBackupWithoutLifecycle( onlineBackupContext ); <END> wrappedAsRuntimeException( backupStrategyImplementation::stop ); wrappedAsRuntimeException( backupStrategyImplementation::shutdown ); return state; }</code><technical_language>LifeSupport a LifeCycle stages instead of this wrapping manual calls, gracefully handles failures way</technical_language>

Target:
PotentiallyErroneousState<BackupStrategyOutcome> doBackup( OnlineBackupContext onlineBackupContext ) { LifeSupport lifeSupport = new LifeSupport(); lifeSupport.add( backupStrategy ); lifeSupport.start(); PotentiallyErroneousState<BackupStrategyOutcome> state = performBackupWithoutLifecycle( onlineBackupContext ); lifeSupport.shutdown(); return state; }
Source:
<code>public JavaFile build() { <START> Collections.sort(staticImports); <END> return new JavaFile(this); }</code><technical_language>ah, is</technical_language>

Target:
public JavaFile build() { return new JavaFile(this); }
Source:
<code>default Stream<T> dropRight(int n) { if(n <= 0) { <START> return this; <END> } else { return reverse().drop(n).reverse(); } }</code><technical_language>Update: This is wrong! java if (n >= length) { return empty(); }</technical_language>

Target:
default Stream<T> dropRight(int n) { if(n <= 0) { return this; } else if (length() <= n) { return empty(); } else { return reverse().drop(n).reverse(); } }
Source:
<code>public void acknowledge(final MessageReference ref, final AckReason reason, final ServerConsumer consumer) throws Exception { <START> if (isNonDestructive() && reason == AckReason.NORMAL) { <END> decDelivering(ref); if (logger.isDebugEnabled()) { logger.debug("acknowledge ignored nonDestructive=true and reason=NORMAL"); } } else { if (ref.isPaged()) { pageSubscription.ack((PagedReference) ref); postAcknowledge(ref, reason); } else { Message message = ref.getMessage(); boolean durableRef = message.isDurable() && isDurable(); if (durableRef) { storageManager.storeAcknowledge(id, message.getMessageID()); } postAcknowledge(ref, reason); } ackAttempts.incrementAndGet(); if (server != null && server.hasBrokerMessagePlugins()) { server.callBrokerMessagePlugins(plugin -> plugin.messageAcknowledged(ref, reason, consumer)); } } }</code><technical_language>field access change, hotpath internal field</technical_language>

Target:
public void acknowledge(final MessageReference ref, final AckReason reason, final ServerConsumer consumer) throws Exception { if (nonDestructive && reason == AckReason.NORMAL) { decDelivering(ref); if (logger.isDebugEnabled()) { logger.debug("acknowledge ignored nonDestructive=true and reason=NORMAL"); } } else { if (ref.isPaged()) { pageSubscription.ack((PagedReference) ref); postAcknowledge(ref, reason); } else { Message message = ref.getMessage(); boolean durableRef = message.isDurable() && isDurable(); if (durableRef) { storageManager.storeAcknowledge(id, message.getMessageID()); } postAcknowledge(ref, reason); } ackAttempts.incrementAndGet(); if (server != null && server.hasBrokerMessagePlugins()) { server.callBrokerMessagePlugins(plugin -> plugin.messageAcknowledged(ref, reason, consumer)); } } }
Source:
<code>public void processElement(ProcessContext context) throws Exception { KV<ImmutableBytesWritable, Result> kv = context.element(); Cell[] cells = checkEmptyRow(kv); if (cells.length == 0) { return; } Put put = new Put(kv.getKey().get()); for (Cell cell : cells) { put.add(cell); } try { context.output(put); } catch (Exception e) { if (e instanceof RetriesExhaustedWithDetailsException) { <START> for (Throwable t : ((RetriesExhaustedWithDetailsException) e).getCauses()) { <END> logger.warn("Error sending mutation to downstream pipeline stage.", t); } } throw e; } }</code><technical_language>Please remove this. need logging in CloudBigtableIO writers. I added #660 track this issue</technical_language>

Target:
public void processElement(ProcessContext context) throws Exception { KV<ImmutableBytesWritable, Result> kv = context.element(); Cell[] cells = checkEmptyRow(kv); if (cells.length == 0) { return; } Put put = new Put(kv.getKey().get()); for (Cell cell : cells) { put.add(cell); } context.output(put); }
Source:
<code>public void saveDirtyResources(boolean force) { if (!force && !Configuration.getClientBehavior().isAutoSaveEnabled()) { return; } <START> if (!force && !isDirty) { <END> return; } if (resources == null) { return; } for (final Resource resource : resources) { if (resource.getURI() == null || resource.getURI().toString().equals(StringUtils.EMPTY)) { continue; } final ProjectSpace projectSpace = ESLocalProjectImpl.class.cast(localProject).toInternalAPI(); if (EMFStoreResource.class.isInstance(resource) && resource == projectSpace.getProject().eResource()) { final Map<EObject, String> eObjectToIdMapping = new LinkedHashMap<EObject, String>( projectSpace.getProject().getEObjectToIdMapping()); final Map<String, EObject> idToEObjectMapping = new LinkedHashMap<String, EObject>( projectSpace.getProject().getIdToEObjectMapping()); EMFStoreResource.class.cast(resource).setIdToEObjectMap(idToEObjectMapping, eObjectToIdMapping); } try { ModelUtil.saveResource(resource, WorkspaceUtil.getResourceLogger()); } catch (final IOException e) { } } isDirty = false; fireDirtyStateChangedNotification(); }</code><technical_language>swap</technical_language>

Target:
public void saveDirtyResources(boolean force) { if (!force && !Configuration.getClientBehavior().isAutoSaveEnabled()) { return; } if (!force && !isDirty) { return; } if (resources == null) { return; } for (final Resource resource : resources) { if (resource.getURI() == null || resource.getURI().toString().equals(StringUtils.EMPTY)) { continue; } final ProjectSpace projectSpace = ESLocalProjectImpl.class.cast(localProject).toInternalAPI(); if (EMFStoreResource.class.isInstance(resource) && resource == projectSpace.getProject().eResource()) { final Map<EObject, String> eObjectToIdMapping = new LinkedHashMap<EObject, String>( projectSpace.getProject().getEObjectToIdMapping()); final Map<String, EObject> idToEObjectMapping = new LinkedHashMap<String, EObject>( projectSpace.getProject().getIdToEObjectMapping()); EMFStoreResource.class.cast(resource).setIdToEObjectMap(idToEObjectMapping, eObjectToIdMapping); } try { if (projectSpace.getLocalChangePackage().eResource() == resource) { projectSpace.getLocalChangePackage().save(); } else { ModelUtil.saveResource(resource, WorkspaceUtil.getResourceLogger()); } } catch (final IOException e) { throw new RuntimeException( MessageFormat.format(Messages.ResourcePersister_SaveFailed, resource.getURI())); } } isDirty = false; fireDirtyStateChangedNotification(); }
Source:
<code>public void init() { addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent mouseEvent) { int y = mouseEvent.getY(); int i = 0; while (i < myCurrentBottoms.length && y > myCurrentBottoms[i]) { ++i; } if (i < myCurrentBottoms.length) { mySelectedDistribution = DISTRIBUTIONS.get(i); if (myListener != null) { myListener.onDistributionSelected(mySelectedDistribution); } repaint(); } } }); if (DISTRIBUTIONS == null) { try { String jsonString = ResourceUtil.loadText(ResourceUtil.getResource(this.getClass(), "wizardData", "distributions.json")); <START> loadDistributionsFromJson(jsonString); <END> } catch (IOException e) { throw new RuntimeException(e); } } loadFonts(); }</code><technical_language>nit: do this as: ourDistributions = getDistributionsFromJson(jsonString)</technical_language>

Target:
public void init() { addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent mouseEvent) { int y = mouseEvent.getY(); int i = 0; while (i < myCurrentBottoms.length && y > myCurrentBottoms[i]) { ++i; } if (i < myCurrentBottoms.length) { mySelectedDistribution = ourDistributions.get(i); if (myListener != null) { myListener.onDistributionSelected(mySelectedDistribution); } repaint(); } } }); if (ourDistributions == null) { try { String jsonString = ResourceUtil.loadText(ResourceUtil.getResource(this.getClass(), "wizardData", "distributions.json")); ourDistributions = loadDistributionsFromJson(jsonString); } catch (IOException e) { throw new RuntimeException(e); } } loadFonts(); }
Source:
<code>private TagModel feedTagStructureToGraph(Tag tag, Set<Tag> visited, int level) { if (visited.contains(tag)) return this.getUniqueByProperty(TagModel.PROP_NAME, tag.getName(), true); visited.add(tag); <START> LOG.info(String.format("Creating TagModel for Tag: %s%s(%d) '%s' traits: %s", StringUtils.repeat(' ', level*2), <END> tag.getName(), tag.getContainedTags().size(), tag.getTitle(), tag.getTraits())); TagModel tagModel = this.create(); tagModel.setName(tag.getName()); tagModel.setTitle(tag.getTitle()).setColor(tag.getColor()).setRoot(tag.isPrime()).setPseudo(tag.isPseudo()); if (null != tag.getTraits()) tagModel.putAllTraits(tag.getTraits()); tag.getContainedTags().forEach(tag2 -> { TagModel tag2model = feedTagStructureToGraph(tag2, visited, level+1); tagModel.addDesignatedTag(tag2model); }); return tagModel; }</code><technical_language>debug level</technical_language>

Target:
private TagModel feedTagStructureToGraph(Tag tag, Set<Tag> visited, int level) { if (visited.contains(tag)) return this.getUniqueByProperty(TagModel.PROP_NAME, tag.getName(), true); visited.add(tag); LOG.fine(String.format("Creating TagModel for Tag: %s%s(%d) '%s' traits: %s", StringUtils.repeat(' ', level*2), tag.getName(), tag.getContainedTags().size(), tag.getTitle(), tag.getTraits())); TagModel tagModel = this.create(); tagModel.setName(tag.getName()); tagModel.setTitle(tag.getTitle()).setColor(tag.getColor()).setRoot(tag.isPrime()).setPseudo(tag.isPseudo()); if (null != tag.getTraits()) tagModel.putAllTraits(tag.getTraits()); tag.getContainedTags().forEach(tag2 -> { TagModel tag2model = feedTagStructureToGraph(tag2, visited, level+1); tagModel.addDesignatedTag(tag2model); }); return tagModel; }
Source:
<code>public void MercuryWidgetTest_001_Twitter() { <START> ArticleContent articleContent = new ArticleContent(); <END> articleContent.clear(MercurySubpages.TWITTER_VERBATIM); articleContent.push("<twitter>", MercurySubpages.TWITTER_VERBATIM); TwitterWidgetPageObject twitterWidgetPageObject = new TwitterWidgetPageObject(driver); twitterWidgetPageObject.openMercuryArticleByName(wikiURL, MercurySubpages.TWITTER_VERBATIM); twitterWidgetPageObject.isLoadedOnMercury(); }</code><technical_language>consider moving functions TwitterWidgetPageObject name method: createPageWithWidget</technical_language>

Target:
public void MercuryWidgetTest_001_Twitter() { TwitterWidgetPageObject twitterWidgetPageObject = new TwitterWidgetPageObject(driver); twitterWidgetPageObject.createAndNavigate(wikiURL); Assertion.assertTrue( twitterWidgetPageObject.isLoadedOnMercury(), MercuryMessages.INVISIBLE_MSG ); }
Source:
<code>public void signalTorefreshSearcherManagers(List<String> subFiles, String host, int port) throws IOException { Message m = Message.createMessage("refresh"); m.setText("refresh"); for (String proj : subFiles) { <START> m.addTag(new File(proj).getName()); <END> } m.write(host, port); }</code><technical_language>need check if file exists is a project</technical_language>

Target:
public void signalTorefreshSearcherManagers(List<String> subFiles, String host, int port) throws IOException { Message m = Message.createMessage("refresh"); for (String proj : subFiles) { m.addTag(new File(proj).getName()); } m.write(host, port); }
Source:
<code>public MapConfiguration createTmsMap(Profile profile, int nrOfZoomLevels) { switch (profile) { case GLOBAL_GEODETIC: return createTmsMap(profile, "EPSG:4326", CrsType.DEGREES, new Bbox(-180, -90, 360, 180), 256, nrOfZoomLevels); default: return createTmsMap(profile, "EPSG:3857", CrsType.METRIC, new Bbox(-MERCATOR, -MERCATOR, 2 * MERCATOR, 2 * MERCATOR), 256, nrOfZoomLevels); <START> } <END> }</code><technical_language>if profile is local, a custom EPSG ? "not implemented yet"</technical_language>

Target:
protected MapConfiguration createTmsMap(Profile profile, int nrOfZoomLevels) { MapConfiguration mapConfiguration = null; switch (profile) { case GLOBAL_GEODETIC: mapConfiguration = createTmsMap("EPSG:4326", CrsType.DEGREES, new Bbox(-180, -90, 360, 180), 256, nrOfZoomLevels); break; case GLOBAL_MERCATOR: mapConfiguration = createTmsMap("EPSG:3857", CrsType.METRIC, new Bbox(-MERCATOR, -MERCATOR, 2 * MERCATOR, 2 * MERCATOR), 256, nrOfZoomLevels); break; default: throw new IllegalArgumentException("Local profiles not supported"); } mapConfiguration.setHintValue(PROFILE, profile); return mapConfiguration; }
Source:
<code>private JButton buildOverrideConfButton(FormStatus form) { JButton button = new JButton("\uE900"); button.setFont(ic_settings); button.setToolTipText("Override the export configuration for this form"); button.setMargin(new Insets(0, 0, 0, 0)); updateConfButton(form, button); button.addActionListener(__ -> { ConfigurationDialog dialog = ConfigurationDialog.from( forms.getCustomConfiguration(form), forms.hasTransferSettings(form), BriefcasePreferences.getStorePasswordsConsentProperty() ); dialog.onRemove(() -> removeConfiguration(form)); dialog.onOK(configuration -> { if (configuration.isEmpty() && <START> (((BriefcaseFormDefinition) form.getFormDefinition()).isFileEncryptedForm() || <END> ((BriefcaseFormDefinition) form.getFormDefinition()).isFieldEncryptedForm())) { configuration.setFormNeedsPrivateKey(Boolean.TRUE); putConfiguration(form, configuration); } else if (configuration.isEmpty()) { removeConfiguration(form); } else { putConfiguration(form, configuration); } }); dialog.open(); }); return button; }</code><technical_language>configuration if belongs a form needs a PrivateKey not. This needed here. Check ExportConfiguration instance is created in ExportForms.getCustomConfiguration(FormStatus form)</technical_language>

Target:
private JButton buildOverrideConfButton(FormStatus form) { JButton button = new JButton("\uE900"); button.setFont(ic_settings); button.setToolTipText("Override the export configuration for this form"); button.setMargin(new Insets(0, 0, 0, 0)); updateConfButton(form, button); button.addActionListener(__ -> { ConfigurationDialog dialog = ConfigurationDialog.from( forms.getCustomConfiguration(form).orElse(ExportConfiguration.empty(form)), forms.hasTransferSettings(form), BriefcasePreferences.getStorePasswordsConsentProperty() ); dialog.onRemove(() -> removeConfiguration(form)); dialog.onOK(configuration -> { if (configuration.isEmpty()) removeConfiguration(form); else putConfiguration(form, configuration); }); dialog.open(); }); return button; }
Source:
<code>protected void initializeConfig() throws IOException, URISyntaxException { configSource = getConfigSource(); config = new ConfigurationObjectFactory(new KillbillPlatformConfigSource(configSource)).build(KillbillServerConfig.class); <START> metricsGraphiteConfig = new ConfigurationObjectFactory(new KillbillPlatformConfigSource(configSource)).build(MetricsGraphiteConfig.class); <END> }</code><technical_language>build new KillbillPlatformConfigSource(configSource) once</technical_language>

Target:
protected void initializeConfig() throws IOException, URISyntaxException { configSource = getConfigSource(); final ConfigurationObjectFactory configFactory = new ConfigurationObjectFactory(new KillbillPlatformConfigSource(configSource)); config = configFactory.build(KillbillServerConfig.class); metricsGraphiteConfig = configFactory.build(MetricsGraphiteConfig.class); }
Source:
<code>public void setVisible(final boolean visible) { super.setVisible(visible); fIsVisible = visible; if (visible) { <START> getContainer().getShell().getDisplay().asyncExec(() -> updateViewer()); <END> } else { getElementViewer().setInput(null); } }</code><technical_language>this a method reference</technical_language>

Target:
public void setVisible(final boolean visible) { super.setVisible(visible); fIsVisible = visible; if (visible) { getContainer().getShell().getDisplay().asyncExec(this::updateViewer); } else { getElementViewer().setInput(null); } }