auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public static ResourcePoolsBuilder newResourcePoolsBuilder(ResourcePools pools) { ResourcePoolsBuilder poolsBuilder = new ResourcePoolsBuilder(); <START> if (pools.getPoolForResource(ResourceType.Core.HEAP) != null) { <END> poolsBuilder = poolsBuilder.heap(pools.getPoolForResource(ResourceType.Core.HEAP).getSize(), pools.getPoolForResource(ResourceType.Core.HEAP).getUnit()); } if (pools.getPoolForResource(ResourceType.Core.OFFHEAP) != null) { poolsBuilder = poolsBuilder.offheap(pools.getPoolForResource(ResourceType.Core.OFFHEAP).getSize(), (MemoryUnit)pools.getPoolForResource(ResourceType.Core.OFFHEAP).getUnit()); } if (pools.getPoolForResource(ResourceType.Core.DISK) != null) { poolsBuilder = poolsBuilder.disk(pools.getPoolForResource(ResourceType.Core.DISK).getSize(), pools.getPoolForResource(ResourceType.Core.DISK).getUnit()); } return poolsBuilder; }</code><technical_language>hardcode resources consider? leverage org.ehcache.config.ResourcePools#getResourceTypeSet method added</technical_language>

Target:
public static ResourcePoolsBuilder newResourcePoolsBuilder(ResourcePools pools) { ResourcePoolsBuilder poolsBuilder = new ResourcePoolsBuilder(); for (ResourceType currentResourceType : pools.getResourceTypeSet()) { poolsBuilder = poolsBuilder.with(currentResourceType, pools.getPoolForResource(currentResourceType).getSize(), pools.getPoolForResource(currentResourceType).getUnit(), pools.getPoolForResource(currentResourceType).isPersistent()); } return poolsBuilder; }
Source:
<code>public static void resetAllNozzleTips() { for (Head head : Configuration.get().getMachine().getHeads()) { for (Nozzle nozzle : head.getNozzles()) { <START> for (NozzleTip nt : nozzle.getCompatibleNozzleTips()) { <END> if (nt instanceof ReferenceNozzleTip) { ReferenceNozzleTip rnt = (ReferenceNozzleTip)nt; rnt.getCalibration().reset(); } } } } }</code><technical_language>nozzle tips. push</technical_language>

Target:
public static void resetAllNozzleTips() { for (NozzleTip nt: Configuration.get().getMachine().getNozzleTips()) { if (nt instanceof ReferenceNozzleTip) { ((ReferenceNozzleTip)nt).getCalibration().resetAll(); } } }
Source:
<code>public List<DispoItem> copyEntireSet(List<DispoItemData> destinationItems, Collection<DispoItem> sourceItems, boolean isCopySet) throws JSONException { List<DispoItem> modifiedItems = new ArrayList<DispoItem>(); HashMap<String, DispoItemData> nameToDestItems = createNameToItemList(destinationItems); for (DispoItem sourceItem : sourceItems) { DispoItemData destItem = nameToDestItems.get(sourceItem.getName()); if (destItem != null) { <START> <END> if (!destItem.getStatus().equals(DispoStrings.Item_Pass)) { DispoItemData newItem = createNewItemWithCopiedAnnotations(destItem, sourceItem, isCopySet); if (newItem != null) { if (destItem.getGuid() == null) { newItem.setGuid(sourceItem.getGuid()); } else { newItem.setGuid(destItem.getGuid()); } modifiedItems.add(newItem); } } else if (destItem.getGuid() == null && !sourceItem.getStatus().equals(DispoStrings.Item_Pass)) { destItem.setGuid(sourceItem.getGuid()); modifiedItems.add(destItem); } } } return modifiedItems; }</code><technical_language>/** */ instead of // auto-formatter wrap</technical_language>

Target:
public List<DispoItem> copyEntireSet(List<DispoItemData> destinationItems, Collection<DispoItem> sourceItems, boolean isCopySet) throws JSONException { List<DispoItem> modifiedItems = new ArrayList<DispoItem>(); HashMap<String, DispoItemData> nameToDestItems = createNameToItemList(destinationItems); for (DispoItem sourceItem : sourceItems) { DispoItemData destItem = nameToDestItems.get(sourceItem.getName()); if (destItem != null) { if (!destItem.getStatus().equals(DispoStrings.Item_Pass)) { DispoItemData newItem = createNewItemWithCopiedAnnotations(destItem, sourceItem, isCopySet); if (newItem != null) { if (!Strings.isValid(destItem.getGuid())) { newItem.setGuid(sourceItem.getGuid()); } else { newItem.setGuid(destItem.getGuid()); } modifiedItems.add(newItem); } } else if (destItem.getGuid() == null && !sourceItem.getStatus().equals(DispoStrings.Item_Pass)) { destItem.setGuid(sourceItem.getGuid()); modifiedItems.add(destItem); } } } return modifiedItems; }
Source:
<code>protected void createFieldEditors() { String providerId = ProviderFramework.getHighestProviderId(type); getPreferenceStore().setDefault( ProviderProfileConstants.PREFS_KEY + type, providerId); <START> getPreferenceStore().setDefault(ProviderProfileConstants.PREFS_KEY, providerId); <END> HashMap<String, String> map = ProviderFramework .getProviderNamesForType(type); String[][] providerList = new String[map.size()][2]; int i = 0; for (Entry<String, String> entry : map.entrySet()) { String toolId = entry.getValue(); String toolDescription = getToolInformationFromId(toolId, PROVIDER_ATT_DESC); String toolName = entry.getKey(); if (toolDescription != null && !toolDescription.equals("")) { toolName = toolName + " " + "[" + toolDescription + "]"; } providerList[i][0] = toolName; providerList[i][1] = toolId; i++; } RadioGroupFieldEditor editor = new RadioGroupFieldEditor( ProviderProfileConstants.PREFS_KEY + type, Messages.ProviderPreferencesPage_1, 1, providerList, getFieldEditorParent(), true); editor.setPreferenceStore(getPreferenceStore()); addField(editor); Composite radioBoxControl = editor .getRadioBoxControl(getFieldEditorParent()); Control[] providerOptions = radioBoxControl.getChildren(); for (Control control : providerOptions) { String curProviderId = (String) control.getData(); String toolDescription = getToolInformationFromId(curProviderId, PROVIDER_ATT_INFO); if (toolDescription != null && !toolDescription.equals("")) { control.setToolTipText(toolDescription); } } }</code><technical_language>Setting default is care of in lines 82-83</technical_language>

Target:
protected void createFieldEditors() { String providerId = ProviderFramework.getHighestProviderId(type); getPreferenceStore().setDefault( ProviderProfileConstants.PREFS_KEY + type, providerId); HashMap<String, String> map = ProviderFramework .getProviderNamesForType(type); String[][] providerList = new String[map.size()][2]; int i = 0; for (Entry<String, String> entry : map.entrySet()) { String toolId = entry.getValue(); String toolDescription = getToolInformationFromId(toolId, PROVIDER_ATT_DESC); String toolName = entry.getKey(); if (toolDescription != null && !toolDescription.equals("")) { toolName = toolName + " " + "[" + toolDescription + "]"; } providerList[i][0] = toolName; providerList[i][1] = toolId; i++; } RadioGroupFieldEditor editor = new RadioGroupFieldEditor( ProviderProfileConstants.PREFS_KEY + type, Messages.ProviderPreferencesPage_1, 1, providerList, getFieldEditorParent(), true); editor.setPreferenceStore(getPreferenceStore()); addField(editor); Composite radioBoxControl = editor .getRadioBoxControl(getFieldEditorParent()); Control[] providerOptions = radioBoxControl.getChildren(); for (Control control : providerOptions) { String curProviderId = (String) control.getData(); String toolDescription = getToolInformationFromId(curProviderId, PROVIDER_ATT_INFO); if (toolDescription != null && !toolDescription.equals("")) { control.setToolTipText(toolDescription); } } }
Source:
<code>public Response viewDataverse(@PathParam("identifier") String idtf) { return allowCors(response(req -> ok( json(execCommand(new GetDataverseCommand(req, findDataverseOrDie(idtf))), false, <START> settingsService.isTrueForKey(SettingsServiceBean.Key.ExcludeEmailFromExport, false) <END> )))); }</code><technical_language>@matthew-a-dunlap please update docs :ExcludeEmailFromExport. Thanks</technical_language>

Target:
public Response viewDataverse(@PathParam("identifier") String idtf) { return allowCors(response(req -> ok( json(execCommand(new GetDataverseCommand(req, findDataverseOrDie(idtf))), settingsService.isTrueForKey(SettingsServiceBean.Key.ExcludeEmailFromExport, false) )))); }
Source:
<code>public void connect(SocketFactory socket_factory, String host, int port, int timeout) throws IOException { command = command.replace("%h", host); command = command.replace("%p", Integer.toString(port)); List<String> cmd = new ArgumentParser(command).getTokenList(); if (!connection.isOpen()) { try { <START> connection.open(null); <END> } catch (RemoteConnectionException e) { throw new IOException(e); } } IRemoteProcessBuilder pb = connection.getProcessBuilder(cmd); process = pb.start(); long endTime = System.currentTimeMillis() + timeout; while (getInputStream().available() == 0 && !process.isCompleted() && (timeout == 0 || System.currentTimeMillis() < endTime)) { try { Thread.sleep(20); } catch (InterruptedException e) { } } if (getInputStream().available() == 0) { throw new IOException(NLS.bind(Messages.JSchConnectionProxyFactory_ProxyCommandFailed, command, new BufferedReader(new InputStreamReader(process.getErrorStream())).readLine())); } errCopyThread = new StreamCopyThread(process.getErrorStream(), System.err); errCopyThread.start(); }</code><technical_language>Need some support progress monitoring, opening connections a long time get stuck occasionally</technical_language>

Target:
public void connect(SocketFactory socket_factory, String host, int port, int timeout) throws IOException { if (timeout == 0) { timeout = 10000; } final int waitTime = 50; final int waitSteps = timeout / waitTime; SubMonitor subMon; if (!connection.isOpen()) { subMon = SubMonitor.convert(monitor, waitSteps * 2); try { connection.open(subMon.newChild(waitSteps)); } catch (RemoteConnectionException e) { throw new IOException(e); } } else { subMon = SubMonitor.convert(monitor, waitSteps); } command = command.replace("%h", host); command = command.replace("%p", Integer.toString(port)); List<String> cmd = new ArgumentParser(command).getTokenList(); IRemoteProcessBuilder pb = connection.getProcessBuilder(cmd); process = pb.start(); long endTime = System.currentTimeMillis() + timeout; while (getInputStream().available() == 0 && !process.isCompleted() && System.currentTimeMillis() < endTime) { try { Thread.sleep(waitTime); subMon.worked(1); } catch (InterruptedException e) { } } final BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(process.getErrorStream())); if (getInputStream().available() == 0) { throw new IOException(NLS.bind(Messages.JSchConnectionProxyFactory_ProxyCommandFailed, command, bufferedReader.readLine())); } new Thread() { @Override public void run() { final ILog log = Activator.getDefault().getLog(); String line; try { while ((line = bufferedReader.readLine()) != null) { log.log(new Status(IStatus.INFO, Activator.getUniqueIdentifier(), IStatus.OK, line, null)); } } catch (IOException e) { Activator.log(e); } }; }.start(); }
Source:
<code>public String render(Model model, Lookup lookup, RequestLookup requestLookup, API api) { if (isSecured && !api.getSession().isPresent()) { if (requestLookup.tracker().isInPage() || requestLookup.tracker().isInLayout() || requestLookup.tracker().isInFragment()) { return ""; } else { throw new SessionNotFoundException( "Fragment '" + name + "' is secured and required an user session to render."); } } <START> DebugLogger.startFragment(this); <END> requestLookup.tracker().in(this); lookup.getComponent(requestLookup.tracker().getCurrentComponentName()) .map(component -> UriUtils.getPublicUri(component, this)) .ifPresent(requestLookup::pushToPublicUriStack); String output = renderer.render(model, lookup, requestLookup, api); requestLookup.popPublicUriStack(); requestLookup.tracker().out(this); DebugLogger.endFragment(this); return output; }</code><technical_language>start end "debug" a try finally block</technical_language>

Target:
public String render(Model model, Lookup lookup, RequestLookup requestLookup, API api) { if (isSecured && !api.getSession().isPresent()) { if (requestLookup.tracker().isInPage() || requestLookup.tracker().isInLayout() || requestLookup.tracker().isInFragment()) { return ""; } else { throw new SessionNotFoundException( "Fragment '" + name + "' is secured and required an user session to render."); } } try { DebugLogger.startFragment(this); requestLookup.tracker().in(this); lookup.getComponent(requestLookup.tracker().getCurrentComponentName()) .map(component -> UriUtils.getPublicUri(component, this)) .ifPresent(requestLookup::pushToPublicUriStack); return renderer.render(model, lookup, requestLookup, api); } finally { requestLookup.popPublicUriStack(); requestLookup.tracker().out(this); DebugLogger.endFragment(this); } }
Source:
<code>public Path readSymbolicLink(final Path link) { checkNotNull("link", link); checkFileNotExistThenThrow(link, true); throw new UnsupportedOperationException(); <START> } <END></code><technical_language>i wrong, original more efficient</technical_language>

Target:
public Path readSymbolicLink(final Path link) throws UnsupportedOperationException, NotLinkException, IOException, SecurityException { checkNotNull("link", link); checkFileNotExistThenThrow(link, true); throw new UnsupportedOperationException(); }
Source:
<code><START> public String build() { <END> return String.format("{\"selector\": {%s}}", query.toString()); }</code><technical_language>reduce boiler plate making this a static, I need query stored in instance java public static String build(OperationOrExpression query) { return String.format("{\"selector\": {%s}}", query.toString()); } I naming final, possibly call method selector maps HTTP API drop Builder suffix (if explicit build method anyway) then: new QueryBuilder(gt("year", 2018)).build()); Query.selector(gt("year", 2018)); a massive saving, is a bit more concise</technical_language>

Target:
public String build() { String selectorString = selector.toString(); String fieldsString = this.fields == null ? null : Helpers.quote(this.fields); String sortString = this.sort == null ? null : quoteSort(this.sort); String limitString = this.limit == null ? null : Helpers.quote(this.limit); String skipString = this.skip == null ? null : Helpers.quote(this.skip); StringBuilder builder = new StringBuilder(); builder.append(String.format("\"selector\": {%s}", selectorString)); if (fieldsString != null) { builder.append(String.format(", \"fields\": %s", fieldsString)); } if (sortString != null) { builder.append(String.format(", \"sort\": %s", sortString)); } if (limitString != null) { builder.append(String.format(", \"limit\": %s", limitString)); } if (skipString != null) { builder.append(String.format(", \"skip\": %s", skipString)); } return String.format("{%s}", builder.toString()); }
Source:
<code>public ActionResult execute() { String courseId = getNonNullRequestParamValue(Const.ParamsNames.COURSE_ID); String studentEmail = getNonNullRequestParamValue(Const.ParamsNames.STUDENT_EMAIL); StudentAttributes student = logic.getStudentForEmail(courseId, studentEmail); if (student == null) { return new JsonResult("No student with given email in given course.", HttpStatus.SC_NOT_FOUND); } InstructorAttributes instructor = logic.getInstructorForGoogleId(courseId, userInfo.id); <START> gateKeeper.verifyAccessible(instructor, logic.getCourse(courseId), student.section, <END> Const.ParamsNames.INSTRUCTOR_PERMISSION_VIEW_STUDENT_IN_SECTIONS); boolean isOpenOrPublishedEmailSentForTheCourse = logic.isOpenOrPublishedEmailSentForTheCourse(courseId); StudentEditDetails dataFormat = new StudentEditDetails(student, isOpenOrPublishedEmailSentForTheCourse); return new JsonResult(dataFormat); }</code><technical_language>necessary check access control here. access control check decoupled for a purpose</technical_language>

Target:
public ActionResult execute() { String courseId = getNonNullRequestParamValue(Const.ParamsNames.COURSE_ID); String studentEmail = getNonNullRequestParamValue(Const.ParamsNames.STUDENT_EMAIL); StudentAttributes student = logic.getStudentForEmail(courseId, studentEmail); if (student == null) { return new JsonResult("No student with given email in given course.", HttpStatus.SC_NOT_FOUND); } boolean isOpenOrPublishedEmailSentForTheCourse = logic.isOpenOrPublishedEmailSentForTheCourse(courseId); StudentEditDetails dataFormat = new StudentEditDetails(student, isOpenOrPublishedEmailSentForTheCourse); return new JsonResult(dataFormat); }
Source:
<code>public void showDialog(Project project) { this.project = project; checkState(project != null, "Null project occurred"); <START> checkState(project.getLocation().isPrefixOf(appContext.getResource().getLocation()), <END> "Given selected item is not descendant of given project"); service.diff(appContext.getDevMachine(), project.getLocation(), null, NAME_STATUS, false, 0, "HEAD", false) .then(diff -> { if (diff.isEmpty()) { dialogFactory.createMessageDialog(constant.commitTitle(), constant.commitNothingToCommitMessageText(), null).show(); } else { final String[] changedFiles = diff.split("\n"); Map<String, Status> items = new HashMap<>(); for (String item : changedFiles) { items.put(item.substring(2, item.length()), defineStatus(item.substring(0, 1))); } filesToCommit.clear(); allFiles = items.keySet(); view.setEnableCommitButton(!view.getMessage().isEmpty()); view.focusInMessageField(); view.showDialog(); view.checkCheckBoxes(stream(appContext.getResources()).map(resource -> resource.getLocation().removeFirstSegments(1)) .collect(Collectors.toSet())); changedPanelPresenter.show(items, null); } }) .catchError(arg -> { notificationManager.notify(constant.diffFailed(), FAIL, FLOAT_MODE); }); service.branchList(appContext.getDevMachine(), project.getLocation(), LIST_REMOTE) .then(view::setRemoteBranchesList) .catchError(error -> { notificationManager.notify(constant.branchesListFailed(), FAIL, FLOAT_MODE); }); }</code><technical_language>CommitAction disabled if of conditions true</technical_language>

Target:
public void showDialog(Project project) { this.project = project; view.setValueToAmendCheckBox(false); view.setValueToPushAfterCommitCheckBox(false); view.setEnableAmendCheckBox(true); view.setEnablePushAfterCommitCheckBox(true); view.setEnableRemoteBranchesDropDownLis(false); service.diff(appContext.getDevMachine(), project.getLocation(), null, NAME_STATUS, false, 0, "HEAD", false) .then(diff -> { service.log(appContext.getDevMachine(), project.getLocation(), null, -1, 1, false) .then(arg -> { if (diff.isEmpty()) { showAskForAmendDialog(); } else { show(diff); } }) .catchError(error -> { if (getErrorCode(error.getCause()) == ErrorCodes.INIT_COMMIT_WAS_NOT_PERFORMED) { service.getStatus(appContext.getDevMachine(), project.getLocation()).then( status -> { view.setEnableAmendCheckBox(false); view.setEnablePushAfterCommitCheckBox(false); List<String> newFiles = new ArrayList<>(); newFiles.addAll(status.getAdded()); newFiles.addAll(status.getUntracked()); show(newFiles.stream().collect(joining("\nA ", "A ", ""))); }); } }); }) .catchError(arg -> { notificationManager.notify(constant.diffFailed(), FAIL, FLOAT_MODE); }); service.branchList(appContext.getDevMachine(), project.getLocation(), LIST_REMOTE) .then(view::setRemoteBranchesList) .catchError(error -> { notificationManager.notify(constant.branchesListFailed(), FAIL, FLOAT_MODE); }); }
Source:
<code>public ConstantExpression(final int value) { <START> valueType = Type.INT_TYPE; <END> this.value = String.valueOf(value); }</code><technical_language>constructor-delegate form instead. More concise if need put in checks need put place. e.g., this(Type.INT_TYPE, String.valueOf(value))</technical_language>

Target:
public ConstantExpression(final int value) { this(Type.INT_TYPE, String.valueOf(value)); }
Source:
<code>public void createTopicWithTitleAndMessage_ShouldPass_JC_13() throws Exception { Users.signUpAndSignIn(); <START> Topic topic = new Topic().withTitle("subject").withBody("message"); <END> Topic createdTopic = Topics.createTopic(topic); Assert.assertTrue(Topics.isCreated(createdTopic)); }</code><technical_language>new Topic() subject body get random</technical_language>

Target:
public void createTopicWithTitleAndMessage_ShouldPass_JC_13() throws Exception { Users.signUpAndSignIn(); Topic topic = new Topic(); Topic createdTopic = Topics.createTopic(topic); Assert.assertTrue(Topics.isCreated(createdTopic)); }
Source:
<code>public void visitMethodInsn(final int opcode, final String owner, final String name, final String desc) { mv.visitMethodInsn(opcode, owner, name, desc); if (constructor) { Type[] types = Type.getArgumentTypes(desc); <START> for (Type type1 : types) { <END> popValue(); if (type1.getSize() == 2) { popValue(); } } switch (opcode) { case INVOKEINTERFACE: case INVOKEVIRTUAL: popValue(); break; case INVOKESPECIAL: Object type = popValue(); if (type == THIS && !superInitialized) { onMethodEnter(); superInitialized = true; constructor = false; } break; } Type returnType = Type.getReturnType(desc); if (returnType != Type.VOID_TYPE) { pushValue(OTHER); if (returnType.getSize() == 2) { pushValue(OTHER); } } } }</code><technical_language>This is valid a good convention</technical_language>

Target:
public void visitMethodInsn(final int opcode, final String owner, final String name, final String desc) { mv.visitMethodInsn(opcode, owner, name, desc); if (constructor) { Type[] types = Type.getArgumentTypes(desc); for (Type eachType : types) { popValue(); if (eachType.getSize() == 2) { popValue(); } } switch (opcode) { case INVOKEINTERFACE: case INVOKEVIRTUAL: popValue(); break; case INVOKESPECIAL: Object type = popValue(); if (type == THIS && !superInitialized) { onMethodEnter(); superInitialized = true; constructor = false; } break; } Type returnType = Type.getReturnType(desc); if (returnType != Type.VOID_TYPE) { pushValue(OTHER); if (returnType.getSize() == 2) { pushValue(OTHER); } } } }
Source:
<code><START> public ExecRow makeRow(boolean latestVersion, TupleDescriptor td, TupleDescriptor parent) throws StandardException { return makeEmptyRow(); } <END></code><technical_language>hmm .. return empty row here, is that</technical_language>

Target:
public ExecRow makeRow(boolean latestVersion, TupleDescriptor td, TupleDescriptor parent) throws StandardException { if (td != null) { if (!(td instanceof SPSDescriptor)) throw new RuntimeException("Unexpected TupleDescriptor " + td.getClass().getName()); return makeSYSSTATEMENTSrow(latestVersion, (SPSDescriptor) td); } else { return makeEmptyRow(); } }
Source:
<code>public void createIndex(String indexDefinition) { assertNotEmpty(indexDefinition, "indexDefinition"); InputStream putresp = null; URI uri = buildUri(getDBUri()).path("_index").build(); try { <START> putresp = client.executeRequest(createPost(uri, null, "application/json")); <END> String result = getAsString(putresp, "result"); if (result.equalsIgnoreCase("created")) { log.info(String.format("Created Index: '%s'", indexDefinition)); } else { log.warn(String.format("Index already exists : '%s'", indexDefinition)); } } finally { close(putresp); } }</code><technical_language>this null indexDefinition</technical_language>

Target:
public void createIndex(String indexDefinition) { assertNotEmpty(indexDefinition, "indexDefinition"); InputStream putresp = null; URI uri = buildUri(getDBUri()).path("_index").build(); try { putresp = client.executeRequest(createPost(uri, indexDefinition, "application/json")); String result = getAsString(putresp, "result"); if (result.equalsIgnoreCase("created")) { log.info(String.format("Created Index: '%s'", indexDefinition)); } else { log.warn(String.format("Index already exists : '%s'", indexDefinition)); } } finally { close(putresp); } }
Source:
<code>public static void refreshEditor(DTreeEditor treeEditor, IStructuredSelection structuredSelection, IProgressMonitor theMonitor) { <START> IProgressMonitor subMonitor = new SubProgressMonitor(theMonitor, 1); <END> IRunnableWithProgress op = getRunnable(treeEditor, structuredSelection); if (op != null) { run(op, treeEditor); } try { subMonitor.worked(1); } finally { subMonitor.done(); } }</code><technical_language>I need add theMonitor.begin("Refreshing", 1);</technical_language>

Target:
public static void refreshEditor(DTreeEditor treeEditor, IStructuredSelection structuredSelection, IProgressMonitor theMonitor) { theMonitor.beginTask("Refreshing", 1); IProgressMonitor subMonitor = new SubProgressMonitor(theMonitor, 1); IRunnableWithProgress op = getRunnable(treeEditor, structuredSelection); if (op != null) { run(op, treeEditor); } try { subMonitor.worked(1); } finally { subMonitor.done(); } }
Source:
<code>protected FileTailingMessageProducerSupport createInstance() throws Exception { FileTailingMessageProducerSupport adapter; if (this.delay == null && this.end == null && this.reopen == null) { adapter = new OSDelegatingFileTailingMessageProducer(); if (this.nativeOptions != null) { ((OSDelegatingFileTailingMessageProducer) adapter).setOptions(this.nativeOptions); } } else { <START> Assert.isNull(this.nativeOptions, "Cannot have 'delay', 'end' or 'reopen' with a native adapter"); <END> adapter = new ApacheCommonsFileTailingMessageProducer(); if (this.delay != null) { ((ApacheCommonsFileTailingMessageProducer) adapter).setPollingDelay(this.delay); } if (this.end != null) { ((ApacheCommonsFileTailingMessageProducer) adapter).setEnd(this.end); } if (this.reopen != null) { ((ApacheCommonsFileTailingMessageProducer) adapter).setReopen(this.reopen); } } adapter.setFile(this.file); adapter.setTaskExecutor(this.taskExecutor); if (this.taskScheduler != null) { adapter.setTaskScheduler(this.taskScheduler); } if (this.fileDelay != null) { adapter.setTailAttemptsDelay(this.fileDelay); } adapter.setOutputChannel(outputChannel); adapter.setBeanName(this.beanName); if (this.autoStartup != null) { adapter.setAutoStartup(this.autoStartup); } if (this.phase != null) { adapter.setPhase(this.phase); } adapter.afterPropertiesSet(); this.adapter = adapter; return adapter; }</code><technical_language>this assert for ApacheCommonsFileTailingMessageProducer</technical_language>

Target:
protected FileTailingMessageProducerSupport createInstance() throws Exception { FileTailingMessageProducerSupport adapter; if (this.delay == null && this.end == null && this.reopen == null) { adapter = new OSDelegatingFileTailingMessageProducer(); if (this.nativeOptions != null) { ((OSDelegatingFileTailingMessageProducer) adapter).setOptions(this.nativeOptions); } } else { if (this.nativeOptions != null && StringUtils.hasText(this.nativeOptions) && logger.isWarnEnabled()) { logger.warn("'native-options' are ignored with an Apache commons-io 'Tailer' adapter"); } adapter = new ApacheCommonsFileTailingMessageProducer(); if (this.delay != null) { ((ApacheCommonsFileTailingMessageProducer) adapter).setPollingDelay(this.delay); } if (this.end != null) { ((ApacheCommonsFileTailingMessageProducer) adapter).setEnd(this.end); } if (this.reopen != null) { ((ApacheCommonsFileTailingMessageProducer) adapter).setReopen(this.reopen); } } adapter.setFile(this.file); adapter.setTaskExecutor(this.taskExecutor); if (this.taskScheduler != null) { adapter.setTaskScheduler(this.taskScheduler); } if (this.fileDelay != null) { adapter.setTailAttemptsDelay(this.fileDelay); } adapter.setOutputChannel(outputChannel); adapter.setBeanName(this.beanName); if (this.autoStartup != null) { adapter.setAutoStartup(this.autoStartup); } if (this.phase != null) { adapter.setPhase(this.phase); } adapter.afterPropertiesSet(); this.adapter = adapter; return adapter; }
Source:
<code>public ResponsePayload installApplication(ApplicationWrapper applicationWrapper, @PathParam("tenantDomain") String tenantDomain) throws MDMAPIException { ResponsePayload responseMsg = new ResponsePayload(); ApplicationManager appManagerConnector; org.wso2.carbon.device.mgt.common.operation.mgt.Operation operation = null; ArrayList<DeviceIdentifier> deviceIdentifiers; try { appManagerConnector = MDMAPIUtils.getAppManagementService(); MobileApp mobileApp = applicationWrapper.getApplication(); if (applicationWrapper.getDeviceIdentifiers() != null) { for (DeviceIdentifier deviceIdentifier : applicationWrapper.getDeviceIdentifiers()) { deviceIdentifiers = new ArrayList<DeviceIdentifier>(); if (deviceIdentifier.getType().equals(Platform.android.toString())) { operation = MDMAndroidOperationUtil.createInstallAppOperation(mobileApp); } else if (deviceIdentifier.getType().equals(Platform.ios.toString())) { operation = MDMIOSOperationUtil.createInstallAppOperation(mobileApp); } deviceIdentifiers.add(deviceIdentifier); } appManagerConnector.installApplicationForDevices(operation, applicationWrapper.getDeviceIdentifiers()); } Response.status(HttpStatus.SC_CREATED); <START> responseMsg.setMessageFromServer("Application has installed successfully."); <END> return responseMsg; } catch (ApplicationManagementException e) { String msg = "Error occurred while saving the operation"; log.error(msg, e); throw new MDMAPIException(msg, e); } }</code><technical_language>Wrong grammar in message used. Please fix</technical_language>

Target:
public ResponsePayload installApplication(ApplicationWrapper applicationWrapper, @PathParam("tenantDomain") String tenantDomain) throws MDMAPIException { ResponsePayload responseMsg = new ResponsePayload(); ApplicationManager appManagerConnector; org.wso2.carbon.device.mgt.common.operation.mgt.Operation operation = null; ArrayList<DeviceIdentifier> deviceIdentifiers; try { appManagerConnector = MDMAPIUtils.getAppManagementService(); MobileApp mobileApp = applicationWrapper.getApplication(); if (applicationWrapper.getDeviceIdentifiers() != null) { for (DeviceIdentifier deviceIdentifier : applicationWrapper.getDeviceIdentifiers()) { deviceIdentifiers = new ArrayList<DeviceIdentifier>(); if (deviceIdentifier.getType().equals(Platform.android.toString())) { operation = MDMAndroidOperationUtil.createInstallAppOperation(mobileApp); } else if (deviceIdentifier.getType().equals(Platform.ios.toString())) { operation = MDMIOSOperationUtil.createInstallAppOperation(mobileApp); } deviceIdentifiers.add(deviceIdentifier); } appManagerConnector.installApplicationForDevices(operation, applicationWrapper.getDeviceIdentifiers()); } Response.status(HttpStatus.SC_CREATED); responseMsg.setMessageFromServer("Application installation request has been sent to the device."); return responseMsg; } catch (ApplicationManagementException e) { String msg = "Error occurred while saving the operation"; log.error(msg, e); throw new MDMAPIException(msg, e); } }
Source:
<code>public void start() throws Exception { synchronized (handlers) { <START> if (!started.compareAndSet(false, true)) { <END> log.info("Already started and start was called. Silently skipping"); return; } for (Stage stage : stagesOrdered()) { currStage = stage; for (Handler handler : handlers.get(stage)) { handler.start(); } } } }</code><technical_language>this error? I stop, good reason for start called multiple times</technical_language>

Target:
public void start() throws Exception { synchronized (handlers) { if (!started.compareAndSet(false, true)) { throw new ISE("Already started"); } for (Stage stage : stagesOrdered()) { currStage = stage; for (Handler handler : handlers.get(stage)) { handler.start(); } } } }
Source:
<code>protected Object doGetValue() { try { return convertToNumber(); } catch (NumberFormatException e) { <START> e.printStackTrace(); <END> } return null; }</code><technical_language>This errors logged in console / error view is cleared for feature. I tested override isValueValid leaves feature untouched in case of NumberFormatException. this change try/catch block in doGetValue required anymore.. @Override public boolean isValueValid() { try { Number number = convertToNumber(); return (number != null); } catch (NumberFormatException e) { return false; } }</technical_language>

Target:
protected Object doGetValue() { return convertToNumber(); }
Source:
<code>protected void executeQueryCommand() { Guid vdsId = getParameters().getId(); VDS vds = vdsDao.get(vdsId); if (vds != null && FeatureSupported.isLlldpInformationSupported(vds.getClusterCompatibilityVersion())) { String[] names = new String[0]; GetLldpVDSCommandParameters lldpVDSCommandParameters = new GetLldpVDSCommandParameters(vdsId, names); VDSReturnValue command = runVdsCommand(VDSCommandType.GetLldp, lldpVDSCommandParameters); getQueryReturnValue().setReturnValue(command.getReturnValue()); } else { <START> getQueryReturnValue().setReturnValue(createEmptyResponse()); <END> } }</code><technical_language>'null' work</technical_language>

Target:
protected void executeQueryCommand() { Guid vdsId = getParameters().getId(); String[] names = new String[0]; setLldpVDSCommandParameters(new GetLldpVDSCommandParameters(vdsId, names)); super.executeQueryCommand(); }
Source:
<code><START> protected static Requirement buildRequirement(String importName) { <END> String filter = String.format("(%s=%s)", PackageNamespace.PACKAGE_NAMESPACE, importName.trim()); return new CapReqBuilder(PackageNamespace.PACKAGE_NAMESPACE).addDirective(PackageNamespace.REQUIREMENT_FILTER_DIRECTIVE, filter) .buildSyntheticRequirement(); }</code><technical_language>protected a lot. this class is designed for subclassing I do is, default private access for fields methods</technical_language>

Target:
private static Requirement buildRequirement(String importName) { final CapReqBuilder b = new CapReqBuilder(PackageNamespace.PACKAGE_NAMESPACE); b.addFilter(PackageNamespace.PACKAGE_NAMESPACE, importName, null, new Attrs()); return b.buildSyntheticRequirement(); }
Source:
<code>public Object invoke(Message request, ServiceDefinition definition) throws Exception { Preconditions.checkArgument(definition != null, "Service definition can't be null"); if (definition.returnType().equals(CompletableFuture.class)) { if (definition.parametrizedType().equals(Message.class)) { return futureInvokeMessage(request); } else { <START> return futureInvokeGeneric(request); <END> } } else { CompletableFuture<Object> future = futureInvokeGeneric(request); Object result = future.get(); return result; } }</code><technical_language>Correct if I wrong, invocations _futureInvokeMessage_ _futureInvokeGeneric_ pretty same, differenece is result of completable future message message.data. I suggest avoid duplication of code, some generic method message transformer function in parameters. e.g futureInvoke(request, message -> message.data())</technical_language>

Target:
public Object invoke(Message request, ServiceDefinition definition) throws Exception { Preconditions.checkArgument(definition != null, "Service definition can't be null"); if (definition.returnType().equals(CompletableFuture.class)) { if (definition.parametrizedType().equals(Message.class)) { return futureInvoke(request, message -> message); } else { return futureInvoke(request, message -> message.data()); } } else { throw new UnsupportedOperationException("Method: " + definition.method() + " must return CompletableFuture"); } }
Source:
<code>public boolean test() { internalBrowser = new InternalBrowser(); if (url != null) { <START> internalBrowser.setURL(url); <END> } if (this.refresh) { internalBrowser.refresh(); } new WaitUntil(new PageIsLoaded(internalBrowser)); if (Platform.getOS().startsWith(Platform.OS_WIN32)) { return internalBrowser.getText().contains(text); } else { String pageHTML = ""; if (!StringUtils.isEmpty(internalBrowser.getURL())) { pageHTML = (String) internalBrowser.evaluate("return document.documentElement.innerHTML;"); } return pageHTML.contains(text); } }</code><technical_language>wrong set URL everytime a condition is tested. done left user. In case a constructor url parameter</technical_language>

Target:
public boolean test() { new WaitUntil(new PageIsLoaded(browser)); if (Platform.getOS().startsWith(Platform.OS_WIN32)) { return browser.getText().contains(text); } else { String pageHTML = ""; if (!StringUtils.isEmpty(browser.getURL())) { pageHTML = (String) browser.evaluate("return document.documentElement.innerHTML;"); } return pageHTML.contains(text); } }
Source:
<code>protected List<Instance> collectInstancesFromReservations(List<Reservation> reservation) { <START> List<List<Instance>> allInstances = Lists.newArrayList(Lists.transform(reservation, new Function<Reservation, List<Instance>>() { <END> @Override public List<Instance> apply(Reservation reservation) { return reservation.getInstances(); } })); return Lists.newArrayList(Iterables.concat(allInstances)); }</code><technical_language>A defensive copy is needed</technical_language>

Target:
protected List<Instance> collectInstancesFromReservations(List<Reservation> reservation) { List<List<Instance>> allInstances = Lists.transform(reservation, new Function<Reservation, List<Instance>>() { @Override public List<Instance> apply(Reservation reservation) { return reservation.getInstances(); } }); return Lists.newArrayList(Iterables.concat(allInstances)); }
Source:
<code>private void createWorkAllocationBoard() { logger.info("Creating " + WORK_ALLOCATION + " board"); List<TurboUser> userList = ui.logic.getRepo(ui.logic.getDefaultRepo()).getUsers(); if (userList.isEmpty()) { DialogMessage.showInformationDialog("Auto-create Board - " + WORK_ALLOCATION, WORK_ALLOCATION + " board cannot be created as your" + " account has no push access to the default repo."); return; } panelControl.closeAllPanels(); FilterPanel panelAdded; TurboUser currUser; String realName, loginName; for (int i = 0; i < Math.min(MAX_WORK_ALLOCATION_PANELS, userList.size()); i++){ currUser = userList.get(i); realName = currUser.getRealName(); loginName = currUser.getLoginName(); panelAdded = panelControl.addPanelAt(i); panelAdded.setPanelName("Work allocated to " + (!realName.isEmpty() ? realName : loginName)); panelAdded.setFilterByString("assignee:" + loginName + " sort:milestone,status"); } panelControl.selectFirstPanel(); String boardName = Utility.generateName(WORK_ALLOCATION, prefs.getAllBoards().keySet().stream().collect(Collectors.toList())); triggerBoardSaveEventSequence(boardName); DialogMessage.showInformationDialog("Auto-create Board - " + WORK_ALLOCATION, WORK_ALLOCATION + " board has been created and loaded.\n\n" + <START> "It is saved under the name \"" + boardName + "\"."); <END> }</code><technical_language>higher levels extracted out increase testability reuse? 1. a method takes a list of TurboUser objects return a list of filter strings 2. a method takes a list of filter strings creates a board for (this method reused other places)</technical_language>

Target:
private void createWorkAllocationBoard() { logger.info("Creating " + WORK_ALLOCATION + " board"); List<TurboUser> userList = ui.logic.getRepo(ui.logic.getDefaultRepo()).getUsers(); if (userList.isEmpty()) { DialogMessage.showInformationDialog("Auto-create Board - " + WORK_ALLOCATION, WORK_ALLOCATION + " board cannot be created as your" + " account has no push access to the default repo."); return; } int noOfPanelsToBeGenerated = Math.min(MAX_WORK_ALLOCATION_PANELS, userList.size()); List<PanelInfo> panelData = generatePanelInfoFromTurboUsers(userList.subList(0, noOfPanelsToBeGenerated), "Work allocated to %s", "assignee:%s sort:milestone,status"); String boardName = Utility.getNameClosestToDesiredName(WORK_ALLOCATION, prefs.getAllBoardNames()); createBoard(panelData, boardName); DialogMessage.showInformationDialog("Auto-create Board - " + WORK_ALLOCATION, WORK_ALLOCATION + " board has been created and loaded.\n\n" + "It is saved under the name \"" + boardName + "\"."); }
Source:
<code>public boolean hasZeroLockAcquisition() { if (modifications == null || modifications.length == 0) { return false; } boolean hasZeroLock = true; for (WriteCommand wc : modifications) { if (!wc.hasAnyFlag(FlagBitSets.ZERO_LOCK_ACQUISITION_TIMEOUT)) { <START> hasZeroLock = false; <END> break; } } return hasZeroLock; }</code><technical_language>return false avoid variable</technical_language>

Target:
public boolean hasZeroLockAcquisition() { if (modifications == null || modifications.length == 0) { return false; } for (WriteCommand wc : modifications) { if (!wc.hasAnyFlag(FlagBitSets.ZERO_LOCK_ACQUISITION_TIMEOUT)) { return false; } } return true; }
Source:
<code>private List<LUNs> getLUNsFromVgInfo(String vgId) { VDSReturnValue returnValue; try { <START> returnValue = getVdsBroker().RunVdsCommand(VDSCommandType.GetVGInfo, <END> new GetVGInfoVDSCommandParameters(getParameters().getVdsId(), vgId)); } catch (RuntimeException e) { log.errorFormat("Could not get info for VG ID: {0}. Error message: {1}", vgId, e.getMessage()); return null; } return (ArrayList<LUNs>) returnValue.getReturnValue(); }</code><technical_language>switch runVdsCommand</technical_language>

Target:
private List<LUNs> getLUNsFromVgInfo(String vgId) { List<LUNs> luns = new ArrayList<>(); VDSReturnValue returnValue; try { returnValue = runVdsCommand(VDSCommandType.GetVGInfo, new GetVGInfoVDSCommandParameters(getParameters().getVdsId(), vgId)); } catch (RuntimeException e) { log.errorFormat("Could not get info for VG ID: {0}. Error message: {1}", vgId, e.getMessage()); return luns; } luns.addAll((ArrayList<LUNs>) returnValue.getReturnValue()); return luns; }
Source:
<code>public boolean isHookFor(Collection<? extends URI> uris) { for (URI uri : uris) { <START> if (UmlModel.UML_FILE_EXTENSION.equals(uri.fileExtension())) { <END> return true; } } return false; }</code><technical_language>this hook triggered for Papyrus resource (especially notation)? for line 49</technical_language>

Target:
public boolean isHookFor(Collection<? extends URI> uris) { for (URI uri : uris) { if (fileExtensions.contains(uri.fileExtension())) { return true; } } return false; }
Source:
<code>public ChangeBendpointsOfEdgesCommand(IGraphicalEditPart movedPart, PrecisionPoint moveDelta) { super(movedPart.getEditingDomain(), <START> Messages.ChangeBendpointsOfEdgesCommand_adaptEdgeBendpointsCommandLabel, null); <END> this.movedPart = movedPart; this.moveDelta = moveDelta; }</code><technical_language>simply "label"</technical_language>

Target:
public ChangeBendpointsOfEdgesCommand(IGraphicalEditPart movedPart, PrecisionPoint moveDelta) { super(movedPart.getEditingDomain(), Messages.ChangeBendpointsOfEdgesCommand_label, null); this.movedPart = movedPart; this.moveDelta = moveDelta; }
Source:
<code>public void load(GlowAreaEffectCloud entity, CompoundTag tag) { super.load(entity, tag); handleIntIfPresent(tag, COLOR, rgb -> entity.setColor(Color.fromRGB(rgb))); handleIntIfPresent(tag, DURATION, entity::setDuration); handleIntIfPresent(tag, REAPPLICATION_DELAY, entity::setReapplicationDelay); handleIntIfPresent(tag, WAIT_TIME, entity::setWaitTime); handleIntIfPresent(tag, DURATION_ON_USE, entity::setDurationOnUse); handleFloatIfPresent(tag, RADIUS, entity::setRadius); handleFloatIfPresent(tag, RADIUS_ON_USE, entity::setRadiusOnUse); handleFloatIfPresent(tag, RADIUS_PER_TICK, entity::setRadiusPerTick); if (tag.isString(PARTICLE)) { final String particle = tag.getString(PARTICLE); try { entity.setParticle(Particle.valueOf(particle)); } catch (IllegalArgumentException e) { <START> Bukkit.getServer().getLogger().warning(String.format( <END> "Ignoring invalid particle type %s in tag %s", particle, tag)); } } if (tag.isCompoundList(EFFECTS)) { tag.getCompoundList(EFFECTS) .stream() .map(GlowMetaPotion::fromNbt) .forEach(effect -> entity.addCustomEffect(effect, false)); } }</code><technical_language>log(Level.WARNING, ...)</technical_language>

Target:
public void load(GlowAreaEffectCloud entity, CompoundTag tag) { super.load(entity, tag); handleIntIfPresent(tag, COLOR, rgb -> entity.setColor(Color.fromRGB(rgb))); handleIntIfPresent(tag, DURATION, entity::setDuration); handleIntIfPresent(tag, REAPPLICATION_DELAY, entity::setReapplicationDelay); handleIntIfPresent(tag, WAIT_TIME, entity::setWaitTime); handleIntIfPresent(tag, DURATION_ON_USE, entity::setDurationOnUse); handleFloatIfPresent(tag, RADIUS, entity::setRadius); handleFloatIfPresent(tag, RADIUS_ON_USE, entity::setRadiusOnUse); handleFloatIfPresent(tag, RADIUS_PER_TICK, entity::setRadiusPerTick); if (tag.isString(PARTICLE)) { final String particle = tag.getString(PARTICLE); try { entity.setParticle(Particle.valueOf(particle)); } catch (IllegalArgumentException e) { GlowServer.logger.warning(() -> String.format( "Ignoring invalid particle type %s in tag %s", particle, tag)); } } if (tag.isCompoundList(EFFECTS)) { tag.getCompoundList(EFFECTS) .stream() .map(GlowMetaPotion::fromNbt) .forEach(effect -> entity.addCustomEffect(effect, false)); } }
Source:
<code>public void testPartialSpecializationResolution_525288() throws Exception { String code = getAboveComment(); IFile file = importFile("testBug525288.cpp", code); int offset = code.indexOf("a0") - 5; IASTNode target = testF3(file, offset); assertInstance(target, IASTName.class); <START> assertEquals("A<0>", ((IASTName) target).toString()); <END> offset = code.indexOf("a1") - 5; target = testF3(file, offset); assertInstance(target, IASTName.class); assertEquals("A", ((IASTName) target).toString()); }</code><technical_language>CPPASTNameBase.sAllowNameComputation needs set "true" in test, if test is querying string representations of template-ids. some existing tests set this flag</technical_language>

Target:
public void testPartialSpecializationResolution_525288() throws Exception { CPPASTNameBase.sAllowNameComputation = true; String code = getAboveComment(); IFile file = importFile("testBug525288.cpp", code); int offset = code.indexOf("a0") - 5; IASTNode target = testF3(file, offset); assertInstance(target, IASTName.class); assertEquals("A<0>", ((IASTName) target).toString()); offset = code.indexOf("a1") - 5; target = testF3(file, offset); assertInstance(target, IASTName.class); assertEquals("A", ((IASTName) target).toString()); }
Source:
<code>public void transform(StructuredRecord in, Emitter<StructuredRecord> emitter) throws Exception { StructuredRecord.Builder builder = StructuredRecord.builder(outSchema); Schema inSchema = in.getSchema(); List<Field> inFields = inSchema.getFields(); for (Field field : inFields) { String name = field.getName(); if (!outSchemaMap.containsKey(name)) { continue; } Schema.Type outFieldType = outSchemaMap.get(name); if (!encodeMap.containsKey(name) || encodeMap.get(name) == EncodeType.NONE) { builder.set(name, in.get(name)); } else { byte[] obj = new byte[0]; if (field.getSchema().getType() == Schema.Type.STRING) { obj = ((String) in.get(name)).getBytes(); } else if (field.getSchema().getType() == Schema.Type.BYTES) { obj = in.get(name); } byte[] outValue = new byte[0]; EncodeType type = encodeMap.get(name); if (type == EncodeType.STRING_BASE32) { outValue = base32Encoder.encodeAsString(obj).getBytes(); } else if (type == EncodeType.BASE32) { outValue = base32Encoder.encode(obj); } else if (type == EncodeType.STRING_BASE64) { outValue = base64Encoder.encodeAsString(obj).getBytes(); } else if (type == EncodeType.BASE64) { outValue = base64Encoder.encode(obj); } else if (type == EncodeType.HEX) { outValue = hexEncoder.encode(obj); } if (outFieldType == Schema.Type.BYTES) { builder.set(name, outValue); } else if (outFieldType == Schema.Type.STRING) { builder.set(name, new String(outValue)); <START> } <END> } } emitter.emit(builder.build()); }</code><technical_language>throw Exception if is other Bytes String</technical_language>

Target:
public void transform(StructuredRecord in, Emitter<StructuredRecord> emitter) throws Exception { StructuredRecord.Builder builder = StructuredRecord.builder(outSchema); Schema inSchema = in.getSchema(); List<Field> inFields = inSchema.getFields(); for (Field field : inFields) { String name = field.getName(); if (!outSchemaMap.containsKey(name)) { continue; } Schema.Type outFieldType = outSchemaMap.get(name); if (!encodeMap.containsKey(name) || encodeMap.get(name) == EncodeType.NONE) { builder.set(name, in.get(name)); } else { byte[] obj = new byte[0]; if (field.getSchema().getType() == Schema.Type.STRING) { obj = ((String) in.get(name)).getBytes(); } else if (field.getSchema().getType() == Schema.Type.BYTES) { obj = in.get(name); } byte[] outValue = new byte[0]; EncodeType type = encodeMap.get(name); if (type == EncodeType.STRING_BASE32) { outValue = base32Encoder.encodeAsString(obj).getBytes(); } else if (type == EncodeType.BASE32) { outValue = base32Encoder.encode(obj); } else if (type == EncodeType.STRING_BASE64) { outValue = base64Encoder.encodeAsString(obj).getBytes(); } else if (type == EncodeType.BASE64) { outValue = base64Encoder.encode(obj); } else if (type == EncodeType.HEX) { outValue = hexEncoder.encode(obj); } if (outFieldType == Schema.Type.BYTES) { builder.set(name, outValue); } else if (outFieldType == Schema.Type.STRING) { builder.set(name, new String(outValue, "UTF-8")); } } } emitter.emit(builder.build()); }