auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public static void removeStatementPatternIds(TransactionBase tx, Set<String> ids) { Optional<Bytes> val = Optional.fromNullable(tx.get(Bytes.of(STATEMENT_PATTERN_ID), STATEMENT_PATTERN_IDS)); Set<String> storedIds = new HashSet<>(); <START> if (val.isPresent()) { <END> storedIds = Sets.newHashSet(val.get().toString().split(VAR_DELIM)); } storedIds.removeAll(ids); String idString = Joiner.on(VAR_DELIM).join(ids); tx.set(Bytes.of(STATEMENT_PATTERN_ID), STATEMENT_PATTERN_IDS, Bytes.of(idString)); tx.set(Bytes.of(STATEMENT_PATTERN_ID), STATEMENT_PATTERN_IDS_HASH, Bytes.of(Hashing.sha256().hashString(idString).toString())); }</code><technical_language>null checks params</technical_language>

Target:
public static void removeStatementPatternIds(TransactionBase tx, Set<String> ids) { checkNotNull(tx); checkNotNull(ids); Optional<Bytes> val = Optional.fromNullable(tx.get(Bytes.of(STATEMENT_PATTERN_ID), STATEMENT_PATTERN_IDS)); Set<String> storedIds = new HashSet<>(); if (val.isPresent()) { storedIds = Sets.newHashSet(val.get().toString().split(VAR_DELIM)); } storedIds.removeAll(ids); String idString = Joiner.on(VAR_DELIM).join(ids); tx.set(Bytes.of(STATEMENT_PATTERN_ID), STATEMENT_PATTERN_IDS, Bytes.of(idString)); tx.set(Bytes.of(STATEMENT_PATTERN_ID), STATEMENT_PATTERN_IDS_HASH, Bytes.of(Hashing.sha256().hashString(idString).toString())); }
Source:
<code>public String getFile(@PathVariable("id") final String id, final HttpServletRequest request) { String encodedId; try { encodedId = URLEncoder.encode(id, "UTF-8"); } catch (UnsupportedEncodingException e) { log.warn("Failed to encode id: {}", id, e); <START> encodedId = id; <END> } final String path = "/api/v3/jobs/" + encodedId + "/" + ControllerUtils.getRemainingPath(request); return "forward:" + path; }</code><technical_language>this point reason throw exception return error client</technical_language>

Target:
public String getFile( @PathVariable("id") final String id, final HttpServletRequest request ) throws UnsupportedEncodingException { final String encodedId = URLEncoder.encode(id, "UTF-8"); final String path = "/api/v3/jobs/" + encodedId + "/" + ControllerUtils.getRemainingPath(request); return "forward:" + path; }
Source:
<code>void remove(K key) { heads.writeLock().lock(); try { heads.computeIfPresent(key, (k, v) -> null); <START> } finally { <END> heads.writeLock().unlock(); } }</code><technical_language>do remove is overridden? I work: java public void remove(K key) { heads.writeLock().lock(); try { heads.remove(key).close(); } finally { heads.writeLock().unlock(); } }</technical_language>

Target:
void remove(K key) { heads.removeNoReturn(key); }
Source:
<code>public synchronized void markFailure() { final Status currentStatus = this.updateAndGetStatus(); switch (currentStatus) { case CLOSED: this.processFailureWhenClosed(); break; <START> case HALF_OPEN: <END> this.openCircuit(); break; case OPEN: LOGGER.debug("New failure. No action needed, circuit already open."); break; default: break; } }</code><technical_language>Status HALF_OPEN here, updateAndGetStatus method return OPEN CLOSED</technical_language>

Target:
public void markFailure() { final boolean isCurrentlyClosed = this.isClosed(); if (isCurrentlyClosed) { this.processFailureWhenClosed(); } else { LOGGER.debug("New failure. No action needed, circuit already open."); } }
Source:
<code>public void testQueryTaskByVariablesWithAllOwners() { Map<String, Object> variables = emptyMap(); Map<String, Object> attributes = emptyMap(); List<String> potOwners = Arrays.asList("katy", "nobody"); <START> List<UserTaskInstanceWithPotOwnerDesc> data = advanceVariableDataService.queryUserTasksByVariables(attributes, variables, emptyMap(), potOwners, new QueryContext(0, 2)); <END> Assert.assertEquals(0, data.size()); }</code><technical_language>I pagination avoid confusion in test. I create a separate test for pagination</technical_language>

Target:
public void testQueryTaskByVariablesWithAllOwners() { List<String> potOwners = Arrays.asList("katy", "nobody"); List<UserTaskInstanceWithPotOwnerDesc> data = advanceVariableDataService.queryUserTasksByVariables(emptyList(), emptyList(), emptyList(), potOwners, queryContext); Assert.assertEquals(0, data.size()); }
Source:
<code>private boolean isRecord(Schema schema) { if (schema == null) { return false; } Schema.Type type = schema.getType(); <START> if (type == Schema.Type.RECORD) { <END> return true; } if (schema.isNullable()) { Schema nonNullable = schema.getNonNullable(); return nonNullable.getType() == Schema.Type.RECORD; } return false; }</code><technical_language>refactor this if more compact code checking nonnullable ternary operator</technical_language>

Target:
private boolean isRecord(Schema schema) { if (schema == null) { return false; } Schema.Type type = schema.isNullable() ? schema.getNonNullable().getType() : schema.getType(); return type == Schema.Type.RECORD; }
Source:
<code>private CompletionStage<Void> addTransfers(IntSet segments) { log.debugf("Adding inbound state transfer for segments %s", segments); Set<Address> excludedSources = new HashSet<>(); Map<Address, IntSet> sources = new HashMap<>(); CompletionStage<Void> stage = CompletableFutures.completedNull(); if (isTransactional && !isTotalOrder) { <START> stage = stage.thenCompose(ignored -> requestTransactions(segments, sources, excludedSources)); <END> } if (isFetchEnabled) { stage = stage.thenRun(() -> requestSegments(segments, sources, excludedSources)); } return stage; }</code><technical_language>Nitpick, if this else block remove thenCompose lambda allocation</technical_language>

Target:
private CompletionStage<Void> addTransfers(IntSet segments) { log.debugf("Adding inbound state transfer for segments %s", segments); Set<Address> excludedSources = new HashSet<>(); Map<Address, IntSet> sources = new HashMap<>(); CompletionStage<Void> stage = CompletableFutures.completedNull(); if (isTransactional && !isTotalOrder) { stage = requestTransactions(segments, sources, excludedSources); } if (isFetchEnabled) { stage = stage.thenRun(() -> requestSegments(segments, sources, excludedSources)); } return stage; }
Source:
<code>public Object getAdapter(Object adaptableObject, Class adapterType) { if (adapterType == IPropertySheetPage.class) { if (propertySheetPage == null) { if (adaptableObject instanceof CompareEditor) { IEditorInput editorInput = ((CompareEditor)adaptableObject).getEditorInput(); if (editorInput instanceof CompareEditorInput) { propertySheetPage = new ExtendedPropertySheetPage(null); <START> CompareConfiguration configuration = ((CompareEditorInput)editorInput) <END> .getCompareConfiguration(); } } } return propertySheetPage; } return null; }</code><technical_language>Remove this line variable "configuration" useless</technical_language>

Target:
public Object getAdapter(Object adaptableObject, Class adapterType) { if (adapterType == IPropertySheetPage.class) { if (propertySheetPage == null) { if (adaptableObject instanceof CompareEditor) { IEditorInput editorInput = ((CompareEditor)adaptableObject).getEditorInput(); if (editorInput instanceof CompareEditorInput) { propertySheetPage = new ExtendedPropertySheetPage(null); } } } return propertySheetPage; } return null; }
Source:
<code>private void checkForCSRF(ASTMethod node, Object data) { if (node.isConstructor()) { if (Helper.foundAnyDML(node)) { addViolation(data, node); } } String name = node.getImage(); <START> if (INIT.equalsIgnoreCase(name) || STATIC_INITIALIZER.equals(name)) { <END> if (Helper.foundAnyDML(node)) { addViolation(data, node); } } }</code><technical_language>a java expert I combine ifs one. If unreadable I extract outer tests a method</technical_language>

Target:
private void checkForCSRF(ASTMethod node, Object data) { if (node.isConstructor() && Helper.foundAnyDML(node)) { addViolation(data, node); } String name = node.getImage(); if (isInitializerMethod(name) && Helper.foundAnyDML(node)) { addViolation(data, node); } }
Source:
<code>public int hashCode() { <START> return Objects.hash(getUsername(), getPolicy(), getContext(), getTitle(), ttl); <END> }</code><technical_language>Similar previous statement. accessing TTL here? Is a matter of int a string / object</technical_language>

Target:
public int hashCode() { return Objects.hash(getUsername(), getPolicy(), getContext(), getTitle(), getTTL()); }
Source:
<code>Path(String definition) throws IOException { this.definition = definition; for (String filePath : definition.split(Pattern.quote(File.pathSeparator))) { try { addElement(getClassPathElement(new File(filePath))); } catch (IOException e) { throw new <START> IOException("\"" + filePath + "\" <END> can not be used as a classpath" + " element. (" + e.getMessage() + ")", e); } } }</code><technical_language>Redundant e.getMessage? "Wrong class path: e.getMessage"</technical_language>

Target:
Path(String definition) throws IOException { this.definition = definition; for (String filePath : definition.split(Pattern.quote(File.pathSeparator))) { try { addElement(getClassPathElement(new File(filePath))); } catch (IOException e) { throw new IOException("Wrong classpath: " + e.getMessage(), e); } } }
Source:
<code>public DnsConfigurationModel() { <START> getEntityChangedEvent().addListener(new IEventListener<EventArgs>() { <END> @Override public void eventRaised(Event<? extends EventArgs> ev, Object sender, EventArgs args) { init(); } }); getPropertyChangedEvent().addListener(new IEventListener<PropertyChangedEventArgs>() { @Override public void eventRaised(Event<? extends PropertyChangedEventArgs> ev, Object sender, PropertyChangedEventArgs args) { if ("IsChangable".equals(args.propertyName)) { boolean value = getIsChangable(); setDnsConfiguration.setIsChangeable(value); nameServerModelListModel.setIsChangeable(value); } } }); }</code><technical_language>prefer overriding of setEntity() method listening for events in this case</technical_language>

Target:
public DnsConfigurationModel() { listenToSetDnsConfigurationCheckboxChanges(); getPropertyChangedEvent().addListener(new IEventListener<PropertyChangedEventArgs>() { @Override public void eventRaised(Event<? extends PropertyChangedEventArgs> ev, Object sender, PropertyChangedEventArgs args) { if ("IsChangable".equals(args.propertyName)) { boolean value = getIsChangable(); shouldSetDnsConfiguration.setIsChangeable(value); nameServerModelListModel.setIsChangeable(value); } } }); }
Source:
<code>private List<ActivityLogEntry> searchLogsByQuery(LogQuery query, AdminActivityLogPageData data) { List<ActivityLogEntry> appLogs = new LinkedList<ActivityLogEntry>(); Iterable<RequestLogs> records = LogServiceFactory.getLogService().fetch(query); for (RequestLogs record : records) { <START> record.getOffset(); <END> List<AppLogLine> appLogLines = record.getAppLogLines(); for (AppLogLine appLog : appLogLines) { totalLogsSearched++; String logMsg = appLog.getLogMessage(); if (logMsg.contains("TEAMMATESLOG") && !logMsg.contains("adminActivityLogPage")) { ActivityLogEntry activityLogEntry = new ActivityLogEntry(appLog); activityLogEntry = data.filterLogs(activityLogEntry); if (activityLogEntry.toShow() && ((!activityLogEntry.isTestingData()) || data.getIfShowTestData())) { if (isFirstRow ) { activityLogEntry.setFirstRow(); isFirstRow = false; } appLogs.add(activityLogEntry); } } } } return appLogs; }</code><technical_language>is this line necessary</technical_language>

Target:
private List<ActivityLogEntry> searchLogsByQuery(LogQuery query, AdminActivityLogPageData data) { List<ActivityLogEntry> appLogs = new LinkedList<ActivityLogEntry>(); Iterable<RequestLogs> records = LogServiceFactory.getLogService().fetch(query); for (RequestLogs record : records) { List<AppLogLine> appLogLines = record.getAppLogLines(); for (AppLogLine appLog : appLogLines) { totalLogsSearched++; String logMsg = appLog.getLogMessage(); if (logMsg.contains("TEAMMATESLOG") && !logMsg.contains("adminActivityLogPage")) { ActivityLogEntry activityLogEntry = new ActivityLogEntry(appLog); activityLogEntry = data.filterLogs(activityLogEntry); if (activityLogEntry.toShow() && ((!activityLogEntry.isTestingData()) || data.getIfShowTestData())) { if (isFirstRow ) { activityLogEntry.setFirstRow(); isFirstRow = false; } appLogs.add(activityLogEntry); } } } } return appLogs; }
Source:
<code>private List<Security> getSecurities() { IStructuredSelection selection = (IStructuredSelection) viewer.getStructuredSelection(); if (selection.isEmpty()) return null; List<Security> selectedSecurities = new ArrayList<>(); Iterator<Security> selectionIterator = selection.iterator(); while(selectionIterator.hasNext()) { Object object = selectionIterator.next(); Security selectedSecurity; if(object instanceof Security) { selectedSecurity = (Security) object; selectedSecurities.add(selectedSecurity); }else if(object instanceof Adaptable) { selectedSecurity = ((Adaptable) object).adapt(Security.class); <START> selectedSecurities.add(selectedSecurity); <END> }else{ } } return selectedSecurities; }</code><technical_language>I need a check for *null* here. Previously, adoptable, returning null a problem meant that: security selected. However, in list of securities, null values</technical_language>

Target:
private List<Security> getSecurities() { IStructuredSelection selection = (IStructuredSelection) viewer.getStructuredSelection(); if (selection.isEmpty()) return null; List<Security> selectedSecurities = new ArrayList<>(); Iterator<Security> selectionIterator = selection.iterator(); while (selectionIterator.hasNext()) { Object object = selectionIterator.next(); Security selectedSecurity; if (object instanceof Security) { selectedSecurity = (Security) object; selectedSecurities.add(selectedSecurity); } else if (object instanceof Adaptable) { selectedSecurity = ((Adaptable) object).adapt(Security.class); if (selectedSecurity != null) { selectedSecurities.add(selectedSecurity); } } else { } } return selectedSecurities; }
Source:
<code>public static Result update(String hash) { DynamicForm dynamicForm = Application.dynamicForm.bindFromRequest(request()); Record record = createRecordFromParams(dynamicForm.data()); List<ValError> validationErrors = new Validator(Register.instance.registerInfo().keys).validate(record); if (validationErrors.isEmpty()) { try { Register.instance.store().update(hash, record); <START> return redirect("/hash/" + record.getHash()); <END> } catch (DatabaseException e) { dynamicForm.reject(e.getMessage()); return ok(views.html.updateEntry.render( Register.instance.registerInfo().keys, dynamicForm, hash)); } } validationErrors.stream().forEach(error -> dynamicForm.reject(error.key, "error.required")); return ok(views.html.updateEntry.render( Register.instance.registerInfo().keys, dynamicForm, hash)); }</code><technical_language>Please play reverse routing: <LINK_0></technical_language>

Target:
public static Result update(String hash) { DynamicForm dynamicForm = Application.dynamicForm.bindFromRequest(request()); Record record = createRecordFromParams(dynamicForm.data()); List<ValidationError> validationErrors = new Validator(Register.instance.registerInfo().keys).validate(record); if (validationErrors.isEmpty()) { try { Register.instance.store().update(hash, record); return redirect(controllers.api.routes.Rest.findByHash(record.getHash())); } catch (DatabaseException e) { dynamicForm.reject(e.getMessage()); return ok(views.html.updateEntry.render( Register.instance.registerInfo().keys, dynamicForm, hash)); } } validationErrors.stream().forEach(error -> dynamicForm.reject(error.key, "error.required")); return ok(views.html.updateEntry.render( Register.instance.registerInfo().keys, dynamicForm, hash)); }
Source:
<code>private void initFilters() { IDialogSettings settings = getSettings(); fTreeViewer.addFilter(fJavaFilter); boolean hideWorkspace = settings.getBoolean(HIDE_WRKSPC); boolean hideEnabledExternal = settings.getBoolean(HIDE_EXENABLED); boolean hideDisabledExternal = !settings.getBoolean(SHOW_EXDISABLED); if (hideWorkspace) fTreeViewer.addFilter(fHideWorkspaceFilter); if (hideEnabledExternal) fTreeViewer.addFilter(fHideExtEnabledFilter); if (hideDisabledExternal) fTreeViewer.addFilter(fHideExtDisabledFilter); fHideWorkspaceFilterAction.setChecked(!hideWorkspace); fHideExtEnabledFilterAction.setChecked(!hideEnabledExternal); fHideExtDisabledFilterAction.setChecked(!hideDisabledExternal); if (PDECore.getDefault().getModelManager().isInitialized()) { PDEState state = PDECore.getDefault().getModelManager().getState(); <START> fSourcePluginFilter = new SourcePluginFilter(state); <END> } else { Job.createSystem("", monitor -> { PDEState state = TargetPlatformHelper.getPDEState(); Tree tree = fTreeViewer.getTree(); if (!tree.isDisposed()) { tree.getDisplay().asyncExec(() -> { fSourcePluginFilter = new SourcePluginFilter(state); fTreeViewer.addFilter(fSourcePluginFilter); }); } }).schedule(); } }</code><technical_language>filter is added</technical_language>

Target:
private void initFilters() { IDialogSettings settings = getSettings(); fTreeViewer.addFilter(fJavaFilter); boolean hideWorkspace = settings.getBoolean(HIDE_WRKSPC); boolean hideEnabledExternal = settings.getBoolean(HIDE_EXENABLED); boolean hideDisabledExternal = !settings.getBoolean(SHOW_EXDISABLED); if (hideWorkspace) fTreeViewer.addFilter(fHideWorkspaceFilter); if (hideEnabledExternal) fTreeViewer.addFilter(fHideExtEnabledFilter); if (hideDisabledExternal) fTreeViewer.addFilter(fHideExtDisabledFilter); fHideWorkspaceFilterAction.setChecked(!hideWorkspace); fHideExtEnabledFilterAction.setChecked(!hideEnabledExternal); fHideExtDisabledFilterAction.setChecked(!hideDisabledExternal); if (PDECore.getDefault().getModelManager().isInitialized()) { PDEState state = PDECore.getDefault().getModelManager().getState(); fSourcePluginFilter = new SourcePluginFilter(state); fTreeViewer.addFilter(fSourcePluginFilter); } else { Job.createSystem("", monitor -> { PDEState state = TargetPlatformHelper.getPDEState(); Tree tree = fTreeViewer.getTree(); if (!tree.isDisposed()) { tree.getDisplay().asyncExec(() -> { fSourcePluginFilter = new SourcePluginFilter(state); fTreeViewer.addFilter(fSourcePluginFilter); }); } }).schedule(); } }
Source:
<code>public void testDeleteWhen404() throws InterruptedException { server.enqueue(jsonResponse("/virtualmachinescalesetlist.json").setResponseCode(404)); final VirtualMachineScaleSetApi vmssAPI = api.getVirtualMachineScaleSetApi(resourcegroup); <START> vmssAPI.delete(vmssname); <END> assertSent(server, "DELETE", "/subscriptions/SUBSCRIPTIONID/resourceGroups/myresourcegroup/providers/" + "Microsoft.Compute" + "/VirtualMachineScaleSets/" + vmssname + "?api-version=2017-03-30"); }</code><technical_language>Verify returns null</technical_language>

Target:
public void testDeleteWhen404() throws InterruptedException { server.enqueue(jsonResponse("/virtualmachinescalesetlist.json").setResponseCode(404)); final VirtualMachineScaleSetApi vmssAPI = api.getVirtualMachineScaleSetApi(resourcegroup); assertNull(vmssAPI.delete(vmssname)); assertSent(server, "DELETE", "/subscriptions/SUBSCRIPTIONID/resourceGroups/myresourcegroup/providers/" + "Microsoft.Compute" + "/VirtualMachineScaleSets/" + vmssname + "?api-version=2017-03-30"); }
Source:
<code>private void validateFilePath(ApplicationContext currentContext) { <START> if (!isFilePathValid(pathname) || !isXMLFile(pathname)) { <END> throw new CLIException(REASON_INVALID_ARGUMENTS, String.format("'%s' is not a valid file.", pathname)); } if (isFileExisting(pathname) && isFileEmpty(pathname)) { throw new CLIException(REASON_FILE_EMPTY, String.format("'%s' is empty.", pathname)); } if (!isFileExisting(pathname)) { throw new CLIException(REASON_INVALID_ARGUMENTS, String.format("'%s' does not exist.", pathname)); } }</code><technical_language>discarding non-xml files, break possibility submit a job archive in code: if (APPLICATION_XML.getMimeType().equals(contentType)) { jobId = currentContext.getRestClient().submitXml(currentContext.getSessionId(), new FileInputStream(jobFile), map(this.variables)); } else { jobId = currentContext.getRestClient().submitJobArchive(currentContext.getSessionId(), new FileInputStream(jobFile), map(this.variables)); } investigate purpose of submitJobArchive, if a valid osbolete feature</technical_language>

Target:
private void validateFilePath(ApplicationContext currentContext) throws JobCreationRestException { if (!isFilePathValid(pathname)) { throw new CLIException(REASON_INVALID_ARGUMENTS, String.format("'%s' is not a valid file.", pathname)); } if (!isValidFileMimeType(pathname)) { throw new JobCreationRestException("Unknown job descriptor type: " + pathname); } if (isFileExisting(pathname) && isFileEmpty(pathname)) { throw new CLIException(REASON_FILE_EMPTY, String.format("'%s' is empty.", pathname)); } if (!isFileExisting(pathname)) { throw new CLIException(REASON_INVALID_ARGUMENTS, String.format("'%s' does not exist.", pathname)); } }
Source:
<code>public CacheEntry<K, V> get() throws TimeoutException { if (taskRef.get() == null && taskRef.getAndUpdate((t) -> t == null ? new SupplierCacheLoaderTask() : t) == null) { AdvancedCacheLoader.CacheLoaderTask<K, V> task = taskRef.get(); executor.execute(() -> { try { manager.processOnAllStores(new WithinThreadExecutor(), filter, task, true, true); } finally { close(); } }); } CacheEntry<K, V> entry; boolean interrupted = false; while ((entry = queue.poll()) == null) { closeLock.lock(); try { if (closed) { <START> if (queue.peek() != null) { <END> continue; } break; } long targetTime = System.nanoTime() + unit.toNanos(timeout); try { if (!closeCondition.await(targetTime - System.nanoTime(), TimeUnit.NANOSECONDS)) { throw new TimeoutException("Couldn't retrieve entry an entry from store in allotted timeout: " + timeout + " unit: " + unit); } } catch (InterruptedException e) { interrupted = true; } } finally { closeLock.unlock(); } } if (interrupted) { Thread.currentThread().interrupt(); } return entry; }</code><technical_language>do a poll and, if entry is null, return (instead of continue?)</technical_language>

Target:
public CacheEntry<K, V> get() throws TimeoutException { if (taskRef.get() == null && taskRef.getAndUpdate((t) -> t == null ? new SupplierCacheLoaderTask() : t) == null) { AdvancedCacheLoader.CacheLoaderTask<K, V> task = taskRef.get(); executor.execute(() -> { try { manager.processOnAllStores(new WithinThreadExecutor(), filter, task, true, true); } finally { close(); } }); } CacheEntry<K, V> entry; boolean interrupted = false; while ((entry = queue.poll()) == null) { closeLock.lock(); try { if (closed) { if ((entry = queue.poll()) != null) { break; } break; } long targetTime = System.nanoTime() + unit.toNanos(timeout); try { if (!closeCondition.await(targetTime - System.nanoTime(), TimeUnit.NANOSECONDS)) { throw new TimeoutException("Couldn't retrieve entry an entry from store in allotted timeout: " + timeout + " unit: " + unit); } } catch (InterruptedException e) { interrupted = true; } } finally { closeLock.unlock(); } } if (interrupted) { Thread.currentThread().interrupt(); } return entry; }
Source:
<code>private void validateSchema(final EventTypeBase eventType) throws InvalidEventTypeException { try { final String eventTypeSchema = eventType.getSchema().getSchema(); JsonUtils.checkEventTypeSchemaValid(eventTypeSchema); final JSONObject schemaAsJson = new JSONObject(eventTypeSchema); final Schema schema = SchemaLoader.load(schemaAsJson); if (schemaAsJson.has("type") && schemaAsJson.getString("type").equals("array") <START> && eventType.getCategory() != EventCategory.UNDEFINED) { <END> throw new InvalidEventTypeException("\"type\" of root element in schema cannot be \"array\""); } if (eventType.getCategory() == EventCategory.BUSINESS && schema.definesProperty("#/metadata")) { throw new InvalidEventTypeException("\"metadata\" property is reserved"); } if (featureToggleService.isFeatureEnabled(CHECK_PARTITIONS_KEYS)) { validatePartitionKeys(schema, eventType); } validateOrderingKeys(schema, eventType); if (eventType.getCompatibilityMode() == CompatibilityMode.COMPATIBLE) { validateJsonSchemaConstraints(schemaAsJson); } } catch (final JSONException e) { throw new InvalidEventTypeException("schema must be a valid json"); } catch (final SchemaException e) { throw new InvalidEventTypeException("schema must be a valid json-schema"); } }</code><technical_language>I undefined events objects</technical_language>

Target:
private void validateSchema(final EventTypeBase eventType) throws InvalidEventTypeException { try { final String eventTypeSchema = eventType.getSchema().getSchema(); JsonUtils.checkEventTypeSchemaValid(eventTypeSchema); final JSONObject schemaAsJson = new JSONObject(eventTypeSchema); if (schemaAsJson.has("type") && !Objects.equals("object", schemaAsJson.getString("type"))) { throw new InvalidEventTypeException("\"type\" of root element in schema can only be \"object\""); } final Schema schema = SchemaLoader.load(schemaAsJson); if (eventType.getCategory() == EventCategory.BUSINESS && schema.definesProperty("#/metadata")) { throw new InvalidEventTypeException("\"metadata\" property is reserved"); } validateOrderingKeys(schema, eventType); if (eventType.getCompatibilityMode() == CompatibilityMode.COMPATIBLE) { validateJsonSchemaConstraints(schemaAsJson); } } catch (final JSONException e) { throw new InvalidEventTypeException("schema must be a valid json"); } catch (final SchemaException e) { throw new InvalidEventTypeException("schema must be a valid json-schema"); } }
Source:
<code><START> public void successfulStartupShutdownTest() throws Exception { <END> MockDataNodeId dataNode = clusterMap.getDataNodes().get(0); List<ReplicaId> replicas = clusterMap.getReplicaIds(dataNode); StorageManager storageManager = createAndStartStoreManager(replicas); for (ReplicaId replica : replicas) { Store store = storageManager.getStore(replica.getPartitionId()); assertTrue("Store should be started", ((BlobStore) store).isStarted()); assertTrue("Compaction should be scheduled", storageManager.scheduleNextForCompaction(replica.getPartitionId())); } MockPartitionId invalidPartition = new MockPartitionId(Long.MAX_VALUE, Collections.<MockDataNodeId>emptyList(), 0); assertNull("Should not have found a store for an invalid partition.", storageManager.getStore(invalidPartition)); assertEquals("Compaction thread count is incorrect", dataNode.getMountPaths().size(), TestUtils.numThreadsByThisName(CompactionManager.THREAD_NAME_PREFIX)); verifyCompactionThreadCount(storageManager, dataNode.getMountPaths().size()); shutdownAndAssertStoresInaccessible(storageManager, replicas); assertEquals("Compaction thread count is incorrect", 0, storageManager.getCompactionThreadCount()); }</code><technical_language>add assertFalse("Store shutdown, (BlobStore) store).isStarted()) shutdownAndAssertStoresInaccessible()</technical_language>

Target:
public void successfulStartupShutdownTest() throws Exception { MockDataNodeId dataNode = clusterMap.getDataNodes().get(0); List<ReplicaId> replicas = clusterMap.getReplicaIds(dataNode); StorageManager storageManager = createAndStartStoreManager(replicas, metricRegistry); for (ReplicaId replica : replicas) { Store store = storageManager.getStore(replica.getPartitionId()); assertTrue("Store should be started", ((BlobStore) store).isStarted()); assertTrue("Compaction should be scheduled", storageManager.scheduleNextForCompaction(replica.getPartitionId())); } Map<String, Counter> counters = metricRegistry.getCounters(); assertEquals(0, getCounterValue(counters, DiskManager.class.getName(), "TotalStoreStartFailures")); assertEquals(0, getCounterValue(counters, DiskManager.class.getName(), "DiskMountPathFailures")); MockPartitionId invalidPartition = new MockPartitionId(Long.MAX_VALUE, Collections.<MockDataNodeId>emptyList(), 0); assertNull("Should not have found a store for an invalid partition.", storageManager.getStore(invalidPartition)); assertEquals("Compaction thread count is incorrect", dataNode.getMountPaths().size(), TestUtils.numThreadsByThisName(CompactionManager.THREAD_NAME_PREFIX)); verifyCompactionThreadCount(storageManager, dataNode.getMountPaths().size()); shutdownAndAssertStoresInaccessible(storageManager, replicas); assertEquals("Compaction thread count is incorrect", 0, storageManager.getCompactionThreadCount()); assertEquals(0, getCounterValue(counters, DiskManager.class.getName(), "TotalStoreShutdownFailures")); }
Source:
<code>private List<Comment> getComments() { <START> LOG.info("Start: Jira NewCommentsConsumer: retrieving issue comments. Last comment id: {}", lastCommentId); <END> List<Comment> newComments = new ArrayList<>(); List<Issue> issues = getIssues(); for (Issue issue : issues) { Issue fullIssue = client().getIssueClient().getIssue(issue.getKey()).claim(); for (Comment comment : fullIssue.getComments()) { if (comment.getId() > lastCommentId) { newComments.add(comment); } } } for (Comment c: newComments) { if (c.getId() > lastCommentId) { lastCommentId = c.getId(); } } LOG.info("End: Jira NewCommentsConsumer: retrieving issue comments. new comments since last run.", newComments.size()); return newComments; }</code><technical_language>Do need this INFO logging noise? If this method is invoked frequently get spammed logs. this DEBUG</technical_language>

Target:
private List<Comment> getComments() { LOG.debug("Start: Jira NewCommentsConsumer: retrieving issue comments. Last comment id: {}", lastCommentId); List<Comment> newComments = new ArrayList<>(); List<Issue> issues = getIssues(); for (Issue issue : issues) { Issue fullIssue = client().getIssueClient().getIssue(issue.getKey()).claim(); for (Comment comment : fullIssue.getComments()) { if (comment.getId() > lastCommentId) { newComments.add(comment); } } } for (Comment c: newComments) { if (c.getId() > lastCommentId) { lastCommentId = c.getId(); } } LOG.debug("End: Jira NewCommentsConsumer: retrieving issue comments. new comments since last run.", newComments.size()); return newComments; }
Source:
<code>private FormatterBuilder createFormatterBuilder(KafkaExternalLoaderCLIArguments properties) throws Exception { <START> FormatterBuilder fb; <END> Properties formatterProperties = m_args.formatterProperties; AbstractFormatterFactory factory; if (formatterProperties.size() > 0) { String formatterClass = m_args.formatterProperties.getProperty("formatter"); String format = m_args.formatterProperties.getProperty("format", "csv"); Class<?> classz = Class.forName(formatterClass); Class<?>[] ctorParmTypes = new Class[]{ String.class, Properties.class }; Constructor<?> ctor = classz.getDeclaredConstructor(ctorParmTypes); Object[] ctorParms = new Object[]{ format, m_args.formatterProperties }; factory = new AbstractFormatterFactory() { @Override public Formatter create(String formatName, Properties props) { try { return (Formatter) ctor.newInstance(ctorParms); } catch (Exception e) { e.printStackTrace(); return null; } } }; fb = new FormatterBuilder(format, formatterProperties); } else { factory = new VoltCSVFormatterFactory(); Properties props = new Properties(); factory.create("csv", props); fb = new FormatterBuilder("csv", props); } fb.setFormatterFactory(factory); return fb; }</code><technical_language>minor: rename fb -> builder formatBuilder</technical_language>

Target:
private FormatterBuilder createFormatterBuilder(KafkaExternalLoaderCLIArguments properties) throws Exception { FormatterBuilder builder; Properties formatterProperties = m_args.formatterProperties; AbstractFormatterFactory factory; if (formatterProperties.size() > 0) { String formatterClass = m_args.formatterProperties.getProperty("formatter"); String format = m_args.formatterProperties.getProperty("format", "csv"); Class<?> classz = Class.forName(formatterClass); Class<?>[] ctorParmTypes = new Class[]{ String.class, Properties.class }; Constructor<?> ctor = classz.getDeclaredConstructor(ctorParmTypes); Object[] ctorParms = new Object[]{ format, m_args.formatterProperties }; factory = new AbstractFormatterFactory() { @Override public Formatter create(String formatName, Properties props) { try { return (Formatter) ctor.newInstance(ctorParms); } catch (Exception e) { e.printStackTrace(); return null; } } }; builder = new FormatterBuilder(format, formatterProperties); } else { factory = new VoltCSVFormatterFactory(); Properties props = new Properties(); factory.create("csv", props); builder = new FormatterBuilder("csv", props); } builder.setFormatterFactory(factory); return builder; }
Source:
<code>public WeightedSnapshot(Collection<WeightedSample> values) { <START> if (values.size()==1 && Double.compare(values.iterator().next().weight,0D)==0) { <END> this.values = new long[0]; this.normWeights = new double[0]; this.quantiles = new double[0]; return; } final WeightedSample[] copy = values.toArray( new WeightedSample[]{} ); Arrays.sort(copy, new Comparator<WeightedSample>() { @Override public int compare(WeightedSample o1, WeightedSample o2) { if (o1.value > o2.value) return 1; if (o1.value < o2.value) return -1; return 0; } } ); this.values = new long[copy.length]; this.normWeights = new double[copy.length]; this.quantiles = new double[copy.length]; double sumWeight = 0; for (WeightedSample sample : copy) { sumWeight += sample.weight; } for (int i = 0; i < copy.length; i++) { this.values[i] = copy[i].value; this.normWeights[i] = copy[i].weight / sumWeight; } for (int i = 1; i < copy.length; i++) { this.quantiles[i] = this.quantiles[i - 1] + this.normWeights[i - 1]; } }</code><technical_language>I obvious perform this check in constructor of snapshot. I understand idea avoid situation element in sample a 0 weight (because provides bogus data), I performed in ExponentiallyDecayingReservoir, logic of rescaling resides. do think, if add a guard condition: java if (scalingFactor == 0) { values.clear(); } in ExponentiallyDecayingReservoir#rescale method? I a more clear solution</technical_language>

Target:
public WeightedSnapshot(Collection<WeightedSample> values) { final WeightedSample[] copy = values.toArray( new WeightedSample[]{} ); Arrays.sort(copy, new Comparator<WeightedSample>() { @Override public int compare(WeightedSample o1, WeightedSample o2) { if (o1.value > o2.value) return 1; if (o1.value < o2.value) return -1; return 0; } } ); this.values = new long[copy.length]; this.normWeights = new double[copy.length]; this.quantiles = new double[copy.length]; double sumWeight = 0; for (WeightedSample sample : copy) { sumWeight += sample.weight; } for (int i = 0; i < copy.length; i++) { this.values[i] = copy[i].value; this.normWeights[i] = copy[i].weight / sumWeight; } for (int i = 1; i < copy.length; i++) { this.quantiles[i] = this.quantiles[i - 1] + this.normWeights[i - 1]; } }
Source:
<code>public static Workspace getWorkspace() throws Exception { if (getInstance() == null) { throw new IllegalStateException("Central is not initialised"); } Workspace ws; synchronized (workspaceQueue) { ws = workspace; if (ws != null) { return ws; } try { Workspace.setDriver(Constants.BNDDRIVER_ECLIPSE); Workspace.addGestalt(Constants.GESTALT_INTERACTIVE, new Attrs()); ws = Workspace.getWorkspaceWithoutException(getWorkspaceDirectory()); if (ws == null) { Processor p = new Processor(); File defaultBase = IO.getFile("~/.bnd/default-ws"); ws = Workspace.createStandaloneWorkspace(p, defaultBase.toURI()); ws.setBase(defaultBase); ws.setProperty("-default-ws", "true"); ws.warning("No bnd workspace found in %s; created default in ~/.bnd/default-ws", getWorkspaceDirectory()); } ws.addBasicPlugin(new WorkspaceListener(ws)); ws.addBasicPlugin(getInstance().repoListenerTracker); ws.addBasicPlugin(getWorkspaceR5Repository()); ws.addBasicPlugin(new JobProgress()); ws.getBuildOrder(); addCnfChangeListener(ws); workspaceRepositoryChangeDetector = new WorkspaceRepositoryChangeDetector(ws); workspace = ws; } catch (final Exception e) { if (ws != null) { ws.close(); } <START> workspaceQueue.fail(e); END> throw e; } } workspaceQueue.resolve(ws); return ws; }</code><technical_language>resolve deferred in synchronized block callbacks occur holding lock</technical_language>

Target:
public static Workspace getWorkspace() throws Exception { if (getInstance() == null) { throw new IllegalStateException("Central is not initialised"); } Workspace ws; Exception exception = null; synchronized (workspaceQueue) { ws = workspace; if (ws != null) { return ws; } try { Workspace.setDriver(Constants.BNDDRIVER_ECLIPSE); Workspace.addGestalt(Constants.GESTALT_INTERACTIVE, new Attrs()); ws = Workspace.getWorkspaceWithoutException(getWorkspaceDirectory()); if (ws == null) { Processor p = new Processor(); File defaultBase = IO.getFile("~/.bnd/default-ws"); ws = Workspace.createStandaloneWorkspace(p, defaultBase.toURI()); ws.setBase(defaultBase); ws.setProperty("-default-ws", "true"); ws.warning("No bnd workspace found in %s; created default in ~/.bnd/default-ws", getWorkspaceDirectory()); } ws.addBasicPlugin(new WorkspaceListener(ws)); ws.addBasicPlugin(getInstance().repoListenerTracker); ws.addBasicPlugin(getWorkspaceR5Repository()); ws.addBasicPlugin(new JobProgress()); ws.getBuildOrder(); addCnfChangeListener(ws); workspaceRepositoryChangeDetector = new WorkspaceRepositoryChangeDetector(ws); workspace = ws; } catch (final Exception e) { if (ws != null) { ws.close(); } exception = e; } } if (exception != null) { workspaceQueue.fail(exception); throw exception; } workspaceQueue.resolve(ws); return ws; }
Source:
<code>public void testCreateOrReplaceWithDeleteExisting() { server.expect().get().withPath("/api/v1/namespaces/ns1/services/my-service").andReturn(200, service).times(2); server.expect().get().withPath("/api/v1/namespaces/ns1/configmaps/my-configmap").andReturn(200, configMap).times(2); server.expect().delete().withPath("/api/v1/namespaces/ns1/services/my-service").andReturn(200 , service).once(); server.expect().delete().withPath("/api/v1/namespaces/ns1/configmaps/my-configmap").andReturn(200, configMap).once(); server.expect().post().withPath("/api/v1/namespaces/ns1/services").andReturn(200, service).once(); server.expect().post().withPath("/api/v1/namespaces/ns1/configmaps").andReturn(200, configMap).once(); <START> <END> KubernetesClient client = server.getClient(); KubernetesList list = new KubernetesListBuilder().withItems(service, configMap).build(); client.resourceList(list).inNamespace("ns1").deletingExisting().createOrReplace(); }</code><technical_language>I need verify server expected</technical_language>

Target:
public void testCreateOrReplaceWithDeleteExisting() throws Exception { server.expect().get().withPath("/api/v1/namespaces/ns1/services/my-service").andReturn(200, service).once(); server.expect().get().withPath("/api/v1/namespaces/ns1/configmaps/my-configmap").andReturn(200, configMap).once(); server.expect().delete().withPath("/api/v1/namespaces/ns1/services/my-service").andReturn(200 , service).once(); server.expect().delete().withPath("/api/v1/namespaces/ns1/configmaps/my-configmap").andReturn(200, configMap).once(); server.expect().post().withPath("/api/v1/namespaces/ns1/services").andReturn(200, updatedService).once(); server.expect().post().withPath("/api/v1/namespaces/ns1/configmaps").andReturn(200, updatedConfigMap).once(); KubernetesClient client = server.getClient(); KubernetesList list = new KubernetesListBuilder().withItems(updatedService, updatedConfigMap).build(); client.resourceList(list).inNamespace("ns1").deletingExisting().createOrReplace(); assertEquals(6, server.getMockServer().getRequestCount()); RecordedRequest request = server.getLastRequest(); assertEquals("/api/v1/namespaces/ns1/configmaps", request.getPath()); assertEquals("POST", request.getMethod()); }
Source:
<code>public void handle(Request request, Response response) throws Exception { String projectKey = request.mandatoryParam(PARAM_PROJECT); try (DbSession dbSession = dbClient.openSession(false)) { Optional<ComponentDto> projectOptional = dbClient.componentDao().selectByKey(dbSession, projectKey); if (!projectOptional.isPresent()) { <START> throw new IllegalArgumentException(String.format("Project key '%s' not found", projectKey)); <END> } ComponentDto project = projectOptional.get(); userSession.checkComponentPermission(UserRole.USER, project); if (!project.isEnabled() || !Qualifiers.PROJECT.equals(project.qualifier())) { throw new IllegalArgumentException("Invalid project key"); } Collection<BranchDto> branches = dbClient.branchDao().selectByComponent(dbSession, project); WsBranches.ListWsResponse.Builder protobufResponse = WsBranches.ListWsResponse.newBuilder(); branches.stream() .filter(b -> b.getKeeType().equals(BranchKeyType.BRANCH)) .forEach(b -> addToProtobuf(protobufResponse, b)); WsUtils.writeProtobuf(protobufResponse.build(), request, response); } }</code><technical_language>shoud 400 404 => NotFoundException</technical_language>

Target:
public void handle(Request request, Response response) throws Exception { String projectKey = request.mandatoryParam(PARAM_PROJECT); try (DbSession dbSession = dbClient.openSession(false)) { ComponentDto project = WsUtils.checkFoundWithOptional( dbClient.componentDao().selectByKey(dbSession, projectKey), "Project key '%s' not found", projectKey); userSession.checkComponentPermission(UserRole.USER, project); if (!project.isEnabled() || !Qualifiers.PROJECT.equals(project.qualifier())) { throw new IllegalArgumentException("Invalid project key"); } Collection<BranchDto> branches = dbClient.branchDao().selectByComponent(dbSession, project); WsBranches.ListWsResponse.Builder protobufResponse = WsBranches.ListWsResponse.newBuilder(); branches.stream() .filter(b -> b.getKeeType().equals(BranchKeyType.BRANCH)) .forEach(b -> addToProtobuf(protobufResponse, b)); WsUtils.writeProtobuf(protobufResponse.build(), request, response); } }
Source:
<code>private void findMaps() { <START> File folder = new File("c:/users/jim/workspace/bubblebobble/src/main/resources"); <END> File[] listOfFiles = folder.listFiles(); assert listOfFiles != null; for (File listOfFile : listOfFiles) { if (listOfFile.isFile()) { if (listOfFile.getName().matches("map[0-9]*.txt")) { maps.add(listOfFile.getName()); } } } }</code><technical_language>This a bad idea; name is Jim, I do Windows</technical_language>

Target:
private void findMaps() { File folder = new File("src/main/resources"); File[] listOfFiles = folder.listFiles(); assert listOfFiles != null; for (File file : listOfFiles) { if (file.isFile()) { if (file.getName().matches("map[0-9]*.txt")) { maps.add(file.getName()); } } } }
Source:
<code>private @Nullable List<ISegment> computeData(final TmfTimeRange timeRange, final Range durationRange) { final AbstractSegmentStoreAnalysisModule analysisModule = fAnalysisModule; if (analysisModule == null) { return null; } <START> final ISegmentStore<ISegment> results = analysisModule.getSegmentStore(); <END> if (results == null) { return null; } Iterator<ISegment> intersectingElements = results.getIntersectingElements(timeRange.getStartTime().getValue(), timeRange.getEndTime().getValue()).iterator(); if (durationRange.lower > Double.MIN_VALUE || durationRange.upper < Double.MAX_VALUE) { Predicate<? super ISegment> predicate = new Predicate<ISegment>() { @Override public boolean apply(@Nullable ISegment input) { return input != null && input.getLength() >= durationRange.lower && input.getLength() <= durationRange.upper; } }; intersectingElements = Iterators.<ISegment> filter(intersectingElements, predicate); } return Lists.newArrayList(intersectingElements); }</code><technical_language>variable in other files updated segStore (no more ss please :p)</technical_language>

Target:
private @Nullable List<ISegment> computeData(final TmfTimeRange timeRange, final Range durationRange) { final AbstractSegmentStoreAnalysisModule analysisModule = fAnalysisModule; if (analysisModule == null) { return null; } final ISegmentStore<ISegment> segStore = analysisModule.getSegmentStore(); if (segStore == null) { return null; } Iterator<ISegment> intersectingElements = segStore.getIntersectingElements(timeRange.getStartTime().getValue(), timeRange.getEndTime().getValue()).iterator(); if (durationRange.lower > Double.MIN_VALUE || durationRange.upper < Double.MAX_VALUE) { Predicate<? super ISegment> predicate = new Predicate<ISegment>() { @Override public boolean apply(@Nullable ISegment input) { return input != null && input.getLength() >= durationRange.lower && input.getLength() <= durationRange.upper; } }; intersectingElements = Iterators.filter(intersectingElements, predicate); } return Lists.newArrayList(intersectingElements); }
Source:
<code>public GenericRow transform(GenericRow record) { for (Map.Entry<String, PinotDataType> entry : _dataTypes.entrySet()) { String column = entry.getKey(); Object value = record.getValue(column); if (value instanceof List) { value = ((List) value).toArray(); } PinotDataType source; if (value instanceof Object[]) { Object[] values = (Object[]) value; source = MULTI_VALUE_TYPE_MAP.get(values[0].getClass()); if (source == null) { source = PinotDataType.OBJECT_ARRAY; <START> } else if (source == PinotDataType.HASHMAP) { <END> source = PinotDataType.getPinotDataTypeFromHashMap((Map<Object, Object>) values[0]); } } else { source = SINGLE_VALUE_TYPE_MAP.get(value.getClass()); if (source == null) { source = PinotDataType.OBJECT; } } PinotDataType dest = entry.getValue(); if (source != dest) { value = dest.convert(value, source); } record.putValue(column, value); } return record; }</code><technical_language>This done conditionally. In other words, consider columns: col1 - primitive column defined MV int/float/double/string (simple array of primitive types Pinot supports). "CompaniesWorkedAt". [ "val1", "val2", "val3" ] col2 - complex column defined MV. addresses is array (struct) array (map). [ { "k1" : "v1", "k2": "v2", "k3": "v3" } ] is a complex column is is standard primitive. AvroRecordExtractor AvroUtils.convert() returned array of Map/HashMap for sample data "dimension_***" : [ { "item_id" : { "string" : "some data" } }, { "item_id" : { "string" : "some data" } } schema for "dimension_***" column is array of primitives, need extract actual HashMap. In cases, is true map size 1 condition map size 1 if object is a complex one. convert Map primitive if schema so</technical_language>

Target:
public GenericRow transform(GenericRow record) { for (Map.Entry<String, PinotDataType> entry : _dataTypes.entrySet()) { String column = entry.getKey(); Object value = record.getValue(column); if (value instanceof List) { value = ((List) value).toArray(); } PinotDataType source; if (value instanceof Object[]) { Object[] values = (Object[]) value; source = MULTI_VALUE_TYPE_MAP.get(values[0].getClass()); if (source == null) { if (values[0] instanceof Map) { source = PinotDataType.getSpecificMapDataTypeFromMap((Map<Object, Object>) values[0]); } else { source = PinotDataType.OBJECT_ARRAY; } } } else { source = SINGLE_VALUE_TYPE_MAP.get(value.getClass()); if (source == null) { source = PinotDataType.OBJECT; } } PinotDataType dest = entry.getValue(); if (source != dest) { value = dest.convert(value, source); } record.putValue(column, value); } return record; }
Source:
<code>public void setBodyFieldsOnly(boolean bodyFieldsOnly) { this.bodyFieldsOnly = bodyFieldsOnly; searchPreferences.setBodyFieldsOnly(bodyFieldsOnly); Object searchPreferencesObject = createNativeSearchPreferences(searchPreferences); try { Header searchPreferencesHeader = new Header( new QName(getPlatformMessageNamespaceUri(), "searchPreferences"), searchPreferencesObject, new JAXBDataBinding(searchPreferencesObject.getClass())); setHeader(port, searchPreferencesHeader); } catch (JAXBException e) { throw new NetSuiteException(new NetSuiteErrorCode(NetSuiteErrorCode.INTERNAL_ERROR), "XML binding error", e); } <START> } <END></code><technical_language>Instead of re-creating header is reset in existing one</technical_language>

Target:
public void setBodyFieldsOnly(boolean bodyFieldsOnly) { this.bodyFieldsOnly = bodyFieldsOnly; searchPreferences.setBodyFieldsOnly(bodyFieldsOnly); Object searchPreferencesObject = createNativeSearchPreferences(searchPreferences); try { Header searchPreferencesHeader = new Header( new QName(getPlatformMessageNamespaceUri(), "searchPreferences"), searchPreferencesObject, new JAXBDataBinding(searchPreferencesObject.getClass())); setHeader(port, searchPreferencesHeader); } catch (JAXBException e) { throw new NetSuiteException(new NetSuiteErrorCode(NetSuiteErrorCode.INTERNAL_ERROR), NetSuiteRuntimeI18n.MESSAGES.getMessage("error.binding"), e); } }