auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private String toConnectionInfoString() { return "{ metastore-uri: " + metastoreUri + ", " + "database: " + database + ", " + "table: " + table + ", " + "partitioned-table: " + isPartitionedTable() + ", " + "dynamic-partitioning: " + isDynamicPartitioning() + ", " + "username: " + username + ", " + "secure-mode: " + secureMode + ", " + "record-writer: " + recordWriter.getClass().getSimpleName() + ", " + "agent-info: " + agentInfo + ", " + <START> "writeId: " + writeId + " }"; <END> }</code><technical_language>log statementId well</technical_language>

Target:
private String toConnectionInfoString() { return "{ metastore-uri: " + metastoreUri + ", " + "database: " + database + ", " + "table: " + table + ", " + "partitioned-table: " + isPartitionedTable() + ", " + "dynamic-partitioning: " + isDynamicPartitioning() + ", " + "username: " + username + ", " + "secure-mode: " + secureMode + ", " + "record-writer: " + recordWriter.getClass().getSimpleName() + ", " + "agent-info: " + agentInfo + ", " + "writeId: " + writeId + ", " + "statementId: " + statementId + " }"; }
Source:
<code>public void processQueue() { if (Thread.currentThread() == thread) { throw new IllegalStateException( "Cannot execute this method in the realm's own thread"); } try { synchronized (queue) { doProcess = true; <START> queue.notifyAll(); <END> while (!queue.isEmpty()) { if (!block) throw new IllegalStateException( "Cannot process queue, ThreadRealm is not blocking on its thread"); queue.wait(); } doProcess = false; } } catch (InterruptedException e) { Thread.currentThread().interrupt(); } }</code><technical_language>is this call for? If queue is empty block method running already? if element is added queue notifyAll is called method? Do I miss some case</technical_language>

Target:
public void processQueue() { if (Thread.currentThread() == thread) { throw new IllegalStateException( "Cannot execute this method in the realm's own thread"); } try { synchronized (queue) { while (!queue.isEmpty()) { if (!block) throw new IllegalStateException( "Cannot process queue, ThreadRealm is not blocking on its thread"); queue.wait(); } } } catch (InterruptedException e) { Thread.currentThread().interrupt(); } }
Source:
<code>public void testFileBatchInputFormatAvroNullSchema() throws Exception { File fileAvro = new File(temporaryFolder.newFolder(), "test.avro"); String outputDatasetName = "test-filesource-avro-null-schema"; String appName = "FileSourceAvroNullSchema"; ApplicationManager appManager = createSourceAndDeployApp(appName, fileAvro, "avro", outputDatasetName, null); Schema recordSchemaWithoutPathField = Schema.recordOf("record", Schema.Field.of("i", Schema.of(Schema.Type.INT)), Schema.Field.of("l", Schema.of(Schema.Type.LONG))); org.apache.avro.Schema avroSchema = new org.apache.avro.Schema.Parser().parse(recordSchemaWithoutPathField. toString()); GenericRecord record = new GenericRecordBuilder(avroSchema) .set("i", Integer.MAX_VALUE) .set("l", Long.MAX_VALUE) .build(); DataSetManager<TimePartitionedFileSet> inputManager = getDataset("TestFile"); DatumWriter<GenericRecord> datumWriter = new GenericDatumWriter<>(avroSchema); DataFileWriter<GenericRecord> dataFileWriter = new DataFileWriter<>(datumWriter); dataFileWriter.create(avroSchema, fileAvro); dataFileWriter.append(record); dataFileWriter.close(); inputManager.flush(); workflowStartAndWait(appManager); List<StructuredRecord> expected = ImmutableList.of( StructuredRecord.builder(RECORD_SCHEMA) .set("i", Integer.MAX_VALUE) .set("l", Long.MAX_VALUE) .set("file", fileAvro.toURI().toString()) .build() ); DataSetManager<Table> outputManager = getDataset(outputDatasetName); List<StructuredRecord> output = MockSink.readOutput(outputManager); <START> Assert.assertEquals(output, expected); <END> }</code><technical_language>expected is first</technical_language>

Target:
public void testFileBatchInputFormatAvroNullSchema() throws Exception { File fileAvro = new File(temporaryFolder.newFolder(), "test.avro"); String outputDatasetName = "test-filesource-avro-null-schema"; String appName = "FileSourceAvroNullSchema"; ApplicationManager appManager = createSourceAndDeployApp(appName, fileAvro, "avro", outputDatasetName, null); Schema recordSchemaWithoutPathField = Schema.recordOf("record", Schema.Field.of("i", Schema.of(Schema.Type.INT)), Schema.Field.of("l", Schema.of(Schema.Type.LONG))); org.apache.avro.Schema avroSchema = new org.apache.avro.Schema.Parser().parse(recordSchemaWithoutPathField. toString()); GenericRecord record = new GenericRecordBuilder(avroSchema) .set("i", Integer.MAX_VALUE) .set("l", Long.MAX_VALUE) .build(); DataSetManager<TimePartitionedFileSet> inputManager = getDataset("TestFile"); DatumWriter<GenericRecord> datumWriter = new GenericDatumWriter<>(avroSchema); DataFileWriter<GenericRecord> dataFileWriter = new DataFileWriter<>(datumWriter); dataFileWriter.create(avroSchema, fileAvro); dataFileWriter.append(record); dataFileWriter.close(); inputManager.flush(); workflowStartAndWait(appManager); List<StructuredRecord> expected = ImmutableList.of( StructuredRecord.builder(RECORD_SCHEMA) .set("i", Integer.MAX_VALUE) .set("l", Long.MAX_VALUE) .set("file", fileAvro.toURI().toString()) .build() ); DataSetManager<Table> outputManager = getDataset(outputDatasetName); List<StructuredRecord> output = MockSink.readOutput(outputManager); Assert.assertEquals(expected, output); }
Source:
<code>public static void classLevelSetup() throws Exception { Map<String, String> overrides = new HashMap<>(); overrides.put(MetastoreConf.ConfVars.EVENT_MESSAGE_FACTORY.getHiveName(), GzipJSONMessageEncoder.class.getCanonicalName()); overrides.put(HiveConf.ConfVars.HIVE_SUPPORT_CONCURRENCY.varname, "true"); overrides.put(HiveConf.ConfVars.HIVE_TXN_MANAGER.varname, "org.apache.hadoop.hive.ql.lockmgr.DbTxnManager"); overrides.put(MetastoreConf.ConfVars.CAPABILITY_CHECK.getHiveName(),"false"); overrides.put(HiveConf.ConfVars.REPL_BOOTSTRAP_DUMP_OPEN_TXN_TIMEOUT.varname,"1s"); overrides.put(HiveConf.ConfVars.DYNAMICPARTITIONINGMODE.varname, "nonstrict"); overrides.put("mapred.input.dir.recursive", "true"); <START> internalBeforeClassSetup(overrides, overrides, TestReplicationScenarios.class, false, "mm"); <END> }</code><technical_language>current class name TestStatsReplicationScenariosMMNoAutogather</technical_language>

Target:
public static void classLevelSetup() throws Exception { Map<String, String> overrides = new HashMap<>(); overrides.put(MetastoreConf.ConfVars.EVENT_MESSAGE_FACTORY.getHiveName(), GzipJSONMessageEncoder.class.getCanonicalName()); overrides.put(HiveConf.ConfVars.HIVE_SUPPORT_CONCURRENCY.varname, "true"); overrides.put(HiveConf.ConfVars.HIVE_TXN_MANAGER.varname, "org.apache.hadoop.hive.ql.lockmgr.DbTxnManager"); overrides.put(MetastoreConf.ConfVars.CAPABILITY_CHECK.getHiveName(), "false"); overrides.put(HiveConf.ConfVars.REPL_BOOTSTRAP_DUMP_OPEN_TXN_TIMEOUT.varname, "1s"); overrides.put(HiveConf.ConfVars.DYNAMICPARTITIONINGMODE.varname, "nonstrict"); overrides.put("mapred.input.dir.recursive", "true"); internalBeforeClassSetup(overrides, overrides, TestStatsReplicationScenariosMMNoAutogather.class, false, AcidTableKind.INSERT_ONLY); }
Source:
<code>public CaseInsensitiveHashMap<K, V> toImmutableCaseInsensitiveMap() { <START> if (this instanceof ImmutableCaseInsensitiveHashMap) { <END> return this; } if (this.isEmpty() && EMPTY_MAP != null) { return EMPTY_MAP; } return new ImmutableCaseInsensitiveHashMap<>(this); }</code><technical_language>this check avoided polymorphism</technical_language>

Target:
public CaseInsensitiveHashMap<K, V> toImmutableCaseInsensitiveMap() { if (this.isEmpty() && EMPTY_MAP != null) { return EMPTY_MAP; } return new ImmutableCaseInsensitiveHashMap<>(this); }
Source:
<code>private State parseHUE(final String value) { if(!value.startsWith("HUE") || value.length() != 6) return null; try { final double hue = Integer.valueOf(value.substring(3, 6)); return new PercentType(new BigDecimal(hue / 255d * 100d)); } catch (NumberFormatException e) { <START> logger.warn("cannot parse color from " + value, e); <END> } return null; }</code><technical_language>parameterized logging instead of string concatenation</technical_language>

Target:
private State parseHUE(final String value) { if (!value.startsWith("HUE") || value.length() != 6) return null; try { final double hue = Integer.valueOf(value.substring(3, 6)); return new PercentType(new BigDecimal(hue / 255d * 100d)); } catch (NumberFormatException e) { logger.warn("cannot parse color from {}", value, e); } return null; }
Source:
<code>private static List<List<JavaFileScannerContext.Location>> initFlows(int arity) { List<List<JavaFileScannerContext.Location>> result = new ArrayList<>(arity + 1); for (int i = 0; i < arity + 1; i++) { <START> result.add(0, ImmutableList.of()); <END> } return result; }</code><technical_language>a big deal list is empty anyway, real need add beginning. I express this method in a liner IntStream.range.mapToObj.collect(toList)</technical_language>

Target:
private static List<List<JavaFileScannerContext.Location>> initFlows(int arity) { return IntStream .range(0, arity + 1) .mapToObj(i -> ImmutableList.<JavaFileScannerContext.Location>of()) .collect(Collectors.toList()); }
Source:
<code>protected void doStart() throws Exception { <START> log.info("Context: {}", camelContext); <END> String groupId = UUID.randomUUID().toString(); log.debug("Creating consumer with {}[{}]", ConsumerConfig.GROUP_ID_CONFIG, groupId); consumerConfig.put(ConsumerConfig.GROUP_ID_CONFIG, groupId); consumerConfig.put(ConsumerConfig.ENABLE_AUTO_COMMIT_CONFIG, Boolean.TRUE.toString()); consumerConfig.put(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG, StringDeserializer.class.getName()); consumerConfig.put(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG, StringDeserializer.class.getName()); consumer = new KafkaConsumer<>(consumerConfig); producerConfig.put(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG, StringSerializer.class.getName()); producerConfig.put(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, StringSerializer.class.getName()); producerConfig.putIfAbsent(ProducerConfig.ACKS_CONFIG, "1"); producerConfig.putIfAbsent(ProducerConfig.BATCH_SIZE_CONFIG, "0"); producer = new KafkaProducer<>(producerConfig); cacheReadyLatch = new CountDownLatch(1); topicPoller = new TopicPoller(consumer, cacheReadyLatch); }</code><technical_language>A logging message nice. starting XXX YY setting (the important values)</technical_language>

Target:
protected void doStart() throws Exception { StringHelper.notEmpty(topic, "topic"); this.cache = Collections.synchronizedMap(new LRUCache<>(maxCacheSize)); if (consumerConfig == null) { consumerConfig = new Properties(); StringHelper.notEmpty(bootstrapServers, "bootstrapServers"); consumerConfig.put(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, bootstrapServers); } if (producerConfig == null) { producerConfig = new Properties(); StringHelper.notEmpty(bootstrapServers, "bootstrapServers"); producerConfig.put(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG, bootstrapServers); } ObjectHelper.notNull(consumerConfig, "consumerConfig"); ObjectHelper.notNull(producerConfig, "producerConfig"); String groupId = UUID.randomUUID().toString(); log.debug("Creating consumer with {}[{}]", ConsumerConfig.GROUP_ID_CONFIG, groupId); consumerConfig.put(ConsumerConfig.GROUP_ID_CONFIG, groupId); consumerConfig.put(ConsumerConfig.ENABLE_AUTO_COMMIT_CONFIG, Boolean.TRUE.toString()); consumerConfig.put(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG, StringDeserializer.class.getName()); consumerConfig.put(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG, StringDeserializer.class.getName()); consumer = new KafkaConsumer<>(consumerConfig); producerConfig.put(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG, StringSerializer.class.getName()); producerConfig.put(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, StringSerializer.class.getName()); producerConfig.putIfAbsent(ProducerConfig.ACKS_CONFIG, "1"); producerConfig.putIfAbsent(ProducerConfig.BATCH_SIZE_CONFIG, "0"); producer = new KafkaProducer<>(producerConfig); cacheReadyLatch = new CountDownLatch(1); topicPoller = new TopicPoller(consumer, cacheReadyLatch, pollDurationMs); }
Source:
<code>public boolean loginCookieAvailable() { <START> return !config.get("env").contains("dev"); <END> }</code><technical_language>add sandbox</technical_language>

Target:
public boolean loginCookieAvailable() { return !((config.get("env").contains("dev")) || (config.get("env").contains("sandbox"))); }
Source:
<code>public void setMessage(final Message aMessage, final boolean isRequest) { try { EventQueue.invokeAndWait( new Runnable() { @Override public void run() { msg = aMessage; CardLayout cl = (CardLayout) (panelContent.getLayout()); request = isRequest; if (isRequest) { requestPanel.setMessage(aMessage, true); requestPanel.setEditable(true); cl.show(panelContent, REQUEST_PANEL); } else { responsePanel.setMessage(aMessage, true); responsePanel.setEditable(true); cl.show(panelContent, RESPONSE_PANEL); } <START> getButtonFixContentLength().setEnabled(msg instanceof HttpMessage); <END> } }); } catch (Exception e) { LOGGER.warn(e.getMessage(), e); } }</code><technical_language>setVisible</technical_language>

Target:
public void setMessage(final Message aMessage, final boolean isRequest) { try { EventQueue.invokeAndWait( new Runnable() { @Override public void run() { msg = aMessage; CardLayout cl = (CardLayout) (panelContent.getLayout()); request = isRequest; if (isRequest) { requestPanel.setMessage(aMessage, true); requestPanel.setEditable(true); getRequestButtonFixContentLength() .setVisible(msg instanceof HttpMessage); cl.show(panelContent, REQUEST_PANEL); } else { responsePanel.setMessage(aMessage, true); responsePanel.setEditable(true); getResponseButtonFixContentLength() .setVisible(msg instanceof HttpMessage); cl.show(panelContent, RESPONSE_PANEL); } } }); } catch (Exception e) { LOGGER.warn(e.getMessage(), e); } }
Source:
<code><START> synchronized boolean isRejected() { <END> return rejected; }</code><technical_language>synchronized(conn) synchronized(this) is expected</technical_language>

Target:
synchronized boolean isRejected() { synchronized (conn) { return rejected; } }
Source:
<code>public D save(D definition) { Assert.notNull(definition, "Definition may not be null"); String name = definition.getName(); String def = definition.getDefinition(); validateBeforeSave(name, def); <START> if (repository.findOne(definition.getName()) != null) { <END> throwDefinitionAlreadyExistsException(definition); } List<ModuleDescriptor> moduleDescriptors = parser.parse(name, def, definitionKind); List<ModuleDefinition> moduleDefinitions = createModuleDefinitions(moduleDescriptors); if (!moduleDefinitions.isEmpty()) { definition.setModuleDefinitions(moduleDefinitions); } D savedDefinition = repository.save(definition); return afterSave(savedDefinition); }</code><technical_language>validateBeforeSave do as: if (repository.findOne(definition.getName()) != null) { throwDefinitionAlreadyExistsException(definition); }</technical_language>

Target:
public D save(D definition) { Assert.notNull(definition, "Definition may not be null"); String name = definition.getName(); String def = definition.getDefinition(); validateBeforeSave(name, def); List<ModuleDescriptor> moduleDescriptors = parser.parse(name, def, definitionKind); List<ModuleDefinition> moduleDefinitions = createModuleDefinitions(moduleDescriptors); if (!moduleDefinitions.isEmpty()) { definition.setModuleDefinitions(moduleDefinitions); } D savedDefinition = repository.save(definition); return afterSave(savedDefinition); }
Source:
<code>public static IModelGeometry<?> getModel(ResourceLocation loaderId, JsonDeserializationContext deserializationContext, JsonObject data) { try { if (!loaders.containsKey(loaderId)) <START> throw new IllegalStateException(String.format("Model loader '%s' not found.", loaderId)); <END> IModelLoader<?> loader = loaders.get(loaderId); return loader.read(deserializationContext, data); } catch(Exception e) { e.printStackTrace(); throw e; } }</code><technical_language>dump a list of loaders</technical_language>

Target:
public static IModelGeometry<?> getModel(ResourceLocation loaderId, JsonDeserializationContext deserializationContext, JsonObject data) { try { if (!loaders.containsKey(loaderId)) { throw new IllegalStateException(String.format("Model loader '%s' not found. Registered loaders: %s", loaderId, loaders.keySet().stream().map(ResourceLocation::toString).collect(Collectors.joining(", ")))); } IModelLoader<?> loader = loaders.get(loaderId); return loader.read(deserializationContext, data); } catch(Exception e) { e.printStackTrace(); throw e; } }
Source:
<code>public void findInPage(String s) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { parentActivity.getCurPageFragment().getWebView().setFindListener(new FindListener() { @Override public void onFindResultReceived(int activeMatchOrdinal, int numberOfMatches, boolean isDoneCounting) { if (!isDoneCounting) { return; } if (numberOfMatches > 0) { findInPageMatch.setText( Integer.toString(activeMatchOrdinal + 1) + "/" + Integer.toString(numberOfMatches) ); <START> findInPageMatch.setTextColor(Color.BLACK); <END> findInPageNext.setEnabled(true); findInPagePrev.setEnabled(true); } else { findInPageMatch.setText("0/0"); findInPageMatch.setTextColor(Color.RED); findInPageNext.setEnabled(false); findInPagePrev.setEnabled(false); } findInPageMatch.setVisibility(View.VISIBLE); } }); parentActivity.getCurPageFragment().getWebView().findAllAsync(s); } else { parentActivity.getCurPageFragment().getWebView().findAll(s); } }</code><technical_language>change color here. Firstly, color resources (values/color.xml) instead of color constants. theme-specific colors (i.e. Black good app is in Dark mode). secondly, color choices need approved design team. For purpose of this patch, modify it</technical_language>

Target:
public void findInPage(String s) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { parentActivity.getCurPageFragment().getWebView().setFindListener(new FindListener() { @Override public void onFindResultReceived(int activeMatchOrdinal, int numberOfMatches, boolean isDoneCounting) { if (!isDoneCounting) { return; } if (numberOfMatches > 0) { findInPageMatch.setText( Integer.toString(activeMatchOrdinal + 1) + "/" + Integer.toString(numberOfMatches) ); findInPageNext.setEnabled(true); findInPagePrev.setEnabled(true); } else { findInPageMatch.setText("0/0"); findInPageNext.setEnabled(false); findInPagePrev.setEnabled(false); } findInPageMatch.setVisibility(View.VISIBLE); } }); parentActivity.getCurPageFragment().getWebView().findAllAsync(s); } else { parentActivity.getCurPageFragment().getWebView().findAll(s); } }
Source:
<code>public static boolean isAuthenticated(HttpServletRequest request) { <START> return request.getAttribute(SessionConstants.HTTP_SESSION_ENGINE_SESSION_ID_KEY) != null; <END> }</code><technical_language>this request session</technical_language>

Target:
public static boolean isAuthenticated(HttpServletRequest request) { return (request.getSession(false) != null && request.getSession(false) .getAttribute(SessionConstants.HTTP_SESSION_ENGINE_SESSION_ID_KEY) != null) || request.getAttribute(SessionConstants.HTTP_SESSION_ENGINE_SESSION_ID_KEY) != null; }
Source:
<code>public Map<String, ValidationResult> preEntitlement(Consumer consumer, Consumer host, Collection<PoolQuantity> entitlementPoolQuantities, CallerType caller) { JsonJsContext args = new JsonJsContext(objectMapper); args.put("consumer", consumer); args.put("hostConsumer", host); args.put("consumerEntitlements", consumer.getEntitlements()); args.put("standalone", config.getBoolean(ConfigProperties.STANDALONE)); args.put("poolQuantities", entitlementPoolQuantities); args.put("caller", caller.getLabel()); args.put("log", log, false); String json = jsRules.runJsFunction(String.class, "validate_pools_batch", args); Map<String, ValidationResult> resultMap; TypeReference<Map<String, ValidationResult>> typeref = new TypeReference<Map<String, ValidationResult>>() {}; try { resultMap = objectMapper.toObject(json, typeref); for (PoolQuantity poolQuantity : entitlementPoolQuantities) { if (!resultMap.containsKey(poolQuantity.getPool().getId())) { resultMap.put(poolQuantity.getPool().getId(), new ValidationResult()); <START> log.info("no result returned for pool:" + poolQuantity.getPool()); <END> } finishValidation(resultMap.get(poolQuantity.getPool().getId()), poolQuantity.getPool(), poolQuantity.getQuantity()); } } catch (Exception e) { throw new RuleExecutionException(e); } return resultMap; }</code><technical_language>{} placeholders</technical_language>

Target:
public Map<String, ValidationResult> preEntitlement(Consumer consumer, Consumer host, Collection<PoolQuantity> entitlementPoolQuantities, CallerType caller) { JsonJsContext args = new JsonJsContext(objectMapper); args.put("consumer", consumer); args.put("hostConsumer", host); args.put("consumerEntitlements", consumer.getEntitlements()); args.put("standalone", config.getBoolean(ConfigProperties.STANDALONE)); args.put("poolQuantities", entitlementPoolQuantities); args.put("caller", caller.getLabel()); args.put("log", log, false); String json = jsRules.runJsFunction(String.class, "validate_pools_batch", args); Map<String, ValidationResult> resultMap; TypeReference<Map<String, ValidationResult>> typeref = new TypeReference<Map<String, ValidationResult>>() {}; try { resultMap = objectMapper.toObject(json, typeref); for (PoolQuantity poolQuantity : entitlementPoolQuantities) { if (!resultMap.containsKey(poolQuantity.getPool().getId())) { resultMap.put(poolQuantity.getPool().getId(), new ValidationResult()); log.info("no result returned for pool: {}", poolQuantity.getPool()); } finishValidation(resultMap.get(poolQuantity.getPool().getId()), poolQuantity.getPool(), poolQuantity.getQuantity()); } } catch (Exception e) { throw new RuleExecutionException(e); } return resultMap; }
Source:
<code>private void initComponents() { setLayout(new MigLayout("", "[100:pref,fill]", "[100:pref,fill]")); <START> mJailPanel.addComponentListener(new ComponentListener() { <END> @Override public void componentResized(ComponentEvent e) { mJailPanel.updateDimensions(e.getComponent().getParent().getWidth(), e.getComponent().getParent().getHeight()); } @Override public void componentMoved(ComponentEvent e) { } @Override public void componentShown(ComponentEvent e) { } @Override public void componentHidden(ComponentEvent e) { } }); JPanel statusPanel = new JPanel(); statusPanel.setOpaque(false); statusPanel.setLayout(new MigLayout("", "[50:pref]", "[pref!]")); statusPanel.add(new JLabel(Messages.getString("GamePanel.player")), "cell 0 0"); statusPanel.add(mPlayerName, "cell 1 0"); statusPanel.add(new JLabel(Messages.getString("GamePanel.status")), "cell 0 1"); statusPanel.add(mTeamLabel, "cell 1 1"); add(statusPanel, "cell 0 0, growy 0"); add(mJailPanel, "cell 0 1"); }</code><technical_language>This is adding a ComponentListener mJailPanel calls another method mJailPanel....can listener IN JailPanel</technical_language>

Target:
private void initComponents() { setLayout(new MigLayout("", "[100:pref,fill]", "[100:pref,fill]")); JPanel jailHolderPanel = new JPanel(); jailHolderPanel.setOpaque(false); jailHolderPanel.add(mJailPanel); jailHolderPanel.addComponentListener(new ComponentListener() { @Override public void componentResized(ComponentEvent e) { mJailPanel.updateDimensions(e.getComponent().getWidth(), e.getComponent().getHeight()); } @Override public void componentMoved(ComponentEvent e) { } @Override public void componentShown(ComponentEvent e) { } @Override public void componentHidden(ComponentEvent e) { } }); JPanel statusPanel = new JPanel(); statusPanel.setOpaque(false); statusPanel.setLayout(new MigLayout("", "[50:pref]", "[pref!]")); statusPanel.add(new JLabel(Messages.getString("GamePanel.player")), "cell 0 0"); statusPanel.add(mPlayerName, "cell 1 0"); statusPanel.add(new JLabel(Messages.getString("GamePanel.status")), "cell 0 1"); statusPanel.add(mTeamLabel, "cell 1 1"); add(statusPanel, "cell 0 0, growy 0"); add(jailHolderPanel, "cell 0 1"); }
Source:
<code>private Set<GlusterServerInfo> fetchServers(VDS upServer, List<VDS> existingServers) { Set<GlusterServerInfo> fetchedServers = null; <START> while (fetchedServers == null && existingServers.size() > 0) { <END> fetchedServers = fetchServers(upServer); if (fetchedServers == null) { logServerMessage(upServer, AuditLogType.GLUSTER_SERVERS_LIST_FAILED); setNonOperational(upServer); existingServers.remove(upServer); upServer = getNewUpServer(existingServers, upServer); } } return fetchedServers; }</code><technical_language>consider !existingServes.isEmpty()</technical_language>

Target:
private Set<GlusterServerInfo> fetchServers(VDS upServer, List<VDS> existingServers) { Set<GlusterServerInfo> fetchedServers = null; while (fetchedServers == null && !existingServers.isEmpty()) { fetchedServers = fetchServers(upServer); if (fetchedServers == null) { logServerMessage(upServer, AuditLogType.GLUSTER_SERVERS_LIST_FAILED); setNonOperational(upServer); existingServers.remove(upServer); upServer = getNewUpServer(existingServers, upServer); } } return fetchedServers; }
Source:
<code>public String toString() { final String revisionName = sha1 != null ? sha1.name() : "null"; StringBuilder s = new StringBuilder("Revision " + revisionName + " ("); if (branches != null) { Joiner.on(", ").appendTo(s, <START> Iterables.transform(branches, (Branch from) -> Util.fixNull(from.getName()))); <END> } s.append(')'); return s.toString(); }</code><technical_language>simpler: java Iterables.transform(branches, -> Util.fixNull(from.getName())));</technical_language>

Target:
public String toString() { final String revisionName = sha1 != null ? sha1.name() : "null"; StringBuilder s = new StringBuilder("Revision " + revisionName + " ("); if (branches != null) { Joiner.on(", ").appendTo(s, Iterables.transform(branches, from -> Util.fixNull(from.getName()))); } s.append(')'); return s.toString(); }
Source:
<code><START> public boolean isValidColumnOrder(ColumnOrder columnOrder) { <END> return columnOrder.getColumnOrderName() == UNDEFINED || columnOrder.getColumnOrderName() == TYPE_DEFINED_ORDER; }</code><technical_language>I think, need public</technical_language>

Target:
boolean isValidColumnOrder(ColumnOrder columnOrder) { return columnOrder.getColumnOrderName() == UNDEFINED || columnOrder.getColumnOrderName() == TYPE_DEFINED_ORDER; }
Source:
<code>public void initialise() { <START> particleUpdater = ParticleUpdater.create(physics); <END> }</code><technical_language>Some particles effects need physics: architecture assume do</technical_language>

Target:
public void initialise() { particleUpdater = ParticleUpdater.create(physics); registerGeneratorFunction(new EnergyRangeGeneratorFunction()); registerGeneratorFunction(new VelocityRangeGeneratorFunction()); registerGeneratorFunction(new ColorRangeGeneratorFunction()); registerGeneratorFunction(new PositionRangeGeneratorFunction()); registerGeneratorFunction(new ScaleRangeGeneratorFunction()); registerGeneratorFunction(new TextureOffsetGeneratorFunction()); registerAffectorFunction(new VelocityAffectorFunction()); registerAffectorFunction(new AccelerationAffectorFunction()); }
Source:
<code>public IStatus validate(IValidationContext ctx) { IStatus status = null; EObject target = ctx.getTarget(); for (EObject content : target.eContents()) { if (content instanceof IdentifiedElement && !(content instanceof Group || content instanceof <START> ViewpointSpec)) <END> { String elementName = ((IdentifiedElement) content).getName(); if (StringUtil.isEmpty(elementName)) { status = ctx.createFailureStatus(getPath(content) + ERROR_MESSAGE); } } } if (status == null) { status = ctx.createSuccessStatus(); } return status; }</code><technical_language>instanceof concrete type while do interface. ViewpointSpec -> Viewpoint. check Group Viewpoint</technical_language>

Target:
public IStatus validate(IValidationContext ctx) { IStatus status = null; EObject target = ctx.getTarget(); for (EObject content : target.eContents()) { if (content instanceof IdentifiedElement) { String elementName = ((IdentifiedElement) content).getName(); if (StringUtil.isEmpty(elementName)) { status = ctx.createFailureStatus(getPath(content) + ERROR_MESSAGE); } } } if (status == null) { status = ctx.createSuccessStatus(); } return status; }
Source:
<code>public Map<Object, Object> readValueFrom(StreamInput in) throws IOException { if (in.readBoolean()) { int size = in.readInt(); HashMap<Object, Object> m = new HashMap<>(size); for (int i = 0; i < size; i++) { <START> Object key = UndefinedType.INSTANCE.streamer().readValueFrom(in); <END> Object val = UndefinedType.INSTANCE.streamer().readValueFrom(in); m.put(key, val); } return m; } return null; }</code><technical_language>read write symmetric this in.readGenericValue() write UndefinedType.INSTANCE.streamer().writeValueTo(...)</technical_language>

Target:
public Map<Object, Object> readValueFrom(StreamInput in) throws IOException { if (in.readBoolean()) { int size = in.readInt(); HashMap<Object, Object> m = new HashMap<>(size); for (int i = 0; i < size; i++) { Object key = in.readGenericValue(); Object val = in.readGenericValue(); m.put(key, val); } return m; } return null; }
Source:
<code>public void before() { <START> String tableName = UUID.randomUUID().toString().substring(0, 16).replace("-", "X"); <END> lockWatcher.setTable(tableName); this.tableReference = TableReference.create(SimpleEteLockWatchResource.NAMESPACE, tableName); }</code><technical_language>nit: standard in other tests is replace _, X. suggestion String tableName = UUID.randomUUID().toString().substring(0, 16).replace("-", "_");</technical_language>

Target:
public void before() { String tableName = UUID.randomUUID().toString().substring(0, 16).replace("-", "_"); lockWatcher.setTable(tableName); this.tableReference = TableReference.create(SimpleEteLockWatchResource.NAMESPACE, tableName); }
Source:
<code>private boolean isVerticalConnector() { return this == CORNER || this == VLINE; <START> } <END></code><technical_language>ooh! I ...Connector, here</technical_language>

Target:
private boolean isVerticalConnector() { return this == CORNER || this == VERTICAL_WALL; }
Source:
<code>private void runStartupRules() { if (triggerManager != null) { Iterable<Rule> startupRules = triggerManager.getRules(STARTUP); for (Rule rule : startupRules) { <START> scheduler.schedule(() -> { <END> try { Script script = scriptEngine.newScriptFromXExpression(rule.getScript()); logger.debug("Executing startup rule '{}'", rule.getName()); RuleEvaluationContext context = new RuleEvaluationContext(); context.setGlobalContext(RuleContextHelper.getContext(rule, injector)); script.execute(context); triggerManager.removeRule(STARTUP, rule); } catch (ScriptExecutionException e) { if (!e.getMessage().contains("cannot be resolved to an item or type")) { logger.error("Error during the execution of startup rule '{}': {}", new Object[] { rule.getName(), e.getCause().getMessage() }); triggerManager.removeRule(STARTUP, rule); } else { logger.debug( "Execution of startup rule '{}' has been postponed as items are still missing: {}", rule.getName(), e.getMessage()); } } }, 0, TimeUnit.SECONDS); } starting = false; triggerManager.startTimerRuleExecution(); } }</code><technical_language>Instead of schedule a zero delay sense execute instead (as long interested in ScheduledFuture)</technical_language>

Target:
private void runStartupRules() { if (triggerManager != null) { Iterable<Rule> startupRules = triggerManager.getRules(STARTUP); for (Rule rule : startupRules) { scheduler.execute(() -> { try { Script script = scriptEngine.newScriptFromXExpression(rule.getScript()); logger.debug("Executing startup rule '{}'", rule.getName()); RuleEvaluationContext context = new RuleEvaluationContext(); context.setGlobalContext(RuleContextHelper.getContext(rule, injector)); script.execute(context); triggerManager.removeRule(STARTUP, rule); } catch (ScriptExecutionException e) { if (!e.getMessage().contains("cannot be resolved to an item or type")) { logger.error("Error during the execution of startup rule '{}': {}", new Object[] { rule.getName(), e.getCause().getMessage() }); triggerManager.removeRule(STARTUP, rule); } else { logger.debug( "Execution of startup rule '{}' has been postponed as items are still missing: {}", rule.getName(), e.getMessage()); } } }); } starting = false; triggerManager.startTimerRuleExecution(); } }
Source:
<code>private boolean supportedRexCall(RexCall call) { final SqlSyntax syntax = call.getOperator().getSyntax(); switch (syntax) { case BINARY: switch (call.getKind()) { case AND: case OR: case LIKE: case EQUALS: case NOT_EQUALS: case GREATER_THAN: case GREATER_THAN_OR_EQUAL: case LESS_THAN: case LESS_THAN_OR_EQUAL: return true; default: return false; } case SPECIAL: switch (call.getKind()) { case CAST: case LIKE: <START> case OTHER_FUNCTION: <END> case ITEM: return true; case CASE: case SIMILAR: default: return false; } case FUNCTION: return true; case POSTFIX: switch (call.getKind()) { case IS_NOT_NULL: case IS_NULL: return true; } case PREFIX: switch (call.getKind()) { case NOT: return true; } case FUNCTION_ID: case FUNCTION_STAR: default: return false; } }</code><technical_language>Put ITEM in front of OTHER_FUNCTION</technical_language>

Target:
private boolean supportedRexCall(RexCall call) { final SqlSyntax syntax = call.getOperator().getSyntax(); switch (syntax) { case BINARY: switch (call.getKind()) { case AND: case OR: case LIKE: case EQUALS: case NOT_EQUALS: case GREATER_THAN: case GREATER_THAN_OR_EQUAL: case LESS_THAN: case LESS_THAN_OR_EQUAL: return true; default: return false; } case SPECIAL: switch (call.getKind()) { case CAST: case LIKE: case ITEM: case OTHER_FUNCTION: return true; case CASE: case SIMILAR: default: return false; } case FUNCTION: return true; case POSTFIX: switch (call.getKind()) { case IS_NOT_NULL: case IS_NULL: return true; } case PREFIX: switch (call.getKind()) { case NOT: return true; } case FUNCTION_ID: case FUNCTION_STAR: default: return false; } }
Source:
<code>public CTFCallsite getCallsite(String eventName, long ip) { final LinkedList<CTFCallsite> candidates = callsitesByName.get(eventName); final CTFCallsite dummyCs = new CTFCallsite(null, null, ip, null, -1); final int pos = Collections.binarySearch(candidates, dummyCs) + 1; if (pos >= candidates.size()) { return null; } <START> if (pos == -1) { <END> if (ip > candidates.getLast().getIp()) { return candidates.getLast(); } return candidates.getFirst(); } return candidates.get(pos); }</code><technical_language>I catch this binarySearch call earlier... Collections.binarySearch is a bit unintuitive. return position if matches exactly, "-position" (aka, "0 - position") if is exact match. return -1, -position. check if pos < 0, -pos get closest matching position. talk Matthew this code snippet</technical_language>

Target:
public CTFCallsite getCallsite(String eventName, long ip) { final LinkedList<CTFCallsite> candidates = callsitesByName.get(eventName); final CTFCallsite dummyCs = new CTFCallsite(null, null, ip, null, -1); final int pos = Collections.binarySearch(candidates, dummyCs) + 1; if (pos >= candidates.size()) { return null; } if (pos < 0) { if (candidates.size() > -pos) { return candidates.get(-pos); } return candidates.getFirst(); } return candidates.get(pos); }
Source:
<code>public GlusterVolumeSnapshotConfigReturnForXmlRpc(Guid clusterId, Map<String, Object> innerMap) { super(innerMap); status = new StatusForXmlRpc((Map<String, Object>) innerMap.get(STATUS)); Map<String, Object> systemConfig = (Map<String, Object>) innerMap.get(SYSTEM_CONFIG); <START> glusterSnapshotConfigInfo.setClusterId(clusterId); <END> Map<String, String> clusterConfigs = new HashMap<String, String>(); for (String key : systemConfig.keySet()) { String value = (String) systemConfig.get(key); clusterConfigs.put(key, value == null ? "" : value); } glusterSnapshotConfigInfo.setClusterConfigOptions(clusterConfigs); glusterSnapshotConfigInfo.setVolumeConfigOptions(parseVolumeConfigDetails((Map<String, Object>) innerMap.get(VOLUME_CONFIG))); }</code><technical_language>I clusterId in sync-job. Is this required</technical_language>

Target:
public GlusterVolumeSnapshotConfigReturnForXmlRpc(Guid clusterId, Map<String, Object> innerMap) { super(innerMap); status = new StatusForXmlRpc((Map<String, Object>) innerMap.get(STATUS)); Map<String, Object> systemConfig = (Map<String, Object>) innerMap.get(SYSTEM_CONFIG); Map<String, String> clusterConfigs = new HashMap<String, String>(); for (String key : systemConfig.keySet()) { String value = (String) systemConfig.get(key); clusterConfigs.put(key, value == null ? "" : value); } glusterSnapshotConfigInfo.setClusterConfigOptions(clusterConfigs); glusterSnapshotConfigInfo.setVolumeConfigOptions(parseVolumeConfigDetails((Map<String, Object>) innerMap.get(VOLUME_CONFIG))); }
Source:
<code><START> protected Guid getDataCenterId(Network network) { <END> return getEntity(StoragePool.class, VdcQueryType.GetStoragePoolByDatacenterName, new NameQueryParameters(network.getDataCenter().getName()), "Datacenter: name=" + network.getDataCenter().getName()).getId(); }</code><technical_language>please export network.getDataCenter().getName()</technical_language>

Target:
protected Guid getDataCenterId(Network network) { String networkName = network.getDataCenter().getName(); return getEntity(StoragePool.class, VdcQueryType.GetStoragePoolByDatacenterName, new NameQueryParameters(networkName), "Datacenter: name=" + networkName).getId(); }
Source:
<code>protected String getBannerTitle() { <START> return "Sign In / Register"; <END> }</code><technical_language>call getWindowTitle() :)</technical_language>

Target:
protected String getBannerTitle() { return getWindowTitle(); }
Source:
<code>public boolean getGlobalListConflicts(List<UserList> project1GlobalLists, List<UserList> project2GlobalLists) { List<UserList> conflicts = new ArrayList<>(); for (UserList project1GlobalList : project1GlobalLists) { for (UserList project2GlobalList : project2GlobalLists) { if (project1GlobalList.getName().equals(project2GlobalList.getName()) && !project1GlobalList.getList() .equals(project2GlobalList.getList())) { conflicts.add(project1GlobalList); } } } return conflicts.isEmpty(); <START> } <END></code><technical_language>need a Project Object becaus work lists of project, please change functionality work lists,</technical_language>

Target:
public boolean getGlobalListConflicts(List<UserList> project1GlobalLists, List<UserList> project2GlobalLists) { List<UserList> conflicts = new ArrayList<>(); for (UserList project1GlobalList : project1GlobalLists) { for (UserList project2GlobalList : project2GlobalLists) { if (project1GlobalList.getName().equals(project2GlobalList.getName())) { conflicts.add(project1GlobalList); } } } return !conflicts.isEmpty(); }
Source:
<code>public void removeSpace(String spaceId) { String bucketName = getBucketName(spaceId); String propertiesBucketName = getBucketName(PROPERTIES_BUCKET); try { s3Client.deleteBucket(bucketName); } catch (AmazonClientException e) { <START> String err = "Could not delete S3 bucket with name " + bucketName <END> + " due to error: " + e.getMessage(); throw new StorageException(err, e, RETRY); } s3Client.deleteObject(propertiesBucketName, spaceId); }</code><technical_language>"Swift container" "S3 bucket"</technical_language>

Target:
public void removeSpace(String spaceId) { String bucketName = getBucketName(spaceId); String propertiesBucketName = getBucketName(PROPERTIES_BUCKET); try { s3Client.deleteBucket(bucketName); } catch (AmazonClientException e) { String err = "Could not delete Swift container with name " + bucketName + " due to error: " + e.getMessage(); throw new StorageException(err, e, RETRY); } s3Client.deleteObject(propertiesBucketName, spaceId); }
Source:
<code>public void checkRead(String file) { if (base != null) { <START> super.checkRead(file); <END> } }</code><technical_language>reflection, I suspect this done for backwards-compatibility reasons, overriding delegating base a behavior change this change is a performance optimization</technical_language>

Target:
public void checkRead(String file) { if (base != null) { base.checkRead(file); } }
Source:
<code>protected void drawForeground(final int mouseX, final int mouseY) { super.drawForeground(mouseX, mouseY); if (storageEntity.isEmpty()) { font.draw("Empty", 10, 20, 4210752); } else { font.draw("Storing:", 10, 20, 4210752); font.draw(storageEntity.getStoredStack().getName().asString(), 10, 30, 4210752); <START> font.draw("Amount:", 10, 50, 4210752); <END> font.draw(String.valueOf(storageEntity.getCurrentCapacity()), 10, 60, 4210752); String percentFilled = String.valueOf((int) ((double) storageEntity.getCurrentCapacity() / (double) storageEntity.getMaxCapacity() * 100)); font.draw("Used: " + percentFilled + "%", 10, 70, 4210752); font.draw("Wrench unit to retain contents", 10, 80, 16711680); } }</code><technical_language>add translation, please</technical_language>

Target:
protected void drawForeground(final int mouseX, final int mouseY) { super.drawForeground(mouseX, mouseY); if (storageEntity.isEmpty()) { font.draw(StringUtils.t("techreborn.tooltip.unit.empty"), 10, 20, 4210752); } else { font.draw(StringUtils.t("gui.techreborn.storage.store"), 10, 20, 4210752); font.draw(storageEntity.getStoredStack().getName().asString(), 10, 30, 4210752); font.draw(StringUtils.t("gui.techreborn.storage.amount"), 10, 50, 4210752); font.draw(String.valueOf(storageEntity.getCurrentCapacity()), 10, 60, 4210752); String percentFilled = String.valueOf((int) ((double) storageEntity.getCurrentCapacity() / (double) storageEntity.getMaxCapacity() * 100)); font.draw(StringUtils.t("gui.techreborn.unit.used") + percentFilled + "%", 10, 70, 4210752); font.draw(StringUtils.t("gui.techreborn.unit.wrenchtip"), 10, 80, 16711680); } }
Source:
<code>public ConfigDef config() { <START> return null; <END> }</code><technical_language>Hmmm... I some awkwardness PredicatedTransformer implement Transformation interface. replace Transformation in TransformationChain's [transformation list](<LINK_0> a PredicatedTransformer and, if predicates configured for a transform user, default behavior for PredicatedTransformer class blindly apply transformation? This solve a problems: - risk of users a PredicatedTransformer in a connector config, try do if add logic prevent picked plugin path scanning startup logged SMT plugin - need implement methods - code path instead of for application of transformations - More flexibility in instantiation and, possibly, ability encapsulate some of ConfigDef generation logic in a separate class ConnectorConfig (haven't looked specifics of this feasible elegant)</technical_language>

Target:
public ConfigDef config() { throw new ConnectException(PredicatedTransformation.class.getName() + ".config() " + "should never be called directly."); }
Source:
<code>public String getPid() { try { StreamTokenizer toks = new StreamTokenizer(new FileReader("/proc/self/stat")); toks.parseNumbers(); if (toks.nextToken() != StreamTokenizer.TT_NUMBER) { <START> System.out.println("Failed to tokenize /proc/self/stat correctly. First token isn't a number"); <END> return "-1"; } return Integer.toString((int)toks.nval); } catch (Exception e) { System.out.println("Failed to get pid! " + e); e.printStackTrace(System.out); return "-1"; } }</code><technical_language>Break line</technical_language>

Target:
public String getPid() { try { StreamTokenizer toks = new StreamTokenizer(new FileReader("/proc/self/stat")); toks.parseNumbers(); if (toks.nextToken() != StreamTokenizer.TT_NUMBER) { System.out.println("Failed to tokenize /proc/self/stat correctly. " + "First token isn't a number"); return "-1"; } return Integer.toString((int)toks.nval); } catch (Exception e) { System.out.println("Failed to get pid! " + e); e.printStackTrace(System.out); return "-1"; } }
Source:
<code>public void run() { Executor executor = ExecutorService.getSingleton().getExecutor(RecurringTasksExecutor.class, 1); SaneAsyncTask<Void> task = new SaneAsyncTask<Void>(executor) { @Override public Void performTask() throws Throwable { RecurringTask[] allTasks = new RecurringTask[] { new RemoteConfigRefreshTask(app), new SharedImageCleanupTask(app), new DailyEventTask(app) }; for (RecurringTask task: allTasks) { task.runIfNecessary(); } <START> if (WikipediaApp.getInstance().getReleaseType() == RELEASE_ALPHA) { <END> new AlphaUpdateChecker(app).runIfNecessary(); } return null; } }; task.execute(); }</code><technical_language>Again, adding isAlpha() hiding constants? And, ReleaseUtil directly</technical_language>

Target:
public void run() { Executor executor = ExecutorService.getSingleton().getExecutor(RecurringTasksExecutor.class, 1); SaneAsyncTask<Void> task = new SaneAsyncTask<Void>(executor) { @Override public Void performTask() throws Throwable { RecurringTask[] allTasks = new RecurringTask[] { new RemoteConfigRefreshTask(app), new SharedImageCleanupTask(app), new DailyEventTask(app) }; for (RecurringTask task: allTasks) { task.runIfNecessary(); } if (WikipediaApp.getInstance().isAlphaRelease()) { new AlphaUpdateChecker(app).runIfNecessary(); } return null; } }; task.execute(); }
Source:
<code>void onTrackDeselected(@NonNull PlayerWrapper player, @NonNull TrackInfo trackInfo) <START> { <END> if (trackInfo.getTrackType() == TrackInfo.MEDIA_TRACK_TYPE_SUBTITLE) { for (int i = 0; i < mSubtitleTracks.size(); i++) { if (mSubtitleTracks.get(i).equals(trackInfo)) { mSelectedSubtitleTrackIndex = -1; continue; } } if (mSettingsMode == SETTINGS_MODE_SUBTITLE_TRACK) { mSubSettingsAdapter.setCheckPosition(mSelectedSubtitleTrackIndex + 1); } mSubtitleButton.setImageDrawable( mResources.getDrawable(R.drawable.ic_subtitle_off)); mSubtitleButton.setContentDescription( mResources.getString(R.string.mcv2_cc_is_off)); } }</code><technical_language>add if (player != mPlayer) return;</technical_language>

Target:
void onTrackDeselected(@NonNull PlayerWrapper player, @NonNull TrackInfo trackInfo) { if (player != mPlayer) return; if (trackInfo.getTrackType() == TrackInfo.MEDIA_TRACK_TYPE_SUBTITLE) { for (int i = 0; i < mSubtitleTracks.size(); i++) { if (mSubtitleTracks.get(i).equals(trackInfo)) { mSelectedSubtitleTrackIndex = -1; if (mSettingsMode == SETTINGS_MODE_SUBTITLE_TRACK) { mSubSettingsAdapter.setCheckPosition(mSelectedSubtitleTrackIndex + 1); } mSubtitleButton.setImageDrawable( mResources.getDrawable(R.drawable.ic_subtitle_off)); mSubtitleButton.setContentDescription( mResources.getString(R.string.mcv2_cc_is_off)); break; } } } }