auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public boolean shouldAlertUpgrade(ArrayList<RpmVersion> isos, String hostOs) { boolean alert = false; <START> DateTimeFormat format = DateTimeFormat.getFormat("yyyyMMdd"); END> String nodeInfo[] = hostOs.split("-"); String formattedISOVersion = null; for (RpmVersion iso: isos) { try { formattedISOVersion = String.valueOf(iso); formattedISOVersion = formattedISOVersion.substring(formattedISOVersion.length() - 8); Date dateISO = format.parse(formattedISOVersion); Date dateNodeISO = format.parse(nodeInfo[2].split("\\.")[0].trim()); if (dateISO.compareTo(dateNodeISO)>0) { alert = true; break; } } catch (IllegalArgumentException er) { logger.info("IllegalArgumentException error: " + er); } } return alert; }</code><technical_language>I suggest "format" static in order avoid parsing pattern time, for example: private static final DateTimeFormat dateISOFormat = DateTimeFormat.getFormat("yyyyMMdd"); //$NON-NLS-1$ this, "dateISOFormat.parse" instead of "format.parse" in code below</technical_language>

Target:
public boolean shouldAlertUpgrade(ArrayList<RpmVersion> isos, String hostOs) { boolean alert = false; for (RpmVersion iso: isos) { try { String nodeInfo[] = hostOs.split("-"); String formattedISOversion = iso.getValue(); formattedISOversion = formattedISOversion.substring(formattedISOversion.length() - 8); Date dateISO = dateISOformat.parse(formattedISOversion); Date dateNodeISO = dateISOformat.parse(nodeInfo[2].split("\\.")[0].trim()); if (dateISO.compareTo(dateNodeISO)>0) { alert = true; break; } } catch (Exception ex) { getLogger().error("Error while trying to determine host upgrade alert", ex); } } return alert; }
Source:
<code>protected void refreshAnchorTypes() { Type type = info.getFreshSignature(); TypeScope scope = new TypeScope(); for (OutputAnchor anchor : outputs) { if (type instanceof FunType) { FunType ftype = (FunType)type; anchor.setFreshRequiredType(ftype.getArgument(), scope); type = ftype.getResult(); } else { <START> new RuntimeException("too many arguments in this functionblock " + name.getText()); <END> } } input.setFreshRequiredType(type, scope); }</code><technical_language>Exception object is created thrown</technical_language>

Target:
protected void refreshAnchorTypes() { Type type = info.getFreshSignature(); TypeScope scope = new TypeScope(); for (OutputAnchor anchor : outputs) { if (type instanceof FunType) { FunType ftype = (FunType)type; anchor.setFreshRequiredType(ftype.getArgument(), scope); type = ftype.getResult(); } else { throw new RuntimeException("too many arguments in this matchblock " + name.getText()); } } input.setFreshRequiredType(type, scope); }
Source:
<code>private Connection getNonCommittingConnection() { Connection connection = conn.get(); try { connection.setAutoCommit(false); <START> return connection; <END> } catch (SQLException e) { throw new RuntimeException(e); } }</code><technical_language>setting db isolation level serialization</technical_language>

Target:
private Connection getNonCommittingConnection() { Connection connection = conn.get(); try { connection.setAutoCommit(false); connection.setTransactionIsolation(Connection.TRANSACTION_SERIALIZABLE); return connection; } catch (SQLException e) { throw new RuntimeException(e); } }
Source:
<code>void resumeReadsInternal(boolean wakeup) { synchronized (lock) { state |= STATE_READS_RESUMED; if (wakeup) state |= STATE_READS_AWAKEN; else if (!anyAreSet(state, STATE_READS_RESUMED)) return; if (!anyAreSet(state, STATE_IN_LISTENER_LOOP)) { state |= STATE_IN_LISTENER_LOOP; getFramedChannel().runInIoThread(new Runnable() { @Override public void run() { try { boolean readAgain; do { synchronized(lock) { state &= ~STATE_READS_AWAKEN; } ChannelListener<? super R> listener = getReadListener(); if (listener == null || !isReadResumed()) { return; } ChannelListeners.invokeChannelListener((R) AbstractFramedStreamSourceChannel.this, listener); final boolean moreData = (frameDataRemaining > 0 && data != null) || !pendingFrameData.isEmpty() || anyAreSet(state, STATE_WAITNG_MINUS_ONE); synchronized (lock) { readAgain =((isReadResumed() && moreData) || allAreSet(state, STATE_READS_AWAKEN)) && allAreClear(state,STATE_CLOSED | STATE_STREAM_BROKEN); if (!readAgain) state &= ~STATE_IN_LISTENER_LOOP; } } while (readAgain); <START> } catch (RuntimeException e) { <END> synchronized (lock) { state &= ~STATE_IN_LISTENER_LOOP; } } } }); } } }</code><technical_language>want cautious handle errors in case. suggestion } catch (RuntimeException | Error e) {</technical_language>

Target:
void resumeReadsInternal(boolean wakeup) { synchronized (lock) { state |= STATE_READS_RESUMED; if (wakeup) state |= STATE_READS_AWAKEN; else if (!anyAreSet(state, STATE_READS_RESUMED)) return; if (!anyAreSet(state, STATE_IN_LISTENER_LOOP)) { state |= STATE_IN_LISTENER_LOOP; getFramedChannel().runInIoThread(new Runnable() { @Override public void run() { try { boolean readAgain; do { synchronized(lock) { state &= ~STATE_READS_AWAKEN; } ChannelListener<? super R> listener = getReadListener(); if (listener == null || !isReadResumed()) { return; } ChannelListeners.invokeChannelListener((R) AbstractFramedStreamSourceChannel.this, listener); final boolean moreData = (frameDataRemaining > 0 && data != null) || !pendingFrameData.isEmpty() || anyAreSet(state, STATE_WAITNG_MINUS_ONE); synchronized (lock) { readAgain =((isReadResumed() && moreData) || allAreSet(state, STATE_READS_AWAKEN)) && allAreClear(state,STATE_CLOSED | STATE_STREAM_BROKEN); if (!readAgain) state &= ~STATE_IN_LISTENER_LOOP; } } while (readAgain); } catch (RuntimeException | Error e) { synchronized (lock) { state &= ~STATE_IN_LISTENER_LOOP; } } } }); } } }
Source:
<code><START> public FastqWriter getFirstOfPair() { <END> return firstOfPair; }</code><technical_language>pretty methods in this nested class private</technical_language>

Target:
private FastqWriter getFirstOfPair() { return firstOfPair; }
Source:
<code>public void contextOfObject() { final String key1 = "Key1"; final String value1 = "first-value"; Map<Object, Object> keyValueMap = new HashMap<>(); keyValueMap.put(key1, value1); Context keyValueContext = Context.of(keyValueMap); <START> System.out.printf("Key1 value %s%n", keyValueContext.getData(key1).get().toString()); <END> END: com.azure.core.util.context.of#map }</code><technical_language>toString() necessary, %s formatter call .toString() it</technical_language>

Target:
public void contextOfObject() { final String key1 = "Key1"; final String value1 = "first-value"; Map<Object, Object> keyValueMap = new HashMap<>(); keyValueMap.put(key1, value1); Context keyValueContext = Context.of(keyValueMap); System.out.printf("Key1 value %s%n", keyValueContext.getData(key1).get()); END: com.azure.core.util.context.of#map }
Source:
<code><START> public static void registerModuleSource(IAnalysisModuleSource source) { <END> synchronized (fSources) { fSources.add(source); refreshModules(); } }</code><technical_language>This needs synchronized of fSources</technical_language>

Target:
public static synchronized void registerModuleSource(IAnalysisModuleSource source) { fSources.add(source); refreshModules(); }
Source:
<code>public String execute(String container, Blob blob) { String blobName = blob.getMetadata().getName(); Payload payload = blob.getPayload(); Long length = payload.getContentMetadata().getContentLength(); checkNotNull(length, "please invoke payload.getContentMetadata().setContentLength(length) prior to azure block upload"); checkArgument(length <= (MAX_NUMBER_OF_BLOCKS * MAX_BLOCK_SIZE)); Long offset = 0L; <START> List<String> blockIds = new LinkedList<String>(); <END> int blockCount = 0; int totalBlocks = (int) Math.ceil(length / MAX_BLOCK_SIZE) + 1; long bytesWritten = 0; while (offset < length) { blockCount++; long chunkSize = MAX_BLOCK_SIZE; if (blockCount >= totalBlocks) { chunkSize = length % MAX_BLOCK_SIZE; } bytesWritten += chunkSize; Payload block = slicer.slice(payload, offset, chunkSize); offset += MultipartUploadStrategy.MAX_BLOCK_SIZE; String blockName = blobName + "-" + offset + "-" + new SecureRandom().nextInt(); byte blockIdBytes[] = Hashing.md5().hashBytes(blockName.getBytes()).asBytes(); String blockId = BaseEncoding.base64().encode(blockIdBytes); blockIds.add(blockId); client.putBlock(container, blobName, blockId, block); } assert(bytesWritten == length); return client.putBlockList(container, blobName, blockIds); }</code><technical_language>Prefer ArrayList, Lists.newArrayList avoid repeating type</technical_language>

Target:
public String execute(String container, Blob blob) { String blobName = blob.getMetadata().getName(); Payload payload = blob.getPayload(); long length = payload.getContentMetadata().getContentLength(); checkNotNull(length, "please invoke payload.getContentMetadata().setContentLength(length) prior to azure block upload"); checkArgument(length <= (MAX_NUMBER_OF_BLOCKS * MAX_BLOCK_SIZE)); long offset = 0L; List<String> blockIds = Lists.newArrayList(); int blockCount = 0; int totalBlocks = (int) Math.ceil(((double)length) / MAX_BLOCK_SIZE); long bytesWritten = 0; while (offset < length) { blockCount++; long chunkSize = MAX_BLOCK_SIZE; if (blockCount >= totalBlocks) { chunkSize = length % MAX_BLOCK_SIZE; } bytesWritten += chunkSize; Payload block = slicer.slice(payload, offset, chunkSize); offset += MultipartUploadStrategy.MAX_BLOCK_SIZE; String blockName = blobName + "-" + offset + "-" + new SecureRandom().nextInt(); byte blockIdBytes[] = Hashing.md5().hashBytes(blockName.getBytes()).asBytes(); String blockId = BaseEncoding.base64().encode(blockIdBytes); blockIds.add(blockId); client.putBlock(container, blobName, blockId, block); } assert(bytesWritten == length); return client.putBlockList(container, blobName, blockIds); }
Source:
<code>protected void executeQueryCommand() { SSHClient client = null; try { client = connect(getParameters().getServerName()); validateFingerprint(client, getParameters().getFingerprint()); <START> authenticate(client, "root", getParameters().getRootPassword()); <END> String serversXml = executeCommand(client); getQueryReturnValue().setReturnValue(extractServers(serversXml)); } catch (Exception e) { throw new RuntimeException(e); } finally { if (client != null) { client.disconnect(); } } }</code><technical_language>reason add this const well</technical_language>

Target:
protected void executeQueryCommand() { SSHClient client = null; try { client = connect(getParameters().getServerName()); validateFingerprint(client, getParameters().getFingerprint()); authenticate(client, ROOT, getParameters().getPassword()); String serversXml = executeCommand(client); getQueryReturnValue().setReturnValue(extractServers(serversXml)); } catch (Exception e) { throw new RuntimeException(e); } finally { if (client != null) { client.disconnect(); } } }
Source:
<code>public boolean spawnWeatherEntity(Entity entity, Cause cause) { <START> checkNotNull(entity, "Entity cannot be null!")return addWeatherEffect((net.minecraft.entity.Entity) entity); <END> }</code><technical_language>Missing a newline</technical_language>

Target:
public boolean spawnWeatherEntity(Entity entity, Cause cause) { checkNotNull(entity, "Entity cannot be null!"); return addWeatherEffect((net.minecraft.entity.Entity) entity); }
Source:
<code>public DetectorOptions build() { message = Optional.ofNullable(message).orElse(""); suppressor = Optional.ofNullable(suppressor).orElse(NeverSuppress.INSTANCE); <START> computePattern(); <END> return DetectorOptions.this; }</code><technical_language>for me, in a pattern = Optional.ofNullable(format).map(this::createPattern).orElse(null)</technical_language>

Target:
public DetectorOptions build() { message = Optional.ofNullable(message).orElse(""); suppressor = Optional.ofNullable(suppressor).orElse(NeverSuppress.INSTANCE); pattern = Optional.ofNullable(format).map(this::createPattern).orElse(null); return DetectorOptions.this; }
Source:
<code>public static void write(final int major, final Slice slice, final OutputStream outputStream) throws IOException { slice.nofBlocks = 1 + slice.external.size() + (slice.embeddedRefBlock == null ? 0 : 1); { slice.contentIDs = new int[slice.external.size()]; final int i = 0; for (final int id : slice.external.keySet()) slice.contentIDs[i] = id; } slice.headerBlock = Block.uncompressedSliceHeaderBlock(createSliceHeaderBlockContent(major, slice)); slice.headerBlock.write(major, outputStream); slice.coreBlock.write(major, outputStream); <START> for (final ExternalDataBlock block : slice.external.values()) <END> block.write(major, outputStream); }</code><technical_language>this Block</technical_language>

Target:
public static void write(final int major, final Slice slice, final OutputStream outputStream) throws IOException { slice.nofBlocks = 1 + slice.external.size() + (slice.embeddedRefBlock == null ? 0 : 1); { slice.contentIDs = new int[slice.external.size()]; final int i = 0; for (final int id : slice.external.keySet()) slice.contentIDs[i] = id; } slice.headerBlock = Block.createRawSliceHeaderBlock(createSliceHeaderBlockContent(major, slice)); slice.headerBlock.write(major, outputStream); slice.coreBlock.write(major, outputStream); for (final Block block : slice.external.values()) block.write(major, outputStream); }
Source:
<code>private Diff getMasterEquivalenceForReferenceChange(ReferenceChange diff, boolean mergeRightToLeft) { Diff masterDiff = null; final Iterator<Diff> equivalentDiffs = diff.getEquivalence().getDifferences().iterator(); final Iterator<Diff> eOppositeDiffs = Iterators.filter(equivalentDiffs, isDiffOnEOppositeOf(diff)); while (masterDiff == null && eOppositeDiffs.hasNext()) { final ReferenceChange candidate = (ReferenceChange)eOppositeDiffs.next(); if (isOneToManyAndAdd(diff, candidate, mergeRightToLeft)) { masterDiff = candidate; } else if (!isSet(diff, mergeRightToLeft) && isOneToOneAndSet(diff, candidate, mergeRightToLeft)) { masterDiff = candidate; } } <START> if (masterDiff == null) { <END> for (Diff equivalentDiff : diff.getEquivalence().getDifferences()) { if (equivalentDiff instanceof FeatureMapChange) { masterDiff = equivalentDiff; break; } } } return masterDiff; }</code><technical_language>this method split in : "getMasterEquivalenceOnEOpposite" "getMasterEquivalenceFeatureMap" this part introduce. Do note filtering : Iterators.tryFind(diff.getEquivalence().getDifferences().iterator(), Predicates.instanceOf(FeatureMapChange.class)). necessary, loop cleaner (and remove "break" while :)). I this concept of "master equivalence" is (yes, I introduced :p). If more cases carry creeping this, need try find a detect reorder (or rethink) equivalence relationship</technical_language>

Target:
private Diff getMasterEquivalenceForReferenceChange(ReferenceChange diff, boolean mergeRightToLeft) { Diff masterDiff = getMasterEquivalenceOnEOpposite(diff, mergeRightToLeft); if (masterDiff == null) { masterDiff = getMasterEquivalenceFeatureMap(diff); } return masterDiff; }
Source:
<code>MockChartLayout() { <START> layoutWidth = ComponentConstants.VIDEOPLAYER_PREFERRED_WIDTH; <END> layoutHeight = ComponentConstants.VIDEOPLAYER_PREFERRED_HEIGHT; }</code><technical_language>I separate constants for chart, in case for some reason choose change video player default size</technical_language>

Target:
MockChartLayout() { layoutWidth = ComponentConstants.CHART_PREFERRED_WIDTH; layoutHeight = ComponentConstants.CHART_PREFERRED_HEIGHT; }
Source:
<code>public <E extends Throwable> E expectError(Class<E> clazz, long timeoutMillis, String errorMsg) throws Exception { Thread.sleep(timeoutMillis); if (env.asyncErrors.isEmpty()) { env.flop(String.format("%s within %d ms", errorMsg, timeoutMillis)); } else { Throwable thrown = env.asyncErrors.remove(0); <START> if (thrown != null && clazz.isInstance(thrown)) { <END> return (E) thrown; } else if (thrown != null) { env.flop(String.format("%s within %d ms; Got %s but expected %s", errorMsg, timeoutMillis, thrown.getClass().getCanonicalName(), clazz.getCanonicalName())); } else { env.flop(String.format("%s within %d ms; Got `null` but expected %s", errorMsg, timeoutMillis, clazz.getCanonicalName())); } } return null; }</code><technical_language>I thrown null here, happen</technical_language>

Target:
public <E extends Throwable> E expectError(Class<E> clazz, long timeoutMillis, String errorMsg) throws Exception { Thread.sleep(timeoutMillis); if (env.asyncErrors.isEmpty()) { env.flop(String.format("%s within %d ms", errorMsg, timeoutMillis)); } else { Throwable thrown = env.asyncErrors.remove(0); if (clazz.isInstance(thrown)) { return (E) thrown; } else { env.flop(String.format("%s within %d ms; Got %s but expected %s", errorMsg, timeoutMillis, thrown.getClass().getCanonicalName(), clazz.getCanonicalName())); } } return null; }
Source:
<code>public void beginFormat(Format format, Map<String, String> parameters) { if (this.previousFormatParameters != null) { <START> if (!this.previousFormatParameters.equals(parameters)) { <END> printParameters(parameters, false); } this.previousFormatParameters = null; } else if (this.previousFormatParameters == null) { printParameters(parameters, false); } switch (format) { case BOLD: handleEmptyParameters(); getXWikiPrinter().printBeginBold(); break; case ITALIC: handleEmptyParameters(); getXWikiPrinter().printBeginItalic(); break; case STRIKEDOUT: print("--"); break; case UNDERLINED: print("__"); break; case SUPERSCRIPT: print("^^"); break; case SUBSCRIPT: print(",,"); break; case MONOSPACE: print("##"); break; case NONE: break; default: break; } }</code><technical_language>If previousFormatParameters is empty enter this if while case before</technical_language>

Target:
public void beginFormat(Format format, Map<String, String> parameters) { if (this.previousFormatParameters != null && !parameters.isEmpty()) { if (!this.previousFormatParameters.equals(parameters)) { printParameters(parameters, false); } this.previousFormatParameters = null; } else if (this.previousFormatParameters == null) { printParameters(parameters, false); } switch (format) { case BOLD: handleEmptyParameters(); getXWikiPrinter().printBeginBold(); break; case ITALIC: handleEmptyParameters(); getXWikiPrinter().printBeginItalic(); break; case STRIKEDOUT: print("--"); break; case UNDERLINED: print("__"); break; case SUPERSCRIPT: print("^^"); break; case SUBSCRIPT: print(",,"); break; case MONOSPACE: print("##"); break; case NONE: break; default: break; } }
Source:
<code>@Test public void verbose() throws Exception { DurableTask task = new PowershellScript("$VerbosePreference = \"Continue\"; Write-Verbose \"Hello, World!\""); task.captureOutput(); Controller c = task.launch(new EnvVars(), ws, launcher, listener); while (c.exitStatus(ws, launcher) == null) { Thread.sleep(100); } ByteArrayOutputStream baos = new ByteArrayOutputStream(); c.writeLog(ws, baos); assertEquals(0, c.exitStatus(ws, launcher).intValue()); assertThat(baos.toString(), containsString("Hello, World!")); <START> c.stop(ws,launcher); <END> c.cleanup(ws); }</code><technical_language>this necessary? test failure a file handle leak I tell, actual DurableTaskStep calling stop (only if deliberately abort build)</technical_language>

Target:
@Test public void verbose() throws Exception { DurableTask task = new PowershellScript("$VerbosePreference = \"Continue\"; Write-Verbose \"Hello, World!\""); task.captureOutput(); Controller c = task.launch(new EnvVars(), ws, launcher, listener); while (c.exitStatus(ws, launcher) == null) { Thread.sleep(100); } ByteArrayOutputStream baos = new ByteArrayOutputStream(); c.writeLog(ws, baos); assertEquals(0, c.exitStatus(ws, launcher).intValue()); assertThat(baos.toString(), containsString("Hello, World!")); c.cleanup(ws); }
Source:
<code>void experimentWithMissingValuesReturnsNotAvailable() { String experimentAccession = "E-GEOD-71585"; ImmutableList<String> cellIdsWithMissingValues = ImmutableList.of( "SRR2138737", "SRR2140225", "SRR2139550", "SRR2139566"); Map<String, String> result = subject.getMetadataValueForCellIds(experimentAccession, SingleCellAnalyticsCollectionProxy.CHARACTERISTIC_INFERRED_CELL_TYPE, cellIdsWithMissingValues); <START> assertThat(result.values()).containsOnly("not available"); <END> }</code><technical_language>hard-coding string in class test, I tested class a static final String variable checked test class</technical_language>

Target:
void experimentWithMissingValuesReturnsNotAvailable() { String experimentAccession = "E-GEOD-71585"; ImmutableList<String> cellIdsWithMissingValues = ImmutableList.of( "SRR2138737", "SRR2140225", "SRR2139550", "SRR2139566"); Map<String, String> result = subject.getMetadataValueForCellIds(experimentAccession, SingleCellAnalyticsCollectionProxy.CHARACTERISTIC_INFERRED_CELL_TYPE, cellIdsWithMissingValues); assertThat(result.values()).containsOnly(MISSING_METADATA_VALUE_PLACEHOLDER); }
Source:
<code>public List<EmailWrapper> generateFeedbackSessionPublishedEmails(FeedbackSessionAttributes session) { boolean isEmailNeeded = fsLogic.isFeedbackSessionViewableToStudents(session); List<StudentAttributes> students = isEmailNeeded ? studentsLogic.getStudentsForCourse(session.getCourseId()) <START> : new ArrayList<StudentAttributes>(); <END> List<InstructorAttributes> instructors = isEmailNeeded ? instructorsLogic.getInstructorsForCourse(session.getCourseId()) : new ArrayList<InstructorAttributes>(); return generateFeedbackSessionPublishedEmails(session, students, instructors); }</code><technical_language>diamond operator (new ArrayList<>())</technical_language>

Target:
public List<EmailWrapper> generateFeedbackSessionPublishedEmails(FeedbackSessionAttributes session) { boolean isEmailNeeded = fsLogic.isFeedbackSessionViewableToStudents(session); List<InstructorAttributes> instructors = isEmailNeeded ? instructorsLogic.getInstructorsForCourse(session.getCourseId()) : new ArrayList<>(); List<StudentAttributes> students = isEmailNeeded ? studentsLogic.getStudentsForCourse(session.getCourseId()) : new ArrayList<>(); return generateFeedbackSessionPublishedEmails(session, students, instructors); }
Source:
<code>public CircularBuffer(int n, int spin) { <START> if (n < 0 || n > MAX_SIZE) throw new RuntimeException(String.format("Error: value too large: %d%n", n)); <END> final int size = (0 == n) ? 1 : (0 == (n & (n - 1))) ? n : (1 << (32 - Integer.numberOfLeadingZeros(n))); buffer = (T[])new Object[size]; buffermask = size - 1; spinMillis = spin; }</code><technical_language>IllegalArgumentException</technical_language>

Target:
public CircularBuffer(int n, int spin) { if (n < 0) { throw new IllegalArgumentException(String.format("Error: value cannot be negative: %d", n)); } if (n > MAX_SIZE) { throw new IllegalArgumentException(String.format("Error: value too large: %d", n)); } final int size = (0 == n) ? 1 : (0 == (n & (n - 1))) ? n : (1 << (32 - Integer.numberOfLeadingZeros(n))); buffer = (T[])new Object[size]; buffermask = size - 1; spinMillis = spin; }
Source:
<code>public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; StorageDevice other = (StorageDevice) obj; <START> if (canCreateBrick == null) { <END> if (other.canCreateBrick != null) return false; } else if (!canCreateBrick.equals(other.canCreateBrick)) return false; if (description == null) { if (other.description != null) return false; } else if (!description.equals(other.description)) return false; if (devPath == null) { if (other.devPath != null) return false; } else if (!devPath.equals(other.devPath)) return false; if (devType == null) { if (other.devType != null) return false; } else if (!devType.equals(other.devType)) return false; if (devUuid == null) { if (other.devUuid != null) return false; } else if (!devUuid.equals(other.devUuid)) return false; if (fsType == null) { if (other.fsType != null) return false; } else if (!fsType.equals(other.fsType)) return false; if (fsUuid == null) { if (other.fsUuid != null) return false; } else if (!fsUuid.equals(other.fsUuid)) return false; if (id == null) { if (other.id != null) return false; } else if (!id.equals(other.id)) return false; if (mountPoint == null) { if (other.mountPoint != null) return false; } else if (!mountPoint.equals(other.mountPoint)) return false; if (name == null) { if (other.name != null) return false; } else if (!name.equals(other.name)) return false; if (size == null) { if (other.size != null) return false; } else if (!size.equals(other.size)) return false; if (vdsId == null) { if (other.vdsId != null) return false; } else if (!vdsId.equals(other.vdsId)) return false; return true; }</code><technical_language>ObjectUtils helper for this</technical_language>

Target:
public boolean equals(Object obj) { if ((obj != null) && (obj instanceof StorageDevice)) { StorageDevice storageDevice = (StorageDevice) obj; if (ObjectUtils.objectsEqual(getId(), storageDevice.getId()) && (ObjectUtils.objectsEqual(getCanCreateBrick(), storageDevice.getCanCreateBrick())) && (ObjectUtils.objectsEqual(getDescription(), storageDevice.getDescription())) && (ObjectUtils.objectsEqual(getDevPath(), storageDevice.getDevPath())) && (ObjectUtils.objectsEqual(getDevType(), storageDevice.getDevType())) && (ObjectUtils.objectsEqual(getDevUuid(), storageDevice.getDevUuid())) && (ObjectUtils.objectsEqual(getFsType(), storageDevice.getFsType())) && (ObjectUtils.objectsEqual(getFsUuid(), storageDevice.getFsUuid())) && (ObjectUtils.objectsEqual(getMountPoint(), storageDevice.getMountPoint())) && (ObjectUtils.objectsEqual(getName(), storageDevice.getName())) && (ObjectUtils.objectsEqual(getSize(), storageDevice.getSize())) && (ObjectUtils.objectsEqual(getVdsId(), storageDevice.getVdsId()))) { return true; } } return false; }
Source:
<code>public static void listObject_test5() throws Exception { int i; <START> int totalObjsNr = 1050; <END> System.out.println("Test: listObjects(final String bucketName, final String prefix, final boolean recursive)"); String[] filenames = new String[totalObjsNr]; for (i = 0; i < totalObjsNr; i++) { String filename = createFile(1); client.putObject(bucketName, filename, filename); Files.delete(Paths.get(filename)); filenames[i] = filename; } i = 0; for (Result<?> r : client.listObjects(bucketName, "minio", true)) { ignore(i++, r.get()); } if (i != totalObjsNr) { throw new Exception("[FAILED] Test: listObject_test5(), number of items found: " + i); } for (i = 0; i < totalObjsNr; i++) { client.removeObject(bucketName, filenames[i]); } }</code><technical_language>objCount totalObjects is</technical_language>

Target:
public static void listObject_test5() throws Exception { int i; int objCount = 1050; System.out.println("Test: recursive: listObjects(final String bucketName, final String prefix" + ", final boolean recursive)"); String[] objectNames = new String[objCount]; String baseFilename = createFile(1); for (i = 0; i < objCount; i++) { objectNames[i] = baseFilename + "-" + i; client.putObject(bucketName, objectNames[i], baseFilename); } Files.delete(Paths.get(baseFilename)); i = 0; for (Result<?> r : client.listObjects(bucketName, "minio", true)) { ignore(i++, r.get()); } if (i != objCount) { throw new Exception("[FAILED] Test: recursive: listObject_test5(), number of items, expected: " + objCount + ", found: " + i); } for (i = 0; i < objCount; i++) { client.removeObject(bucketName, objectNames[i]); } }
Source:
<code>public void transform(StructuredRecord in, Emitter<StructuredRecord> emitter) throws Exception { StructuredRecord.Builder builder = StructuredRecord.builder(outSchema); Schema inSchema = in.getSchema(); List<Field> inFields = inSchema.getFields(); for (Field field : inFields) { String name = field.getName(); if (!outSchemaMap.containsKey(name)) { continue; } Schema.Type outFieldType = outSchemaMap.get(name); if (!compMap.containsKey(name) || compMap.get(name) == CompressorType.NONE) { builder.set(name, in.get(name)); } else { byte[] obj = new byte[0]; if (field.getSchema().getType() == Schema.Type.BYTES) { obj = in.get(name); } else if (field.getSchema().getType() == Schema.Type.STRING) { <START> obj = ((String) in.get(name)).getBytes("UTF-8"); <END> } byte[] outValue = new byte[0]; CompressorType type = compMap.get(name); if (type == CompressorType.SNAPPY) { outValue = Snappy.compress(obj); } else if (type == CompressorType.ZIP) { outValue = zip(obj); } else if (type == CompressorType.GZIP) { outValue = gzip(obj); } if (outFieldType == Schema.Type.BYTES) { if (outValue != null) { builder.set(name, outValue); } } else { LOG.warn("Output field '" + name + "' is not of BYTES. In order to emit compressed data, you should set " + "it to type BYTES."); } } } emitter.emit(builder.build()); }</code><technical_language>Bytes.toBytes((String) in.get(name))</technical_language>

Target:
public void transform(StructuredRecord in, Emitter<StructuredRecord> emitter) throws Exception { StructuredRecord.Builder builder = StructuredRecord.builder(outSchema); Schema inSchema = in.getSchema(); List<Field> inFields = inSchema.getFields(); for (Field field : inFields) { String name = field.getName(); if (!outSchemaMap.containsKey(name)) { continue; } Schema.Type outFieldType = outSchemaMap.get(name); if (!compMap.containsKey(name) || compMap.get(name) == CompressorType.NONE) { builder.set(name, in.get(name)); } else { byte[] obj = new byte[0]; if (field.getSchema().getType() == Schema.Type.BYTES) { obj = in.get(name); } else if (field.getSchema().getType() == Schema.Type.STRING) { obj = Bytes.toBytes((String) in.get(name)); } byte[] outValue = new byte[0]; CompressorType type = compMap.get(name); if (type == CompressorType.SNAPPY) { outValue = Snappy.compress(obj); } else if (type == CompressorType.ZIP) { outValue = zip(obj); } else if (type == CompressorType.GZIP) { outValue = gzip(obj); } if (outFieldType == Schema.Type.BYTES) { if (outValue != null) { builder.set(name, outValue); } } else { LOG.warn("Output field '" + name + "' is not of BYTES. In order to emit compressed data, you should set " + "it to type BYTES."); } } } emitter.emit(builder.build()); }
Source:
<code>public Optional<UpgradeNodeRequest> deleteFWUpgradeNode(final UpgradeNodeRequest upgradeNode){ try { final Map<String, ExpectedAttributeValue> deleteConditions = new HashMap<String, ExpectedAttributeValue>(); deleteConditions.put(GROUP_NAME_ATTRIBUTE_NAME, new ExpectedAttributeValue( new AttributeValue().withS(upgradeNode.groupName) )); deleteConditions.put(FROM_FW_VERSION_ATTRIBUTE_NAME, new ExpectedAttributeValue( new AttributeValue().withN(upgradeNode.fromFWVersion.toString()) )); HashMap<String, AttributeValue> keys = new HashMap<String, AttributeValue>(); keys.put(GROUP_NAME_ATTRIBUTE_NAME, new AttributeValue().withS(upgradeNode.groupName)); keys.put(FROM_FW_VERSION_ATTRIBUTE_NAME, new AttributeValue().withN(upgradeNode.fromFWVersion.toString())); final DeleteItemRequest deleteItemRequest = new DeleteItemRequest() .withTableName(tableName) .withKey(keys) .withExpected(deleteConditions) .withReturnValues(ReturnValue.ALL_OLD); final DeleteItemResult result = this.dynamoDBClient.deleteItem(deleteItemRequest); return attributeValuesToUpgradeNode(result.getAttributes()); <START> } catch (AmazonServiceException ase) { <END> LOGGER.error("Failed to delete Upgrade Node for Group: {}, error {}", upgradeNode.groupName, ase.getMessage()); } return Optional.absent(); }</code><technical_language>catch AmazonClientException</technical_language>

Target:
public Optional<UpgradeNodeRequest> deleteFWUpgradeNode(final UpgradeNodeRequest upgradeNode){ try { final Map<String, ExpectedAttributeValue> deleteConditions = new HashMap<String, ExpectedAttributeValue>(); deleteConditions.put(GROUP_NAME_ATTRIBUTE_NAME, new ExpectedAttributeValue( new AttributeValue().withS(upgradeNode.groupName) )); deleteConditions.put(FROM_FW_VERSION_ATTRIBUTE_NAME, new ExpectedAttributeValue( new AttributeValue().withN(upgradeNode.fromFWVersion.toString()) )); HashMap<String, AttributeValue> keys = new HashMap<String, AttributeValue>(); keys.put(GROUP_NAME_ATTRIBUTE_NAME, new AttributeValue().withS(upgradeNode.groupName)); keys.put(FROM_FW_VERSION_ATTRIBUTE_NAME, new AttributeValue().withN(upgradeNode.fromFWVersion.toString())); final DeleteItemRequest deleteItemRequest = new DeleteItemRequest() .withTableName(tableName) .withKey(keys) .withExpected(deleteConditions) .withReturnValues(ReturnValue.ALL_OLD); final DeleteItemResult result = this.dynamoDBClient.deleteItem(deleteItemRequest); return attributeValuesToUpgradeNode(result.getAttributes()); } catch (AmazonServiceException ase) { LOGGER.error("Failed to delete Upgrade Node for Group: {}. Service error {}", upgradeNode.groupName, ase.getMessage()); } catch (AmazonClientException awcEx){ LOGGER.error("Failed to delete Upgrade Node for Group: {}. Client error: {}", awcEx.getMessage()); } catch (Exception e) { LOGGER.error("Exception thrown while deleting upgrade node. {}", e.getMessage()); return Optional.absent(); } return Optional.absent(); }
Source:
<code>public void testRemovingExecutor() throws Exception { if (!isTestSetup()) { return; } ExecutorLoader loader = createLoader(); Executor executor = loader.addExecutor("localhost1", 12345); loader.removeExecutor("localhost1", 12345); <START> Executor fetchedExecutor = loader.fetchExecutor("localhost1", 12345); <END> Assert.assertNull(fetchedExecutor); }</code><technical_language>safer assert exists assert is delete</technical_language>

Target:
public void testRemovingExecutor() throws Exception { if (!isTestSetup()) { return; } ExecutorLoader loader = createLoader(); Executor executor = loader.addExecutor("localhost1", 12345); Assert.assertNotNull(executor); loader.removeExecutor("localhost1", 12345); Executor fetchedExecutor = loader.fetchExecutor("localhost1", 12345); Assert.assertNull(fetchedExecutor); }
Source:
<code>public Container getContainer(String accountName, String containerName) throws AccountServiceException { Container primaryResult = primaryAccountService.getContainer(accountName, containerName); try { Container secondaryResult = secondaryAccountService.getContainer(accountName, containerName); <START> if (++getContainerRequestCount % 100 < config.samplingPercentageForGetContainerConsistencyCheck <END> && primaryResult != null && !primaryResult.equals(secondaryResult)) { logger.warn("Inconsistency detected between primary and secondary for accountName ={}, containerName = {}", accountName, containerName); accountServiceMetrics.getContainerDataInconsistencyCount.inc(); } } catch (Exception e) { accountServiceMetrics.getContainerDataInconsistencyCount.inc(); logger.error("get container failed for secondary for accountName={}, containerName={}", accountName, containerName, e); } return primaryResult; }</code><technical_language>Single container comparison is lightweight, need sampling</technical_language>

Target:
public Container getContainer(String accountName, String containerName) throws AccountServiceException { Container primaryResult = primaryAccountService.getContainer(accountName, containerName); if (shouldCompare()) { try { Container secondaryResult = secondaryAccountService.getContainer(accountName, containerName); if (primaryResult != null && !primaryResult.equals(secondaryResult)) { logger.warn("Inconsistency detected between primary and secondary for accountName ={}, containerName = {}", accountName, containerName); accountServiceMetrics.accountDataInconsistencyCount.inc(); } } catch (Exception e) { accountServiceMetrics.accountDataInconsistencyCount.inc(); logger.error("get container failed for secondary for accountName={}, containerName={}", accountName, containerName, e); } } return primaryResult; }
Source:
<code>public AuthorizationResponse authorize(final AuthorizationRequest request) throws AuthorizationDeniedException { if (request == null) { throw new IllegalArgumentException("Authorization request must not be null"); } Callable<AuthorizationResponse> callable = new Callable<AuthorizationResponse>() { @Override public AuthorizationResponse call() throws Exception { if (request.getAudience() == null) { request.setAudience(configuration.getResource()); } else { <START> request.setAudience(request.getAudience()); <END> } HttpMethod<AuthorizationResponse> method = http.<AuthorizationResponse>post(serverConfiguration.getTokenEndpoint()); if (token != null) { method = method.authorizationBearer(token.call()); } return method .authentication() .uma(request) .response() .json(AuthorizationResponse.class) .execute(); } }; try { return callable.call(); } catch (Exception cause) { return Throwables.retryAndWrapExceptionIfNecessary(callable, token, "Failed to obtain authorization data", cause); } }</code><technical_language>Is this "else" necessary</technical_language>

Target:
public AuthorizationResponse authorize(final AuthorizationRequest request) throws AuthorizationDeniedException { if (request == null) { throw new IllegalArgumentException("Authorization request must not be null"); } Callable<AuthorizationResponse> callable = new Callable<AuthorizationResponse>() { @Override public AuthorizationResponse call() throws Exception { if (request.getAudience() == null) { request.setAudience(configuration.getResource()); } HttpMethod<AuthorizationResponse> method = http.<AuthorizationResponse>post(serverConfiguration.getTokenEndpoint()); if (token != null) { method = method.authorizationBearer(token.call()); } return method .authentication() .uma(request) .response() .json(AuthorizationResponse.class) .execute(); } }; try { return callable.call(); } catch (Exception cause) { return Throwables.retryAndWrapExceptionIfNecessary(callable, token, "Failed to obtain authorization data", cause); } }
Source:
<code>public Cursor find(SessionLocal session, SearchRow first, SearchRow last) { ArrayList<Value> params = Utils.newSmallArrayList(); StringBuilder builder = new StringBuilder("SELECT * FROM ").append(targetTableName).append(" T"); boolean f = false; for (int i = 0; first != null && i < first.getColumnCount(); i++) { Value v = first.getValue(i); if (v != null) { builder.append(f ? " AND " : " WHERE "); f = true; Column col = table.getColumn(i); col.getSQL(builder, sqlFlags); if (v == ValueNull.INSTANCE) { builder.append(" IS NULL"); } else { builder.append(">="); addParameter(builder, col); params.add(v); } } } for (int i = 0; last != null && i < last.getColumnCount(); i++) { Value v = last.getValue(i); if (v != null) { builder.append(f ? " AND " : " WHERE "); f = true; Column col = table.getColumn(i); col.getSQL(builder, sqlFlags); if (v == ValueNull.INSTANCE) { builder.append(" IS NULL"); } else { builder.append("<="); addParameter(builder, col); params.add(v); } } } String sql = builder.toString(); try { PreparedStatement prep = link.execute(sql, params, false, session); <START> if (link.getFetchSize() != -1) { prep.setFetchSize(link.getFetchSize()); } <END> ResultSet rs = prep.getResultSet(); return new LinkedCursor(link, rs, session, sql, prep); } catch (Exception e) { throw TableLink.wrapException(sql, e); } }</code><technical_language>late call this method. called PreparedStatement.executeSomething()</technical_language>

Target:
public Cursor find(SessionLocal session, SearchRow first, SearchRow last) { ArrayList<Value> params = Utils.newSmallArrayList(); StringBuilder builder = new StringBuilder("SELECT * FROM ").append(targetTableName).append(" T"); boolean f = false; for (int i = 0; first != null && i < first.getColumnCount(); i++) { Value v = first.getValue(i); if (v != null) { builder.append(f ? " AND " : " WHERE "); f = true; Column col = table.getColumn(i); col.getSQL(builder, sqlFlags); if (v == ValueNull.INSTANCE) { builder.append(" IS NULL"); } else { builder.append(">="); addParameter(builder, col); params.add(v); } } } for (int i = 0; last != null && i < last.getColumnCount(); i++) { Value v = last.getValue(i); if (v != null) { builder.append(f ? " AND " : " WHERE "); f = true; Column col = table.getColumn(i); col.getSQL(builder, sqlFlags); if (v == ValueNull.INSTANCE) { builder.append(" IS NULL"); } else { builder.append("<="); addParameter(builder, col); params.add(v); } } } String sql = builder.toString(); try { PreparedStatement prep = link.execute(sql, params, false, session); ResultSet rs = prep.getResultSet(); return new LinkedCursor(link, rs, session, sql, prep); } catch (Exception e) { throw TableLink.wrapException(sql, e); } }
Source:
<code>public String render(final GetBucketResult br) { <START> if( !br.getObjIterator().hasNext()) { <END> return "No objects were reported in the bucket '" + br.getBucketName() + "'"; } return ASCIITable.getInstance().getTable(getHeaders(), formatBucketList(br.getObjIterator())); }</code><technical_language>iterator empty? null</technical_language>

Target:
public String render(final GetBucketResult br) { if( (null == br.getObjIterator()) || !br.getObjIterator().hasNext()) { return "No objects were reported in bucket '" + br.getBucketName() + "'"; } return ASCIITable.getInstance().getTable(getHeaders(), formatBucketList(br.getObjIterator())); }
Source:
<code>public Query<T> withTimeoutAndMaxScatterGatherBytes(Query<T> query, ServerConfig serverConfig) { <START> Query<T> new_query = QueryContexts.verifyMaxQueryTimeout( <END> QueryContexts.withMaxScatterGatherBytes( QueryContexts.withDefaultTimeout( query, Math.min(serverConfig.getDefaultQueryTimeout(), serverConfig.getMaxQueryTimeout()) ), serverConfig.getMaxScatterGatherBytes() ), serverConfig.getMaxQueryTimeout() ); return new_query.withOverriddenContext(ImmutableMap.of(DirectDruidClient.QUERY_FAIL_TIME, this.startTimeMillis + QueryContexts.getTimeout(new_query))); }</code><technical_language>newQuery is more Druid-like spelling</technical_language>

Target:
public Query<T> withTimeoutAndMaxScatterGatherBytes(Query<T> query, ServerConfig serverConfig) { Query<T> newQuery = QueryContexts.verifyMaxQueryTimeout( QueryContexts.withMaxScatterGatherBytes( QueryContexts.withDefaultTimeout( query, Math.min(serverConfig.getDefaultQueryTimeout(), serverConfig.getMaxQueryTimeout()) ), serverConfig.getMaxScatterGatherBytes() ), serverConfig.getMaxQueryTimeout() ); return newQuery.withOverriddenContext(ImmutableMap.of(DirectDruidClient.QUERY_FAIL_TIME, this.startTimeMillis + QueryContexts.getTimeout(newQuery))); }
Source:
<code>public Queue<Selectable> createFlowTriggerEventQueue(DistroxUpgradeTriggerEvent event) { Queue<Selectable> chain = new ConcurrentLinkedQueue<>(); chain.add(new StackEvent(SaltUpdateEvent.SALT_UPDATE_EVENT.event(), event.getResourceId(), event.accepted())); <START> chain.add(new DatalakeClusterUpgradeTriggerEvent(CLUSTER_UPGRADE_INIT_EVENT.event(), event.getResourceId(), event.accepted(), <END> event.getImageChangeDto().getImageId())); chain.add(new StackImageUpdateTriggerEvent(FlowChainTriggers.STACK_IMAGE_UPDATE_TRIGGER_EVENT, event.getImageChangeDto())); if (event.isReplaceVms()) { LOGGER.warn("Replace VMs for DistroX is not implemented!"); } return chain; }</code><technical_language>DatalakeClusterUpgradeTriggerEvent renamed is general</technical_language>

Target:
public Queue<Selectable> createFlowTriggerEventQueue(DistroxUpgradeTriggerEvent event) { Queue<Selectable> chain = new ConcurrentLinkedQueue<>(); chain.add(new StackEvent(SaltUpdateEvent.SALT_UPDATE_EVENT.event(), event.getResourceId(), event.accepted())); chain.add(new ClusterUpgradeTriggerEvent(CLUSTER_UPGRADE_INIT_EVENT.event(), event.getResourceId(), event.accepted(), event.getImageChangeDto().getImageId())); chain.add(new StackImageUpdateTriggerEvent(FlowChainTriggers.STACK_IMAGE_UPDATE_TRIGGER_EVENT, event.getImageChangeDto())); if (event.isReplaceVms()) { LOGGER.warn("Replace VMs for DistroX is not implemented!"); } return chain; }
Source:
<code>private void addCpuPinning(final String compatibilityVersion) { final String cpuPinning = vm.getCpuPinning(); if (cpuPinning != null && !cpuPinning.isEmpty() && Boolean.TRUE.equals(Config.<Boolean> GetValue(ConfigValues.CpuPinningEnabled, compatibilityVersion)) <START> && cpuPinning != null) { <END> final XmlRpcStruct pinDict = new XmlRpcStruct(); for (String pin : cpuPinning.split("_")) { final String[] split = pin.split("#"); pinDict.add(split[0], split[1]); } createInfo.add(VdsProperties.cpuPinning, pinDict); } }</code><technical_language>StringUtils.isNotEmpty(cpuPinning) test cpuPinning != null twice. change to: if (StringUtils.isNotEmpty(cpuPinning) && Boolean.TRUE.equals(Config.<Boolean> GetValue(ConfigValues.CpuPinningEnabled,compatibilityVersion))</technical_language>

Target:
private void addCpuPinning(final String compatibilityVersion) { final String cpuPinning = vm.getCpuPinning(); if (!StringUtils.isEmpty(cpuPinning) && Boolean.TRUE.equals(Config.<Boolean> GetValue(ConfigValues.CpuPinningEnabled, compatibilityVersion)) && cpuPinning != null) { final XmlRpcStruct pinDict = new XmlRpcStruct(); for (String pin : cpuPinning.split("_")) { final String[] split = pin.split("#"); pinDict.add(split[0], split[1]); } createInfo.add(VdsProperties.cpuPinning, pinDict); } }
Source:
<code>public void testTreeHasherWith1MBPayload() throws IOException { TreeHash th = TreeHash.Hasher.buildTreeHashFromPayload(new ByteSourcePayload(getData(1 * MB))); <START> assertEquals(th.getLinearHash().toString(), "9bc1b2a288b26af7257a36277ae3816a7d4f16e89c1e7e77d0a5c48bad62b360"); <END> assertEquals(th.getTreeHash().toString(), "9bc1b2a288b26af7257a36277ae3816a7d4f16e89c1e7e77d0a5c48bad62b360"); }</code><technical_language>Discussed offline, is safer: assertEquals(th.getLinearHash(), HashCode.fromString("9bc1b2a288b26af7257a36277ae3816a7d4f16e89c1e7e77d0a5c48bad62b360"));</technical_language>

Target:
public void testTreeHasherWith1MBPayload() throws IOException { TreeHash th = TreeHash.Hasher.buildTreeHashFromPayload(new ByteSourcePayload(getData(1 * MB))); assertEquals(th.getLinearHash(), HashCode.fromString("9bc1b2a288b26af7257a36277ae3816a7d4f16e89c1e7e77d0a5c48bad62b360")); assertEquals(th.getTreeHash(), HashCode.fromString("9bc1b2a288b26af7257a36277ae3816a7d4f16e89c1e7e77d0a5c48bad62b360")); }
Source:
<code>protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); layersShown = false; usePolygon = false; Mapbox.getInstance(this, getString(R.string.access_token)); setContentView(R.layout.activity_isochrone); mapView = findViewById(R.id.mapView); mapView.onCreate(savedInstanceState); mapView.getMapAsync(new OnMapReadyCallback() { @Override public void onMapReady(@NonNull final MapboxMap mapboxMap) { IsochroneActivity.this.mapboxMap = mapboxMap; mapboxMap.setStyle(Style.LIGHT, new Style.OnStyleLoaded() { @Override public void onStyleLoaded(@NonNull Style style) { mapboxMap.addOnMapClickListener(IsochroneActivity.this); <START> initIsochroneCenterSymbolLayer(); <END> findViewById(R.id.switch_isochrone_style_fab).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { usePolygon = !usePolygon; redrawIsochroneData(lastSelectedLatLng); } }); Toast.makeText(IsochroneActivity.this, getString(R.string.click_on_map_instruction), Toast.LENGTH_SHORT).show(); } }); } }); }</code><technical_language>provide style parameter this method</technical_language>

Target:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); layersShown = false; usePolygon = false; Mapbox.getInstance(this, getString(R.string.access_token)); setContentView(R.layout.activity_isochrone); mapView = findViewById(R.id.mapView); mapView.onCreate(savedInstanceState); mapView.getMapAsync(new OnMapReadyCallback() { @Override public void onMapReady(@NonNull final MapboxMap mapboxMap) { IsochroneActivity.this.mapboxMap = mapboxMap; mapboxMap.setStyle(Style.LIGHT, new Style.OnStyleLoaded() { @Override public void onStyleLoaded(@NonNull final Style style) { mapboxMap.addOnMapClickListener(IsochroneActivity.this); initIsochroneCenterSymbolLayer(style); findViewById(R.id.switch_isochrone_style_fab).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { usePolygon = !usePolygon; redrawIsochroneData(style, lastSelectedLatLng); } }); Toast.makeText(IsochroneActivity.this, getString(R.string.click_on_map_instruction), Toast.LENGTH_SHORT).show(); } }); } }); }