auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void applyPattern(String pattern) { icuDecimalFormat.applyPattern(pattern); <START> updateFieldsFromIcu(); <END> icuDecimalFormat.setPositivePrefix(icuDecimalFormat.getPositivePrefix()); icuDecimalFormat.setPositiveSuffix(icuDecimalFormat.getPositiveSuffix()); icuDecimalFormat.setNegativePrefix(icuDecimalFormat.getNegativePrefix()); icuDecimalFormat.setNegativeSuffix(icuDecimalFormat.getNegativeSuffix()); icuDecimalFormat.setGroupingSize(icuDecimalFormat.getGroupingSize()); icuDecimalFormat.setRoundingMode(convertRoundingMode(roundingMode)); icuDecimalFormat.setMaximumIntegerDigits(icuDecimalFormat.getMaximumIntegerDigits()); icuDecimalFormat.setMinimumIntegerDigits(icuDecimalFormat.getMinimumIntegerDigits()); icuDecimalFormat.setMaximumFractionDigits(icuDecimalFormat.getMaximumFractionDigits()); icuDecimalFormat.setMinimumFractionDigits(icuDecimalFormat.getMinimumFractionDigits()); }</code><technical_language>put ten lines of code updateFieldsFromIcu() method? I put ten lines of code calls method, indirectly init(). other method I get new code is applyLocalizedPattern(), I imagine behave applyPattern() anyway</technical_language>

Target:
public void applyPattern(String pattern) { icuDecimalFormat.applyPattern(pattern); updateFieldsFromIcu(); }
Source:
<code>protected void executeCommand() { VDSReturnValue vdsReturnValue = extendUnderlyingVolumeSize(getImage()); setSucceeded(vdsReturnValue.getSucceeded()); if (vdsReturnValue.getSucceeded()) { Guid taskId = createTask(getAsyncTaskId(), vdsReturnValue.getCreationInfo(), getParameters().getParentCommand()); getTaskIdList().add(taskId); if (getParameters().getParentNotifiesCallback()) { getReturnValue().getVdsmTaskIdList().add(taskId); getReturnValue().getInternalVdsmTaskIdList().add(taskId); <START> getParameters().setVdsmTaskIds(new ArrayList<>(Collections.singletonList(taskId))); <END> persistCommand(getParameters().getParentCommand(), true); } } else { updateAuditLog(AuditLogType.USER_EXTEND_DISK_SIZE_FAILURE, getParameters().getNewSizeInGB()); } }</code><technical_language>List.of() of java-11</technical_language>

Target:
protected void executeCommand() { VDSReturnValue vdsReturnValue = extendUnderlyingVolumeSize(getImage()); setSucceeded(vdsReturnValue.getSucceeded()); if (vdsReturnValue.getSucceeded()) { Guid taskId = createTask(getAsyncTaskId(), vdsReturnValue.getCreationInfo(), getParameters().getParentCommand()); getTaskIdList().add(taskId); if (getParameters().getParentNotifiesCallback()) { getReturnValue().getVdsmTaskIdList().add(taskId); getReturnValue().getInternalVdsmTaskIdList().add(taskId); getParameters().setVdsmTaskIds(new ArrayList<>(List.of(taskId))); persistCommand(getParameters().getParentCommand(), true); } } else { updateAuditLog(AuditLogType.USER_EXTEND_DISK_SIZE_FAILURE, getParameters().getNewSizeInGB()); } }
Source:
<code><START> public Object visit(final AntlrBaseNode node) { <END> return node.accept(this); }</code><technical_language>this return Object instead of T</technical_language>

Target:
public T visit(final AntlrBaseNode node) { return node.accept(this); }
Source:
<code>public void close() throws SecurityException { for (ExtensionProxy extension : getExtensions()) { extension.invoke(new ExtMap() .mput(Base.InvokeKeys.COMMAND, Base.InvokeCommands.TERMINATE)); } <START> } <END></code><technical_language>do need send TERMINATE this is extension manager do, if need event, please add command in logger interface</technical_language>

Target:
public void close() throws SecurityException { Iterator<ExtensionProxy> iter = getExtensions().iterator(); while (iter.hasNext()) { ExtensionProxy extension = iter.next(); extension.invoke(new ExtMap() .mput(Base.InvokeKeys.COMMAND, Logger.InvokeCommands.CLOSE)); } }
Source:
<code>private String encodeArrayValue(final Object value) { final int length = Array.getLength(value); <START> if(length == 0){ <END> return ""; } final StringBuilder ret = new StringBuilder(Array.get(value, 0).toString()); for (int i = 1; i < length; ++i) { ret.append(','); ret.append(Array.get(value, i).toString()); } return ret.toString(); }</code><technical_language>missing space if</technical_language>

Target:
private static String encodeArrayValue(final Object value) { final int length = Array.getLength(value); final StringBuilder ret = new StringBuilder(); for (int i = 0; i < length; ++i) { ret.append(','); ret.append(Array.get(value, i).toString()); } return ret.toString(); }
Source:
<code>public static void resetInstance() { instance = null; <START> SecureRandom random = new SecureRandom(); <END> Realm realm = Realm.getInstance(configuration); UserFactoryStore store = realm.where(UserFactoryStore.class).findFirst(); realm.beginTransaction(); if (store == null) { store = realm.createObject(UserFactoryStore.class); } store.setUserName(new BigInteger(130, random).toString(32)); realm.commitTransaction(); realm.close(); }</code><technical_language>UUID.random().toString() user name, safe enough</technical_language>

Target:
public static void resetInstance() { instance = null; Realm realm = Realm.getInstance(configuration); UserFactoryStore store = realm.where(UserFactoryStore.class).findFirst(); realm.beginTransaction(); if (store == null) { store = realm.createObject(UserFactoryStore.class); } store.setUserName(UUID.randomUUID().toString()); realm.commitTransaction(); realm.close(); }
Source:
<code>private void loadMergeBranchComponents() { <START> String mergeBranchUuid = analysisMetadataHolder.getBranch().get().getMergeBranchUuid().get(); <END> uuidsByKey = new HashMap<>(); try (DbSession dbSession = dbClient.openSession(false)) { List<ComponentDto> components = dbClient.componentDao().selectByProjectUuid(mergeBranchUuid, dbSession); for (ComponentDto dto : components) { uuidsByKey.put(removeBranchFromKey(dto.getDbKey()), dto.uuid()); } } }</code><technical_language>![MAJOR](<LINK_0> 'Severity: MAJOR') Call "Optional#isPresent()" accessing value. [![rule](<LINK_1>](<LINK_2></technical_language>

Target:
private void loadMergeBranchComponents() { String mergeBranchUuid = analysisMetadataHolder.getBranch().get().getMergeBranchUuid().get(); uuidsByKey = new HashMap<>(); try (DbSession dbSession = dbClient.openSession(false)) { List<ComponentDto> components = dbClient.componentDao().selectByProjectUuid(mergeBranchUuid, dbSession); for (ComponentDto dto : components) { uuidsByKey.put(dto.getKey(), dto.uuid()); } } }
Source:
<code>public static boolean compareTypesById(DataType<?> left, DataType<?> right) { if (left.id() != right.id()) { return false; } else if (isArray(left)) { <START> return compareTypesById(unnest(left), unnest(right)); <END> } else { return true; } }</code><technical_language>Is unnest this here? if array more dimensions other</technical_language>

Target:
public static boolean compareTypesById(DataType<?> left, DataType<?> right) { if (left.id() != right.id()) { return false; } else if (isArray(left)) { return compareTypesById( ((ArrayType) left).innerType(), ((ArrayType) right).innerType()); } else { return true; } }
Source:
<code><START> public void onTestSuccess(ITestResult result) { <END> long time = System.currentTimeMillis(); TestNgRunStateTracker.logEvent( TestNgRunStateTracker.EventLog.builder() .setEvent(TestNgRunStateTracker.TestNgRunEvent.LISTENER_TEST_METHOD_PASS) .setTimeOfEvent(time) .setThreadId(Thread.currentThread().getId()) .addData(TestNgRunStateTracker.EventInfo.METHOD_NAME, result.getMethod().getMethodName()) .addData(TestNgRunStateTracker.EventInfo.CLASS_NAME, result.getMethod().getRealClass() .getCanonicalName()) .addData(TestNgRunStateTracker.EventInfo.CLASS_INSTANCE, result.getMethod().getInstance()) .addData(TestNgRunStateTracker.EventInfo.TEST_NAME, result.getTestContext().getName()) .addData(TestNgRunStateTracker.EventInfo.SUITE_NAME, result.getTestContext().getSuite() .getName()) .build() ); try { TimeUnit.SECONDS.sleep(1); } catch(InterruptedException e) { throw new RuntimeException("Problem with delaying after test method listener onTestSuccess", e); } }</code><technical_language>listener methods share code. Is manage a common method</technical_language>

Target:
public void onTestSuccess(ITestResult result) { logEvent(buildEventLog(result, LISTENER_TEST_METHOD_PASS).build()); delayAfterEvent(LISTENER_TEST_METHOD_PASS); }
Source:
<code>public boolean supportsColumnStatistics() { <START> return false; <END> }</code><technical_language>This means TestHiveClientInMemoryMetastore run statistics tests. Do implement this in a commit</technical_language>

Target:
public boolean supportsColumnStatistics() { return true; }
Source:
<code>public void startNextActivity() { <START> Toast.makeText(this, "Logged in Successfully", Toast.LENGTH_SHORT).show(); <END> startActivity(new Intent(this, DashboardActivity.class)); }</code><technical_language>Please put hardcoded string in strings.xml file call there</technical_language>

Target:
public void startNextActivity() { Toast.makeText(this, R.string.Log_in_success, Toast.LENGTH_SHORT).show(); startActivity(new Intent(this, DashboardActivity.class)); }
Source:
<code>public <T> void addListener(T observer, RealmChangeListener<T> listener) { if (observerPairs.isEmpty()) { nativeStartListening(nativePtr); } <START> CollectionObserverPair<T> collectionObserverPair = new CollectionObserverPair<>(observer, listener); <END> observerPairs.add(collectionObserverPair); }</code><technical_language>I a reason this T there. Is for java6? @cmelchior</technical_language>

Target:
public <T> void addListener(T observer, RealmChangeListener<T> listener) { addListener(observer, new RealmChangeListenerWrapper<T>(listener)); }
Source:
<code>public void testSupportHandlerManager() { SupportHandlerManager handlerManager = new SupportHandlerManager(); SupportProviderManager providerManager = new SupportProviderManager(); SupportProduct product = providerManager.getProduct("org.eclipse.mylyn.tasks.tests.product1"); IStatus status = new ProductStatus(product); SupportRequest request = new SupportRequest(providerManager, status, product); handlerManager.preProcess(request); assertTrue(((AttributeTaskMapper) request.getDefaultContribution()).isMappingComplete()); IProgressMonitor monitor = new NullOperationMonitor(); handlerManager.process(request.getDefaultContribution(), monitor); assertNotNull(request.getDefaultContribution()); AttributeTaskMapper mapper = ((AttributeTaskMapper) request.getDefaultContribution()); assertTrue(!mapper.isHandled()); TaskData taskData = null; try { taskData = mapper.createTaskData(monitor); } catch (CoreException e) { fail("unexpected CoreException " + e.getMessage()); } assertNotNull(taskData); mapper.setTaskData(taskData); handlerManager.postProcess(mapper, monitor); <START> TaskAttribute serv = taskData.getRoot().getAttribute("bug_severity"); <END> assertEquals("enhancement", serv.getValue()); }</code><technical_language>test rely Bugzilla connector there? If yes, this is fail Tycho try work mock connector instead</technical_language>

Target:
public void testSupportHandlerManager() { SupportHandlerManager handlerManager = new SupportHandlerManager(); SupportProviderManager providerManager = new SupportProviderManager(); SupportProduct product = providerManager.getProduct("org.eclipse.mylyn.tasks.tests.productnormal"); IStatus status = new ProductStatus(product); SupportRequest request = new SupportRequest(providerManager, status, product); handlerManager.preProcess(request); assertTrue(((AttributeTaskMapper) request.getDefaultContribution()).isMappingComplete()); IProgressMonitor monitor = new NullOperationMonitor(); handlerManager.process(request.getDefaultContribution(), monitor); assertNotNull(request.getDefaultContribution()); AttributeTaskMapper mapper = ((AttributeTaskMapper) request.getDefaultContribution()); assertTrue(!mapper.isHandled()); TaskData taskData = null; try { taskData = mapper.createTaskData(monitor); } catch (CoreException e) { fail("unexpected CoreException " + e.getMessage()); } assertNotNull(taskData); mapper.setTaskData(taskData); handlerManager.postProcess(mapper, monitor); TaskAttribute serv = taskData.getRoot().getMappedAttribute(TaskAttribute.SEVERITY); assertEquals("enhancement", serv.getValue()); }
Source:
<code>public void pullImage(String dockerServerURI, String register, String imageName) { DockerExplorer de = this; de.open(); de.getConnection(dockerServerURI); new ContextMenu("Pull...").select(); new WaitUntil(new ShellWithTextIsAvailable("Pull Image"), TimePeriod.NORMAL); <START> String fullRegisterName = register; <END> Combo combo = new DefaultCombo(); combo.setSelection(fullRegisterName); new LabeledText(IMAGE_NAME).setFocus(); new LabeledText(IMAGE_NAME).setText(imageName); new PushButton("Finish").click(); AbstractWait.sleep(TimePeriod.getCustom(5)); new WaitWhile(new JobIsRunning(), TimePeriod.VERY_LONG); }</code><technical_language>Is this string needed? register</technical_language>

Target:
public void pullImage(String dockerServerURI, String register, String imageName) { DockerExplorer de = this; de.open(); de.getConnection(dockerServerURI); new ContextMenu("Pull...").select(); new WaitUntil(new ShellWithTextIsAvailable("Pull Image"), TimePeriod.NORMAL); Combo combo = new DefaultCombo(); combo.setSelection(register); new LabeledText(IMAGE_NAME).setFocus(); new LabeledText(IMAGE_NAME).setText(imageName); new PushButton("Finish").click(); AbstractWait.sleep(TimePeriod.getCustom(5)); new WaitWhile(new JobIsRunning(), TimePeriod.VERY_LONG); }
Source:
<code><START> public void showPrimary(StatePrimaryResponse.StatePrimary[] states, ApiAddress apiAddress) { <END> StatePrimaryResponse.StatePrimary userState = null; for (int i = 0; i < states.length; i++) { if (states[i].getCode().equalsIgnoreCase(apiAddress.attributes().state())) { userState = states[i]; break; } } if (userState == null) { Timber.e("Unable to extract state primary"); return; } Context context = getContext(); String name = userState.getState(); String packageName = context.getPackageName(); int resId = getResources().getIdentifier(name.toLowerCase(), "drawable", packageName); Drawable img = context.getResources().getDrawable(resId); if (img != null){ primariesButton.setCompoundDrawablesWithIntrinsicBounds( img, null, null, null ); } primariesButton.setText(name); }</code><technical_language>in future, (when time-constrained), this is good code move a helper class testable unit tests. good for though</technical_language>

Target:
public void showPrimary(StatePrimaryResponse.StatePrimary[] states, ApiAddress apiAddress) { StatePrimaryResponse.StatePrimary userState = null; for (int i = 0; i < states.length; i++) { if (states[i].getCode().equalsIgnoreCase(apiAddress.attributes().state())) { userState = states[i]; break; } } if (userState == null) { Timber.e("Unable to extract state primary"); return; } Context context = getContext(); String name = userState.getState(); if (name != null) { String stateName = name.toLowerCase(); if (stateName.equalsIgnoreCase("new york")) { stateName = "new_york"; } else if (stateName.equalsIgnoreCase("new jersey")) { stateName = "new_jersey"; } else if (stateName.equalsIgnoreCase("new hampshire")) { stateName = "new_hampshire"; } else if (stateName.equalsIgnoreCase("new mexico")) { stateName = "new_mexico"; } else if (stateName.equalsIgnoreCase("north carolina")) { stateName = "north_carolina"; } else if (stateName.equalsIgnoreCase("north dakota")) { stateName = "north_dakota"; } else if (stateName.equalsIgnoreCase("south carolina")) { stateName = "south_carolina"; } else if (stateName.equalsIgnoreCase("south dakota")) { stateName = "south_dakota"; } else if (stateName.equalsIgnoreCase("west virginia")) { stateName = "west_virginia"; } else if (stateName.equalsIgnoreCase("rhode island")) { stateName = "rhode_island"; } String packageName = context.getPackageName(); int resId = getResources().getIdentifier(stateName, "drawable", packageName); Drawable img = context.getResources().getDrawable(resId); if (img != null) { primariesButton.setCompoundDrawablesWithIntrinsicBounds(img, null, null, null); } } primariesButton.setText(name); }
Source:
<code>@Override public void writeString(String val) { if (val != null) { if (buf.capacity() < val.length()) { if (stringsMap == null) stringsMap = new HashMap<>(); byte[] bytes = stringsMap.computeIfAbsent(val, s -> s.getBytes()); try { writeByteArray(bytes); } <START> catch (Exception e) { <END> stringsMap.remove(val); throw e; } if (lastFinished) stringsMap.remove(val); } else writeByteArray(val.getBytes()); } else writeByteArray(null); }</code><technical_language>I if exception appears here, this object invalid, for example, arrOff incorrect, necessary handle this exception here</technical_language>

Target:
@Override public void writeString(String val) { if (val != null) { if (curStrBackingArr == null) curStrBackingArr = val.getBytes(); writeByteArray(curStrBackingArr); if (lastFinished) curStrBackingArr = null; } else writeByteArray(null); }
Source:
<code>public List<Object> configurations() { <START> return Collections.singletonList(new TooManyLinesInFileCheck.Config(maximum)); <END> }</code><technical_language>remove TooManyLinesInFileCheck</technical_language>

Target:
public List<Object> configurations() { return Collections.singletonList(new Config(maximum)); }
Source:
<code>public String getText(Object object) { <START> String label = ((ValidationRule) object).getName(); <END> return label == null || label.length() == 0 ? getString("_UI_ValidationRule_type") : getString("_UI_ValidationRule_type") + " " + label; }</code><technical_language>IdentifiedElementQuery.getLabel Do forget: * @not-generated</technical_language>

Target:
public String getText(Object object) { IdentifiedElementQuery query = new IdentifiedElementQuery((SemanticValidationRule) object); String label = query.getLabel(); return label == null || label.length() == 0 ? getString("_UI_ValidationRule_type") : getString("_UI_ValidationRule_type") + " " + label; }
Source:
<code>public void scaleTo0ShouldWarn() { int pods = PodsAreDeployed.getNumberOfCurrentReplicas(project, OpenShiftResources.EAP_APP_REPLICATION_CONTROLLER); new WaitUntil( new PodsAreDeployed(project, OpenShiftResources.EAP_APP_REPLICATION_CONTROLLER, pods), TimePeriod.LONG); OpenShiftResource replicationController = project.getOpenShiftResource(Resource.DEPLOYMENT, OpenShiftResources.EAP_APP_REPLICATION_CONTROLLER); replicationController.select(); scaleTo(0); <START> Matcher<String> confirmationDialogMatcher = new ShellButtonsMatcher(Arrays.asList("Yes", "No")); <END> new WaitUntil(new ShellMatchingMatcherIsAvailable(confirmationDialogMatcher)); new DefaultShell(confirmationDialogMatcher).setFocus(); new YesButton().click(); assertPodAmountDesiredEqualsCurrent(0, project); }</code><technical_language>necessary implement robus matcher get a shell. Please store shell name in OpenShiftLabel.Shell.STOP_DEPLOYMENT new new DefaultShell(OpenShiftLabel.Shell.STOP_DEPLOYMENT));. waiting is default, normal, wait for shell, bcs. shell lookup wait for a period of lenght TimePeriod.NORMAL default</technical_language>

Target:
public void scaleTo0ShouldWarn() { int pods = requiredService.getReplicationController().getCurrentReplicaCount(); new WaitUntil( new PodsAreDeployed(project, OpenShiftResources.NODEJS_APP_REPLICATION_CONTROLLER, pods), TimePeriod.LONG); OpenShiftResource replicationController = project.getOpenShiftResource(Resource.DEPLOYMENT, OpenShiftResources.NODEJS_APP_REPLICATION_CONTROLLER); replicationController.select(); scaleTo(0); new DefaultShell(OpenShiftLabel.Shell.STOP_ALL_DEPLOYMENTS).setFocus(); new YesButton().click(); assertPodAmountDesiredEqualsCurrent(0, project); }
Source:
<code>public void testClearSpec() throws Exception { <START> Assume.assumeFalse("IBM JDK does not support some of the algorithms used in this test. See ELY-2063.", <END> isIbmJdk()); ClearPasswordSpec clearSpec = new ClearPasswordSpec("myMaskedPassword".toCharArray()); PasswordFactory factory = PasswordFactory.getInstance(algorithm); MaskedPassword masked = (MaskedPassword) factory.generatePassword(clearSpec); ClearPasswordSpec unmasked = factory.getKeySpec(masked, ClearPasswordSpec.class); Assert.assertEquals("myMaskedPassword", new String(unmasked.getEncodedPassword())); KeySpec maskedSpec = new MaskedPasswordSpec(masked.getInitialKeyMaterial(), masked.getIterationCount(), masked.getSalt(), masked.getMaskedPasswordBytes(), masked.getInitializationVector()); MaskedPassword copyOfMasked = (MaskedPassword) factory.generatePassword(maskedSpec); ClearPasswordSpec unmasked2 = factory.getKeySpec(copyOfMasked, ClearPasswordSpec.class); Assert.assertEquals("myMaskedPassword", new String(unmasked2.getEncodedPassword())); }</code><technical_language>Is necessary ignore algorithms IBM JDK in this test? of working</technical_language>

Target:
public void testClearSpec() throws Exception { ClearPasswordSpec clearSpec = new ClearPasswordSpec("myMaskedPassword".toCharArray()); PasswordFactory factory = PasswordFactory.getInstance(algorithm); MaskedPassword masked = (MaskedPassword) factory.generatePassword(clearSpec); ClearPasswordSpec unmasked = factory.getKeySpec(masked, ClearPasswordSpec.class); Assert.assertEquals("myMaskedPassword", new String(unmasked.getEncodedPassword())); KeySpec maskedSpec = new MaskedPasswordSpec(masked.getInitialKeyMaterial(), masked.getIterationCount(), masked.getSalt(), masked.getMaskedPasswordBytes(), masked.getInitializationVector()); MaskedPassword copyOfMasked = (MaskedPassword) factory.generatePassword(maskedSpec); ClearPasswordSpec unmasked2 = factory.getKeySpec(copyOfMasked, ClearPasswordSpec.class); Assert.assertEquals("myMaskedPassword", new String(unmasked2.getEncodedPassword())); }
Source:
<code>public void testExportWithFilter() throws IOException { SWTBotEditor editorBot = fEditorBot; assertNotNull(editorBot); final SWTBotTable tableBot = editorBot.bot().table(); tableBot.getTableItem(0).click(3); SWTBotText textBot = editorBot.bot().text(); textBot.typeText("LoggerA|LoggerB|LoggerC"); textBot.pressShortcut(Keystrokes.CTRL, Keystrokes.CR); fBot.waitUntil(Conditions.tableHasRows(tableBot, 6), 5000); tableBot.getTableItem(1).contextMenu(EXPORT_TO_TSV).click(); assertTsvContentsEquals(ImmutableList.of(HEADER_TEXT, EVENT1_TEXT, EVENT2_TEXT, EVENT3_TEXT)); <START> fBot.closeAllEditors(); <END> }</code><technical_language>Is test fail if call this? tests need runned in a specific order change. Test independent</technical_language>

Target:
public void testExportWithFilter() throws IOException { SWTBotEditor editorBot = fEditorBot; assertNotNull(editorBot); final SWTBotTable tableBot = editorBot.bot().table(); tableBot.getTableItem(0).click(3); SWTBotText textBot = editorBot.bot().text(); textBot.typeText("LoggerA|LoggerB|LoggerC"); textBot.pressShortcut(Keystrokes.CTRL, Keystrokes.CR); fBot.waitUntil(Conditions.tableHasRows(tableBot, 6), 5000); tableBot.getTableItem(1).contextMenu(EXPORT_TO_TSV).click(); assertTsvContentsEquals(ImmutableList.of(HEADER_TEXT, EVENT1_TEXT, EVENT2_TEXT, EVENT3_TEXT)); }
Source:
<code>public void shouldSetRemovalTime_HistoricProcessInstanceAuthorization() { testRule.getProcessEngineConfiguration() .setEnableHistoricInstancePermissions(true); String processInstanceId = testRule.process().call().userTask().deploy().start(); Authorization authorization = authorizationService.createNewAuthorization(Authorization.AUTH_TYPE_GRANT); authorization.setResource(Resources.HISTORIC_PROCESS_INSTANCE); authorization.setResourceId(processInstanceId); authorization.setUserId("foo"); authorizationService.saveAuthorization(authorization); authorization = authorizationService.createAuthorizationQuery().singleResult(); assertThat(authorization.getRemovalTime()).isNull(); testRule.updateHistoryTimeToLive("rootProcess", 5); HistoricProcessInstanceQuery query = historyService.createHistoricProcessInstanceQuery().rootProcessInstances(); testRule.syncExec( historyService.setRemovalTimeToHistoricProcessInstances() .calculatedRemovalTime() .byQuery(query) .hierarchical() .executeAsync() ); authorization = authorizationService.createAuthorizationQuery() .resourceType(Resources.HISTORIC_PROCESS_INSTANCE) .singleResult(); assertThat(authorization.getRemovalTime()).isEqualTo(addDays(CURRENT_DATE, 5)); <START> testRule.clearAuthorization(); <END> }</code><technical_language>@After method clears authorizations if assert statement fails</technical_language>

Target:
public void shouldSetRemovalTime_HistoricProcessInstanceAuthorization() { testRule.getProcessEngineConfiguration() .setEnableHistoricInstancePermissions(true); String processInstanceId = testRule.process().call().userTask().deploy().start(); Authorization authorization = authorizationService.createNewAuthorization(Authorization.AUTH_TYPE_GRANT); authorization.setResource(Resources.HISTORIC_PROCESS_INSTANCE); authorization.setResourceId(processInstanceId); authorization.setUserId("foo"); authorizationService.saveAuthorization(authorization); authorization = authorizationService.createAuthorizationQuery().singleResult(); assertThat(authorization.getRemovalTime()).isNull(); testRule.updateHistoryTimeToLive("rootProcess", 5); HistoricProcessInstanceQuery query = historyService.createHistoricProcessInstanceQuery().rootProcessInstances(); testRule.syncExec( historyService.setRemovalTimeToHistoricProcessInstances() .calculatedRemovalTime() .byQuery(query) .hierarchical() .executeAsync() ); authorization = authorizationService.createAuthorizationQuery() .resourceType(Resources.HISTORIC_PROCESS_INSTANCE) .singleResult(); assertThat(authorization.getRemovalTime()).isEqualTo(addDays(CURRENT_DATE, 5)); }
Source:
<code>public String apply(@NotNull String key) { <START> CacheRefKeeper cacheRefKeeper = refOfCacheKeeper.get(); <END> if (cacheRefKeeper == null) { throw new ISE("Cache reference is null WTF"); } PollingCache cache = cacheRefKeeper.getAndIncrementRef(); try { if (cache == null) { return this.apply(key); } return Strings.emptyToNull((String) cache.get(key)); } finally { if (cacheRefKeeper != null && cache != null) { cacheRefKeeper.doneWithIt(); } } }</code><technical_language>final</technical_language>

Target:
public String apply(@NotNull String key) { final CacheRefKeeper cacheRefKeeper = refOfCacheKeeper.get(); if (cacheRefKeeper == null) { throw new ISE("Cache reference is null WTF"); } final PollingCache cache = cacheRefKeeper.getAndIncrementRef(); try { if (cache == null) { return this.apply(key); } return Strings.emptyToNull((String) cache.get(key)); } finally { if (cacheRefKeeper != null && cache != null) { cacheRefKeeper.doneWithIt(); } } }
Source:
<code>public TorrentStatistic getStatistics(String dotTorrentFilePath) throws IOException { FileMetadataProvider metadataProvider = new FileMetadataProvider(dotTorrentFilePath); TorrentMetadata metadata = metadataProvider.getTorrentMetadata(); LoadedTorrent loadedTorrent = communicationManager.getTorrentsStorage().getLoadedTorrent(metadata.getHexInfoHash()); if (loadedTorrent != null) { <START> return loadedTorrent.getTorrentStatistic(); <END> } throw new IllegalStateException("Torrent has not been loaded yet"); }</code><technical_language>return a copy of TorrentStatistic instance this class is mutable</technical_language>

Target:
public TorrentStatistic getStatistics(String dotTorrentFilePath) throws IOException { FileMetadataProvider metadataProvider = new FileMetadataProvider(dotTorrentFilePath); TorrentMetadata metadata = metadataProvider.getTorrentMetadata(); LoadedTorrent loadedTorrent = communicationManager.getTorrentsStorage().getLoadedTorrent(metadata.getHexInfoHash()); if (loadedTorrent != null) { return new TorrentStatistic(loadedTorrent.getTorrentStatistic()); } throw new IllegalStateException("Torrent has not been loaded yet"); }
Source:
<code>public static final byte[] getKeyFingerprintBytes(final PublicKey key) { if (key == null) { <START> log.error("Public key is uninitialized, failed to retreive fingerprint."); <END> return null; } final byte[] keyBytes = getKeyBytes(key); if (keyBytes == null) { log.error("Can't get key bytes, will return null."); return null; } final byte[] fingerprintBytes = DigestUtils.md5(keyBytes); if (log.isDebugEnabled()) { log.debug("Fingerprint bytes are " + Hex.encodeHexString(fingerprintBytes) + "."); } return fingerprintBytes; }</code><technical_language>s/uninitilized/null</technical_language>

Target:
public static final byte[] getKeyFingerprintBytes(final PublicKey key) { if (key == null) { log.error("Public key is null, failed to retreive fingerprint."); return null; } final byte[] keyBytes = getKeyBytes(key); if (keyBytes == null) { log.error("Can't get key bytes, will return null."); return null; } final byte[] fingerprintBytes = DigestUtils.md5(keyBytes); if (log.isDebugEnabled()) { log.debug("Fingerprint bytes are " + Hex.encodeHexString(fingerprintBytes) + "."); } return fingerprintBytes; }
Source:
<code>public E get() throws InterruptedException, ExecutionException { String name = Thread.currentThread().getName(); <START> System.out.println(">>> FATAL " + name); <END> if (name.contains("client.thread")) { throw new IllegalStateException(">>> FATAL " + name); } return super.get(); }</code><technical_language>is this left for debugging</technical_language>

Target:
public E get() throws InterruptedException, ExecutionException { assert (!Thread.currentThread().getName().contains("client.thread")); return super.get(); }
Source:
<code>public void base_tree_visitor_check() { List<Issue> issues = issueClient.find(IssueQuery.create().rules("javascript-custom-rules:base")).list(); assertThat(issues).hasSize(1); Issue issue = issues.get(0); assertThat(issue.line()).isEqualTo(2); assertThat(issue.message()).isEqualTo("Function expression."); <START> } <END></code><technical_language>IMO explicit assertion (is null?)</technical_language>

Target:
public void base_tree_visitor_check() { List<Issues.Issue> issues = findIssues("deprecated-custom-rules:base"); assertThat(issues).hasSize(1); Issues.Issue issue = issues.get(0); assertThat(issue.getLine()).isEqualTo(2); assertThat(issue.getMessage()).isEqualTo("Function expression."); assertThat(issue.getDebt()).isEqualTo("5min"); }
Source:
<code>public void setStateForDurability(Iv2InitiateTaskMessage initiateTask, Collection<Integer> involvedPartitions) { m_initiateTask = initiateTask; m_involvedPartitions = ImmutableSet.copyOf(involvedPartitions); if (m_initiateTaskBuffer == null) { m_initiateTaskBuffer = ByteBuffer.allocate(initiateTask.getSerializedSize()); <START> } <END> try { initiateTask.flattenToBuffer(m_initiateTaskBuffer); m_initiateTaskBuffer.flip(); } catch (IOException e) { throw new RuntimeException(e); } }</code><technical_language>If null, reset buffer position is 0 limit is initiateTask.getSerializedSize()</technical_language>

Target:
public void setStateForDurability(Iv2InitiateTaskMessage initiateTask, Collection<Integer> involvedPartitions) { m_initiateTask = initiateTask; m_involvedPartitions = ImmutableSet.copyOf(involvedPartitions); if (m_initiateTaskBuffer == null) { m_initiateTaskBuffer = ByteBuffer.allocate(initiateTask.getSerializedSize()); } else { m_initiateTaskBuffer.position(0); m_initiateTaskBuffer.limit(initiateTask.getSerializedSize()); } try { initiateTask.flattenToBuffer(m_initiateTaskBuffer); m_initiateTaskBuffer.flip(); } catch (IOException e) { throw new RuntimeException(e); } }
Source:
<code><START> public Builder toBuilder() { <END> return new Builder() .setConfiguration(configuration) .withTableId(tableId) .withScan(serializableScan.scan); }</code><technical_language>super.toBuilder().withTableId(tableId)..</technical_language>

Target:
public Builder toBuilder() { return new Builder(getConfiguration()) .withTableId(tableId) .withScan(serializableScan.scan); }
Source:
<code>private void processAndVerifySuccess2(final Record input, final boolean isSuccess, boolean isSame, final Integer countryGeoNameId, final Integer cityGeoNameId) { final Record inputCopy = input.copy(); collector.reset(); startSession(); assertEquals(1, collector.getNumStartEvents()); assertEquals(isSuccess, morphline.process(inputCopy)); if (!isSuccess) { assertEquals(0, collector.getRecords().size()); } else { assertEquals(1, collector.getRecords().size()); final Record actual = collector.getFirstRecord(); final Object body = actual.getFirstValue(Fields.ATTACHMENT_BODY); actual.removeAll(Fields.ATTACHMENT_BODY); assertEquals(input, actual); assertTrue(body instanceof JsonNode); final JsonNode jsonNode = (JsonNode)body; assertNotNull(jsonNode); <START> System.out.println("VALUE: " + jsonNode.toString()); <END> final JsonNode countryNode = jsonNode.get("country"); if (countryGeoNameId != null) { assertNotNull(countryNode); assertEquals(countryGeoNameId.intValue(), countryNode.get("geoname_id").asInt()); } else { assertNull(countryNode); } final JsonNode cityNode = jsonNode.get("city"); if (cityGeoNameId != null) { assertNotNull(cityNode); assertEquals(cityGeoNameId.intValue(), cityNode.get("geoname_id").asInt()); } else { assertNull(cityNode); } } }</code><technical_language>remove print statement stdout</technical_language>

Target:
private void processAndVerifySuccess2(final Record input, final boolean isSuccess, boolean isSame, final Integer countryGeoNameId, final Integer cityGeoNameId) { final Record inputCopy = input.copy(); collector.reset(); startSession(); assertEquals(1, collector.getNumStartEvents()); assertEquals(isSuccess, morphline.process(inputCopy)); if (!isSuccess) { assertEquals(0, collector.getRecords().size()); } else { assertEquals(1, collector.getRecords().size()); final Record actual = collector.getFirstRecord(); final Object body = actual.getFirstValue(Fields.ATTACHMENT_BODY); actual.removeAll(Fields.ATTACHMENT_BODY); assertEquals(input, actual); assertTrue(body instanceof JsonNode); final JsonNode jsonNode = (JsonNode)body; assertNotNull(jsonNode); final JsonNode countryNode = jsonNode.get("country"); if (countryGeoNameId != null) { assertNotNull(countryNode); assertEquals(countryGeoNameId.intValue(), countryNode.get("geoname_id").asInt()); } else { assertNull(countryNode); } final JsonNode cityNode = jsonNode.get("city"); if (cityGeoNameId != null) { assertNotNull(cityNode); assertEquals(cityGeoNameId.intValue(), cityNode.get("geoname_id").asInt()); } else { assertNull(cityNode); } } }
Source:
<code>public SingleOp(Runnable op) { <START> this.op = op; <END> }</code><technical_language>this("SingleOp);</technical_language>

Target:
public SingleOp(Runnable op) { this("SingleOp", op); }
Source:
<code>public static void setCurrent(SiteContext current) { <START> logger.debug("Getting read lock for context {}", current); <END> current.accessLock.lock(); threadLocal.set(current); MDC.put(SITE_NAME_MDC_KEY, current.getSiteName()); }</code><technical_language>forgot mention change read access</technical_language>

Target:
public static void setCurrent(SiteContext current) { logger.debug("Getting access lock for context {}", current); current.accessLock.lock(); threadLocal.set(current); MDC.put(SITE_NAME_MDC_KEY, current.getSiteName()); }
Source:
<code>public void assertCaptureTemplate() { PathMatcher pathMatcher = new RegexPathMatcher(); Map<String, String> variables = pathMatcher.captureVariables("/app/{jobName}/disable/{until}/done", "/app/myJob/disable/20201231/done?name=some_name&value=some_value"); assertFalse(variables.isEmpty()); <START> assertEquals(2, variables.size()); <END> assertEquals("myJob", variables.get("jobName")); assertEquals("20201231", variables.get("until")); assertNull(variables.get("app")); }</code><technical_language>assertThat</technical_language>

Target:
public void assertCaptureTemplate() { PathMatcher pathMatcher = new RegexPathMatcher(); Map<String, String> variables = pathMatcher.captureVariables("/app/{jobName}/disable/{until}/done", "/app/myJob/disable/20201231/done?name=some_name&value=some_value"); assertFalse(variables.isEmpty()); assertThat(variables.size(), is(2)); assertThat(variables.get("jobName"), is("myJob")); assertThat(variables.get("until"), is("20201231")); assertNull(variables.get("app")); }
Source:
<code><START> public DestructionAwareBeanPostProcessor threadPoolShutdownProcessor() { <END> return (Object bean, String beanName) -> { if (beanName.equals("taskExecutor")) { ExecutorService executor = (ExecutorService) bean; executor.shutdownNow(); } if (beanName.equals("taskScheduler")) { ExecutorService executor = ((ThreadPoolTaskScheduler) bean).getScheduledThreadPoolExecutor(); executor.shutdownNow(); } }; }</code><technical_language>some logging in this method</technical_language>

Target:
public DestructionAwareBeanPostProcessor threadPoolShutdownProcessor() { return (Object bean, String beanName) -> { if ("taskExecutor".equals(beanName)) { log.info("Shutting down ExecutorService '" + beanName + "'"); ExecutorService executor = (ExecutorService) bean; executor.shutdownNow(); } }; }
Source:
<code>public static Observable<Long> rangeLong(long start, long count) { if (count < 0) { throw new IllegalArgumentException("count >= 0 required but it was " + count); } if (count == 0) { return empty(); } if (count == 1) { return just(start); } <START> if (start + (count - 1) > Long.MAX_VALUE) { <END> throw new IllegalArgumentException("Long overflow"); } return RxJavaPlugins.onAssembly(new ObservableRangeLong(start, count)); }</code><technical_language>overflow check in Flowable</technical_language>

Target:
public static Observable<Long> rangeLong(long start, long count) { if (count < 0) { throw new IllegalArgumentException("count >= 0 required but it was " + count); } if (count == 0) { return empty(); } if (count == 1) { return just(start); } long end = start + (count - 1); if (start > 0 && end < 0) { throw new IllegalArgumentException("Overflow! start + count is bigger than Long.MAX_VALUE"); } return RxJavaPlugins.onAssembly(new ObservableRangeLong(start, count)); }
Source:
<code>public PlanImpl build() { for (final String namespace : evaluatorsToAdd.keySet()) { for (final String evaluator : evaluatorsToAdd.get(namespace)) { if (evaluatorsToDelete.containsKey(namespace) && evaluatorsToDelete.get(namespace).contains(evaluator)) { throw new RuntimeException(evaluator + " is planned for both addition and deletion."); } } } for (final String namespace : allTransferSteps.keySet()) { for (final TransferStep transferStep : allTransferSteps.get(namespace)) { if (evaluatorsToDelete.containsKey(namespace) && evaluatorsToDelete.get(namespace).contains(transferStep.getDstId())) { throw new RuntimeException(transferStep.getDstId() + " is planned for deletion."); } else if (evaluatorsToAdd.containsKey(namespace) && evaluatorsToAdd.get(namespace).contains(transferStep.getSrcId())) { throw new RuntimeException(transferStep.getSrcId() + " is planned for addition."); } } } final DAG<EMOperation> dependencyGraph = constructDAG(evaluatorsToAdd, evaluatorsToDelete, allTransferSteps); int numTotalOps = 0; for (final Set<String> evalsToAdd : evaluatorsToAdd.values()) { numTotalOps += evalsToAdd.size(); } for (final Set<String> evalsToDel : evaluatorsToDelete.values()) { numTotalOps += evalsToDel.size(); } for (final List<TransferStep> transferSteps : allTransferSteps.values()) { numTotalOps += transferSteps.size(); } <START> return new PlanImpl(evaluatorsToAdd, evaluatorsToDelete, allTransferSteps, dependencyGraph, numTotalOps); <END> }</code><technical_language>move L227-L237 done PlanImpl's constructor? Passing collections number of elements unnatural</technical_language>

Target:
public PlanImpl build() { for (final String namespace : evaluatorsToAdd.keySet()) { for (final String evaluator : evaluatorsToAdd.get(namespace)) { if (evaluatorsToDelete.containsKey(namespace) && evaluatorsToDelete.get(namespace).contains(evaluator)) { throw new RuntimeException(evaluator + " is planned for both addition and deletion."); } } } for (final String namespace : allTransferSteps.keySet()) { for (final TransferStep transferStep : allTransferSteps.get(namespace)) { if (evaluatorsToDelete.containsKey(namespace) && evaluatorsToDelete.get(namespace).contains(transferStep.getDstId())) { throw new RuntimeException(transferStep.getDstId() + " is planned for deletion."); } else if (evaluatorsToAdd.containsKey(namespace) && evaluatorsToAdd.get(namespace).contains(transferStep.getSrcId())) { throw new RuntimeException(transferStep.getSrcId() + " is planned for addition."); } } } final DAG<EMOperation> dependencyGraph = constructDAG(evaluatorsToAdd, evaluatorsToDelete, allTransferSteps); return new PlanImpl(evaluatorsToAdd, evaluatorsToDelete, allTransferSteps, dependencyGraph); }
Source:
<code>public void onNext(final AggregationMessage message) { LOG.log(Level.INFO, "Received aggregation message {0}", message); final String slaveId = message.getSlaveId().toString(); final String data = codec.decode(message.getData().array()); if (slaveId.substring(AggregationExampleDriver.WORKER_CONTEXT_PREFIX.length()) .equals(data.substring(AggregationExampleDriver.TASK_PREFIX.length()))) { msgCountDown.countDown(); } else { exception = exception == null ? new RuntimeException(String.format("SlaveId %s should not send message with data %s.", slaveId, data)) <START> : exception; <END> } }</code><technical_language>If plan throw RuntimeException, do wait Exception occurs throw in validate()? Is specific reason throw directly? Also, if more failure place</technical_language>

Target:
public void onNext(final AggregationMessage message) { LOG.log(Level.INFO, "Received aggregation message {0}", message); final String slaveId = message.getSlaveId().toString(); final String data = codec.decode(message.getData().array()); if (slaveId.startsWith(AggregationExampleDriver.WORKER_CONTEXT_PREFIX) && data.startsWith(AggregationExampleDriver.TASK_PREFIX) && slaveId.substring(AggregationExampleDriver.WORKER_CONTEXT_PREFIX.length()) .equals(data.substring(AggregationExampleDriver.TASK_PREFIX.length()))) { msgCountDown.countDown(); } else { throw new RuntimeException(String.format("SlaveId %s should not send message with data %s.", slaveId, data)); } }
Source:
<code>public PREfastParser() { super(Messages._Warnings_PREfast_ParserName(), Messages._Warnings_PREfast_LinkName(), Messages._Warnings_PREfast_TrendName(), PREFAST_PATTERN_WARNING, <START> true); <END> }</code><technical_language>If isStringMatchActivated==true override method isLineInteresting line.contains("DEFECT");</technical_language>

Target:
public PREfastParser() { super(Messages._Warnings_PREfast_ParserName(), Messages._Warnings_PREfast_LinkName(), Messages._Warnings_PREfast_TrendName(), PREFAST_PATTERN_WARNING); }
Source:
<code>public void testSetHeaderStrictInvalidReference() { SAMRecord sam = createTestRecordHelper(); final SAMFileHeader samHeader = sam.getHeader(); sam.setReferenceName("unresolveable"); <START> int originalRefIndex = sam.getReferenceIndex(); <END> Assert.assertEquals(SAMRecord.NO_ALIGNMENT_REFERENCE_INDEX, originalRefIndex); Assert.assertNull(sam.mReferenceIndex); sam.setHeaderStrict(samHeader); }</code><technical_language>This is odd -- setReferenceName() clear reference index? (and "originalRefIndex" is "original" reference index)</technical_language>

Target:
public void testSetHeaderStrictInvalidReference() { SAMRecord sam = createTestRecordHelper(); final SAMFileHeader samHeader = sam.getHeader(); sam.setReferenceName("unresolvable"); Assert.assertEquals(new Integer(SAMRecord.NO_ALIGNMENT_REFERENCE_INDEX), sam.getReferenceIndex()); sam.setHeaderStrict(samHeader); }
Source:
<code>public void render(Context context, GlusterVolumeEntity volume, SafeHtmlBuilder sb) { if (volume == null) { return; } GlusterStatus status = volume.getStatus(); ImageResource statusImage = null; String tooltip; <START> Boolean brickWarn = false; <END> for(GlusterBrickEntity brick : volume.getBricks()) { if(brick.getStatus() == GlusterStatus.DOWN) { brickWarn = true; } } if (!brickWarn) { switch (status) { case DOWN: statusImage = resources.downImage(); tooltip = constants.down(); break; case UP: statusImage = resources.upImage(); tooltip = constants.up(); break; default: statusImage = resources.downImage(); tooltip = constants.down(); } } else { statusImage = resources.volumeBrickWarning(); tooltip = constants.brickWarning(); } SafeHtml statusImageHtml = SafeHtmlUtils.fromTrustedString(AbstractImagePrototype.create(statusImage).getHTML()); sb.append(applicationTemplates.statusTemplate(statusImageHtml, tooltip)); }</code><technical_language>call this isBrickDown</technical_language>

Target:
public void render(Context context, GlusterVolumeEntity volume, SafeHtmlBuilder sb) { if (volume == null) { return; } GlusterStatus status = volume.getStatus(); ImageResource statusImage = null; String tooltip; Boolean isBrickDown = false; for(GlusterBrickEntity brick : volume.getBricks()) { if(brick.getStatus() == GlusterStatus.DOWN) { isBrickDown = true; break; } } if (!isBrickDown) { switch (status) { case DOWN: statusImage = resources.downImage(); tooltip = constants.down(); break; case UP: statusImage = resources.upImage(); tooltip = constants.up(); break; default: statusImage = resources.downImage(); tooltip = constants.down(); } } else { statusImage = resources.volumeUpWarning(); tooltip = constants.volumeBricksDown(); } SafeHtml statusImageHtml = SafeHtmlUtils.fromTrustedString(AbstractImagePrototype.create(statusImage).getHTML()); sb.append(applicationTemplates.statusTemplate(statusImageHtml, tooltip)); }
Source:
<code>static InputStream createInputStream(String method, String id, String params) throws IOException { @SuppressWarnings("StringBufferMayBeStringBuilder") StringBuffer envelope = new StringBuffer(); envelope.append("{\""); envelope.append(JSONRPC); envelope.append("\":\""); envelope.append(VERSION); envelope.append("\",\""); envelope.append(ID); envelope.append("\":"); <START> if (null!=id && 0!=id.length()) { <END> envelope.append(id); } else { envelope.append("null"); } envelope.append(",\""); envelope.append(METHOD); envelope.append("\":"); if (null!=method && 0!=method.length()) { envelope.append('"'); envelope.append(method); envelope.append('"'); } else { envelope.append("null"); } envelope.append(",\""); envelope.append(PARAMS); envelope.append("\":"); if (null!=params && 0!=params.length()) { String decodedParams; if(BASE64_PATTERN.matcher(params).matches()) { decodedParams = new String(Base64.decode(params), StandardCharsets.UTF_8); } else { switch(params.charAt(0)) { case '[': case '{': decodedParams = params; break; default: throw new IOException("badly formed 'param' parameter starting with; [" + params.charAt(0) + "]"); } } envelope.append(decodedParams); } else { envelope.append("[]"); } envelope.append('}'); return new ByteArrayInputStream(envelope.toString().getBytes(StandardCharsets.UTF_8)); }</code><technical_language>add spaces !=</technical_language>

Target:
static InputStream createInputStream(String method, String id, String params) throws IOException { StringBuilder envelope = new StringBuilder(); envelope.append("{\""); envelope.append(JSONRPC); envelope.append("\":\""); envelope.append(VERSION); envelope.append("\",\""); envelope.append(ID); envelope.append("\":"); if (null!=id && 0!=id.length()) { envelope.append(id); } else { envelope.append("null"); } envelope.append(",\""); envelope.append(METHOD); envelope.append("\":"); if (null!=method && 0!=method.length()) { envelope.append('"'); envelope.append(method); envelope.append('"'); } else { envelope.append("null"); } envelope.append(",\""); envelope.append(PARAMS); envelope.append("\":"); if (null!=params && 0!=params.length()) { String decodedParams; if(BASE64_PATTERN.matcher(params).matches()) { decodedParams = new String(Base64.decode(params), StandardCharsets.UTF_8); } else { switch(params.charAt(0)) { case '[': case '{': decodedParams = params; break; default: throw new IOException("badly formed 'param' parameter starting with; [" + params.charAt(0) + "]"); } } envelope.append(decodedParams); } else { envelope.append("[]"); } envelope.append('}'); return new ByteArrayInputStream(envelope.toString().getBytes(StandardCharsets.UTF_8)); }