auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private void setCanonicalQueryString() { <START> Map<String,ArrayList<String>> signedQueryParams = new TreeMap<>(); <END> String encodedQuery = this.url.encodedQuery(); if (encodedQuery == null) { this.canonicalQueryString = ""; return; } for (String queryParam : encodedQuery.split("&")) { String[] tokens = queryParam.split("="); ArrayList<String> vals = signedQueryParams.get(tokens[0]); if (vals == null) { vals = new ArrayList<String>(); signedQueryParams.put(tokens[0], vals); } if (tokens.length > 1) { vals.add(tokens[1]); } else { vals.add(""); } } ArrayList<String> canonicalSubQueries = new ArrayList<String>(); for (Map.Entry<String, ArrayList<String>> entry: signedQueryParams.entrySet()) { ArrayList<String> v = entry.getValue(); if (v.size() > 0) { List<String> subQueries = v.stream() .map(s -> entry.getKey() + "=" + s) .collect(Collectors.toList()); canonicalSubQueries.add(Joiner.on("&").join(subQueries)); } } this.canonicalQueryString = Joiner.on("&").join(canonicalSubQueries); }</code><technical_language>Multimap here. java String encodedQuery = this.url.encodedQuery(); if (encodedQuery == null) { this.canonicalQueryString = ""; return; } Multimap<String, String> signedQueryParams = TreeMultimap.create(); for (String queryParam : encodedQuery.split("&")) { String[] tokens = queryParam.split("="); if (tokens.length > 1) { signedQueryParams.put(tokens[0], tokens[1]); } else { signedQueryParams.put(tokens[0], ""); } } this.canonicalQueryString = Joiner.on("&").withKeyValueSeparator("=").join(signedQueryParams.entries());</technical_language>

Target:
private void setCanonicalQueryString() { String encodedQuery = this.url.encodedQuery(); if (encodedQuery == null) { this.canonicalQueryString = ""; return; } Multimap<String, String> signedQueryParams = MultimapBuilder.treeKeys().arrayListValues().build(); for (String queryParam : encodedQuery.split("&")) { String[] tokens = queryParam.split("="); if (tokens.length > 1) { signedQueryParams.put(tokens[0], tokens[1]); } else { signedQueryParams.put(tokens[0], ""); } } this.canonicalQueryString = Joiner.on("&").withKeyValueSeparator("=").join(signedQueryParams.entries()); }
Source:
<code>protected String getAuthorizationBaseUrl() { <START> return "<LINK_0>"; <END> }</code><technical_language>"?" is unneded char added automatically if needed</technical_language>

Target:
protected String getAuthorizationBaseUrl() { return "<LINK_1>"; }
Source:
<code>public static ServerAggregators deserialize(byte[] b, Configuration conf) { if (b == null) { return ServerAggregators.EMPTY_AGGREGATORS; } ByteArrayInputStream stream = new ByteArrayInputStream(b); try { DataInputStream input = new DataInputStream(stream); int minNullableIndex = WritableUtils.readVInt(input); int len = WritableUtils.readVInt(input); Aggregator[] aggregators = new Aggregator[len]; Expression[] expressions = new Expression[len]; SingleAggregateFunction[] functions = new SingleAggregateFunction[len]; for (int i = 0; i < aggregators.length; i++) { SingleAggregateFunction aggFunc = (SingleAggregateFunction)ExpressionType.values()[WritableUtils.readVInt(input)].newInstance(); aggFunc.readFields(input); functions[i] = aggFunc; Aggregator aggregator = aggFunc.getAggregator(); <START> if (aggregator instanceof Configurable) { <END> ((Configurable)aggregator).setConf(conf); } aggregators[i] = aggregator; expressions[i] = aggFunc.getAggregatorExpression(); } return new ServerAggregators(functions, aggregators,expressions, minNullableIndex); } catch (IOException e) { throw new RuntimeException(e); } finally { try { stream.close(); } catch (IOException e) { throw new RuntimeException(e); } } }</code><technical_language>Is need set Config solely get threshold compress? pass serialization instead</technical_language>

Target:
public static ServerAggregators deserialize(byte[] b, Configuration conf) { if (b == null) { return ServerAggregators.EMPTY_AGGREGATORS; } ByteArrayInputStream stream = new ByteArrayInputStream(b); try { DataInputStream input = new DataInputStream(stream); int minNullableIndex = WritableUtils.readVInt(input); int len = WritableUtils.readVInt(input); Aggregator[] aggregators = new Aggregator[len]; Expression[] expressions = new Expression[len]; SingleAggregateFunction[] functions = new SingleAggregateFunction[len]; for (int i = 0; i < aggregators.length; i++) { SingleAggregateFunction aggFunc = (SingleAggregateFunction)ExpressionType.values()[WritableUtils.readVInt(input)].newInstance(); aggFunc.readFields(input, conf); functions[i] = aggFunc; aggregators[i] = aggFunc.getAggregator(); expressions[i] = aggFunc.getAggregatorExpression(); } return new ServerAggregators(functions, aggregators,expressions, minNullableIndex); } catch (IOException e) { throw new RuntimeException(e); } finally { try { stream.close(); } catch (IOException e) { throw new RuntimeException(e); } } }
Source:
<code>protected CommandStatus run() { try { status = CommandStatus.RUNNING; Files.copy(source, destination.resolve(source.getFileName()), REPLACE_EXISTING); } catch (IOException e) { status = CommandStatus.FAILED; <START> e.printStackTrace(); <END> return status; } return CommandStatus.SUCCESS; }</code><technical_language>Remove log</technical_language>

Target:
protected CommandStatus run() { logger.info("Copying " + source + " to " + destination); try { status = CommandStatus.RUNNING; Files.copy(source, destination.resolve(source.getFileName()), REPLACE_EXISTING); } catch (IOException e) { status = CommandStatus.FAILED; logger.error("Local copy failed! Returning failed.", e); return status; } return CommandStatus.SUCCESS; }
Source:
<code>public int writeBatch(final OutputStream os, final Cursor cursor, final List<byte[]> events) throws IOException { int byteCount = B_FIXED_BYTE_COUNT; os.write(B_CURSOR_PARTITION_BEGIN); final byte[] partition = cursor.getPartition().getBytes(StandardCharsets.UTF_8); os.write(partition); byteCount += partition.length; os.write(B_OFFSET_BEGIN); final byte[] offset = cursor.getOffset().getBytes(StandardCharsets.UTF_8); os.write(offset); byteCount += offset.length; os.write(B_CURSOR_PARTITION_END); if (!events.isEmpty()) { os.write(B_EVENTS_ARRAY_BEGIN); for (int i = 0; i < events.size(); i++) { final byte[] event = events.get(i); os.write(event); byteCount += event.length; if (i < (events.size() - 1)) { os.write(B_COMMA_DELIM); } else { os.write(B_CLOSE_BRACKET); } } <START> } <END> os.write(B_CLOSE_CURLY_BRACKET); os.write(B_BATCH_SEPARATOR); os.flush(); return byteCount; }</code><technical_language>Is duplicate this part of events write process</technical_language>

Target:
public int writeBatch(final OutputStream os, final Cursor cursor, final List<byte[]> events) throws IOException { int byteCount = B_FIXED_BYTE_COUNT; os.write(B_CURSOR_PARTITION_BEGIN); final byte[] partition = cursor.getPartition().getBytes(UTF_8); os.write(partition); byteCount += partition.length; os.write(B_OFFSET_BEGIN); final byte[] offset = cursor.getOffset().getBytes(UTF_8); os.write(offset); byteCount += offset.length; os.write(B_CURSOR_PARTITION_END); if (!events.isEmpty()) { os.write(B_EVENTS_ARRAY_BEGIN); for (int i = 0; i < events.size(); i++) { final byte[] event = events.get(i); os.write(event); byteCount += event.length; if (i < (events.size() - 1)) { os.write(B_COMMA_DELIM); } else { os.write(B_CLOSE_BRACKET); } } } os.write(B_CLOSE_CURLY_BRACKET); os.write(B_BATCH_SEPARATOR); os.flush(); return byteCount; }
Source:
<code>protected void createDefaultDiskProfile() { executeInNewTransaction(() -> { final DiskProfile diskProfile = diskProfileHelper.createDiskProfile(getStorageDomain().getId(), getStorageDomainName()); DiskProfileParameters diskProfileParameters = new DiskProfileParameters(diskProfile, true); <START> runInternalAction(VdcActionType.AddDiskProfile, diskProfileParameters, cloneContextAndDetachFromParent()); <END> getCompensationContext().snapshotNewEntity(diskProfile); getCompensationContext().stateChanged(); return null; }); }</code><technical_language>runInternalActionWithTasksContext() instead of changing passed context? - creates more correct context for a child command</technical_language>

Target:
protected void createDefaultDiskProfile() { executeInNewTransaction(() -> { final DiskProfile diskProfile = diskProfileHelper.createDiskProfile(getStorageDomain().getId(), getStorageDomainName()); DiskProfileParameters diskProfileParameters = new DiskProfileParameters(diskProfile, true); runInternalActionWithTasksContext(VdcActionType.AddDiskProfile, diskProfileParameters); getCompensationContext().snapshotNewEntity(diskProfile); getCompensationContext().stateChanged(); return null; }); }
Source:
<code><START> public Cluster.Builder createClusterBuilderNoDebouncing() { <END> return Cluster.builder() .withQueryOptions(new QueryOptions() .setRefreshNodeIntervalMillis(0) .setRefreshNodeListIntervalMillis(0) .setRefreshSchemaIntervalMillis(0)); }</code><technical_language>Nice, this is common enough nice provide this level</technical_language>

Target:
public Cluster.Builder createClusterBuilderNoDebouncing() { return Cluster.builder().withQueryOptions(TestUtils.nonDebouncingQueryOptions()); }
Source:
<code>public void checkoutEntry(File f, DirCacheEntry entry, boolean config_filemode) throws IOException { ObjectLoader ol = repo.openBlob(entry.getObjectId()); if (ol == null) throw new MissingObjectException(entry.getObjectId(), Constants.TYPE_BLOB); byte[] bytes = ol.getCachedBytes(); File parentDir = f.getParentFile(); <START> parentDir.mkdirs(); <END> File tmpFile = java.io.File .createTempFile(f.getName(), null, parentDir); FileChannel channel = new FileOutputStream(tmpFile).getChannel(); ByteBuffer buffer = ByteBuffer.wrap(bytes); try { int j = channel.write(buffer); if (j != bytes.length) throw new IOException(MessageFormat.format( JGitText.get().couldNotWriteFile, tmpFile)); } finally { channel.close(); } FS fs = repo.getFS(); if (config_filemode && fs.supportsExecute()) { if (FileMode.EXECUTABLE_FILE.equals(entry.getRawMode())) { if (!fs.canExecute(tmpFile)) fs.setExecute(tmpFile, true); } else { if (fs.canExecute(tmpFile)) fs.setExecute(tmpFile, false); } } if (!tmpFile.renameTo(f)) { f.delete(); if (!tmpFile.renameTo(f)) { throw new IOException(MessageFormat.format( JGitText.get().couldNotWriteFile, tmpFile.getPath(), f.getPath())); } } entry.setLastModified(f.lastModified()); }</code><technical_language>done this in caller, do need repeat here</technical_language>

Target:
public void checkoutEntry(File f, DirCacheEntry entry, boolean config_filemode) throws IOException { ObjectLoader ol = repo.openBlob(entry.getObjectId()); if (ol == null) throw new MissingObjectException(entry.getObjectId(), Constants.TYPE_BLOB); byte[] bytes = ol.getCachedBytes(); File parentDir = f.getParentFile(); File tmpFile = java.io.File .createTempFile(f.getName(), null, parentDir); FileChannel channel = new FileOutputStream(tmpFile).getChannel(); ByteBuffer buffer = ByteBuffer.wrap(bytes); try { int j = channel.write(buffer); if (j != bytes.length) throw new IOException(MessageFormat.format( JGitText.get().couldNotWriteFile, tmpFile)); } finally { channel.close(); } FS fs = repo.getFS(); if (config_filemode && fs.supportsExecute()) { if (FileMode.EXECUTABLE_FILE.equals(entry.getRawMode())) { if (!fs.canExecute(tmpFile)) fs.setExecute(tmpFile, true); } else { if (fs.canExecute(tmpFile)) fs.setExecute(tmpFile, false); } } if (!tmpFile.renameTo(f)) { f.delete(); if (!tmpFile.renameTo(f)) { throw new IOException(MessageFormat.format( JGitText.get().couldNotWriteFile, tmpFile.getPath(), f.getPath())); } } entry.setLastModified(f.lastModified()); entry.setLength((int) ol.getSize()); }
Source:
<code>public Set<ConnectorCapabilities> getCapabilities() { <START> return immutableEnumSet(NOT_NULL_COLUMNS); <END> }</code><technical_language>NOT_NULL_COLUMN_CONSTRAINTS</technical_language>

Target:
public Set<ConnectorCapabilities> getCapabilities() { return immutableEnumSet(NOT_NULL_COLUMN_CONSTRAINT); }
Source:
<code>private void updateMemory(long memorySize) { <START> if (partial || useSystemMemoryPool) { <END> systemMemoryContext.setBytes(memorySize); } else { localUserMemoryContext.setBytes(memorySize); } }</code><technical_language>partial useSystemMemoryPool needed? field partial decide want do user system allocation. multiple variables/fields (partial, maxPartialMemory, useSystemMemoryPool) for memory-related decisions non-trivial reason in this class</technical_language>

Target:
private void updateMemory(long memorySize) { if (useSystemMemory) { systemMemoryContext.setBytes(memorySize); } else { localUserMemoryContext.setBytes(memorySize); } }
Source:
<code>public String getId() { <START> return projectType + ":" + name; <END> }</code><technical_language>a hint: character literals for concatenations this StringBuilder in background character append worth string append</technical_language>

Target:
public String getId() { return projectType + ':' + name; }
Source:
<code>private void showFormatCompareConfirmWindow(String commandName) { StorageModel storageModel = (StorageModel) getWindow(); StoragePool dataCenter = storageModel.getDataCenter().getSelectedItem(); StorageDomain <START> sd = <END> Linq.firstOrNull(storageDomainsToAdd); UICommand okCommand = UICommand.createDefaultOkUiCommand(commandName, this); if (sd.getStorageFormat().compareTo(dataCenter.getStoragePoolFormatType()) < 0) { ConfirmationModel model = new ConfirmationModel(); model.setTitle(ConstantsManager.getInstance().getConstants().areYouSureTitle()); model.setMessage(ConstantsManager.getInstance().getMessages() .compareStorageFormatToDataCenterWarningMessage( sd.getStorageFormat().getValue(), dataCenter.getStoragePoolFormatType().getValue())); model.setHelpTag(HelpTag.import_storage_domain_confirmation); model.setHashName("import_storage_domain_confirmation"); UICommand cancelCommand = createCancelCommand("CancelImportConfirm"); model.getCommands().add(okCommand); model.getCommands().add(cancelCommand); formatConfirmModel = model; new UICommand("OnShowFormatConfirmWindow", this).execute(); } else { okCommand.execute(); } }</code><technical_language>nan</technical_language>

Target:
private void showFormatCompareConfirmWindow(String commandName) { StorageModel storageModel = (StorageModel) getWindow(); StoragePool dataCenter = storageModel.getDataCenter().getSelectedItem(); StorageDomain sd = Linq.firstOrNull(storageDomainsToAdd); UICommand okCommand = UICommand.createDefaultOkUiCommand(commandName, this); if (sd.getStorageFormat().compareTo(dataCenter.getStoragePoolFormatType()) < 0) { ConfirmationModel model = new ConfirmationModel(); model.setTitle(ConstantsManager.getInstance().getConstants().areYouSureTitle()); model.setMessage(ConstantsManager.getInstance().getMessages() .compareStorageFormatToDataCenterWarningMessage( dataCenter.getName(), sd.getName(), sd.getStorageFormat().getValue(), dataCenter.getStoragePoolFormatType().getValue())); model.setHelpTag(HelpTag.import_storage_domain_confirmation); model.setHashName("import_storage_domain_confirmation"); UICommand cancelCommand = createCancelCommand("CancelImportConfirm"); model.getCommands().add(okCommand); model.getCommands().add(cancelCommand); formatConfirmModel = model; new UICommand("OnShowFormatConfirmWindow", this).execute(); } else { okCommand.execute(); } }
Source:
<code>private static Decoder createDecoder(ObjectMapper objectMapper, ObjectMapper cborObjectMapper) { <START> return new RejectNullDecoder( <END> new CoerceNullCollectionsDecoder( new Java8OptionalAwareDecoder( new GuavaOptionalAwareDecoder( new InputStreamDelegateDecoder( new TextDelegateDecoder( new CborDelegateDecoder( cborObjectMapper, new JacksonDecoder(objectMapper)))))))); }</code><technical_language>Thoughts renaming this "NeverReturnNullDecoder"</technical_language>

Target:
private static Decoder createDecoder(ObjectMapper objectMapper, ObjectMapper cborObjectMapper) { return new NeverReturnNullDecoder( new CoerceNullCollectionsDecoder( new Java8OptionalAwareDecoder( new GuavaOptionalAwareDecoder( new InputStreamDelegateDecoder( new TextDelegateDecoder( new CborDelegateDecoder( cborObjectMapper, new JacksonDecoder(objectMapper)))))))); }
Source:
<code><START> public String getSrcRecord() { <END> return srcRecord; }</code><technical_language>Thou hast a typo :)</technical_language>

Target:
public String getSrcRecord() { return srcRecord.toString(); }
Source:
<code>public static EventType fromInteger(int x) { switch (x) { case 1: return HOST_UPDATE; case 2: return PORT_UPDATE; case 3: return ACTIVATION; case 4: return INACTIVATION; case 5: return CREATED; case 128: return ERROR; default: <START> return ERROR; <END> } }</code><technical_language>default ERROR. more sense thrown IllegalArgumentException</technical_language>

Target:
public static EventType fromInteger(int x) throws IllegalArgumentException { switch (x) { case 1: return HOST_UPDATE; case 2: return PORT_UPDATE; case 3: return ACTIVATION; case 4: return INACTIVATION; case 5: return CREATED; case 128: return ERROR; default: throw new IllegalArgumentException(String.format( "inalid status code %d", x)); } }
Source:
<code>public int getMultiplier() { <START> return 10; <END> }</code><technical_language>give a slightly example of ExternalContext used, pass multiplier argument creating a TestContext instead of hardcoding getMultiplier</technical_language>

Target:
public int getMultiplier() { return this.multiplier; }
Source:
<code>private static Configuration getLanguageConfig(@NonNull Configuration remoteConfig, @NonNull SharedPreferences prefs) { Configuration newConfig = new Configuration(remoteConfig); Locale newLocale = LanguageUtil.getLocale(prefs.getString(Preferences.LANGUAGE, ""), prefs); <START> Timber.d("AnkiDroidApp::getLanguageConfig - setting locale to %s", newLocale.toString()); <END> if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { String strLocaleList = newLocale.toLanguageTag(); if (!strLocaleList.contains(Locale.getDefault().toLanguageTag())) { strLocaleList = strLocaleList + "," + Locale.getDefault().toLanguageTag(); } LocaleList newLocaleList = LocaleList.forLanguageTags(strLocaleList); newConfig.setLocales(newLocaleList); } else { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) { newConfig.setLocale(newLocale); } else { newConfig.locale = newLocale; } } return newConfig; }</code><technical_language>Nit: need call .toString(), logging framework do for efficiency</technical_language>

Target:
private static Configuration getLanguageConfig(@NonNull Configuration remoteConfig, @NonNull SharedPreferences prefs) { Configuration newConfig = new Configuration(remoteConfig); Locale newLocale = LanguageUtil.getLocale(prefs.getString(Preferences.LANGUAGE, ""), prefs); Timber.d("AnkiDroidApp::getLanguageConfig - setting locale to %s", newLocale); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { String strLocaleList = newLocale.toLanguageTag(); if (!strLocaleList.contains(Locale.getDefault().toLanguageTag())) { strLocaleList = strLocaleList + "," + Locale.getDefault().toLanguageTag(); } LocaleList newLocaleList = LocaleList.forLanguageTags(strLocaleList); newConfig.setLocales(newLocaleList); } else { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) { newConfig.setLocale(newLocale); } else { newConfig.locale = newLocale; } } return newConfig; }
Source:
<code>public GeradorDeBoleto(Boleto... boletos) { this.boletos = boletos; try { templateJasper = GeradorDeBoleto.class.getResourceAsStream("/br/com/caelum/stella/boleto/templates/boleto-default.jasper"); parametros.put(JRParameter.REPORT_LOCALE, new Locale("pt", "BR")); InputStream template_sub = GeradorDeBoleto.class.getResourceAsStream("/br/com/caelum/stella/boleto/templates/boleto-default_instrucoes.jasper"); parametros.put("SUB_INSTRUCOES", JRLoader.loadObject(template_sub)); } catch (JRException e) { <START> e.printStackTrace(); <END> } }</code><technical_language>Rethrows. Se der erro, recebemos o feedback "na cara"</technical_language>

Target:
public GeradorDeBoleto(Boleto... boletos) { this.boletos = boletos; try { templateJasper = GeradorDeBoleto.class.getResourceAsStream("/br/com/caelum/stella/boleto/templates/boleto-default.jasper"); parametros.put(JRParameter.REPORT_LOCALE, new Locale("pt", "BR")); InputStream template_sub = GeradorDeBoleto.class.getResourceAsStream("/br/com/caelum/stella/boleto/templates/boleto-default_instrucoes.jasper"); parametros.put("SUB_INSTRUCOES", JRLoader.loadObject(template_sub)); } catch (JRException e) { throw new GeracaoBoletoException(e); } }
Source:
<code>public void closeDetailsPanel() { <START> setSelectedShortcut(null); <END> setSelectedDetailsPanelAction(new CloseAction()); }</code><technical_language>deselectShortcut consistent</technical_language>

Target:
public void closeDetailsPanel() { setSelectedShortcut(null); setOpenedDetailsPanel(new None()); }
Source:
<code>public String writeToString() { String result = this.podcast + "\t" + this.episode + "\t" + this.deviceId + "\t" + this.action + "\t" + this.timestamp.getTime() + "\t" + String.valueOf(this.started) + "\t" + String.valueOf(this.position) + "\t" + String.valueOf(this.total); <START> return result; <END> }</code><technical_language>return instead of creating a String</technical_language>

Target:
public String writeToString() { return this.podcast + "\t" + this.episode + "\t" + this.deviceId + "\t" + this.action + "\t" + this.timestamp.getTime() + "\t" + String.valueOf(this.started) + "\t" + String.valueOf(this.position) + "\t" + String.valueOf(this.total); }
Source:
<code>private void processFiles(List<File> files) throws CheckstyleException { for (final File file : files) { <START> final String fileName = file.getAbsolutePath(); <END> try { final long timestamp = file.lastModified(); if (cacheFile != null && cacheFile.isInCache(fileName, timestamp) || !acceptFileStarted(fileName)) { continue; } if (cacheFile != null) { cacheFile.put(fileName, timestamp); } fireFileStarted(fileName); final SortedSet<LocalizedMessage> fileMessages = processFile(file); fireErrors(fileName, fileMessages); fireFileFinished(fileName); } catch (Exception ex) { if (cacheFile != null) { cacheFile.remove(fileName); } throw new CheckstyleException("Exception was thrown while processing " + file.getPath(), ex); } catch (Error error) { if (cacheFile != null) { cacheFile.remove(fileName); } throw new Error("Error was thrown while processing " + file.getPath(), error); } } }</code><technical_language>throws SecurityException declared - <LINK_1> throw other exception if smth completely wrong. minimize exception chance possible</technical_language>

Target:
private void processFiles(List<File> files) throws CheckstyleException { for (final File file : files) { String fileName = null; try { fileName = file.getAbsolutePath(); final long timestamp = file.lastModified(); if (cacheFile != null && cacheFile.isInCache(fileName, timestamp) || !acceptFileStarted(fileName)) { continue; } if (cacheFile != null) { cacheFile.put(fileName, timestamp); } fireFileStarted(fileName); final SortedSet<LocalizedMessage> fileMessages = processFile(file); fireErrors(fileName, fileMessages); fireFileFinished(fileName); } catch (Exception ex) { if (fileName != null && cacheFile != null) { cacheFile.remove(fileName); } throw new CheckstyleException("Exception was thrown while processing " + file.getPath(), ex); } catch (Error error) { if (fileName != null && cacheFile != null) { cacheFile.remove(fileName); } throw new Error("Error was thrown while processing " + file.getPath(), error); } } }
Source:
<code>public void testDiscardPendingWritesOnInactive() throws IOException { final AtomicBoolean closeWasCalled = new AtomicBoolean(false); ChunkedInput<ByteBuf> notifiableInput = new ChunkedInput<ByteBuf>() { private boolean done; private final ByteBuf buffer = Unpooled.copiedBuffer("Test", CharsetUtil.ISO_8859_1); @Override public boolean isEndOfInput() throws Exception { return done; } @Override public void close() throws Exception { buffer.release(); closeWasCalled.set(true); } @Deprecated @Override public ByteBuf readChunk(ChannelHandlerContext ctx) throws Exception { return readChunk(ctx.alloc()); } @Override public ByteBuf readChunk(ByteBufAllocator allocator) throws Exception { if (done) { return null; } done = true; return buffer.retainedDuplicate(); } @Override public long length() { return -1; } @Override public long progress() { return 1; } }; EmbeddedChannel ch = new EmbeddedChannel(new ChunkedWriteHandler()); ChannelFuture r1 = ch.write(new ChunkedFile(TMP)); ChannelFuture r2 = ch.write(new ChunkedNioFile(TMP)); ch.write(notifiableInput); <START> ch.close().awaitUninterruptibly(); <END> assertFalse(r1.isSuccess()); assertFalse(r2.isSuccess()); assertTrue(closeWasCalled.get()); }</code><technical_language>ch.finish() assert return value</technical_language>

Target:
public void testDiscardPendingWritesOnInactive() throws IOException { final AtomicBoolean closeWasCalled = new AtomicBoolean(false); ChunkedInput<ByteBuf> notifiableInput = new ChunkedInput<ByteBuf>() { private boolean done; private final ByteBuf buffer = Unpooled.copiedBuffer("Test", CharsetUtil.ISO_8859_1); @Override public boolean isEndOfInput() throws Exception { return done; } @Override public void close() throws Exception { buffer.release(); closeWasCalled.set(true); } @Deprecated @Override public ByteBuf readChunk(ChannelHandlerContext ctx) throws Exception { return readChunk(ctx.alloc()); } @Override public ByteBuf readChunk(ByteBufAllocator allocator) throws Exception { if (done) { return null; } done = true; return buffer.retainedDuplicate(); } @Override public long length() { return -1; } @Override public long progress() { return 1; } }; EmbeddedChannel ch = new EmbeddedChannel(new ChunkedWriteHandler()); ChannelFuture r1 = ch.write(new ChunkedFile(TMP)); ChannelFuture r2 = ch.write(new ChunkedNioFile(TMP)); ch.write(notifiableInput); assertFalse(ch.finish()); assertFalse(r1.isSuccess()); assertFalse(r2.isSuccess()); assertTrue(closeWasCalled.get()); }
Source:
<code>default double rate() { <START> return 0.0f; <END> }</code><technical_language>nit: 0.0 0d enough</technical_language>

Target:
default double rate() { return 0d; }
Source:
<code>@Test public void doubles() throws IOException { String json = "[-0.0," + "1.0," + "1.7976931348623157E308," + "4.9E-324," + "0.0," + "-0.5," + "2.2250738585072014E-308," + "3.141592653589793," + "2.718281828459045]"; JsonReader reader = newReader(json); reader.beginArray(); double expected1 = -0.0; assertThat(reader.nextDouble()).isEqualTo(expected1, Offset.offset(0d)); assertThat(reader.nextDouble()).isEqualTo(1.0, Offset.offset(0d)); assertThat(reader.nextDouble()).isEqualTo(1.7976931348623157E308, Offset.offset(0d)); assertThat(reader.nextDouble()).isEqualTo(4.9E-324, Offset.offset(0d)); assertThat(reader.nextDouble()).isEqualTo(0.0, Offset.offset(0d)); <START> double expected = -0.5; <END> assertThat(reader.nextDouble()).isEqualTo(expected, Offset.offset(0d)); assertThat(reader.nextDouble()).isEqualTo(2.2250738585072014E-308, Offset.offset(0d)); assertThat(reader.nextDouble()).isEqualTo(3.141592653589793, Offset.offset(0d)); assertThat(reader.nextDouble()).isEqualTo(2.718281828459045, Offset.offset(0d)); reader.endArray(); assertThat(reader.peek()).isEqualTo(JsonReader.Token.END_DOCUMENT); }</code><technical_language>More</technical_language>

Target:
@Test public void doubles() throws IOException { String json = "[-0.0," + "1.0," + "1.7976931348623157E308," + "4.9E-324," + "0.0," + "-0.5," + "2.2250738585072014E-308," + "3.141592653589793," + "2.718281828459045]"; JsonReader reader = newReader(json); reader.beginArray(); assertThat(reader.nextDouble()).isEqualTo(-0.0); assertThat(reader.nextDouble()).isEqualTo(1.0); assertThat(reader.nextDouble()).isEqualTo(1.7976931348623157E308); assertThat(reader.nextDouble()).isEqualTo(4.9E-324); assertThat(reader.nextDouble()).isEqualTo(0.0); assertThat(reader.nextDouble()).isEqualTo(-0.5); assertThat(reader.nextDouble()).isEqualTo(2.2250738585072014E-308); assertThat(reader.nextDouble()).isEqualTo(3.141592653589793); assertThat(reader.nextDouble()).isEqualTo(2.718281828459045); reader.endArray(); assertThat(reader.peek()).isEqualTo(JsonReader.Token.END_DOCUMENT); }
Source:
<code>public static String getAuthHeaderValue(StripeGatewayConfig stripeGatewayConfig) { <START> return "Bearer " + stripeGatewayConfig.getAuthToken().getTest(); <END> }</code><technical_language>test token</technical_language>

Target:
public static String getAuthHeaderValue(StripeGatewayConfig stripeGatewayConfig) { return "Bearer " + stripeGatewayConfig.getAuthTokens().getTest(); }
Source:
<code>private Response doGetPriamConfig(String group, String name) { try { final Map<String, Object> result = new HashMap<>(); final Map<String, Object> value = priamServer.getConfiguration().getStructuredConfiguration(group); if (name != null && value.containsKey(name)) { result.put(name, value.get(name)); return Response.ok(GsonJsonSerializer.getGson().toJson(result)).build(); } else if (name != null) { result.put("message", String.format("No such structured config: [%s]", name)); logger.error(String.format("No such structured config: [%s]", name)); return Response.status(404) .entity(GsonJsonSerializer.getGson().toJson(result)) <START> .type(MediaType.TEXT_PLAIN) <END> .build(); } else { result.putAll(value); return Response.ok(GsonJsonSerializer.getGson().toJson(result)).build(); } } catch (Exception e) { logger.error("Error while executing getPriamConfig", e); return Response.serverError().build(); } }</code><technical_language>this plain text convert JSON</technical_language>

Target:
private Response doGetPriamConfig(String group, String name) { try { final Map<String, Object> result = new HashMap<>(); final Map<String, Object> value = priamServer.getConfiguration().getStructuredConfiguration(group); if (name != null && value.containsKey(name)) { result.put(name, value.get(name)); return Response.ok(GsonJsonSerializer.getGson().toJson(result)).build(); } else if (name != null) { result.put("message", String.format("No such structured config: [%s]", name)); logger.error(String.format("No such structured config: [%s]", name)); return Response.status(404) .entity(GsonJsonSerializer.getGson().toJson(result)) .type(MediaType.APPLICATION_JSON) .build(); } else { result.putAll(value); return Response.ok(GsonJsonSerializer.getGson().toJson(result)).build(); } } catch (Exception e) { logger.error("Error while executing getPriamConfig", e); return Response.serverError().build(); } }
Source:
<code>private void updateUIForOrientation(){ if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) { <START> setActionBarVisible(false); <END> } else { setActionBarVisible(true); } }</code><technical_language>@mdinino I toolbar hidden (It's hidden iOS). in fact, this method removed</technical_language>

Target:
private void updateUIForOrientation(){ Fragment fragment = null; int currentItem = pager.getCurrentItem(); if (currentItem < pagerAdapter.getCount()) { fragment = pagerAdapter.getItem(currentItem); } boolean isCurrentFragmentVideoUnit = false; if (fragment != null && fragment instanceof CourseUnitVideoFragment) { isCurrentFragmentVideoUnit = true; } if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE && isCurrentFragmentVideoUnit) { getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); setActionBarVisible(false); findViewById(R.id.course_unit_nav_bar).setVisibility(View.GONE); pager.setEnabled(true); } else { getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN); setActionBarVisible(true); findViewById(R.id.course_unit_nav_bar).setVisibility(View.VISIBLE); pager.setEnabled(true); } }
Source:
<code>public static void onAction( ChangeInfo change, RevisionInfo revision, ActionInfo action, ActionButton button) { RestApi api = ChangeApi.revision( change.legacy_id().get(), revision.name()) .view(action.id()); JavaScriptObject f = get(action.id()); if (f != null) { ActionContext c = ActionContext.create(api); c.set(action); c.set(change); c.set(revision); c.button(button); ApiGlue.invoke(f, c); } else { <START> ChangeGlue.simple(change, action, api); <END> } }</code><technical_language>i misleading ChangeGlue.simple() is called RevisionGlue. I guess wanted reuse method there, commands refresh change2 screen. For purpose ChangeGlue.simple method is static. want extend new places, ProjectGlue, GroupGrlue, etc. find a approach reuse common BaseGlue.simple() call approach dispatch specific refresh() foo method</technical_language>

Target:
public static void onAction( ChangeInfo change, RevisionInfo revision, ActionInfo action, ActionButton button) { RestApi api = ChangeApi.revision( change.legacy_id().get(), revision.name()) .view(action.id()); JavaScriptObject f = get(action.id()); if (f != null) { ActionContext c = ActionContext.create(api); c.set(action); c.set(change); c.set(revision); c.button(button); ApiGlue.invoke(f, c); } else { DefaultActions.invoke(change, action, api); } }
Source:
<code>public void run() { logger.info("Starting."); try { workflowDefinitions.postProcessWorkflowDefinitions(); while (!shutdownRequested) { try { executor.waitUntilQueueSizeLowerThanThreshold(executorDao.getMaxWaitUntil()); if (!shutdownRequested) { if (executorDao.tick()) { workflowInstances.recoverWorkflowInstancesFromDeadNodes(); } int potentiallyStuckProcessors = stateProcessorFactory.getPotentiallyStuckProcessors(); if (potentiallyStuckProcessors > 0) { periodicLogger.warn("{} of state processor threads are potentially stuck (processing longer than seconds)", potentiallyStuckProcessors, executor.getThreadCount(), stuckThreadThresholdSeconds); } dispatch(getNextInstanceIds()); } } catch (PollingRaceConditionException pex) { logger.info(pex.getMessage()); sleep(true); } catch (@SuppressWarnings("unused") InterruptedException dropThrough) { } catch (Exception e) { logger.error("Exception in executing dispatcher - retrying after sleep period (" + e.getMessage() + ")", e); sleep(false); } } <START> } catch (IOException | ReflectiveOperationException e) { <END> logger.error("Exception in initializing workflow definitions", e); } finally { shutdownPool(); executorDao.markShutdown(); logger.info("Shutdown finished."); shutdownDone.countDown(); } }</code><technical_language>move try-catch-logging-rethow workflowDefinitions.postProcessWorkflowDefinitions() remove catch statement altogether. Currently if normal operation throw IOExceptions this catch hide them</technical_language>

Target:
public void run() { logger.info("Starting."); try { workflowDefinitions.postProcessWorkflowDefinitions(); while (!shutdownRequested) { try { executor.waitUntilQueueSizeLowerThanThreshold(executorDao.getMaxWaitUntil()); if (!shutdownRequested) { if (executorDao.tick()) { workflowInstances.recoverWorkflowInstancesFromDeadNodes(); } int potentiallyStuckProcessors = stateProcessorFactory.getPotentiallyStuckProcessors(); if (potentiallyStuckProcessors > 0) { periodicLogger.warn("{} of state processor threads are potentially stuck (processing longer than seconds)", potentiallyStuckProcessors, executor.getThreadCount(), stuckThreadThresholdSeconds); } dispatch(getNextInstanceIds()); } } catch (PollingRaceConditionException pex) { logger.info(pex.getMessage()); sleep(true); } catch (@SuppressWarnings("unused") InterruptedException dropThrough) { } catch (Exception e) { logger.error("Exception in executing dispatcher - retrying after sleep period (" + e.getMessage() + ")", e); sleep(false); } } } catch (IOException | ReflectiveOperationException e) { logger.error("Fetching workflow definitions failed", e); } finally { shutdownPool(); executorDao.markShutdown(); logger.info("Shutdown finished."); shutdownDone.countDown(); } }
Source:
<code>void onReply(String msg) { if (popup != null) { popup.hide(); return; } if (replyBox == null) { replyBox = new ReplyBox( psId, revision, allLabels, permittedLabels, msg); allLabels = null; permittedLabels = null; } final PluginSafePopupPanel p = new PluginSafePopupPanel(true); if(style != null) { p.setStyleName(style.replyBox()); } else { p.setStyleName(style2.replyBox()); <START> } <END> p.addAutoHidePartner(replyButton.getElement()); p.addCloseHandler(new CloseHandler<PopupPanel>() { @Override public void onClose(CloseEvent<PopupPanel> event) { if (popup == p) { popup = null; } } }); p.add(replyBox); p.showRelativeTo(replyButton); GlobalKey.dialog(p); popup = p; }</code><technical_language>p.setStyleName(style != null ? style.replyBox() : style2.replyBox());</technical_language>

Target:
void onReply(String msg) { if (popup != null) { popup.hide(); return; } if (replyBox == null) { replyBox = new ReplyBox( psId, revision, allLabels, permittedLabels, msg); allLabels = null; permittedLabels = null; } final PluginSafePopupPanel p = new PluginSafePopupPanel(true); p.setStyleName(style != null ? style.replyBox() : style2.replyBox()); p.addAutoHidePartner(replyButton.getElement()); p.addCloseHandler(new CloseHandler<PopupPanel>() { @Override public void onClose(CloseEvent<PopupPanel> event) { if (popup == p) { popup = null; } } }); p.add(replyBox); p.showRelativeTo(replyButton); GlobalKey.dialog(p); popup = p; }
Source:
<code>public E previous() { int i = this.nextIndex - 1; if (i < 0) { logger.logAndThrow(new NoSuchElementException()); return null; } else if (i >= items.size()) { logger.logAndThrow(new ConcurrentModificationException()); return null; } else { try { this.nextIndex = i; this.lastRetIndex = i; return items.get(this.lastRetIndex); } catch (IndexOutOfBoundsException ex) { <START> logger.logAndThrow(new ConcurrentModificationException()); <END> return null; } } }</code><technical_language>other places</technical_language>

Target:
public E previous() { int i = this.nextIndex - 1; if (i < 0) { throw logger.logExceptionAsError(new NoSuchElementException()); } else if (i >= items.size()) { throw logger.logExceptionAsError(new ConcurrentModificationException()); } else { try { this.nextIndex = i; this.lastRetIndex = i; return items.get(this.lastRetIndex); } catch (IndexOutOfBoundsException ex) { throw logger.logExceptionAsError(new ConcurrentModificationException(ex)); } } }
Source:
<code>public static void beforeClass() throws IOException { SWTBotUtils.initialize(); SWTBotPreferences.TIMEOUT = 20000; SWTBotPreferences.KEYBOARD_LAYOUT = "EN_US"; fLogger.removeAllAppenders(); fLogger.addAppender(new ConsoleAppender(new SimpleLayout(), ConsoleAppender.SYSTEM_OUT)); fBot = new SWTWorkbenchBot(); SWTBotUtils.closeView("welcome", fBot); SWTBotUtils.switchToPerspective(KERNEL_PERSPECTIVE_ID); SWTBotUtils.createProject(TRACE_PROJECT_NAME); String tracePath = FileLocator.toFileURL(CtfTestTrace.ARM_64_BIT_HEADER.getTraceURL()).getPath(); SWTBotUtils.openTrace(TRACE_PROJECT_NAME, tracePath, KERNEL_TRACE_TYPE); SWTBotUtils.activateEditor(fBot, CtfTestTrace.ARM_64_BIT_HEADER.getTraceURL().getPath().replaceAll("/", <START> "")); Assume.assumeNotNull(tracePath); <END> }</code><technical_language>remove</technical_language>

Target:
public static void beforeClass() throws IOException { SWTBotUtils.initialize(); SWTBotPreferences.TIMEOUT = 20000; SWTBotPreferences.KEYBOARD_LAYOUT = "EN_US"; fLogger.removeAllAppenders(); fLogger.addAppender(new ConsoleAppender(new SimpleLayout(), ConsoleAppender.SYSTEM_OUT)); fBot = new SWTWorkbenchBot(); SWTBotUtils.closeView("welcome", fBot); SWTBotUtils.switchToPerspective(KERNEL_PERSPECTIVE_ID); SWTBotUtils.createProject(TRACE_PROJECT_NAME); String tracePath = FileLocator.toFileURL(CtfTestTrace.ARM_64_BIT_HEADER.getTraceURL()).getPath(); SWTBotUtils.openTrace(TRACE_PROJECT_NAME, tracePath, KERNEL_TRACE_TYPE); SWTBotUtils.activateEditor(fBot, CtfTestTrace.ARM_64_BIT_HEADER.getTraceURL().getPath().replaceAll("/", "")); }
Source:
<code><START> private boolean patternMatchesAny(Pattern pattern, List<String> content) { <END> if (pattern != null) { for (String str : content) { if (pattern.matcher(str).find()) { return true; } } } return false; }</code><technical_language>static</technical_language>

Target:
private static boolean patternMatchesAny(Pattern pattern, List<String> content) { if (pattern != null) { for (String str : content) { if (pattern.matcher(str).find()) { return true; } } } return false; }
Source:
<code>public void process() { PerformanceMonitor.startActivity("rendering/copyImageToScreen"); FINAL.bindTexture(); <START> glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); <END> renderFullscreenQuad(); PerformanceMonitor.endActivity(); }</code><technical_language>nodes currently a glClear call is intention verify if strictly necessary if clear color depth buffer. reasoning is in some cases pixels rewritten clearing output buffers a default is unnecessary. I able verify this standard nodes, mind checking impact removing call clearing of buffers in VR-related nodes? Right default frame buffer a depth buffer</technical_language>

Target:
public void process() { PerformanceMonitor.startActivity("rendering/copyImageToScreen"); FINAL.bindTexture(); renderFullscreenQuad(); PerformanceMonitor.endActivity(); }
Source:
<code>protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); <START> setTitle("RxAndroid Samples"); <END> setContentView(R.layout.samples_menu_activity); }</code><technical_language>this name of application name of activity default</technical_language>

Target:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.samples_menu_activity); ArrayAdapter<String> menuAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1); menuAdapter.addAll(MenuItems.titles); ListView listView = (ListView) findViewById(android.R.id.list); listView.setAdapter(menuAdapter); listView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { startActivity(MenuItems.intentForSample(SamplesMenuActivity.this, position)); } }); }
Source:
<code>public PapyrusStereotypedElementItemProviderDecorator(ComposeableAdapterFactory adapterFactory) { super(adapterFactory); <START> labelProviderService = new LabelProviderServiceImpl(); <END> try { labelProviderService.startService(); } catch (ServiceException ex) { Activator.getDefault().getLog().log( new Status(IStatus.WARNING, Activator.PLUGIN_ID, "Unable to start Papyrus Label Provider Service", ex)); } }</code><technical_language>worries a bit imagine _each_ decorator start service (whatever means, familiar papyrus services) check this is a common of services? share a common instance decorators</technical_language>

Target:
public PapyrusStereotypedElementItemProviderDecorator(ComposeableAdapterFactory adapterFactory) { super(adapterFactory); }
Source:
<code>AstNode parse( final DdlTokenStream tokens, final AstNode parentNode ) throws ParsingException { boolean view = true; DdlStatement stmt = null; SchemaElementType schemaElementType = null; if (tokens.canConsume(DdlStatement.CREATE_FOREIGN_TABLE.tokens())) { stmt = DdlStatement.CREATE_FOREIGN_TABLE; view = false; schemaElementType = SchemaElementType.FOREIGN; } else if (tokens.canConsume(DdlStatement.CREATE_VIEW.tokens()) || tokens.canConsume(DdlStatement.CREATE_VIRTUAL_VIEW.tokens())) { stmt = DdlStatement.CREATE_VIEW; schemaElementType = SchemaElementType.VIRTUAL; } else { throw new TeiidDdlParsingException(tokens, "Unparsable create table|view statement"); } <START> assert (stmt != null) : "Create table|view statement is null"; <END> final String id = parseIdentifier(tokens); final AstNode tableNode = getNodeFactory().node(id, parentNode, (view ? TeiidDdlLexicon.CreateTable.VIEW_STATEMENT : TeiidDdlLexicon.CreateTable.TABLE_STATEMENT)); tableNode.setProperty(TeiidDdlLexicon.SchemaElement.TYPE, schemaElementType.toDdl()); parseTableBody(tokens, tableNode); if (tokens.hasNext() && tokens.canConsume(TeiidReservedWord.AS.toDdl())) { if (!parseQueryExpression(tokens, tableNode)) { throw new TeiidDdlParsingException(tokens, "Unparsable create table statement"); } } return tableNode; }</code><technical_language>This is a nit, more clear "...table view..." "...table|view..."</technical_language>

Target:
AstNode parse( final DdlTokenStream tokens, final AstNode parentNode ) throws ParsingException { boolean view = true; DdlStatement stmt = null; SchemaElementType schemaElementType = null; if (tokens.canConsume(DdlStatement.CREATE_FOREIGN_TABLE.tokens())) { stmt = DdlStatement.CREATE_FOREIGN_TABLE; view = false; schemaElementType = SchemaElementType.FOREIGN; } else if (tokens.canConsume(DdlStatement.CREATE_VIEW.tokens()) || tokens.canConsume(DdlStatement.CREATE_VIRTUAL_VIEW.tokens())) { stmt = DdlStatement.CREATE_VIEW; schemaElementType = SchemaElementType.VIRTUAL; } else { throw new TeiidDdlParsingException(tokens, "Unparsable create table or view statement"); } assert (stmt != null) : "Create table or view statement is null"; final String id = parseIdentifier(tokens); final AstNode tableNode = getNodeFactory().node(id, parentNode, (view ? TeiidDdlLexicon.CreateTable.VIEW_STATEMENT : TeiidDdlLexicon.CreateTable.TABLE_STATEMENT)); tableNode.setProperty(TeiidDdlLexicon.SchemaElement.TYPE, schemaElementType.toDdl()); parseTableBody(tokens, tableNode); if (tokens.hasNext() && tokens.canConsume(TeiidReservedWord.AS.toDdl())) { if (!parseQueryExpression(tokens, tableNode)) { throw new TeiidDdlParsingException(tokens, "Unparsable create table statement"); } } return tableNode; }
Source:
<code>public void setGlobalEntries(IAntClasspathEntry[] entries) { if (fUserGlobalEntry == null) { String name = AntPreferencesMessages.ClasspathModel_3; fUserGlobalEntry = createGlobalEntry(entries, name, true, true, GLOBAL_USER); } else { fUserGlobalEntry.removeAll(); for (IAntClasspathEntry <START> entrie : <END> entries) { fUserGlobalEntry.addEntry(new ClasspathEntry(entrie, fUserGlobalEntry)); } } }</code><technical_language>rename entry</technical_language>

Target:
public void setGlobalEntries(IAntClasspathEntry[] entries) { if (fUserGlobalEntry == null) { String name = AntPreferencesMessages.ClasspathModel_3; fUserGlobalEntry = createGlobalEntry(entries, name, true, true, GLOBAL_USER); } else { fUserGlobalEntry.removeAll(); for (IAntClasspathEntry entry : entries) { fUserGlobalEntry.addEntry(new ClasspathEntry(entry, fUserGlobalEntry)); } } }