auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void connect() throws IOException { synchronized (lock) { if (!connected) { socket = createSocket(); writeChannel = Channels.newChannel(socket.getOutputStream()); readChannel = socket.getInputStream(); connected = true; logger.debug( <START> "Connection established to {}({}):{}", <END> host, socket.getRemoteSocketAddress(), socket.getPort() ); } } }</code><technical_language>format code in intellij</technical_language>

Target:
public void connect() throws IOException { synchronized (this) { if (!connected) { socket = createSocket(); writeChannel = Channels.newChannel(socket.getOutputStream()); readChannel = socket.getInputStream(); connected = true; logger.debug("Connection established to {}({}):{}", host, socket.getRemoteSocketAddress(), socket.getPort()); } } }
Source:
<code>public boolean create(Address addressRecord) { LOG.trace("AddressDAO.create() - Begin"); <START> boolean result = true; <END> if (addressRecord != null) { result = super.create(addressRecord); } LOG.trace("AddressDAO.create() - End"); return result; }</code><technical_language>is need for declaring result variable. simply do return super.create</technical_language>

Target:
public boolean create(Address addressRecord) { LOG.trace("AddressDAO.create()"); return addressRecord != null ? super.create(addressRecord) : true; }
Source:
<code>public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Insert insert = (Insert) o; if (columns != null ? !columns.equals(insert.columns) : insert.columns != null) return false; if (table != null ? !table.equals(insert.table) : insert.table != null) return false; <START> if (subQuery != null ? !subQuery.equals(insert.subQuery) : insert.subQuery != null) <END> return false; return true; }</code><technical_language>null check is needed</technical_language>

Target:
public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } Insert<?> insert = (Insert<?>) o; return table.equals(insert.table) && columns.equals(insert.columns) && insertSource.equals(insert.insertSource); }
Source:
<code>public void testPutSingleRowFirstColumn() { AbstractTransaction transaction = mock(AbstractTransaction.class); putSingleRowFirstColumn(transaction, TEST_ROW_KEY, TEST_VALUE); ArgumentCaptor<Map> argument = ArgumentCaptor.forClass(Map.class); Mockito.verify(transaction, times(1)).put(eq(tableRef), argument.capture()); Cell expectedCell = Cell.create(PtBytes.toBytes(TEST_ROW_KEY), PtBytes.toBytes(FIRST_COL_SHORT_NAME)); assertThat(argument.getValue().entrySet().size()).isEqualTo(1); <START> assertThat(argument.getValue().keySet().toArray()[0]).isEqualTo(expectedCell); <END> assertThat((byte[]) argument.getValue().values().toArray()[0]) .usingComparator(UnsignedBytes.lexicographicalComparator()) .isEqualTo(EncodingUtils.encodeUnsignedVarLong(TEST_VALUE)); }</code><technical_language>Iterables.getOnlyElement combine assets one</technical_language>

Target:
public void testPutSingleRowFirstColumn() { AbstractTransaction transaction = mock(AbstractTransaction.class); putSingleRowFirstColumn(transaction, TEST_ROW_KEY, TEST_VALUE); ArgumentCaptor<Map> argument = ArgumentCaptor.forClass(Map.class); verify(transaction, times(1)).put(eq(tableRef), argument.capture()); Map<Cell, byte[]> foundMap = argument.getValue(); Cell expectedCell = Cell.create(PtBytes.toBytes(TEST_ROW_KEY), PtBytes.toBytes(FIRST_COL_SHORT_NAME)); assertThat(Iterables.getOnlyElement(foundMap.keySet())).isEqualTo(expectedCell); assertThat(Iterables.getOnlyElement(foundMap.values())) .usingComparator(UnsignedBytes.lexicographicalComparator()) .isEqualTo(EncodingUtils.encodeUnsignedVarLong(TEST_VALUE)); }
Source:
<code>public MapLoader<String, Object> newMapStore(String mapName, Properties properties) { LOGGER.trace("INSIDE: newMapStore()"); <START> return new FileSystemPersistenceProvider(mapName, properties); <END> }</code><technical_language>code, I agree</technical_language>

Target:
public MapLoader<String, Object> newMapStore(String mapName, Properties properties) { String persistencePath = properties.getProperty(PERSISTENCE_PATH_KEY); LOGGER.trace( "INSIDE: newMapStore(). Creating new for map stored in {}", FileSystemPersistenceProvider.class.getName(), mapName, persistencePath); return new FileSystemPersistenceProvider(mapName, persistencePath); }
Source:
<code>private void handleScreenTurnedOn() { final int count = mCallbacks.size(); for (int i = 0; i < count; i++) { KeyguardUpdateMonitorCallback cb = mCallbacks.get(i).get(); if (cb != null) { cb.onScreenTurnedOn(); } } <START> updateIrisListeningState(); <END> }</code><technical_language>is this necessary? This generic updateBiometicListeningState(). I this turn iris scanner? If so, leave authenticating state, do for fingerprint, send another signal high power mode complete authentication. This is do in fingerprint</technical_language>

Target:
private void handleScreenTurnedOn() { final int count = mCallbacks.size(); for (int i = 0; i < count; i++) { KeyguardUpdateMonitorCallback cb = mCallbacks.get(i).get(); if (cb != null) { cb.onScreenTurnedOn(); } } }
Source:
<code>HttpURLConnection getRequest(ParseHttpRequest parseRequest) throws IOException { HttpURLConnection connection; URL url = new URL(parseRequest.getUrl()); connection = (HttpURLConnection)url.openConnection(); connection.setRequestMethod(parseRequest.getMethod().toString()); connection.setConnectTimeout(socketOperationTimeout); connection.setReadTimeout(socketOperationTimeout); connection.setDoInput(true); connection.setInstanceFollowRedirects(false); for (Map.Entry<String, String> entry : parseRequest.getAllHeaders().entrySet()) { connection.setRequestProperty(entry.getKey(), entry.getValue()); } if (disableHttpLibraryAutoUncompress()) { <START> connection.setRequestProperty("Accept-encoding", "gzip"); <END> } ParseHttpBody body = parseRequest.getBody(); if (body != null) { connection.setRequestProperty("Content-Length", String.valueOf(body.getContentLength())); connection.setRequestProperty("Content-Type", body.getContentType()); connection.setFixedLengthStreamingMode(body.getContentLength()); connection.setDoOutput(true); } return connection; }</code><technical_language>nit: magic strings</technical_language>

Target:
HttpURLConnection getRequest(ParseHttpRequest parseRequest) throws IOException { HttpURLConnection connection; URL url = new URL(parseRequest.getUrl()); connection = (HttpURLConnection)url.openConnection(); connection.setRequestMethod(parseRequest.getMethod().toString()); connection.setConnectTimeout(socketOperationTimeout); connection.setReadTimeout(socketOperationTimeout); connection.setDoInput(true); connection.setInstanceFollowRedirects(false); for (Map.Entry<String, String> entry : parseRequest.getAllHeaders().entrySet()) { connection.setRequestProperty(entry.getKey(), entry.getValue()); } if (disableHttpLibraryAutoDecompress()) { connection.setRequestProperty(ACCEPT_ENCODING_HEADER, GZIP_ENCODING); } ParseHttpBody body = parseRequest.getBody(); if (body != null) { connection.setRequestProperty(CONTENT_LENGTH_HEADER, String.valueOf(body.getContentLength())); connection.setRequestProperty(CONTENT_TYPE_HEADER, body.getContentType()); connection.setFixedLengthStreamingMode(body.getContentLength()); connection.setDoOutput(true); } return connection; }
Source:
<code>void findTexts(IngestJobContext context) { blackboard = Case.getCurrentCase().getServices().getBlackboard(); try { SleuthkitCase skCase = Case.getCurrentCase().getSleuthkitCase(); absFiles = skCase.findAllFilesWhere("name ='mmssms.db'"); if (absFiles.isEmpty()) { return; } for (AbstractFile file : absFiles) { try { jFile = new java.io.File(Case.getCurrentCase().getTempDirectory(), file.getName().replaceAll("[<>%|\"/:*\\\\]", "")); dbPath = jFile.toString(); ContentUtils.writeToFile(file, jFile, context::dataSourceIngestIsCancelled); <START> fileId = file.getId(); <END> findTextsInDB(dbPath, fileId); } catch (ReadContentInputStream.ReadContentInputStreamException ex) { logger.log(Level.WARNING, String.format("Error reading content from file '%s' (id=%d).", file.getName(), fileId), ex); } catch (Exception ex) { logger.log(Level.SEVERE, String.format("Error writing content from file '%s' (id=%d) to '%s'.", file.getName(), fileId, dbPath), ex); } } } catch (TskCoreException e) { logger.log(Level.SEVERE, "Error finding text messages", e); } }</code><technical_language>call AbstractFile.getId needs occur call ContentUtils.writeToFile</technical_language>

Target:
void findTexts(IngestJobContext context) { blackboard = Case.getCurrentCase().getServices().getBlackboard(); try { SleuthkitCase skCase = Case.getCurrentCase().getSleuthkitCase(); absFiles = skCase.findAllFilesWhere("name ='mmssms.db'"); if (absFiles.isEmpty()) { return; } for (AbstractFile file : absFiles) { try { jFile = new java.io.File(Case.getCurrentCase().getTempDirectory(), file.getName().replaceAll("[<>%|\"/:*\\\\]", "")); dbPath = jFile.toString(); fileId = file.getId(); ContentUtils.writeToFile(file, jFile, context::dataSourceIngestIsCancelled); findTextsInDB(dbPath, fileId); } catch (ReadContentInputStream.ReadContentInputStreamException ex) { logger.log(Level.WARNING, String.format("Error reading content from file '%s' (id=%d).", file.getName(), fileId), ex); } catch (Exception ex) { logger.log(Level.SEVERE, String.format("Error writing content from file '%s' (id=%d) to '%s'.", file.getName(), fileId, dbPath), ex); } } } catch (TskCoreException e) { logger.log(Level.SEVERE, "Error finding text messages", e); } }
Source:
<code>public void should_fail_if_spliterator_does_not_have_characteristic() { Spliterator<?> actual = createSpliterator(Spliterator.SORTED); <START> Throwable thrown = catchThrowable(() -> assertThat(actual).hasCharacteristics(Spliterator.DISTINCT)); <END> assertThat(thrown).isInstanceOf(AssertionError.class); }</code><technical_language>expectAssertionError check correct error is built verify(failures).failure(info, <error factory>);</technical_language>

Target:
public void should_fail_if_spliterator_does_not_have_characteristic() { Spliterator<?> actual = createSpliterator(Spliterator.SORTED); expectAssertionError(() -> spliterators.assertHasCharacteristics(INFO, actual, Spliterator.DISTINCT)); verify(failures).failure(INFO, shouldContain(Collections.singleton("SORTED"), new String[] {"DISTINCT"}, Collections.singleton("DISTINCT"))); }
Source:
<code>private void handleMessage(final Message m, final OutputStream output) throws IOException, ValidationException { m.validate(); if (!canAcceptMessage(m)) { LOGGER.log(Level.WARNING, "Message dropped: {0} - too many messages in the system", m.getTags()); output.write(Message.DeliveryStatus.OVER_LIMIT.getStatusCode()); return; } Response response; try { response = processMessage(m); } catch (Exception ex) { LOGGER.log(Level.WARNING, String.format("Message dropped: %s - message error", m), ex); output.write(Message.DeliveryStatus.ERROR.getStatusCode()); output.write(ex.getMessage().getBytes()); return; } LOGGER.log(Level.FINER, "Message received: {0}", m.getTags()); LOGGER.log(Level.FINER, "Messages in the system: {0}", getMessagesInTheSystem()); output.write(Message.DeliveryStatus.OK.getStatusCode()); output.write(gson.toJson(response).getBytes()); output.flush(); <START> } <END></code><technical_language>abstract encoding/decoding ? message.getEncoded()</technical_language>

Target:
private void handleMessage(final Message m, final OutputStream output) throws IOException, ValidationException { m.validate(); if (isMessageLimitExceeded()) { LOGGER.log(Level.WARNING, "Message dropped: {0} - too many messages in the system", m); output.write(Message.DeliveryStatus.OVER_LIMIT.getStatusCode()); return; } Response response; try { response = processMessage(m); } catch (Exception ex) { LOGGER.log(Level.WARNING, String.format("Message dropped: %s - message error", m), ex); output.write(Message.DeliveryStatus.ERROR.getStatusCode()); output.write(ex.getMessage().getBytes()); return; } LOGGER.log(Level.FINER, "Message received: {0}", m); LOGGER.log(Level.FINER, "Messages in the system: {0}", getMessagesInTheSystem()); output.write(Message.DeliveryStatus.OK.getStatusCode()); output.write(gson.toJson(response).getBytes()); output.flush(); }
Source:
<code>public void add(ITicket ticket){ list.add(ticket); <START> list.sort(ORDER); <END> }</code><technical_language>Instead of sorting more efficient iterate of update shouldTick flag</technical_language>

Target:
public void add(ITicket ticket){ if(tickets.contains(ticket)){ return; } tickets.add(ticket); tick |= ticket.shouldTick(); }
Source:
<code>public boolean hasAccess(final Object obj) { if (!(obj instanceof Long)) { return false; } else if (getResourcePermissions().isUserRoleAdmin() || getResourcePermissions().isUserRoleOnc()) { return true; } else { Long acbId = (Long) obj; CertificationBodyDTO acb = null; try { acb = acbDao.getById(acbId); if (acb != null && acb.isRetired()) { LOGGER.warn("Non-admin user " + Util.getUsername() + " tried to see activity for retired ACB " + acb.getName()); return false; } <START> } catch (EntityRetrievalException ex) { } <END> return isAcbValidForCurrentUser(acbId); } }</code><technical_language>I this a odd situation, if test if ACB is retired, return false in catch ? I guess depends important is return retired ACB information..</technical_language>

Target:
public boolean hasAccess(final Object obj) { if (!(obj instanceof Long)) { return false; } else if (getResourcePermissions().isUserRoleAdmin() || getResourcePermissions().isUserRoleOnc()) { return true; } else { Long acbId = (Long) obj; CertificationBodyDTO acb = null; try { acb = acbDao.getById(acbId); if (acb != null && acb.isRetired()) { LOGGER.warn("Non-admin user " + Util.getUsername() + " tried to see activity for retired ACB " + acb.getName()); return false; } } catch (Exception ex) { return false; } return isAcbValidForCurrentUser(acbId); } }
Source:
<code>public void treeExpanded(final TreeExpansionEvent event) { if (event.getElement() instanceof DTreeItem) { DTreeItem dTreeItem = (DTreeItem) event.getElement(); if (!dTreeItem.isExpanded()) { CommandStack commandStack = domain.getCommandStack(); CompoundCommand expandDTreeItemCmd = new CompoundCommand("Expand " + dTreeItem.getName() + " tree item"); expandDTreeItemCmd.append(new TreeFoldingRecordingCommand(session, event, true)); final SiriusCommand result = new SiriusCommand(domain); if (!Platform.getPreferencesService().getBoolean(SiriusPlugin.ID, SiriusPreferencesKeys.PREF_AUTO_REFRESH.name(), false, null)) { result.getTasks().add(new RefreshTreeElementTask((DTreeItem) event.getElement(), domain)); <START> } <END> expandDTreeItemCmd.append(result); commandStack.execute(expandDTreeItemCmd); } } }</code><technical_language>is access preferenceStore expand. This is efficient (or better). I Pierre-Charles observed this problem (see for more detail). lines final SiriusCommand result = new SiriusCommand(domain); expandDTreeItemCmd.append(result); in new "if" too</technical_language>

Target:
public void treeExpanded(final TreeExpansionEvent event) { if (event.getElement() instanceof DTreeItem) { DTreeItem dTreeItem = (DTreeItem) event.getElement(); if (!dTreeItem.isExpanded()) { CommandStack commandStack = domain.getCommandStack(); CompoundCommand expandDTreeItemCmd = new CompoundCommand("Expand " + dTreeItem.getName() + " tree item"); expandDTreeItemCmd.append(new TreeFoldingRecordingCommand(session, event, true)); if (!Platform.getPreferencesService().getBoolean(SiriusPlugin.ID, SiriusPreferencesKeys.PREF_AUTO_REFRESH.name(), false, null)) { SiriusCommand result = new SiriusCommand(domain); result.getTasks().add(new RefreshTreeElementTask((DTreeItem) event.getElement(), domain)); expandDTreeItemCmd.append(result); } commandStack.execute(expandDTreeItemCmd); } } }
Source:
<code>private Joiner createAwsJoiner() { try { Class clazz = Class.forName("com.hazelcast.cluster.impl.TcpIpJoinerOverAWS"); Constructor constructor = clazz.getConstructor(Node.class); return (Joiner) constructor.newInstance(this); } catch (ClassNotFoundException e) { StringBuilder message = new StringBuilder("Your Hazelcast network configuration has AWS discovery ") .append("enabled, but there is no Hazelcast AWS module on a classpath. ") .append(LINE_SEPARATOR) .append("Hint: If you are using Maven then add this dependency into your pom.xml:") .append(LINE_SEPARATOR) .append("<dependency>").append(LINE_SEPARATOR) .append(" <groupId>com.hazelcast</groupId>").append(LINE_SEPARATOR) .append(" <artifactId>hazelcast-aws</artifactId>").append(LINE_SEPARATOR) <START> .append(" <version>${hazelcast-aws.version}</version>").append(LINE_SEPARATOR) <END> .append("</dependency>").append(LINE_SEPARATOR); throw new ConfigurationException(message.toString(), e); } catch (Exception e) { throw rethrow(e); } }</code><technical_language>If copy paste this logic defined hazelcast-aws.version property, fail. 1: version of module? I guess module need match HZ version? 2: If do a lookup, <version>insert-right-version-here</version> more obvious some work end user is required here</technical_language>

Target:
private Joiner createAwsJoiner() { try { Class clazz = Class.forName("com.hazelcast.cluster.impl.TcpIpJoinerOverAWS"); Constructor constructor = clazz.getConstructor(Node.class); return (Joiner) constructor.newInstance(this); } catch (ClassNotFoundException e) { String message = "Your Hazelcast network configuration has AWS discovery " + "enabled, but there is no Hazelcast AWS module on a classpath. " + LINE_SEPARATOR + "Hint: If you are using Maven then add this dependency into your pom.xml:" + LINE_SEPARATOR + "<dependency>" + LINE_SEPARATOR + " <groupId>com.hazelcast</groupId>" + LINE_SEPARATOR + " <artifactId>hazelcast-aws</artifactId>" + LINE_SEPARATOR + " <version>insert hazelcast-aws version</version>" + LINE_SEPARATOR + "</dependency>" + LINE_SEPARATOR + " See <LINK_0> for additional details"; throw new ConfigurationException(message, e); } catch (Exception e) { throw rethrow(e); } }
Source:
<code>public abstract void beginArray() throws IOException; public abstract void endArray() throws IOException; public abstract void beginObject() throws IOException; public abstract void endObject() throws IOException; public abstract boolean hasNext() throws IOException; public abstract Token peek() throws IOException; public abstract String nextName() throws IOException; public abstract int selectName(Options options) throws IOException; public abstract String nextString() throws IOException; public abstract int selectString(Options options) throws IOException; public abstract boolean nextBoolean() throws IOException; public abstract <T> T nextNull() throws IOException; public abstract double nextDouble() throws IOException; public abstract long nextLong() throws IOException; public abstract int nextInt() throws IOException; public abstract void skipValue() throws IOException; <START> public String getPath() { <END> return JsonScope.getPath(stackSize, scopes, pathNames, pathIndices); }</code><technical_language>final then</technical_language>

Target:
public abstract void beginArray() throws IOException; public abstract void endArray() throws IOException; public abstract void beginObject() throws IOException; public abstract void endObject() throws IOException; public abstract boolean hasNext() throws IOException; public abstract Token peek() throws IOException; public abstract String nextName() throws IOException; public abstract int selectName(Options options) throws IOException; public abstract String nextString() throws IOException; public abstract int selectString(Options options) throws IOException; public abstract boolean nextBoolean() throws IOException; public abstract <T> T nextNull() throws IOException; public abstract double nextDouble() throws IOException; public abstract long nextLong() throws IOException; public abstract int nextInt() throws IOException; public abstract void skipValue() throws IOException; public final String getPath() { return JsonScope.getPath(stackSize, scopes, pathNames, pathIndices); }
Source:
<code>FlowScript createFlowScriptByURL() throws InvalidScriptException { try { <START> URL inputUrl = new URL(url); <END> if (flowScriptActionType.equals(FlowActionType.CONTINUE.toString())) { return FlowScript.createContinueFlowScript(); } else if (flowScriptActionType.equals(FlowActionType.IF.toString())) { return FlowScript.createIfFlowScript(inputUrl, getScriptEngine(), getFlowScriptTarget(), getFlowScriptTargetElse(), getFlowScriptTargetContinuation(), parameters()); } else if (flowScriptActionType.equals(FlowActionType.LOOP.toString())) { return FlowScript.createLoopFlowScript(inputUrl, getScriptEngine(), getFlowScriptTarget(), parameters()); } if (flowScriptActionType.equals(FlowActionType.REPLICATE.toString())) { return FlowScript.createReplicateFlowScript(inputUrl, getScriptEngine(), parameters()); } else { throw new DatabaseManagerException("Invalid flow script action: " + flowScriptActionType); } } catch (MalformedURLException e) { throw new InvalidScriptException(e); } }</code><technical_language>initialize inputUrl variable try block</technical_language>

Target:
FlowScript createFlowScriptByURL() throws InvalidScriptException { URL inputUrl; try { inputUrl = new URL(url); } catch (MalformedURLException e) { throw new InvalidScriptException(e); } if (flowScriptActionType.equals(FlowActionType.CONTINUE.toString())) { return FlowScript.createContinueFlowScript(); } else if (flowScriptActionType.equals(FlowActionType.IF.toString())) { return FlowScript.createIfFlowScript(inputUrl, getScriptEngine(), getFlowScriptTarget(), getFlowScriptTargetElse(), getFlowScriptTargetContinuation(), parameters()); } else if (flowScriptActionType.equals(FlowActionType.LOOP.toString())) { return FlowScript.createLoopFlowScript(inputUrl, getScriptEngine(), getFlowScriptTarget(), parameters()); } if (flowScriptActionType.equals(FlowActionType.REPLICATE.toString())) { return FlowScript.createReplicateFlowScript(inputUrl, getScriptEngine(), parameters()); } else { throw new DatabaseManagerException("Invalid flow script action: " + flowScriptActionType); } }
Source:
<code>private void addCompoundInstallTaskFor(JsonFeature jfeature, TaskList tasks) { <START> tasks.add( <END> Operation.INSTALL, jfeature.getId(), HashMap<String, Set<JsonFeature>>::new, (jfeatures, r) -> installFeatures(r, jfeatures), (id, jfeatures) -> jfeatures.computeIfAbsent(jfeature.getRegion(), r -> new HashSet<>()).add(jfeature)); }</code><technical_language>Do this a clearer? Curious other reviewers think. // Constants public static final Supplier<Map<String, Set<JsonFeature>> COMPOUND_INSTALL_SUPPLIER = HashMap<String, Set<JsonFeature>>::new; public static final BiConsumer<String, T> COMPOUND_INSTALL_ACCUMULATOR = (id, jfeatures) -> jfeatures.computeIfAbsent(jfeature.getRegion(), r -> new HashSet<>()).add(jfeature); private void addCompoundInstallTaskFor(JsonFeature jfeature, TaskList tasks) { tasks.createCompoundTaskIfAbsent( Operation.INSTALL, COMPOUND_INSTALL_SUPPLIER, COMPOUND_INSTALL_ACCUMULATOR)) .add( Operation.INSTALL, jfeature.getId(), (jfeatures, r) -> installFeatures(r, jfeatures)); } I realized this class is completely stateless, I if a factory method TaskList create compound tasks bad..</technical_language>

Target:
private void addCompoundInstallTaskFor(JsonFeature jfeature, TaskList tasks) { tasks .addIfAbsent( Operation.INSTALL, HashMap<String, Set<JsonFeature>>::new, (jfeatures, r) -> installFeatures(r, jfeatures)) .add( jfeature.getId(), jfeatures -> jfeatures .computeIfAbsent(jfeature.getRegion(), r -> new HashSet<>()) .add(jfeature)); }
Source:
<code>public Optional<Object> apply( final Object... args ) { Integer maxInt = Integer.MIN_VALUE; Double maxDouble = Double.MIN_VALUE; if(args.length == 0) { return Optional.empty(); } for(Object arg: args) { <START> if(arg instanceof Integer) { <END> maxInt = java.lang.Math.max( maxInt, (Integer) arg ); } else if(arg instanceof Double) { maxDouble = java.lang.Math.max( maxDouble, (Double) arg ); } } if(maxInt == Integer.MIN_VALUE && maxDouble == Double.MIN_VALUE) { return Optional.<Object>of( Double.NaN ); } if(maxInt.doubleValue() >= maxDouble) { return Optional.<Object>of(maxInt); } else { return Optional.<Object>of(maxDouble); } }</code><technical_language>Need add for Long</technical_language>

Target:
public Optional<Object> apply( final Object... args ) { Integer maxInt = Integer.MIN_VALUE; Double maxDouble = -(Double.MIN_VALUE); Long maxLong = Long.MIN_VALUE; if(args.length == 0) { return Optional.empty(); } for(Object arg: args) { if(arg instanceof Integer) { maxInt = java.lang.Math.max( maxInt, (Integer) arg ); } else if(arg instanceof Double) { maxDouble = java.lang.Math.max( maxDouble, (Double) arg ); } else if(arg instanceof Long) { maxLong = java.lang.Math.max(maxLong, (Long) arg); } } if(maxInt == Integer.MIN_VALUE && maxDouble == Double.MIN_VALUE && maxLong == Long.MIN_VALUE) { return Optional.empty(); } if(maxInt.longValue() >= maxDouble.longValue() && maxInt.longValue() >= maxLong) { return Optional.<Object>of(maxInt); } else if(maxLong >= maxDouble.longValue() && maxLong >= maxInt.longValue()) { return Optional.<Object>of(maxLong); } else { return Optional.<Object>of(maxDouble); } }
Source:
<code>private void setUpPeopleDrawerAdapter() { try { peopleDrawerList = new ArrayList<>(); this.peopleAdapter = new RefreshableCursorAdapter(ZulipActivity.this, peopleDrawerList, app) { @Override protected void doNarrow(int id) { resetPeopleSearch(); if (id == allPeopleId) { openAllPrivateMessages(); } else { <START> Person person = Person.getById(app, (int) id); <END> narrowPMWith(person); switchToPrivate(); } } }; peopleDrawer.setAdapter(peopleAdapter); FloatingHeaderDecoration decor = new FloatingHeaderDecoration(peopleAdapter); peopleDrawer.setAdapter(peopleAdapter); peopleDrawer.addItemDecoration(decor, 1); } catch (Exception e) { ZLog.logException(e); } }</code><technical_language>need for cast int</technical_language>

Target:
private void setUpPeopleDrawerAdapter() { try { peopleDrawerList = new ArrayList<>(); this.peopleAdapter = new RefreshableCursorAdapter(ZulipActivity.this, peopleDrawerList, app) { @Override protected void onPeopleSelect(int id) { resetPeopleSearch(); if (id == Constants.ALL_PEOPLE_ID) { openAllPrivateMessages(); } else if (id == Constants.MENTIONS) { doNarrow(new NarrowFilterMentioned()); } else { Person person = Person.getById(app, id); narrowPMWith(person); switchToPrivate(); } } }; peopleDrawer.setAdapter(peopleAdapter); FloatingHeaderDecoration decor = new FloatingHeaderDecoration(peopleAdapter); peopleDrawer.setAdapter(peopleAdapter); peopleDrawer.addItemDecoration(decor, 1); } catch (Exception e) { ZLog.logException(e); } }
Source:
<code>public CompiledSchemaRepository<Schema> provide() { CachedCompiledSchemaRepository<Schema> repository = new CachedCompiledSchemaRepository<>( new DirectCompiledSchemaRepository<>(rawSchemaClient, SchemaCompilersFactory.avroSchemaCompiler()), configFactory.getIntProperty(Configs.SCHEMA_CACHE_COMPILED_MAXIMUM_SIZE), configFactory.getIntProperty(Configs.SCHEMA_CACHE_COMPILED_EXPIRE_AFTER_ACCESS_MINUTES)); notificationsBus.registerTopicCallback(new TopicCallback() { @Override public void onTopicRemoved(Topic topic) { repository.removeFromCache(topic); } @Override public void onTopicCreated(Topic topic) { logger.info("Loading latest schema for created topic {}", topic.getQualifiedName()); <START> schemaVersionsRepository.onlineLatestSchemaVersion(topic).ifPresent( <END> schemaVersion -> repository.getSchema(topic, schemaVersion, true)); } @Override public void onTopicChanged(Topic topic) { logger.info("Loading latest schema for updated topic {}", topic.getQualifiedName()); schemaVersionsRepository.onlineLatestSchemaVersion(topic).ifPresent( schemaVersion -> repository.getSchema(topic, schemaVersion, true)); } }); return repository; }</code><technical_language>check topic is avro-type? get rid of unnecessary schema registry requests for json-topics. update below</technical_language>

Target:
public CompiledSchemaRepository<Schema> provide() { CachedCompiledSchemaRepository<Schema> repository = new CachedCompiledSchemaRepository<>( new DirectCompiledSchemaRepository<>(rawSchemaClient, SchemaCompilersFactory.avroSchemaCompiler()), configFactory.getIntProperty(Configs.SCHEMA_CACHE_COMPILED_MAXIMUM_SIZE), configFactory.getIntProperty(Configs.SCHEMA_CACHE_COMPILED_EXPIRE_AFTER_ACCESS_MINUTES)); notificationsBus.registerTopicCallback(new TopicCallback() { @Override public void onTopicRemoved(Topic topic) { repository.removeFromCache(topic); } @Override public void onTopicCreated(Topic topic) { updateLatestSchema(topic, "new"); } @Override public void onTopicChanged(Topic topic) { updateLatestSchema(topic, "updated"); } private void updateLatestSchema(Topic topic, String operationName) { if (topic.getContentType() == ContentType.AVRO) { logger.info("Loading latest schema for topic {}", operationName, topic.getQualifiedName()); schemaVersionsRepository.onlineLatestSchemaVersion(topic).ifPresent( schemaVersion -> repository.getSchema(topic, schemaVersion, true)); } } }); return repository; }
Source:
<code>public void checkHoveringFeature() { String expectedTextInHoverPopUp = "System.Console\nRepresents the standard input, output, and error streams for console applications. This class cannot be inherited."; editor.moveCursorToText("Console"); <START> Assert.assertEquals(editor.getTextFromHoverPopup(), expectedTextInHoverPopUp, "<LINK_0>"); <END> }</code><technical_language>change "editor.waitTextInHoverPopup(expectedTextInHoverPopUp);" this increase stability of this test</technical_language>

Target:
public void checkHoveringFeature() { String expectedTextInHoverPopUp = "System.Console\nRepresents the standard input, output, and error streams for console applications. This class cannot be inherited."; editor.moveCursorToText("Console"); try { editor.waitTextInHoverPopUpEqualsTo(expectedTextInHoverPopUp); } catch (TimeoutException ex) { fail("Known permanent failure: <LINK_0>", ex); } }
Source:
<code>int getAccessValue(ReaderWay way) { int accessValue = 0; Integer tmpAccessValue = 0; for (String restriction : restrictions) { tmpAccessValue = accessMap.get(way.getTag(restriction, "yes")); if (tmpAccessValue != null && tmpAccessValue > accessValue) { accessValue = tmpAccessValue; } } if(accessValue == 0){ GHPoint estmCentre = way.getTag("estimated_center", null); if (estmCentre != null) { SpatialRule rule = spatialRuleLookup.lookupRule(estmCentre); accessValue = getEdgeValueForAccess(rule.isAccessible(way, "")); } <START> } <END> return accessValue; }</code><technical_language>explain this case</technical_language>

Target:
int getAccessValue(ReaderWay way) { int accessValue = 0; Integer tmpAccessValue; for (String restriction : restrictions) { tmpAccessValue = accessMap.get(way.getTag(restriction, "yes")); if (tmpAccessValue != null && tmpAccessValue > accessValue) { accessValue = tmpAccessValue; } } if (spatialRuleLookupEnabled() && accessValue == 0) { switch (getSpatialRule(way).getAccessValue(way.getTag("highway", ""), TransportationMode.MOTOR_VEHICLE, AccessValue.ACCESSIBLE)){ case ACCESSIBLE: accessValue = accessMap.get("yes"); break; case EVENTUALLY_ACCESSIBLE: accessValue = accessMap.get("destination"); break; case NOT_ACCESSIBLE: accessValue = accessMap.get("no"); break; } } return accessValue; }
Source:
<code>public Assignments(@JsonProperty("assignments") Map<VariableReferenceExpression, RowExpression> assignments) { this.assignments = unmodifiableMap(new HashMap<>(requireNonNull(assignments, "assignments is null"))); <START> this.outputs = new ArrayList<>(assignments.keySet()); <END> }</code><technical_language>nit: put unmodifiableList here</technical_language>

Target:
public Assignments(@JsonProperty("assignments") Map<VariableReferenceExpression, RowExpression> assignments) { this.assignments = unmodifiableMap(new LinkedHashMap<>(requireNonNull(assignments, "assignments is null"))); this.outputs = unmodifiableList(new ArrayList<>(assignments.keySet())); }
Source:
<code>public QueryResult find(Map<String, Object> query, long skip, long limit, List<String> fields, List<Map<String, String>> sortDocument) throws CheckedQueryException { if (query == null) { <START> logger.log(Level.SEVERE, "-find called with null selector; bailing."); <END> throw new CheckedQueryException(); } if (!updateAllIndexes()) { throw new CheckedQueryException(); } QueryExecutor queryExecutor = new QueryExecutor(this, dbQueue); Map<String, Object> indexes = listIndexes(); return queryExecutor.find(query, indexes, skip, limit, fields, sortDocument); }</code><technical_language>idea this a - prefix</technical_language>

Target:
public QueryResult find(Map<String, Object> query, long skip, long limit, List<String> fields, List<Map<String, String>> sortDocument) throws CheckedQueryException { if (query == null) { logger.log(Level.SEVERE, "-find called with null selector; bailing."); throw new CheckedQueryException(); } if (!updateAllIndexes()) { throw new CheckedQueryException(); } QueryExecutor queryExecutor = new QueryExecutor(this, indexDbQueue); Map<String, Object> indexes = listIndexes(); return queryExecutor.find(query, indexes, skip, limit, fields, sortDocument); }
Source:
<code>private void updateDiskSize(DiskImage diskImage) { <START> getSizeExtend().validateEntity(new IValidation[] { <END> new NotEmptyValidation(), new NonNegativeLongNumberValidation(), }); if (getSizeExtend().getIsValid()) { long sizeToAddInGigabytes = Long.parseLong(getSizeExtend().getEntity()); if (sizeToAddInGigabytes > 0) { diskImage.setSizeInGigabytes(diskImage.getSizeInGigabytes() + sizeToAddInGigabytes); } } }</code><technical_language>please move 'validate' method, this method handle size updating</technical_language>

Target:
private void updateDiskSize(DiskImage diskImage) { long sizeToAddInGigabytes = Long.parseLong(getSizeExtend().getEntity()); if (sizeToAddInGigabytes > 0) { diskImage.setSizeInGigabytes(diskImage.getSizeInGigabytes() + sizeToAddInGigabytes); } }
Source:
<code>public static XSLTTransformation using(String location) { <START> contextClassLoader = Thread.currentThread().getContextClassLoader(); <END> XSLTTransformation tansformation = new XSLTTransformation(); tansformation.location = location; return tansformation; }</code><technical_language>Good</technical_language>

Target:
public static XSLTTransformation using(String location) { XSLTTransformation tansformation = new XSLTTransformation(); tansformation.contextClassLoader = Thread.currentThread().getContextClassLoader(); tansformation.location = location; return tansformation; }
Source:
<code>public void process() { PerformanceMonitor.startActivity("rendering/chunksAlphaReject"); final Vector3f cameraPosition = playerCamera.getPosition(); int numberOfRenderedTriangles = 0; int numberOfChunksThatAreNotReadyYet = 0; <START> displayResolutionDependentFBOs.get(new ResourceUrn("engine:sceneOpaque")).bind(); END> chunkShader.setFloat("clip", 0.0f, true); chunkShader.activateFeature(ShaderProgramFeature.FEATURE_ALPHA_REJECT); while (renderQueues.chunksAlphaReject.size() > 0) { RenderableChunk chunk = renderQueues.chunksAlphaReject.poll(); if (chunk.hasMesh()) { final ChunkMesh chunkMesh = chunk.getMesh(); final Vector3f chunkPosition = chunk.getPosition().toVector3f(); chunkMesh.updateMaterial(chunkShader, chunkPosition, chunk.isAnimated()); numberOfRenderedTriangles += chunkMesh.render(ALPHA_REJECT, chunkPosition, cameraPosition); } else { numberOfChunksThatAreNotReadyYet++; } } chunkShader.deactivateFeature(ShaderProgramFeature.FEATURE_ALPHA_REJECT); worldRenderer.increaseTrianglesCount(numberOfRenderedTriangles); worldRenderer.increaseNotReadyChunkCount(numberOfChunksThatAreNotReadyYet); PerformanceMonitor.endActivity(); }</code><technical_language>put new ResourceUrn("engine:sceneOpaque") in a static final variable beginning of class. Also, want check if use: addDesiredStateChange(new BindFBO(myStaticResourceUrn, displayResolutionDependentFBOs)) in initialize, is done in other nodes, instead of this bind statement</technical_language>

Target:
public void process() { PerformanceMonitor.startActivity("rendering/chunksAlphaReject"); final Vector3f cameraPosition = playerCamera.getPosition(); int numberOfRenderedTriangles = 0; int numberOfChunksThatAreNotReadyYet = 0; sceneOpaqueFbo.bind(); chunkShader.setFloat("clip", 0.0f, true); chunkShader.activateFeature(ShaderProgramFeature.FEATURE_ALPHA_REJECT); while (renderQueues.chunksAlphaReject.size() > 0) { RenderableChunk chunk = renderQueues.chunksAlphaReject.poll(); if (chunk.hasMesh()) { final ChunkMesh chunkMesh = chunk.getMesh(); final Vector3f chunkPosition = chunk.getPosition().toVector3f(); chunkMesh.updateMaterial(chunkShader, chunkPosition, chunk.isAnimated()); numberOfRenderedTriangles += chunkMesh.render(ALPHA_REJECT, chunkPosition, cameraPosition); } else { numberOfChunksThatAreNotReadyYet++; } } chunkShader.deactivateFeature(ShaderProgramFeature.FEATURE_ALPHA_REJECT); worldRenderer.increaseTrianglesCount(numberOfRenderedTriangles); worldRenderer.increaseNotReadyChunkCount(numberOfChunksThatAreNotReadyYet); PerformanceMonitor.endActivity(); }
Source:
<code>private void setupWsClient() { try { wsClient = new PubSubWSClientBuilder().setContext(plan.getLogicalPlan()).build(); if (wsClient != null) { wsClient.setup(); } } catch (Exception e) { <START> LOG.warn("Cannot establish websocket connection", e); <END> } }</code><technical_language>information connect URI, is this info in log message</technical_language>

Target:
private void setupWsClient() { wsClient = new PubSubWebSocketClientBuilder().setContext(plan.getLogicalPlan()).build(); if (wsClient != null) { try { wsClient.openConnection(); } catch (Exception e) { LOG.warn("Cannot establish websocket connection to uri {}", wsClient.getUri(), e); } } }
Source:
<code>private void addRepos() { IProvisioningAgent agent = ServiceHelper.getService(AutomaticUpdatePlugin.getContext(), IProvisioningAgent.class); IMetadataRepositoryManager metaManager = agent.getService(IMetadataRepositoryManager.class); IArtifactRepositoryManager artifactManager = agent.getService(IArtifactRepositoryManager.class); List<URI> currentMetaRepos = Arrays .asList(metaManager.getKnownRepositories(IRepositoryManager.REPOSITORIES_ALL)); if (reposToMigrate != null && metaManager != null && artifactManager != null) { for (URI <START> reposToMigrate1 : <END> reposToMigrate) { if (!currentMetaRepos.contains(reposToMigrate1)) { metaManager.addRepository(reposToMigrate1); artifactManager.addRepository(reposToMigrate1); addedRepos.add(reposToMigrate1); } } } }</code><technical_language>repoToMigrate</technical_language>

Target:
private void addRepos() { IProvisioningAgent agent = ServiceHelper.getService(AutomaticUpdatePlugin.getContext(), IProvisioningAgent.class); IMetadataRepositoryManager metaManager = agent.getService(IMetadataRepositoryManager.class); IArtifactRepositoryManager artifactManager = agent.getService(IArtifactRepositoryManager.class); List<URI> currentMetaRepos = Arrays .asList(metaManager.getKnownRepositories(IRepositoryManager.REPOSITORIES_ALL)); if (reposToMigrate != null && metaManager != null && artifactManager != null) { for (URI repoToMigrate : reposToMigrate) { if (!currentMetaRepos.contains(repoToMigrate)) { metaManager.addRepository(repoToMigrate); artifactManager.addRepository(repoToMigrate); addedRepos.add(repoToMigrate); } } } }
Source:
<code><START> public void setRxBufferCapacity(int rxBufferCapacity) { <END> this.rxBufferCapacity = rxBufferCapacity; }</code><technical_language>methods return this</technical_language>

Target:
public Builder setRxBufferCapacity(int rxBufferCapacity) { this.rxBufferCapacity = rxBufferCapacity; return this; }
Source:
<code><START> public String getFileName() { return fileName; } <END></code><technical_language>keyword "this" in methods member names</technical_language>

Target:
public String getFileName() { return this.fileName; }
Source:
<code>public static String generateHmacSha256(String key, String valueToEncrypt) { try { byte[] hash = generateHmacSha256Bytes(key, valueToEncrypt); <START> StringBuffer result = new StringBuffer(); <END> for (byte b : hash) { result.append(String.format("%02x", b)); } return result.toString(); } catch (RuntimeException e) { throw new RuntimeException("CommunityCommons::EncodeHmacSha256::Unable to encode: " + e.getMessage(), e); } }</code><technical_language>Please a [StringBuilder](<LINK_0> instead</technical_language>

Target:
public static String generateHmacSha256(String key, String valueToEncrypt) { try { byte[] hash = generateHmacSha256Bytes(key, valueToEncrypt); StringBuilder result = new StringBuilder(); for (byte b : hash) { result.append(String.format("%02x", b)); } return result.toString(); } catch (UnsupportedEncodingException | IllegalStateException | InvalidKeyException | NoSuchAlgorithmException e) { throw new RuntimeException("CommunityCommons::generateHmacSha256::Unable to encode: " + e.getMessage(), e); } }
Source:
<code>public static <START> java.util.TimeZone getTimeZone( <END> int offset, boolean dst, long when, String country) { if (country == null) { return null; } TimeZone bias = TimeZone.getDefault(); TimeZone timeZone = TimeZoneFinder.getInstance() .lookupTimeZoneByCountryAndOffset(country, offset, dst, when, bias); return timeZone != null ? java.util.TimeZone.getTimeZone(timeZone.getID()) : null; }</code><technical_language>prefer import icu.util.Timezone java.util.TimeZone default in this file returning this thing. icu.util.Timezone is internal impl detail. Alternatively replace of TimeZone new icu version system (if want replace it). Mixing bad</technical_language>

Target:
public static java.util.TimeZone getTimeZone( int offset, boolean dst, long when, String country) { android.icu.util.TimeZone icuTimeZone = getIcuTimeZone(offset, dst, when, country); return icuTimeZone != null ? java.util.TimeZone.getTimeZone(icuTimeZone.getID()) : null; }
Source:
<code>public void buildStorageAccount(AzureClient client, StorageAccountParameters storageAccountParameters) { try { String template = azureStorageAccountTemplateBuilder.build(storageAccountParameters); <START> if (!client.templateDeploymentExists(storageAccountParameters.getResourceGroupName(), storageAccountParameters.getStorageAccountName())) { <END> String parameters = new Json(Map.of()).getValue(); Deployment templateDeployment = client.createTemplateDeployment( storageAccountParameters.getResourceGroupName(), storageAccountParameters.getStorageAccountName(), template, parameters); LOGGER.debug("Created template deployment for storage account: {}", templateDeployment.exportTemplate().template()); } } catch (Exception e) { String message = String.format("Could not create storage account %s in resource group %s", storageAccountParameters.getStorageAccountName(), storageAccountParameters.getResourceGroupName()); LOGGER.warn(message, e); throw new CloudConnectorException(message); } }</code><technical_language>please extract this condition a private method</technical_language>

Target:
public void buildStorageAccount(AzureClient client, StorageAccountParameters storageAccountParameters) { String resourceGroupName = storageAccountParameters.getResourceGroupName(); String storageAccountName = storageAccountParameters.getStorageAccountName(); try { String template = azureStorageAccountTemplateBuilder.build(storageAccountParameters); if (!client.templateDeploymentExists(resourceGroupName, storageAccountName)) { String parameters = new Json(Map.of()).getValue(); Deployment templateDeployment = client.createTemplateDeployment(resourceGroupName, storageAccountName, template, parameters); LOGGER.debug("Created template deployment for storage account: {}", templateDeployment.exportTemplate().template()); } } catch (CloudException e) { LOGGER.info("Provisioning error, cloud exception happened: ", e); if (e.body() != null && e.body().details() != null) { String details = e.body().details().stream().map(CloudError::message).collect(Collectors.joining(", ")); throw new CloudConnectorException(String.format("Storage account provisioning failed, status code %s, error message: %s, details: %s", e.body().code(), e.body().message(), details)); } else { throw new CloudConnectorException(String.format("Storage account provisioning failed: '%s', please go to Azure Portal for detailed message", e)); } } catch (Exception e) { String message = String.format("Could not create storage account %s in resource group %s", storageAccountName, resourceGroupName); LOGGER.warn(message, e); throw new CloudConnectorException(message); } }
Source:
<code>public AttributesManager(DataManager dataManager) { super(dataManager, Attribute.class, AttributePermission.class, DeviceAttribute.class, GroupAttribute.class); refreshItems(); <START> refreshExtendedPermissions(); <END> }</code><technical_language>refresh everything. Do a performance issues it</technical_language>

Target:
public AttributesManager(DataManager dataManager) { super(dataManager, Attribute.class); refreshItems(); refreshExtendedPermissions(); }
Source:
<code><START> public void executeQueryCommand() { <END> IscsiBond iscsiBond = getDbFacade().getIscsiBondDao().get(getParameters().getId()); if (iscsiBond != null) { iscsiBond.getNetworkIds().addAll(getDbFacade().getIscsiBondDao() .getNetworkIdsByIscsiBondId(iscsiBond.getId())); iscsiBond.getStorageConnectionIds().addAll(getDbFacade().getIscsiBondDao() .getStorageConnectionIdsByIscsiBondId(iscsiBond.getId())); getQueryReturnValue().setReturnValue(iscsiBond); } }</code><technical_language>public</technical_language>

Target:
protected void executeQueryCommand() { IscsiBond iscsiBond = getDbFacade().getIscsiBondDao().get(getParameters().getId()); if (iscsiBond != null) { iscsiBond.getNetworkIds().addAll(getDbFacade().getIscsiBondDao() .getNetworkIdsByIscsiBondId(iscsiBond.getId())); iscsiBond.getStorageConnectionIds().addAll(getDbFacade().getIscsiBondDao() .getStorageConnectionIdsByIscsiBondId(iscsiBond.getId())); getQueryReturnValue().setReturnValue(iscsiBond); } }
Source:
<code>public boolean isCidrFormatValid(String cidr) { <START> return (cidr == null || !cidr.matches(ValidationUtils.CIDR_FORMAT_PATTERN)) ? <END> false : true; }</code><technical_language>replaced by: return cidr != null && cidr.matches(ValidationUtils.CIDR_FORMAT_PATTERN);</technical_language>

Target:
public boolean isCidrFormatValid(String cidr) { return (cidr != null && cidr.matches(ValidationUtils.CIDR_FORMAT_PATTERN)); }