auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public int getOffset(int x, int y, int[] trailing) { checkLayout(); NSAutoreleasePool pool = null; if (!NSThread.isMainThread()) pool = (NSAutoreleasePool) new NSAutoreleasePool().alloc().init(); try { computeRuns(); if (trailing != null && trailing.length < 1) SWT.error(SWT.ERROR_INVALID_ARGUMENT); int length = text.length(); if (length == 0) return 0; NSPoint pt = new NSPoint(); pt.x = x; <START> pt.y = y; <END> double partialFraction = new double [1]; long glyphIndex = layoutManager.glyphIndexForPoint(pt, textContainer, partialFraction); long charOffset = layoutManager.characterIndexForGlyphAtIndex(glyphIndex); if (textStorage.string().characterAtIndex(charOffset) == '\n') charOffset--; int offset = (int) charOffset; offset = Math.min(untranslateOffset(offset), length - 1); if (trailing != null) { trailing[0] = Math.round((float) partialFraction[0]); if (partialFraction[0] >= 0.5) { char ch = text.charAt(offset); if (0xD800 <= ch && ch <= 0xDBFF) { if (offset + 1 < length) { ch = text.charAt(offset + 1); if (0xDC00 <= ch && ch <= 0xDFFF) { trailing[0]++; } } } } } return offset; } finally { if (pool != null) pool.release(); } }</code><technical_language>Changing this line pt.y = y - getVerticalIndent(); fixes problem</technical_language>

Target:
public int getOffset(int x, int y, int[] trailing) { checkLayout(); NSAutoreleasePool pool = null; if (!NSThread.isMainThread()) pool = (NSAutoreleasePool) new NSAutoreleasePool().alloc().init(); try { computeRuns(); if (trailing != null && trailing.length < 1) SWT.error(SWT.ERROR_INVALID_ARGUMENT); int length = text.length(); if (length == 0) return 0; NSPoint pt = new NSPoint(); pt.x = x; pt.y = y - getVerticalIndent(); double partialFraction = new double [1]; long glyphIndex = layoutManager.glyphIndexForPoint(pt, textContainer, partialFraction); long charOffset = layoutManager.characterIndexForGlyphAtIndex(glyphIndex); if (textStorage.string().characterAtIndex(charOffset) == '\n') charOffset--; int offset = (int) charOffset; offset = Math.min(untranslateOffset(offset), length - 1); if (trailing != null) { trailing[0] = Math.round((float) partialFraction[0]); if (partialFraction[0] >= 0.5) { char ch = text.charAt(offset); if (0xD800 <= ch && ch <= 0xDBFF) { if (offset + 1 < length) { ch = text.charAt(offset + 1); if (0xDC00 <= ch && ch <= 0xDFFF) { trailing[0]++; } } } } } return offset; } finally { if (pool != null) pool.release(); } }
Source:
<code>public void init() throws IndyLifecycleException { if ( System.getProperty( FORKJOINPOOL_COMMON_PARALLELISM ) == null ) { if ( config.getForkJoinPoolCommonParallelism() > 0 ) { String value = new Integer( config.getForkJoinPoolCommonParallelism() ).toString(); System.setProperty( FORKJOINPOOL_COMMON_PARALLELISM, value ); <START> logger.info( "Set {}={}", FORKJOINPOOL_COMMON_PARALLELISM, value ); <END> } } }</code><technical_language>good pull system properties a check, if is set (on command line, etc), I this logic reset it</technical_language>

Target:
public void init() throws IndyLifecycleException { Integer commonPoolSize = null; if ( System.getProperty( FORKJOINPOOL_COMMON_PARALLELISM ) != null ) { commonPoolSize = Integer.parseInt( System.getProperty( FORKJOINPOOL_COMMON_PARALLELISM ) ); } else if ( config.getForkJoinPoolCommonParallelism() > 0 ) { commonPoolSize = config.getForkJoinPoolCommonParallelism(); System.setProperty( FORKJOINPOOL_COMMON_PARALLELISM, commonPoolSize.toString() ); } if ( commonPoolSize != null ) { logger.info( "Set {}={}", FORKJOINPOOL_COMMON_PARALLELISM, commonPoolSize ); } }
Source:
<code><START> void updateChain(DataInputStream din, DataOutputStream dout) throws Exception <END> { String username = CoreNodeUtils.deserializeString(din); byte[] raw = Serialize.deserializeByteArray(din, 2 * UserPublicKeyLink.MAX_SIZE); List<UserPublicKeyLink> res = ((CborObject.CborList)CborObject.fromByteArray(raw)).map(UserPublicKeyLink::fromCbor); ProofOfWork proof = ProofOfWork.fromCbor(CborObject.fromByteArray(Serialize.deserializeByteArray(din, 100))); boolean isAdded = coreNode.updateChain(username, res, proof).get(); dout.writeBoolean(isAdded); }</code><technical_language>Remind me: this get called for other ops signup</technical_language>

Target:
void updateChain(DataInputStream din, DataOutputStream dout) throws Exception { String username = CoreNodeUtils.deserializeString(din); byte[] raw = Serialize.deserializeByteArray(din, 2 * UserPublicKeyLink.MAX_SIZE); List<UserPublicKeyLink> res = ((CborObject.CborList)CborObject.fromByteArray(raw)).map(UserPublicKeyLink::fromCbor); ProofOfWork proof = ProofOfWork.fromCbor(CborObject.fromByteArray(Serialize.deserializeByteArray(din, 100))); Optional<RequiredDifficulty> err = coreNode.updateChain(username, res, proof).get(); dout.writeBoolean(err.isEmpty()); if (err.isPresent()) dout.writeInt(err.get().requiredDifficulty); }
Source:
<code><START> public static String getData(String uuid, Integer major, Integer minor, String companyCode, Integer txPower, <END> boolean LELimited, boolean LEGeneral, boolean BR_EDRSupported, boolean LE_BRController, boolean LE_BRHost) { String data = ""; String flags = "000"; flags += Integer.toString(LE_BRHost ? 1 : 0); flags += Integer.toString(LE_BRController ? 1 : 0); flags += Integer.toString(BR_EDRSupported ? 1 : 0); flags += Integer.toString(LEGeneral ? 1 : 0); flags += Integer.toString(LELimited ? 1 : 0); String flagsString = Integer.toHexString(Integer.parseInt(flags, 2)); if (flagsString.length() == 1) { flagsString = "0" + flagsString; } txPower = checkRange(txPower, TX_POWER_MAX, TX_POWER_MIN); String txPowerString = Integer.toHexString(txPower & 0xFF); if (txPowerString.length() == 1) { txPowerString = "0" + txPowerString; } data += PKT_BYTES_NUMBER; data += AD_BYTES_NUMBER; data += AD_FLAG; data += flagsString; data += PAYLOAD_BYTES_NUMBER; data += MANUFACTURER_AD; data += companyCode.substring(2, 4); data += companyCode.substring(0, 2); data += BEACON_ID; if (uuid.length() == 32) { data += checkHex(uuid.toString(), UUID_DEFAULT); } else { data += UUID_DEFAULT; } data += to2BytesHex(checkRange(major, MAJOR_MAX, MAJOR_MIN)); data += to2BytesHex(checkRange(minor, MINOR_MAX, MINOR_MIN)); data += txPowerString; data += "00"; return data; }</code><technical_language>checks for major, minor, txpower uuid performed application level (i.e. in BeaconExample), run twice..</technical_language>

Target:
public static String getData(String uuid, Integer major, Integer minor, String companyCode, Integer txPower, boolean LELimited, boolean LEGeneral, boolean BR_EDRSupported, boolean LE_BRController, boolean LE_BRHost) { String data = ""; String flags = "000"; flags += Integer.toString(LE_BRHost ? 1 : 0); flags += Integer.toString(LE_BRController ? 1 : 0); flags += Integer.toString(BR_EDRSupported ? 1 : 0); flags += Integer.toString(LEGeneral ? 1 : 0); flags += Integer.toString(LELimited ? 1 : 0); String flagsString = Integer.toHexString(Integer.parseInt(flags, 2)); if (flagsString.length() == 1) { flagsString = "0" + flagsString; } txPower = inSetRange(txPower, TX_POWER_MAX, TX_POWER_MIN); String txPowerString = Integer.toHexString(txPower & 0xFF); if (txPowerString.length() == 1) { txPowerString = "0" + txPowerString; } data += PKT_BYTES_NUMBER; data += AD_BYTES_NUMBER; data += AD_FLAG; data += flagsString; data += PAYLOAD_BYTES_NUMBER; data += MANUFACTURER_AD; data += companyCode.substring(2, 4); data += companyCode.substring(0, 2); data += BEACON_ID; if (uuid.length() == 32) { data += inSetHex(uuid.toString(), UUID_DEFAULT); } else { data += UUID_DEFAULT; } data += to2BytesHex(inSetRange(major, MAJOR_MAX, MAJOR_MIN)); data += to2BytesHex(inSetRange(minor, MINOR_MAX, MINOR_MIN)); data += txPowerString; data += "00"; return data; }
Source:
<code>public HttpHeaders getHeaders() { <START> HttpHeaders headers = new HttpHeaders(); <END> return headers; }</code><technical_language>TODO: write headers</technical_language>

Target:
public HttpHeaders getHeaders() { return this.headers; }
Source:
<code>public synchronized void flush() { for (CompletableFuture<Void> f : _pendingFutures) { try { f.get(); } catch (InterruptedException | ExecutionException e) { String msg = "Flush failed with error"; LOG.error(msg, e); throw new DatastreamRuntimeException(msg, e); } } <START> _pendingFutures.clear(); <END> }</code><technical_language>Line 93 care of removing futures, right</technical_language>

Target:
public synchronized void flush() { if (_unrecoverableError != null) { throw _unrecoverableError; } for (CompletableFuture<Void> f : _pendingFutures) { try { f.get(); } catch (InterruptedException | ExecutionException e) { String msg = "Flush failed with error"; LOG.error(msg, e); throw new DatastreamRuntimeException(msg, e); } } _pendingFutures.clear(); }
Source:
<code>public static File findLatestBuildToolsFolder(File buildToolsHome) { File[] buildToolsVersions = buildToolsHome.listFiles(new FileFilter() { @Override public boolean accept(File file) { return file.getName().matches("\\d+\\.\\d+\\.\\d+$"); } }); if (buildToolsVersions == null || buildToolsVersions.length == 0) { throw new SelendroidException("No valid build-tools versions found in " + buildToolsHome.getName()); } Arrays.sort( buildToolsVersions, new Comparator<File>() { @Override public int compare(File f1, File f2) { String[] v1 = f1.getName().split("\\."); String[] v2 = f2.getName().split("\\."); for (int i = 0; i < 3; i++) { int curV1 = Integer.parseInt(v1[i]); int curV2 = Integer.parseInt(v2[i]); <START> if (curV1 != curV2) { <END> return Integer.compare(curV1, curV2); } } return 0; } }); return buildToolsVersions[buildToolsVersions.length - 1].getAbsoluteFile(); }</code><technical_language>I call Integer.compare return result if 0</technical_language>

Target:
public static File findLatestBuildToolsFolder(File buildToolsHome) { File[] buildToolsVersions = buildToolsHome.listFiles(new FileFilter() { @Override public boolean accept(File file) { return file.getName().matches(BUILD_TOOLS_VERSION_REGEX); } }); if (buildToolsVersions == null || buildToolsVersions.length == 0) { throw new SelendroidException("No valid build-tools versions found in " + buildToolsHome.getName()); } Pattern pattern = Pattern.compile(BUILD_TOOLS_VERSION_REGEX); Arrays.sort( buildToolsVersions, new Comparator<File>() { @Override public int compare(File f1, File f2) { Matcher m1 = pattern.matcher(f1.getName()); Matcher m2 = pattern.matcher(f2.getName()); m1.find(); m2.find(); for (int i = 1; i <= 3; i++) { int compare = Integer.compare( Integer.parseInt(m1.group(i)), Integer.parseInt(m2.group(i))); if (compare != 0) { return compare; } } return 0; } }); return buildToolsVersions[buildToolsVersions.length - 1].getAbsoluteFile(); }
Source:
<code>public void breakBlock(@Nonnull World world, @Nonnull BlockPos pos, @Nonnull IBlockState state) { TileEntity tileentity = world.getTileEntity(pos); if (tileentity instanceof TileEntityEngineeringTable) { IItemHandler itemHandler = tileentity.getCapability(ITEM_HANDLER_CAPABILITY, null); <START> assert itemHandler != null; <END> InventoryHelper.spawnItemStack(world, pos.getX(), pos.getY(), pos.getZ(), itemHandler.getStackInSlot(0)); } super.breakBlock(world, pos, state); }</code><technical_language>assert testing. Change if statement, exception</technical_language>

Target:
public void breakBlock(@Nonnull World world, @Nonnull BlockPos pos, @Nonnull IBlockState state) { TileEntity tileentity = world.getTileEntity(pos); IItemHandler itemHandler = tileentity.getCapability(ITEM_HANDLER_CAPABILITY, null); if (itemHandler != null) { InventoryHelper.spawnItemStack(world, pos.getX(), pos.getY(), pos.getZ(), itemHandler.getStackInSlot(0)); } super.breakBlock(world, pos, state); }
Source:
<code><START> public int getLineVerticalIndent(int index) { <END> checkWidget(); if (index < 0 || index > content.getLineCount()) { SWT.error(SWT.ERROR_INVALID_ARGUMENT); } return isListening(ST.LineGetStyle) ? 0 : renderer.getLineVerticalIndent(index, verticalIndent); }</code><technical_language>Throws AIOOB exception called index = line count</technical_language>

Target:
public int getLineVerticalIndent(int index) { checkWidget(); if (index < 0 || index > content.getLineCount()) { SWT.error(SWT.ERROR_INVALID_ARGUMENT); } return isListening(ST.LineGetStyle) ? 0 : renderer.getLineVerticalIndent(index); }
Source:
<code>public ListenableFuture<?> index(ChangeData cd) { <START> return executor.submit(indexTask(cd)); <END> }</code><technical_language>check too</technical_language>

Target:
public ListenableFuture<?> index(ChangeData cd) { return executor != null ? executor.submit(indexTask(cd)) : null; }
Source:
<code>void renameColumn(CharSequence name, CharSequence newName) { int index = columnNameIndexMap.keyIndex(name); int columnIndex = columnNameIndexMap.valueAt(index); columnNameIndexMap.removeAt(index); columnNameIndexMap.putAt(columnNameIndexMap.keyIndex(newName), newName, columnIndex); TableColumnMetadata oldColumnMetadata = columnMetadata.get(columnIndex); <START> TableColumnMetadata newColumnMetadata = new TableColumnMetadata(Chars.toString(newName), <END> oldColumnMetadata.getType(), oldColumnMetadata.isIndexed(), oldColumnMetadata.getIndexValueBlockCapacity(), oldColumnMetadata.isSymbolTableStatic()); columnMetadata.setQuick(columnIndex, newColumnMetadata); }</code><technical_language>I suggest update column name existing metadata</technical_language>

Target:
void renameColumn(CharSequence name, CharSequence newName) { int index = columnNameIndexMap.keyIndex(name); int columnIndex = columnNameIndexMap.valueAt(index); columnNameIndexMap.removeAt(index); columnNameIndexMap.putAt(columnNameIndexMap.keyIndex(newName), newName, columnIndex); TableColumnMetadata oldColumnMetadata = columnMetadata.get(columnIndex); oldColumnMetadata.setName(Chars.toString(newName)); }
Source:
<code>public long streamMessagesForRecording() { try (ExclusivePublication publication = aeron.addExclusivePublication(CHANNEL, STREAM_ID)) { final IdleStrategy idleStrategy = YieldingIdleStrategy.INSTANCE; while (!publication.isConnected()) { idleStrategy.idle(); } <START> final long start = System.nanoTime(); <END> final UnsafeBuffer buffer = this.buffer; for (long i = 0; i < NUMBER_OF_MESSAGES; i++) { buffer.putLong(0, i); idleStrategy.reset(); while (publication.offer(buffer, 0, MESSAGE_LENGTH) < 0) { idleStrategy.idle(); } } final long stopPosition = publication.position(); final CountersReader counters = aeron.countersReader(); final int counterId = RecordingPos.findCounterIdBySession(counters, publication.sessionId()); idleStrategy.reset(); while (counters.getCounterValue(counterId) < stopPosition) { idleStrategy.idle(); } final long durationMs = TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - start); final double dataRate = (stopPosition * 1000.0d / durationMs) / MEGABYTE; final double recordingMb = stopPosition / MEGABYTE; final long msgRate = (NUMBER_OF_MESSAGES / durationMs) * 1000L; System.out.printf( "Recorded %.02f MB @ %.02f MB/s - %,d msg/sec - %d byte payload + 32 byte header%n", recordingMb, dataRate, msgRate, MESSAGE_LENGTH); return RecordingPos.getRecordingId(counters, counterId); } }</code><technical_language>time unit in name</technical_language>

Target:
public long streamMessagesForRecording() { try (ExclusivePublication publication = aeron.addExclusivePublication(CHANNEL, STREAM_ID)) { final IdleStrategy idleStrategy = YieldingIdleStrategy.INSTANCE; while (!publication.isConnected()) { idleStrategy.idle(); } final long startNs = System.nanoTime(); final UnsafeBuffer buffer = this.buffer; for (long i = 0; i < NUMBER_OF_MESSAGES; i++) { buffer.putLong(0, i); idleStrategy.reset(); while (publication.offer(buffer, 0, MESSAGE_LENGTH) < 0) { idleStrategy.idle(); } } final long stopPosition = publication.position(); final CountersReader counters = aeron.countersReader(); final int counterId = RecordingPos.findCounterIdBySession(counters, publication.sessionId()); idleStrategy.reset(); while (counters.getCounterValue(counterId) < stopPosition) { idleStrategy.idle(); } final long durationMs = TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - startNs); final double dataRate = (stopPosition * 1000.0d / durationMs) / MEGABYTE; final double recordingMb = stopPosition / MEGABYTE; final long msgRate = (NUMBER_OF_MESSAGES / durationMs) * 1000L; System.out.printf( "Recorded %.02f MB @ %.02f MB/s - %,d msg/sec - %d byte payload + 32 byte header%n", recordingMb, dataRate, msgRate, MESSAGE_LENGTH); return RecordingPos.getRecordingId(counters, counterId); } }
Source:
<code>public void start(BundleContext context) throws Exception { <START> final Set<Bundle> bundlesToRefresh = Arrays.stream(context.getBundles()).filter(b -> b.getSymbolicName().contains("theme")).collect(Collectors.toSet()); <END> if (!bundlesToRefresh.isEmpty()) { Bundle systemBundle = context.getBundle(0); FrameworkWiring frameworkWiring = systemBundle.adapt(FrameworkWiring.class); frameworkWiring.refreshBundles(bundlesToRefresh); } }</code><technical_language>able fix smoke tests if filter for resolved bundles avoid refreshing if resolved</technical_language>

Target:
public void start(BundleContext context) throws Exception { final Set<Bundle> unresolvedVaadinThemeFragments = getUnresolvedVaadinThemeFragments(context); if (!unresolvedVaadinThemeFragments.isEmpty()) { final Bundle vaadinThemeHostBundle = getVaadinThemeHostbundle(context); final List<Bundle> bundlesToRefresh = new ArrayList<>(); bundlesToRefresh.add(vaadinThemeHostBundle); final Bundle systemBundle = context.getBundle(0); FrameworkWiring frameworkWiring = systemBundle.adapt(FrameworkWiring.class); frameworkWiring.refreshBundles(bundlesToRefresh); } }
Source:
<code>public HttpRequest signGetBlob(String container, String name, long timeInSeconds) { <START> System.out.println("Method signGetBlob is called " + container + " , " + name + " , " + timeInSeconds); <END> checkNotNull(container, "container"); checkNotNull(name, "name"); return sign("GET", container, name, null, timeInSeconds, null, null); }</code><technical_language>Remove unneeded logging</technical_language>

Target:
public HttpRequest signGetBlob(String container, String name, long timeInSeconds) { checkNotNull(container, "container"); checkNotNull(name, "name"); return sign("GET", container, name, null, timeInSeconds, null, null); }
Source:
<code>public void reset() { <START> super.write(new byte[] {0x72, 0x65, 0x73, 0x65, 0x74, 0x65, 0x6e, 0x63}); END> }</code><technical_language>Again, this byte sequence a constant somewhere? (I enough is other)</technical_language>

Target:
public void reset() { super.write(CANEncoder.RESET_ENCODER_BYTE_SEQUENCE); }
Source:
<code>static InputStream getDecompressorStream(InputStream stream) throws IOException { BufferedInputStream buff = new BufferedInputStream(stream); int maxLen = Arrays.stream(ClientCompressor.values()).max( Comparator.comparingInt(x -> x.magic.length)).get().magic.length; buff.mark(maxLen); byte[] headerBuffer = new byte[maxLen]; <START> int len = buff.read(headerBuffer); <END> buff.reset(); Optional<ClientCompressor> compressor = Arrays.stream(ClientCompressor.values()).filter(t -> matchMagic(t, headerBuffer, len)).findFirst(); return compressor.map(t -> { try { return t.decompressorClass.getConstructor(InputStream.class).newInstance(buff); } catch (Exception exc) { throw new RuntimeException(exc); } }).orElseGet(() -> buff); }</code><technical_language>this do right thing, buff.read return number of bytes, fill header buffer</technical_language>

Target:
static InputStream getDecompressorStream(InputStream stream) throws IOException { BufferedInputStream buff = new BufferedInputStream(stream); List<ClientCompressor> compressors = Arrays.stream(ClientCompressor.values()).sorted( Comparator.comparingInt((ClientCompressor t) -> t.magic.length).reversed() ).collect( Collectors.toList()); int maxLen = compressors.get(0).magic.length; buff.mark(maxLen); byte[] headerBuffer = new byte[maxLen]; int len = ByteStreams.read(buff, headerBuffer, 0, maxLen); buff.reset(); ClientCompressor compressor = compressors.stream().filter( t -> t.magic.length <= len && t.matchMagic(headerBuffer, len)).collect(MoreCollectors.onlyElement()); return compressor.decompressorCreator.apply(buff); }
Source:
<code>private static ContentIdentifier create(EntityType type, String uri, String id, Integer seriesNumber) { switch (type) { case BRAND: return new BrandIdentifier(uri, id); case EPISODE: return new EpisodeIdentifier(uri, id); case FILM: return new FilmIdentifier(uri, id); case ITEM: case SONG: return new ItemIdentifier(uri, id); case PERSON: return new PersonIdentifier(uri, id); case SERIES: return new SeriesIdentifier(uri, seriesNumber, id); default: <START> throw new RuntimeException("Can't createDefault content identifier for " + uri); <END> } }</code><technical_language>Refactor error I</technical_language>

Target:
private static ContentIdentifier create(EntityType type, String uri, String id, Integer seriesNumber) { switch (type) { case BRAND: return new BrandIdentifier(uri, id); case EPISODE: return new EpisodeIdentifier(uri, id); case FILM: return new FilmIdentifier(uri, id); case ITEM: case SONG: return new ItemIdentifier(uri, id); case PERSON: return new PersonIdentifier(uri, id); case SERIES: return new SeriesIdentifier(uri, seriesNumber, id); default: throw new RuntimeException("Can't create content identifier for " + uri); } }
Source:
<code><START> private int removeNodeElementsToSatisfyCharsLimit(ArrayNode node, int needToRemoveCharsNumber) <END> { int removedCharsNumber = 0; while (node.size() > 0 && needToRemoveCharsNumber > removedCharsNumber) { final int lengthBeforeRemove = node.toString().length(); final int removeUntil = node.size() / 2; for (int removeAt = node.size() - 1; removeAt >= removeUntil; removeAt--) { node.remove(removeAt); } final int lengthAfterRemove = node.toString().length(); removedCharsNumber += lengthBeforeRemove - lengthAfterRemove; } return removedCharsNumber; }</code><technical_language>this method static</technical_language>

Target:
private static int removeNodeElementsToSatisfyCharsLimit(ArrayNode node, int needToRemoveCharsNumber) { int removedCharsNumber = 0; while (node.size() > 0 && needToRemoveCharsNumber > removedCharsNumber) { final int lengthBeforeRemove = node.toString().length(); final int removeUntil = node.size() / 2; for (int removeAt = node.size() - 1; removeAt >= removeUntil; removeAt--) { node.remove(removeAt); } final int lengthAfterRemove = node.toString().length(); removedCharsNumber += lengthBeforeRemove - lengthAfterRemove; } return removedCharsNumber; }
Source:
<code>private void setUsernamePasswordVisibility(int type) { <START> if (requiresUsernamePassword(type)) { mView.findViewById(R.id.userpass).setVisibility(View.VISIBLE); } else { mView.findViewById(R.id.userpass).setVisibility(View.GONE); } <END> }</code><technical_language>suggest a local visibility int in other places, a ternary inline, duplicate this code</technical_language>

Target:
private void setUsernamePasswordVisibility(int type) { mView.findViewById(R.id.userpass).setVisibility( requiresUsernamePassword(type) ? View.VISIBLE : View.GONE); }
Source:
<code>public Response sendRequest(Request request) throws IOException { if (request == null) { <START> throw new IllegalArgumentException(); <END> } if (!mConnectionStatus.working()) { throw new IOException("Not connected to server"); } mSender.print(request.message()); mSender.flush(); Response response = null; String rawResponse = mReceiver.readLine(); if (isValid(rawResponse)) { response = new Response(rawResponse); } else { throw new IOException("Invalid response"); } return response; }</code><technical_language>NullPointerExceptionis more specific. Objects.requireNonNull(request)</technical_language>

Target:
public Response sendRequest(Request request) throws IOException { Objects.requireNonNull(request); if (!mConnectionStatus.working()) { throw new IOException("Not connected to server"); } mSender.print(request.message()); mSender.flush(); Response response = null; String rawResponse = mReceiver.readLine(); if (isValid(rawResponse)) { response = new Response(rawResponse); } else { throw new IOException("Invalid response"); } return response; }
Source:
<code>public static PID get(String value) { String id; String qualifier; String componentPath; String repositoryPath; if (value != null && value.startsWith(repository.getFedoraBase())) { repositoryPath = value; String path = value.substring(repository.getFedoraBase().length()); Matcher matcher = RepositoryPathConstants.repositoryPathPattern.matcher(path); if (matcher.matches()) { qualifier = matcher.group(1); componentPath = matcher.group(5); id = matcher.group(3); } else { return null; } } else if (value != null) { Matcher matcher = RepositoryPathConstants.identifierPattern.matcher(value); if (matcher.matches()) { qualifier = matcher.group(2); if (qualifier == null) { qualifier = RepositoryPathConstants.CONTENT_BASE; } id = matcher.group(4); componentPath = matcher.group(6); repositoryPath = getRepositoryPath(id, qualifier, componentPath); } else { return null; } <START> } else { <END> return null; } return new FedoraPID(id, qualifier, componentPath, URI.create(repositoryPath)); }</code><technical_language>suggest switching early return if is null prior main if/else block</technical_language>

Target:
public static PID get(String value) { if (value == null) { return null; } String id; String qualifier; String componentPath; String repositoryPath; if (value.startsWith(repository.getFedoraBase())) { repositoryPath = value; String path = value.substring(repository.getFedoraBase().length()); Matcher matcher = RepositoryPathConstants.repositoryPathPattern.matcher(path); if (matcher.matches()) { qualifier = matcher.group(1); componentPath = matcher.group(5); id = matcher.group(3); } else { return null; } } else { Matcher matcher = RepositoryPathConstants.identifierPattern.matcher(value); if (matcher.matches()) { qualifier = matcher.group(2); if (qualifier == null) { qualifier = RepositoryPathConstants.CONTENT_BASE; } id = matcher.group(4); componentPath = matcher.group(6); repositoryPath = getRepositoryPath(id, qualifier, componentPath); } else { return null; } } return new FedoraPID(id, qualifier, componentPath, URI.create(repositoryPath)); }
Source:
<code>void collectTypedefs() { for (TypedVar var : compiler.getTopScope().getAllSymbols()) { JSType type = var.getType(); if (type == null || !isTypedef(type) || var.getName().startsWith("window.") <START> || isPrivate(var.getJSDocInfo())) { <END> continue; } JSType realType = compiler.getTypeRegistry().getType(var.getName()); if (realType != null && shouldEmitTypedefByName(realType)) { typedefs.put(realType, var.getName()); } } }</code><technical_language>line for this commit: "Minor syntax fixes". ("Minor fixes" is vague, hard if fixing minor clutz bugs some other thing.)</technical_language>

Target:
void collectTypedefs() { for (TypedVar var : compiler.getTopScope().getAllSymbols()) { if (shouldSkipVar(var)) { continue; } JSType type = var.getType(); if (type == null || !isTypedef(type) || var.getName().startsWith("window.") || isPrivate(var.getJSDocInfo())) { continue; } JSType realType = compiler.getTypeRegistry().getType(var.getName()); if (realType != null && shouldEmitTypedefByName(realType) && !typedefs.containsKey(realType)) { typedefs.put(realType, var.getName()); } } }
Source:
<code>private void injectFilter(ServletContext context, Bundle refBundle) { LOGGER.info( "Injecting SecurityJavaSubjectFilter into ID: {}", refBundle.getSymbolicName(), refBundle.getBundleId()); try { SessionCookieConfig sessionCookieConfig = context.getSessionCookieConfig(); sessionCookieConfig.setPath("/"); sessionCookieConfig.setSecure(true); sessionCookieConfig.setHttpOnly(true); } catch (Exception e) { LOGGER.trace( "Failed trying to set the cookie config path to /. This can usually be ignored", e); } for (Filter filter : filterList) { try { FilterRegistration filterReg = context.addFilter(SECURITY_JAVA_SUBJECT_FILTER, filter); if (filterReg == null) { <START> filterReg = context.getFilterRegistration(SECURITY_JAVA_SUBJECT_FILTER); <END> } else { ((FilterRegistration.Dynamic) filterReg).setAsyncSupported(true); } filterReg.addMappingForUrlPatterns(EnumSet.of(DispatcherType.REQUEST), true, ALL_URLS); } catch (IllegalStateException ise) { LOGGER.error( "Could not inject into because the servlet was already initialized. This means that SecurityJavaSubjectFilter will not be included in {}.", filter.getClass(), refBundle.getSymbolicName(), refBundle.getSymbolicName(), ise); } } }</code><technical_language>guessing this bad side effects, "name" for filter registrations. more sense classname of filter</technical_language>

Target:
private void injectFilter(ServletContext context, Bundle refBundle) { LOGGER.info( "Injecting SecurityJavaSubjectFilter into ID: {}", refBundle.getSymbolicName(), refBundle.getBundleId()); try { SessionCookieConfig sessionCookieConfig = context.getSessionCookieConfig(); sessionCookieConfig.setPath("/"); sessionCookieConfig.setSecure(true); sessionCookieConfig.setHttpOnly(true); } catch (Exception e) { LOGGER.trace( "Failed trying to set the cookie config path to /. This can usually be ignored", e); } for (Filter filter : filterList) { try { FilterRegistration filterReg = context.addFilter(filter.getClass().getName(), filter); if (filterReg == null) { filterReg = context.getFilterRegistration(filter.getClass().getName()); } else { ((FilterRegistration.Dynamic) filterReg).setAsyncSupported(true); } filterReg.addMappingForUrlPatterns(EnumSet.of(DispatcherType.REQUEST), true, ALL_URLS); } catch (IllegalStateException ise) { LOGGER.error( "Could not inject into because the servlet was already initialized. This means that SecurityJavaSubjectFilter will not be included in {}.", filter.getClass(), refBundle.getSymbolicName(), refBundle.getSymbolicName(), ise); } } }
Source:
<code>private void transferBinaries(Resource resc, BinaryTransferSession transferSession) { PID objPid = PIDs.get(resc.toString()); Set<Resource> rescTypes = resc.listProperties(RDF.type).toList().stream() .map(Statement::getResource).collect(toSet()); if (TYPES_ALLOWING_DESC.stream().anyMatch(rescTypes::contains)) { transferModsFile(objPid, resc, transferSession); } if (rescTypes.contains(Cdr.FileObject)) { transferOriginalFile(objPid, resc, transferSession); transferFitsExtract(objPid, resc, transferSession); } else if (objPid.getQualifier().equals(DEPOSIT_RECORD_BASE)) { transferDepositManifests(objPid, resc, transferSession); } <START> Path premisLogPath = getPremisFile(objPid).toPath(); <END> resc.addProperty(CdrDeposit.premisStorageUri, premisLogPath.toUri().toString()); NodeIterator iterator = getChildIterator(resc); if (iterator == null) { return; } try { while (iterator.hasNext()) { Resource childResc = (Resource) iterator.next(); transferBinaries(childResc, transferSession); } } finally { iterator.close(); } }</code><technical_language>verify this is right path? memory is this is pre-ingest location premis file is stored, post-ingest. I path of post-ingest log exists IngestContentObjectJob IngestDepositRecordJob completed. a get path in RegisterToLongleafJob, i tested it: BinaryObject premisBin = repositoryObjectLoader.getBinaryObject(DatastreamPids.getMdEventsPid(pid)); URI premisStorageUri = premisBin.getContentUri(); ingest content/deposit jobs completed, meaning work in this job objects ingested fedora yet</technical_language>

Target:
private void transferBinaries(Resource resc, BinaryTransferSession transferSession) { PID objPid = PIDs.get(resc.toString()); Set<Resource> rescTypes = resc.listProperties(RDF.type).toList().stream() .map(Statement::getResource).collect(toSet()); if (TYPES_ALLOWING_DESC.stream().anyMatch(rescTypes::contains)) { transferModsFile(objPid, resc, transferSession); } if (rescTypes.contains(Cdr.FileObject)) { transferOriginalFile(objPid, resc, transferSession); transferFitsExtract(objPid, resc, transferSession); } else if (objPid.getQualifier().equals(DEPOSIT_RECORD_BASE)) { transferDepositManifests(objPid, resc, transferSession); } NodeIterator iterator = getChildIterator(resc); if (iterator == null) { return; } try { while (iterator.hasNext()) { Resource childResc = (Resource) iterator.next(); transferBinaries(childResc, transferSession); } } finally { iterator.close(); } }
Source:
<code>public IActionInvokeStatus call() throws Exception { try { final IActionInvoker actionInvoker = resource.getDefaultActionInvoker(); final IAction action = createActionBean( actionClass, actionId ); final Map<String, Serializable> params = deserialize( action, actionParams ); IActionInvokeStatus status = actionInvoker.invokeAction( action, user, params ); if ( status != null && status.getThrowable() == null ) { getLogger().info( Messages.getInstance().getRunningInBgLocallySuccess( action.getClass().getName(), params ), status.getThrowable() ); } else { getLogger().error( Messages.getInstance().getCouldNotInvokeActionLocally( action.getClass().getName(), params ), <START> status.getThrowable() ); <END> } return status; } catch ( final Throwable thr ) { getLogger() .error( Messages.getInstance().getCouldNotInvokeActionLocallyUnexpected( ( StringUtil.isEmpty( actionClass ) ? actionId : actionClass ), actionParams ), thr ); } return null; }</code><technical_language>This result NPE if status==null</technical_language>

Target:
public IActionInvokeStatus call() throws Exception { try { final IActionInvoker actionInvoker = resource.getDefaultActionInvoker(); final IAction action = createActionBean( actionClass, actionId ); final Map<String, Serializable> params = deserialize( action, actionParams ); IActionInvokeStatus status = actionInvoker.invokeAction( action, user, params ); if ( status != null && status.getThrowable() == null ) { getLogger().info( Messages.getInstance().getRunningInBgLocallySuccess( action.getClass().getName(), params ), status.getThrowable() ); } else { getLogger().error( Messages.getInstance().getCouldNotInvokeActionLocally( action.getClass().getName(), params ), ( status != null ? status.getThrowable() : null ) ); } return status; } catch ( final Throwable thr ) { getLogger() .error( Messages.getInstance().getCouldNotInvokeActionLocallyUnexpected( ( StringUtil.isEmpty( actionClass ) ? actionId : actionClass ), actionParams ), thr ); } return null; }
Source:
<code>public AdHocPlannedStmtBatch plan(String sql, Object[] userParams, boolean singlePartition) throws AdHocPlanningException { List<String> sqlStatements = new ArrayList<>(); AdHocSQLMix mix = AdHocNTBase.processAdHocSQLStmtTypes(sql, sqlStatements); switch (mix) { case EMPTY: throw new AdHocPlanningException("No valid SQL found."); case ALL_DDL: case MIXED: throw new AdHocPlanningException("DDL not supported in stored procedures."); default: break; } if (sqlStatements.size() != 1) { <START> throw new AdHocPlanningException("One statement only in stored procedures."); <END> } sql = sqlStatements.get(0); Object partitionKey = singlePartition ? "1" : null; List<AdHocPlannedStatement> stmts = new ArrayList<>(); AdHocPlannedStatement result = null; result = AdHocNTBase.compileAdHocSQL(m_catalogContext, sql, false, partitionKey, ExplainMode.NONE, userParams); stmts.add(result); return new AdHocPlannedStmtBatch(userParams, stmts, -1, null, null, userParams); }</code><technical_language>error message for this case: "Only statement is allowed in stored procedure " + procedureName + ", received " + sqlStatements.size();</technical_language>

Target:
public AdHocPlannedStmtBatch plan(String sql, Object[] userParams, boolean singlePartition) throws AdHocPlanningException { List<String> sqlStatements = new ArrayList<>(); AdHocSQLMix mix = AdHocNTBase.processAdHocSQLStmtTypes(sql, sqlStatements); switch (mix) { case EMPTY: throw new AdHocPlanningException("No valid SQL found."); case ALL_DDL: case MIXED: throw new AdHocPlanningException("DDL not supported in stored procedures."); default: break; } if (sqlStatements.size() != 1) { throw new AdHocPlanningException("Only one statement is allowed in stored procedure, but received " + sqlStatements.size()); } sql = sqlStatements.get(0); Object partitionKey = singlePartition ? "1" : null; List<AdHocPlannedStatement> stmts = new ArrayList<>(); AdHocPlannedStatement result = null; result = AdHocNTBase.compileAdHocSQL(m_catalogContext, sql, false, partitionKey, ExplainMode.NONE, false, userParams); stmts.add(result); return new AdHocPlannedStmtBatch(userParams, stmts, -1, null, null, userParams); }
Source:
<code>private void selectCSVFile() { Intent intent = new Intent(Intent.ACTION_GET_CONTENT); intent.addCategory(Intent.CATEGORY_OPENABLE); intent.setType("text/csv"); <START> startActivityForResult(Intent.createChooser(intent, "Open CSV"), ACTIVITY_CHOOSE_FILE); <END> }</code><technical_language>Please extract this string</technical_language>

Target:
private void selectCSVFile() { Intent intent = new Intent(Intent.ACTION_GET_CONTENT); intent.addCategory(Intent.CATEGORY_OPENABLE); intent.setType("text/csv"); startActivityForResult(Intent.createChooser(intent, getString(R.string.open_csv)), ACTIVITY_CHOOSE_FILE); }
Source:
<code><START> public boolean realmExists() { <END> return new File(canonicalPath).exists(); }</code><technical_language>This method is useful in some cases, I this public API. proper lock, this method guarantee anything</technical_language>

Target:
boolean realmExists() { return new File(canonicalPath).exists(); }
Source:
<code><START> public void addSubAttribute(Attribute newSubAttribute) { if (newSubAttribute == null) { throw new IllegalArgumentException(); } subAttributes.put(newSubAttribute.getName(), newSubAttribute); } <END></code><technical_language>add a child named "..", confusing</technical_language>

Target:
public void addSubAttribute(Attribute newSubAttribute) { if (newSubAttribute == null || PARENT_PATH.equals(newSubAttribute.getName())) { throw new IllegalArgumentException("New attribute cannot be null or equal to the parent path '..'"); } subAttributes.put(newSubAttribute.getName(), newSubAttribute); }
Source:
<code>public static QueryGranularity fromString(String str) { String name = str.toUpperCase(); if(name.equals("ALL")) { return QueryGranularity.ALL; } else if(name.equals("NONE")) { return QueryGranularity.NONE; } else if(CALENDRIC_GRANULARITIES.containsKey(name)) { <START> return new PeriodGranularity(CALENDRIC_GRANULARITIES.get(name), null, null); <END> } return new DurationGranularity(convertValue(str), 0); }</code><technical_language>instead of creating a new object time, more sense store constants for predefined granularity string</technical_language>

Target:
public static QueryGranularity fromString(String str) { String name = str.toUpperCase(); if(name.equals("ALL")) { return QueryGranularity.ALL; } else if(name.equals("NONE")) { return QueryGranularity.NONE; } else if(CALENDRIC_GRANULARITIES.containsKey(name)) { return CALENDRIC_GRANULARITIES.get(name); } return new DurationGranularity(convertValue(str), 0); }
Source:
<code><START> public GetSCOTask(WeakReference<AbstractContentNode<?>> weakContentRef, PropertyChangeListener listener) { <END> this.weakNodeRef = weakContentRef; this.listener = listener; }</code><technical_language>public in non-public class, public removed</technical_language>

Target:
GetSCOTask(WeakReference<AbstractContentNode<?>> weakContentRef, PropertyChangeListener listener) { this.weakNodeRef = weakContentRef; this.listener = listener; }
Source:
<code>private PrestoException invalidSubfieldPath() { <START> return new PrestoException(INVALID_FUNCTION_ARGUMENT, format("Invalid subfield path: '%s'", path)); <END> }</code><technical_language>index encoded in error message denote wrong, I assume toString() is for purpose? java format("Invalid subfield path: '%s'", this)</technical_language>

Target:
private PrestoException invalidSubfieldPath() { return new PrestoException(INVALID_FUNCTION_ARGUMENT, format("Invalid subfield path: '%s'", this)); }
Source:
<code>private void triggerWindowProcess() throws Exception { while (windowsGrouping.hasTriggerWindow()) { RowIterator<BinaryRowData> elementIterator = windowsGrouping.buildTriggerWindowElementsIterator(); <START> TimeWindow currentWindow = windowsGrouping.getTriggerWindow(); <END> while (elementIterator.advanceNext()) { BinaryRowData winElement = elementIterator.getRow(); arrowSerializer.write(getFunctionInput(winElement)); currentBatchCount++; } if (currentBatchCount > 0) { inputKeyAndWindow.add(Tuple2.of(lastGroupSet, currentWindow)); arrowSerializer.finishCurrentBatch(); pythonFunctionRunner.process(baos.toByteArray()); elementCount += currentBatchCount; checkInvokeFinishBundleByCount(); currentBatchCount = 0; baos.reset(); } } }</code><technical_language>Move this line if (currentBatchCount > 0)</technical_language>

Target:
private void triggerWindowProcess() throws Exception { while (windowsGrouping.hasTriggerWindow()) { RowIterator<BinaryRowData> elementIterator = windowsGrouping.buildTriggerWindowElementsIterator(); while (elementIterator.advanceNext()) { BinaryRowData winElement = elementIterator.getRow(); arrowSerializer.write(getFunctionInput(winElement)); currentBatchCount++; } if (currentBatchCount > 0) { TimeWindow currentWindow = windowsGrouping.getTriggerWindow(); inputKeyAndWindow.add(Tuple2.of(lastGroupSet, currentWindow)); arrowSerializer.finishCurrentBatch(); pythonFunctionRunner.process(baos.toByteArray()); elementCount += currentBatchCount; checkInvokeFinishBundleByCount(); currentBatchCount = 0; baos.reset(); } } }
Source:
<code>public void shutdown() { <START> m_executorService.shutdown(); <END> }</code><technical_language>in Volt properly shutdown executor service</technical_language>

Target:
public void shutdown() throws InterruptedException { m_isShutdown.set(true); networkLog.debug("Shutting down Encryption and Decryption services."); if (m_encEs != null) { m_encEs.shutdown(); m_encEs.awaitTermination(365, TimeUnit.DAYS); } if (m_decEs != null) { m_decEs.shutdown(); m_decEs.awaitTermination(365, TimeUnit.DAYS); } networkLog.debug("Encryption and Decryption services successfully shutdown."); }
Source:
<code>public Double getExpectedValue(int start, int length) { <START> assertTrue(length < MAX_SAMPLES); <END> double[] samples = new double[2 * length]; for (int i = 0; i < length; i++) { samples[i] = (double) (start + i); samples[i + length] = (double) (start + i); } return calculateFromSamplesUsingVasicek(samples); }</code><technical_language>move this change previous commit</technical_language>

Target:
public Double getExpectedValue(int start, int length) { assertTrue(2 * length < MAX_SAMPLES); double[] samples = new double[2 * length]; for (int i = 0; i < length; i++) { samples[i] = (double) (start + i); samples[i + length] = (double) (start + i); } return calculateFromSamplesUsingVasicek(samples); }
Source:
<code>public static LogicalTableSpool create(RelNode input, Type readType, Type writeType, String tableName) { RelOptCluster cluster = input.getCluster(); RelTraitSet traitSet = cluster.traitSetOf(Convention.NONE); <START> return new LogicalTableSpool(cluster, traitSet, input, readType, writeType, tableName); <END> }</code><technical_language>deduce collation/distribution traits input? If lose traits lead problems planning</technical_language>

Target:
public static LogicalTableSpool create(RelNode input, Type readType, Type writeType, String tableName) { RelOptCluster cluster = input.getCluster(); RelMetadataQuery mq = cluster.getMetadataQuery(); RelTraitSet traitSet = cluster.traitSetOf(Convention.NONE) .replaceIfs(RelCollationTraitDef.INSTANCE, () -> mq.collations(input)) .replaceIf(RelDistributionTraitDef.INSTANCE, () -> mq.distribution(input)); return new LogicalTableSpool(cluster, traitSet, input, readType, writeType, tableName); }
Source:
<code>public void getUserGroups() throws NotFoundException { Long[] expectedGroupIDs = {4l, 5l, 6l}; JCUser jcUser = new JCUser("user", "email@email.com", "pwd"); <START> for (int i = 0; i < expectedGroupIDs.length; i++) { <END> Group group = new Group("group" + i); group.setId(expectedGroupIDs[i]); jcUser.getGroups().add(group); } when(userService.get(anyLong())).thenReturn(jcUser); JsonResponse jsonResponse = userController.userGroups(1l); assertThat(jsonResponse.getStatus(), is(JsonResponseStatus.SUCCESS)); assertThat((Iterable<Long>) jsonResponse.getResult(), hasItems(expectedGroupIDs)); }</code><technical_language>Please move loop out a separate method</technical_language>

Target:
public void getUserGroups() throws NotFoundException { long userID = 1l; Component component = createDefaultComponent(); when(componentService.getComponentOfForum()).thenReturn(component); userController.userGroups(userID); verify(userService).getUserGroupIDs(component.getId(), userID); }
Source:
<code><START> private void outputDiff(PrintStream out, String path, ObjectId id1, <END> FileMode mode1, ObjectId id2, FileMode mode2, Repository repo) throws IOException { DiffFormatter fmt = new DiffFormatter(); String name1 = "a/" + path; String name2 = "b/" + path; out.println("diff --git " + name1 + " " + name2); boolean isNew = false; boolean isDelete = false; if (id1.equals(ObjectId.zeroId())) { out.println("new file mode " + mode2); isNew = true; } else if (id2.equals(ObjectId.zeroId())) { out.println("deleted file mode " + mode1); isDelete = true; } else if (!mode1.equals(mode2)) { out.println("old mode " + mode1); out.println("new mode " + mode2); } out.println("index " + id1.abbreviate(repo, 7).name() + ".." + id2.abbreviate(repo, 7).name() + (mode1.equals(mode2) ? " " + mode1 : "")); out.println("--- " + (isNew ? "/dev/null" : name1)); out.println("+++ " + (isDelete ? "/dev/null" : name2)); RawText a = getRawText(id1, repo); RawText b = getRawText(id2, repo); MyersDiff diff = new MyersDiff(a, b); fmt.formatEdits(out, a, b, diff.getEdits()); }</code><technical_language>is write this function, other Google copyright it. However, reuse code thanks original source license compatible own, license requires give notice. Please copy header of source file file, copyright header above, add a note start of like: /* * Some portions (e.g. outputDiff) are:</technical_language>

Target:
private void outputDiff(PrintStream out, String path, ObjectId id1, FileMode mode1, ObjectId id2, FileMode mode2, Repository repo) throws IOException { DiffFormatter fmt = new DiffFormatter(); String name1 = "a/" + path; if (needsQuoting(name1)) { name1 = QuotedString.GIT_PATH.quote(name1); } String name2 = "b/" + path; if (needsQuoting(name2)) { name2 = QuotedString.GIT_PATH.quote(name2); } out.print("diff --git " + name1 + " " + name2 + "\n"); boolean isNew = FileMode.MISSING.equals(mode1); boolean isDelete = FileMode.MISSING.equals(mode2); if (isNew) { out.print("new file mode " + mode2 + "\n"); } else if (isDelete) { out.print("deleted file mode " + mode1 + "\n"); } else if (!mode1.equals(mode2)) { out.print("old mode " + mode1 + "\n"); out.print("new mode " + mode2 + "\n"); } out.print("index " + id1.abbreviate(repo, 7).name() + ".." + id2.abbreviate(repo, 7).name() + (mode1.equals(mode2) ? " " + mode1 : "") + "\n"); out.print("--- " + (isNew ? "/dev/null" : name1) + "\n"); out.print("+++ " + (isDelete ? "/dev/null" : name2) + "\n"); RawText a = getRawText(id1, repo); RawText b = getRawText(id2, repo); MyersDiff diff = new MyersDiff(a, b); fmt.formatEdits(out, a, b, diff.getEdits()); }
Source:
<code>public void pointWrite() throws IOException { Table table = connection.getTable(TableName.valueOf(BENCHMARK_WRITE_TABLE)); String rowPrefix = getRowPrefix(jobConfig.cellsPerRow, jobConfig.cellSize); Put put = new Put(Bytes.toBytes(rowPrefix + String.format(SUFFIX_FMT, 100))); long currentTimestamp = System.currentTimeMillis(); for (int cellInd = 0; cellInd < jobConfig.cellsPerRow; cellInd++) { put.addColumn( COL_FAMILY, Bytes.toBytes("qualifier-" + String.format(SUFFIX_FMT, cellInd)), currentTimestamp, <START> getRandomBytes(jobConfig.cellSize)); <END> } table.put(put); }</code><technical_language>I constant for run, compute random once, reuse</technical_language>

Target:
public void pointWrite() throws IOException { String rowKey = MUTATE_ROW_PREFIX + String.format("%06d", getRandomInt(1_000_000)); Put put = new Put(Bytes.toBytes(rowKey)); byte[] cellValue = getRandomBytes(rowShapeParams.cellSize); for (int cellInd = 0; cellInd < rowShapeParams.cellsPerRow; cellInd++) { put.addColumn( COL_FAMILY, Bytes.toBytes("qualifier-" + String.format("%06d", cellInd)), SAMPLE_TIMESTAMP, cellValue); } table.put(put); }