auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>Bundle toBundle() { Bundle bundle = new Bundle(); bundle.putString(KEY_ID, id); bundle.putString(KEY_PARENT_ID, parentId); bundle.putString(KEY_DISPLAY_NAME, displayName); bundle.putParcelable(KEY_DISPLAY_ICON, ParcelUtils.toParcelable(displayIcon)); bundle.putBundle(KEY_EXTRAS, bundle); bundle.putStringArrayList(KEY_ATTENDEES, attendees); bundle.putStringArrayList(KEY_SUB_CONVERSATION_IDS, subConversationIds); bundle.putInt(KEY_LOADED_MESSAGE_SIZE, loadedMessageSize); bundle.putLong(KEY_NEWEST_MESSAGE_TIMESTAMP, newestMsgTimestmap); bundle.putLong(KEY_OLDEST_MESSAGE_TIMESTAMP, oldestMsgTimestmap); return bundle; <START> }} <END></code><technical_language>Please separate lines</technical_language>

Target:
Bundle toBundle() { Bundle bundle = new Bundle(); bundle.putString(KEY_ID, id); bundle.putString(KEY_PARENT_ID, parentId); bundle.putString(KEY_DISPLAY_NAME, displayName); bundle.putParcelable(KEY_DISPLAY_ICON, ParcelUtils.toParcelable(displayIcon)); bundle.putBundle(KEY_EXTRAS, bundle); bundle.putStringArrayList(KEY_ATTENDEES, attendees); bundle.putStringArrayList(KEY_SUB_CONVERSATION_IDS, subConversationIds); bundle.putInt(KEY_LOADED_MESSAGE_SIZE, loadedMessageSize); bundle.putLong(KEY_NEWEST_MESSAGE_TIMESTAMP, newestMsgTimestmap); bundle.putLong(KEY_OLDEST_MESSAGE_TIMESTAMP, oldestMsgTimestmap); return bundle; }
Source:
<code>public SpnegoResult(HttpHeader header, URI uri, String value) { <START> this.header = header; <END> this.uri = uri; this.value = value; }</code><technical_language>Check for null</technical_language>

Target:
public SpnegoResult(HttpHeader header, URI uri, String value) { this.header = requireNonNull(header, "header is null"); this.uri = requireNonNull(uri, "uri is null"); this.value = requireNonNull(value, "value is null"); }
Source:
<code><START> public Email addUserEmail(User user, ContactType contactType, String address, Boolean defaultAddress) { <END> Email email = emailDAO.create(user.getContactInfo(), contactType, defaultAddress, address); if (user.getRole() == Role.STUDENT) { studentDAO.fireUpdate(user.getId()); } else { staffMemberDAO.fireUpdate(user.getId()); } return email; }</code><technical_language>StudentController.addStudentEmail checks good if (StringUtils.isBlank(address)) { throw new IllegalArgumentException("Email blank."); } if (!UserUtils.isAllowedEmail(address, contactType, student.getPerson().getId())) throw new UserEmailInUseException();</technical_language>

Target:
public Email addUserEmail(User user, ContactType contactType, String address, Boolean defaultAddress) { address = StringUtils.trim(address); if (StringUtils.isBlank(address)) { throw new IllegalArgumentException("Email cannot be blank."); } Email email = emailDAO.create(user.getContactInfo(), contactType, defaultAddress, address); if (user.getRole() == Role.STUDENT) { studentDAO.fireUpdate(user.getId()); } else { staffMemberDAO.fireUpdate(user.getId()); } return email; }
Source:
<code>private void localize(final ApplicationConstants constants) { startedTimeEditor.setLabel(constants.rebalanceStartTime()); volumeEditor.setLabel(constants.rebalanceVolumeName()); clusterEditor.setLabel(constants.rebalanceClusterVolume()); statusTimeEditor.setLabel(constants.rebalanceStatusTime()); statusLabel.setText(constants.rebalanceComplete()); <START> statusLabel.setVisible(false); <END> }</code><technical_language>relevant for localization</technical_language>

Target:
private void localize(final ApplicationConstants constants) { startedTimeEditor.setLabel(constants.rebalanceStartTime()); volumeEditor.setLabel(constants.rebalanceVolumeName()); clusterEditor.setLabel(constants.rebalanceClusterVolume()); statusTimeEditor.setLabel(constants.rebalanceStatusTime()); statusLabel.setText(constants.rebalanceComplete()); }
Source:
<code>public static void fhirResourceCreate(String fhirStoreName, String resourceType) throws IOException, URISyntaxException { CloudHealthcare client = createClient(); HttpClient httpClient = HttpClients.createDefault(); String uri = String.format( <START> "%sv1beta1/%s/fhir/%s", client.getRootUrl(), fhirStoreName, resourceType); <END> URIBuilder uriBuilder = new URIBuilder(uri) .setParameter("access_token", getAccessToken()); StringEntity requestEntity = new StringEntity( "{\"resourceType\": \"" + resourceType + "\", \"language\": \"en\"}"); HttpUriRequest request = RequestBuilder .post() .setUri(uriBuilder.build()) .setEntity(requestEntity) .addHeader("Content-Type", "application/fhir+json") .addHeader("Accept-Charset", "utf-8") .addHeader("Accept", "application/fhir+json; charset=utf-8") .build(); HttpResponse response = httpClient.execute(request); HttpEntity responseEntity = response.getEntity(); if (response.getStatusLine().getStatusCode() != HttpStatus.SC_CREATED) { System.err.print(String.format( "Exception creating FHIR resource: %s\n", response.getStatusLine().toString())); responseEntity.writeTo(System.err); throw new RuntimeException(); } System.out.print("FHIR resource created: "); responseEntity.writeTo(System.out); }</code><technical_language>v1? v1beta1</technical_language>

Target:
public static void fhirResourceCreate(String fhirStoreName, String resourceType) throws IOException, URISyntaxException { CloudHealthcare client = createClient(); HttpClient httpClient = HttpClients.createDefault(); String uri = String.format( "%sv1/%s/fhir/%s", client.getRootUrl(), fhirStoreName, resourceType); URIBuilder uriBuilder = new URIBuilder(uri) .setParameter("access_token", getAccessToken()); StringEntity requestEntity = new StringEntity( "{\"resourceType\": \"" + resourceType + "\", \"language\": \"en\"}"); HttpUriRequest request = RequestBuilder .post() .setUri(uriBuilder.build()) .setEntity(requestEntity) .addHeader("Content-Type", "application/fhir+json") .addHeader("Accept-Charset", "utf-8") .addHeader("Accept", "application/fhir+json; charset=utf-8") .build(); HttpResponse response = httpClient.execute(request); HttpEntity responseEntity = response.getEntity(); if (response.getStatusLine().getStatusCode() != HttpStatus.SC_CREATED) { System.err.print(String.format( "Exception creating FHIR resource: %s\n", response.getStatusLine().toString())); responseEntity.writeTo(System.err); throw new RuntimeException(); } System.out.print("FHIR resource created: "); responseEntity.writeTo(System.out); }
Source:
<code>public ValidationResult validate(Template subject) { ValidationResultBuilder resultBuilder = ValidationResult.builder(); if (Objects.isNull(subject)) { <START> resultBuilder.error("Template request cannot be null in the instance group request."); <END> } else { resultBuilder.ifError(() -> subject.getRootVolumeSize() != null && subject.getRootVolumeSize() < 1, "Root volume size cannot be smaller than 1 gigabyte."); } return resultBuilder.build(); }</code><technical_language>this validation runs in flow</technical_language>

Target:
public ValidationResult validate(Template subject) { ValidationResultBuilder resultBuilder = ValidationResult.builder(); if (Objects.isNull(subject)) { resultBuilder.error("Template cannot be null in the instance group request."); } else { resultBuilder.ifError(() -> subject.getRootVolumeSize() != null && subject.getRootVolumeSize() < 1, "Root volume size cannot be smaller than 1 gigabyte."); } return resultBuilder.build(); }
Source:
<code>public void stop() { try { server.stop(); } catch (Exception e) { <START> LOGGER.error("Failed to stop the Jetty server"); <END> } }</code><technical_language>log exception</technical_language>

Target:
public void stop() { try { server.stop(); } catch (Exception e) { LOGGER.error("Failed to stop the Jetty server.", e); } }
Source:
<code>private void setAzkabanExecutionOptions(ExecutionParameters executionParameters, ExecutableFlow executableFlow) throws CloudFlowException { try { executableFlow.setFlowDefinitionId(Integer.parseInt(executionParameters.getFlowId())); } catch (NumberFormatException e) { throw new CloudFlowValidationException(String.format("Parameter '%s' must be an integer.", Constants.FLOW_ID_KEY)); } executableFlow.setFlowVersion(executionParameters.getFlowVersion()); executableFlow.setDescription(executionParameters.getDescription()); if (!executionParameters.getExperimentId().isEmpty()) { try { executableFlow.setExperimentId(Integer.parseInt(executionParameters.getExperimentId())); } catch (NumberFormatException e) { throw new CloudFlowValidationException(String.format("Parameter '%s' must be an integer.", Constants.EXPERIMENT_ID_KEY)); } } executableFlow.setSubmitUser(executionParameters.getSubmitUser()); ExecutionOptions executionOptions = new ExecutionOptions(); executionOptions.setFailureAction(ExecutionOptions.FailureAction.valueOf( executionParameters.getFailureAction().toString())); executionOptions.setNotifyOnFirstFailure(executionParameters.isNotifyOnFirstFailure()); executionOptions.setNotifyOnLastFailure(executionParameters.isNotifyFailureOnExecutionComplete()); executionOptions.setConcurrentOption(executionParameters.getConcurrentOption().getName()); <START> setRuntimeProperties(executionParameters, executionOptions); <END> executableFlow.setExecutionOptions(executionOptions); }</code><technical_language>Is this required for POC this done later? In case a chance of defining properties structured tying provide now</technical_language>

Target:
private void setAzkabanExecutionOptions(ExecutionParameters executionParameters, ExecutableFlow executableFlow) { try { executableFlow.setFlowDefinitionId(Integer.parseInt(executionParameters.getFlowId())); } catch (NumberFormatException e) { throw new CloudFlowValidationException("Flow id must be an integer."); } if(executionParameters.getFlowVersion() <= 0) { throw new CloudFlowValidationException("Flow version must be a positive number."); } executableFlow.setFlowVersion(executionParameters.getFlowVersion()); executableFlow.setDescription(executionParameters.getDescription()); if (!executionParameters.getExperimentId().isEmpty()) { try { executableFlow.setExperimentId(Integer.parseInt(executionParameters.getExperimentId())); } catch (NumberFormatException e) { throw new CloudFlowValidationException("Experiment id must be an integer."); } } executableFlow.setSubmitUser(executionParameters.getSubmitUser()); ExecutionOptions executionOptions = new ExecutionOptions(); executionOptions.setFailureAction(ExecutionOptions.FailureAction.valueOf( executionParameters.getFailureAction().toString())); executionOptions.setNotifyOnFirstFailure(executionParameters.isNotifyOnFirstFailure()); executionOptions.setNotifyOnLastFailure(executionParameters.isNotifyFailureOnExecutionComplete()); executionOptions.setConcurrentOption(executionParameters.getConcurrentOption().getName()); setRuntimeProperties(executionParameters, executionOptions); executableFlow.setExecutionOptions(executionOptions); }
Source:
<code>public T getValueOrElse(T defaultValue) { <START> return (isSuccess() ? value : defaultValue); <END> }</code><technical_language>defaultValue nullable? Null allowed of a result consistent forbid too</technical_language>

Target:
public T getValueOrElse(T defaultValue) { ArgChecker.notNull(defaultValue, "defaultValue"); return (isSuccess() ? value : defaultValue); }
Source:
<code>public static @NonNull String buildCompatibilityTraceTypeId(@NonNull String traceTypeId) { if (traceTypeId.startsWith(EARLY_TRACE_COMPASS_CUSTOM_TXT_TRACE_TYPE_PREFIX)) { <START> return NonNullUtils.checkNotNull(traceTypeId.replace(EARLY_TRACE_COMPASS_CUSTOM_TXT_TRACE_TYPE_PREFIX, CUSTOM_TXT_TRACE_TYPE_PREFIX)); <END> } int index = traceTypeId.lastIndexOf(SEPARATOR); if ((index != -1) && (traceTypeId.startsWith(LINUX_TOOLS_CUSTOM_TXT_TRACE_TYPE_PREFIX))) { String definitionName = index < traceTypeId.length() ? traceTypeId.substring(index + 1) : ""; if (traceTypeId.contains(CustomTxtTrace.class.getSimpleName() + SEPARATOR) && traceTypeId.indexOf(SEPARATOR) == index) { return buildTraceTypeId(CustomTxtTraceDefinition.CUSTOM_TXT_CATEGORY, definitionName); } return NonNullUtils.checkNotNull(traceTypeId.replace(LINUX_TOOLS_CUSTOM_TXT_TRACE_TYPE_PREFIX, CUSTOM_TXT_TRACE_TYPE_PREFIX)); } return traceTypeId; }</code><technical_language>Technically, incorrectly replace a category name. substring</technical_language>

Target:
public static @NonNull String buildCompatibilityTraceTypeId(@NonNull String traceTypeId) { if (traceTypeId.startsWith(EARLY_TRACE_COMPASS_CUSTOM_TXT_TRACE_TYPE_PREFIX)) { return CUSTOM_TXT_TRACE_TYPE_PREFIX + traceTypeId.substring(EARLY_TRACE_COMPASS_CUSTOM_TXT_TRACE_TYPE_PREFIX.length()); } int index = traceTypeId.lastIndexOf(SEPARATOR); if ((index != -1) && (traceTypeId.startsWith(LINUX_TOOLS_CUSTOM_TXT_TRACE_TYPE_PREFIX))) { String definitionName = index < traceTypeId.length() ? traceTypeId.substring(index + 1) : ""; if (traceTypeId.contains(CustomTxtTrace.class.getSimpleName() + SEPARATOR) && traceTypeId.indexOf(SEPARATOR) == index) { return buildTraceTypeId(CustomTxtTraceDefinition.CUSTOM_TXT_CATEGORY, definitionName); } return CUSTOM_TXT_TRACE_TYPE_PREFIX + traceTypeId.substring(LINUX_TOOLS_CUSTOM_TXT_TRACE_TYPE_PREFIX.length()); } return traceTypeId; }
Source:
<code>public void initialize(Class<K> keyClass, Class<T> persistentClass, Properties properties) throws GoraException { try { super.initialize(keyClass, persistentClass, properties); <START> IgniteMappingBuilder builder = new IgniteMappingBuilder(this); <END> builder.readMappingFile(getConf().get(PARSE_MAPPING_FILE_KEY, DEFAULT_MAPPING_FILE)); igniteMapping = builder.getIgniteMapping(); igniteParameters = IgniteParameters.load(properties, conf); connection = acquiereConnection(); LOG.info("Ignite store was successfully initialized"); } catch (ClassNotFoundException | SQLException ex) { LOG.error("Error while initializing Ignite store", ex); throw new GoraException(ex); } }</code><technical_language>Type safety: constructor IgniteMappingBuilder(IgniteStore) belongs raw type IgniteMappingBuilder. References generic type IgniteMappingBuilder< K,T > parameterized</technical_language>

Target:
public void initialize(Class<K> keyClass, Class<T> persistentClass, Properties properties) throws GoraException { try { super.initialize(keyClass, persistentClass, properties); IgniteMappingBuilder<K, T> builder = new IgniteMappingBuilder<K, T>(this); builder.readMappingFile(getConf().get(PARSE_MAPPING_FILE_KEY, DEFAULT_MAPPING_FILE)); igniteMapping = builder.getIgniteMapping(); igniteParameters = IgniteParameters.load(properties); connection = acquireConnection(); LOG.info("Ignite store was successfully initialized"); if (!schemaExists()) { createSchema(); } } catch (ClassNotFoundException | SQLException ex) { LOG.error("Error while initializing Ignite store", ex); throw new GoraException(ex); } }
Source:
<code>private List<String> getColumnsMetadata(String parent, JsonNode propertiesNode) throws IOException <START> { <END> List<String> metadata = new ArrayList(); Iterator<Map.Entry<String, JsonNode>> iterator = propertiesNode.fields(); while (iterator.hasNext()) { Map.Entry<String, JsonNode> entry = iterator.next(); String key = entry.getKey(); JsonNode value = entry.getValue(); String childKey = parent == null || parent.isEmpty() ? key : parent.concat(".").concat(key); if (value.isObject()) { metadata.addAll(getColumnsMetadata(childKey, value)); continue; } if (!value.isArray()) { metadata.add(childKey.concat(":").concat(value.textValue())); } } return metadata; }</code><technical_language>if io.airlift.json.JsonCodec#jsonCodec(java.lang.Class<T>) write a mapping classes. Notice json class full, contains fields interested in</technical_language>

Target:
private List<String> getColumnsMetadata(String parent, JsonNode propertiesNode) { List<String> metadata = new ArrayList<>(); Iterator<Entry<String, JsonNode>> iterator = propertiesNode.fields(); while (iterator.hasNext()) { Entry<String, JsonNode> entry = iterator.next(); String key = entry.getKey(); JsonNode value = entry.getValue(); String childKey = null; if (parent == null || parent.isEmpty()) { childKey = key; } else { childKey = parent.concat(".").concat(key); } if (value.isObject()) { metadata.addAll(getColumnsMetadata(childKey, value)); continue; } if (!value.isArray()) { metadata.add(childKey.concat(":").concat(value.textValue())); } } return metadata; }
Source:
<code>@Override public <I extends Indexer> I createIndexer(boolean direct) { BytePointer ptr = arrayData(); int size = arraySize(); int dims = dims(); int depth = depth(); <START> int elemSize = CV_ELEM_SIZE1(depth); <END> long[] sizes = new long[dims+1]; long[] strides = new long[dims+1]; for (int i=0; i<dims; i++) { sizes[i] = size(i); int step = step(i); if (step%elemSize != 0) throw new UnsupportedOperationException("Step is not a multiple of element size"); strides[i] = step/elemSize; } sizes[dims] = arrayChannels(); strides[dims] = 1; switch (depth) { case CV_8U: return (I)UByteIndexer.create(ptr.capacity(size), sizes, strides, direct).indexable(this); case CV_8S: return (I)ByteIndexer.create(ptr.capacity(size), sizes, strides, direct).indexable(this); case CV_16U: return (I)UShortIndexer.create(new ShortPointer(ptr).capacity(size/2), sizes, strides, direct).indexable(this); case CV_16S: return (I)ShortIndexer.create(new ShortPointer(ptr).capacity(size/2), sizes, strides, direct).indexable(this); case CV_32S: return (I)IntIndexer.create(new IntPointer(ptr).capacity(size/4), sizes, strides, direct).indexable(this); case CV_32F: return (I)FloatIndexer.create(new FloatPointer(ptr).capacity(size/4), sizes, strides, direct).indexable(this); case CV_64F: return (I)DoubleIndexer.create(new DoublePointer(ptr).capacity(size/8), sizes, strides, direct).indexable(this); default: assert false; } return null; }</code><technical_language>I call elemSize1() instead</technical_language>

Target:
@Override public <I extends Indexer> I createIndexer(boolean direct) { BytePointer ptr = arrayData(); int size = arraySize(); int dims = dims(); int depth = depth(); long elemSize = elemSize1(); long[] sizes = new long[dims+1]; long[] strides = new long[dims+1]; for (int i=0; i<dims; i++) { sizes[i] = size(i); int step = step(i); if (step%elemSize != 0) { throw new UnsupportedOperationException("Step is not a multiple of element size"); } strides[i] = step/elemSize; } sizes[dims] = arrayChannels(); strides[dims] = 1; switch (depth) { case CV_8U: return (I)UByteIndexer.create(ptr.capacity(size), sizes, strides, direct).indexable(this); case CV_8S: return (I)ByteIndexer.create(ptr.capacity(size), sizes, strides, direct).indexable(this); case CV_16U: return (I)UShortIndexer.create(new ShortPointer(ptr).capacity(size/2), sizes, strides, direct).indexable(this); case CV_16S: return (I)ShortIndexer.create(new ShortPointer(ptr).capacity(size/2), sizes, strides, direct).indexable(this); case CV_32S: return (I)IntIndexer.create(new IntPointer(ptr).capacity(size/4), sizes, strides, direct).indexable(this); case CV_32F: return (I)FloatIndexer.create(new FloatPointer(ptr).capacity(size/4), sizes, strides, direct).indexable(this); case CV_64F: return (I)DoubleIndexer.create(new DoublePointer(ptr).capacity(size/8), sizes, strides, direct).indexable(this); default: assert false; } return null; }
Source:
<code>public Optional<DecorrelationResult> visitEnforceSingleRow(EnforceSingleRowNode node, Void context) { Optional<DecorrelationResult> childDecorrelationResultOptional = lookup.resolve(node.getSource()).accept(this, null); <START> if (!childDecorrelationResultOptional.isPresent() || !childDecorrelationResultOptional.get().atMostSingleRow) { <END> return Optional.empty(); } return childDecorrelationResultOptional; }</code><technical_language>return childDecorrelationResultOptional.filter(DecorrelationResult::isAtMostSingleRow);</technical_language>

Target:
public Optional<DecorrelationResult> visitEnforceSingleRow(EnforceSingleRowNode node, Void context) { Optional<DecorrelationResult> childDecorrelationResultOptional = lookup.resolve(node.getSource()).accept(this, null); return childDecorrelationResultOptional.filter(result -> result.atMostSingleRow); }
Source:
<code>public PrivateEncryptedChannel getPrivateEncryptedChannel(String channelName) throws IllegalArgumentException{ <START> if (!channelName.startsWith("private-encrypted")) { <END> throw new IllegalArgumentException("Encrypted private channels must begin with 'private-encrypted-'"); } else { return (PrivateEncryptedChannel) findChannelInChannelMap(channelName); } }</code><technical_language>this check construction time (via [getDisallowedNameExpressions](<LINK_0> duplicate logic class cast exception naturally convey information better</technical_language>

Target:
public PrivateEncryptedChannel getPrivateEncryptedChannel(String channelName) throws IllegalArgumentException{ if (!channelName.startsWith("private-encrypted-")) { throw new IllegalArgumentException("Encrypted private channels must begin with 'private-encrypted-'"); } else { return (PrivateEncryptedChannel) findChannelInChannelMap(channelName); } }
Source:
<code>public void getMeasurementJsonError() { final CountDownLatch signal = new CountDownLatch(1); <START> new OkHttpClient().newCall(new Request.Builder().url(NON_PARSABLE_URL).build()).enqueue(new GetMeasurementCallback() { <END> @Override public void onSuccess(String json) { Assert.fail(); signal.countDown(); } @Override public void onError(String msg) { signal.countDown(); } }); try { signal.await(1, TimeUnit.MINUTES); } catch (InterruptedException e) { e.printStackTrace(); Assert.fail(); } }</code><technical_language>instead of a parsable URL pass a nonexisting URL. This fix CI. <LINK_0></technical_language>

Target:
public void getMeasurementJsonError() { final CountDownLatch signal = new CountDownLatch(1); a.getOkHttpClient().newCall(new Request.Builder().url(NON_EXISTING_MEASUREMENT_URL).build()).enqueue(new GetMeasurementJsonCallback() { @Override public void onSuccess(String json) { Assert.fail(); signal.countDown(); } @Override public void onError(String msg) { signal.countDown(); } }); try { signal.await(1, TimeUnit.MINUTES); } catch (InterruptedException e) { e.printStackTrace(); Assert.fail(); } }
Source:
<code>public SpatialRuleLookup build(Collection<SpatialRule> rules, JsonFeatureCollection jsonFeatureCollection, BBox bounds, double resolution, boolean exact) { for (SpatialRule spatialRule : rules) { for (JsonFeature jsonFeature : jsonFeatureCollection.getFeatures()) { if (spatialRule.getUniqueName().equals(jsonFeature.getProperty("ISO_A3"))) { Geometry geometry = jsonFeature.getGeometry(); if (!geometry.isPolygon()) continue; spatialRule.setBorders(geometry.asPolygon().getPolygons()); break; } } } BBox polygonBounds = BBox.createInverse(false); for (SpatialRule spatialRule : rules) { if (!spatialRule.getBorders().isEmpty()) { for (Polygon polygon : spatialRule.getBorders()) { polygonBounds.update(polygon.getMinLat(), polygon.getMinLon()); polygonBounds.update(polygon.getMaxLat(), polygon.getMaxLon()); } } } <START> if (polygonBounds.minLon == Double.MAX_VALUE) { <END> throw new IllegalStateException("No SpatialRules defined or Polygons defined"); } BBox calculatedBounds = polygonBounds.calculateIntersection(bounds); if (calculatedBounds == null) return null; SpatialRuleLookup spatialRuleLookup = new SpatialRuleLookupArray(calculatedBounds, resolution, exact); for (SpatialRule spatialRule : rules) { spatialRuleLookup.addRule(spatialRule); } return spatialRuleLookup; }</code><technical_language>is safer !polygonBounds.isValid() instead</technical_language>

Target:
public SpatialRuleLookup build(Collection<SpatialRule> rules, JsonFeatureCollection jsonFeatureCollection, BBox bounds, double resolution, boolean exact) { for (SpatialRule spatialRule : rules) { for (JsonFeature jsonFeature : jsonFeatureCollection.getFeatures()) { if (spatialRule.getId().equals(jsonFeature.getProperty("ISO_A3"))) { Geometry geometry = jsonFeature.getGeometry(); if (!geometry.isPolygon()) continue; spatialRule.setBorders(geometry.asPolygon().getPolygons()); break; } } } BBox polygonBounds = BBox.createInverse(false); for (SpatialRule spatialRule : rules) { if (!spatialRule.getBorders().isEmpty()) { for (Polygon polygon : spatialRule.getBorders()) { polygonBounds.update(polygon.getMinLat(), polygon.getMinLon()); polygonBounds.update(polygon.getMaxLat(), polygon.getMaxLon()); } } } if (!polygonBounds.isValid()) { throw new IllegalStateException("No SpatialRules defined or Polygons defined"); } BBox calculatedBounds = polygonBounds.calculateIntersection(bounds); if (calculatedBounds == null) return null; SpatialRuleLookup spatialRuleLookup = new SpatialRuleLookupArray(calculatedBounds, resolution, exact); for (SpatialRule spatialRule : rules) { spatialRuleLookup.addRule(spatialRule); } return spatialRuleLookup; }
Source:
<code>public void testMultiTxSuspendResume() throws Exception { executeTestForAllCaches(new CI2Exc<Ignite, IgniteCache<Integer, Integer>>() { @Override public void applyx(Ignite ignite, final IgniteCache<Integer, Integer> cache) throws Exception { for (TransactionIsolation isolation : TransactionIsolation.values()) { final List<Transaction> clientTxs = new ArrayList<>(); for (int i = 0; i < 10; i++) { Transaction tx = ignite.transactions().txStart(transactionConcurrency(), isolation); cache.put(i, i); tx.suspend(); clientTxs.add(tx); } <START> GridTestUtils.runMultiThreaded(new CI1Exc<Integer>() { <END> @Override public void applyx(Integer idx) throws Exception { Transaction tx = clientTxs.get(idx); assertEquals(SUSPENDED, tx.state()); tx.resume(); assertEquals(ACTIVE, tx.state()); tx.commit(); } }, 10, "th-suspend"); for (int i = 0; i < 10; i++) assertEquals(i, (int)cache.get(i)); cache.removeAll(); } } }); }</code><technical_language>replaced lambda</technical_language>

Target:
public void testMultiTxSuspendResume() throws Exception { executeTestForAllCaches(new CI2Exc<Ignite, IgniteCache<Integer, Integer>>() { @Override public void applyx(Ignite ignite, final IgniteCache<Integer, Integer> cache) throws Exception { for (TransactionIsolation isolation : TransactionIsolation.values()) { final List<Transaction> clientTxs = new ArrayList<>(); for (int i = 0; i < 10; i++) { Transaction tx = ignite.transactions().txStart(transactionConcurrency(), isolation); cache.put(i, i); tx.suspend(); clientTxs.add(tx); } GridTestUtils.runMultiThreaded(new CI1<Integer>() { @Override public void apply (Integer idx) { Transaction tx = clientTxs.get(idx); assertEquals(SUSPENDED, tx.state()); tx.resume(); assertEquals(ACTIVE, tx.state()); tx.commit(); } }, 10, "th-suspend"); for (int i = 0; i < 10; i++) assertEquals(i, (int)cache.get(i)); cache.removeAll(); } } }); }
Source:
<code>public String digest(String value) throws Exception { <START> return saltValue(value, digestSource.digest(new String(keySource.getKey()))); <END> }</code><technical_language>new String(byte[], StandardCharsets.UTF_8) here, avoid a platform specific locale</technical_language>

Target:
public String digest(String value) throws Exception { return saltValue(value, keySource.getKey()); }
Source:
<code>private void addEmbeddedProject(HalResource halResource, Project project) { Project minimalFilledProject = new Project(project.getName()); minimalFilledProject.setType(null); minimalFilledProject.setProjectType(null); HalResource<Project> halProject = new HalResource<>(minimalFilledProject); try { Link projectLink = linkTo(ProjectController.class).slash("api" + ProjectController.PROJECTS_URL + "/" + project.getId()).withSelfRel(); halProject.add(projectLink); <START> } catch (Exception e) { <END> log.error("cannot create embedded project with id: " + project.getId()); } halResource.addEmbeddedResource("sw360:projects", halProject); }</code><technical_language>generic catch? removed</technical_language>

Target:
private void addEmbeddedProject(HalResource halResource, Project project) { Project minimalFilledProject = new Project(project.getName()); minimalFilledProject.setType(null); minimalFilledProject.setProjectType(null); HalResource<Project> halProject = new HalResource<>(minimalFilledProject); Link projectLink = linkTo(ProjectController.class).slash("api" + ProjectController.PROJECTS_URL + "/" + project.getId()).withSelfRel(); halProject.add(projectLink); halResource.addEmbeddedResource("sw360:projects", halProject); }
Source:
<code>public void testGetPileup() { final SAMFileHeader header = ArtificialReadUtils.createArtificialSamHeader(1, 1, 1000); final Locatable loc = new SimpleInterval("chr1", 10, 10); final int readLength = 3; final GATKRead read1 = ArtificialReadUtils.createArtificialRead(header, "read1", 0, 1, readLength); read1.setBases(Utils.dupBytes((byte) 'A', readLength)); read1.setBaseQualities(Utils.dupBytes((byte) 30, readLength)); read1.setCigar("3M"); <START> final GATKRead read2 = ArtificialReadUtils.createArtificialRead(header, "read1", 0, 10, readLength); <END> read2.setBases(Utils.dupBytes((byte) 'A', readLength)); read2.setBaseQualities(Utils.dupBytes((byte) 30, readLength)); read2.setCigar("3M"); final GATKRead read3 = ArtificialReadUtils.createArtificialRead(header, "read1", 0, 7, readLength); read3.setBases(Utils.dupBytes((byte) 'C', readLength)); read3.setBaseQualities(Utils.dupBytes((byte) 20, readLength)); read3.setCigar("1M1D2M"); final GATKRead read4 = ArtificialReadUtils.createArtificialRead(header, "read1", 0, 7, readLength); read4.setBases(Utils.dupBytes((byte) 'C', readLength)); read4.setBaseQualities(Utils.dupBytes((byte) 20, readLength)); read4.setCigar("1M5D2M"); final ReadPileup pileup = GATKProtectedVariantContextUtils.getPileup(loc, Arrays.asList(read1, read2, read3, read4)); final int[] counts = pileup.getBaseCounts(); Assert.assertEquals(counts, new int[]{1, 1, 0, 0}); }</code><technical_language>typo: read names (the argument createArtificialRead) read2, read3, on</technical_language>

Target:
public void testGetPileup() { final SAMFileHeader header = ArtificialReadUtils.createArtificialSamHeader(1, 1, 1000); final Locatable loc = new SimpleInterval("chr1", 10, 10); final int readLength = 3; final GATKRead read1 = ArtificialReadUtils.createArtificialRead(header, "read1", 0, 1, readLength); read1.setBases(Utils.dupBytes((byte) 'A', readLength)); read1.setBaseQualities(Utils.dupBytes((byte) 30, readLength)); read1.setCigar("3M"); final GATKRead read2 = ArtificialReadUtils.createArtificialRead(header, "read2", 0, 10, readLength); read2.setBases(Utils.dupBytes((byte) 'A', readLength)); read2.setBaseQualities(Utils.dupBytes((byte) 30, readLength)); read2.setCigar("3M"); final GATKRead read3 = ArtificialReadUtils.createArtificialRead(header, "read3", 0, 7, readLength); read3.setBases(Utils.dupBytes((byte) 'C', readLength)); read3.setBaseQualities(Utils.dupBytes((byte) 20, readLength)); read3.setCigar("1M1D2M"); final GATKRead read4 = ArtificialReadUtils.createArtificialRead(header, "read4", 0, 7, readLength); read4.setBases(Utils.dupBytes((byte) 'C', readLength)); read4.setBaseQualities(Utils.dupBytes((byte) 20, readLength)); read4.setCigar("1M5D2M"); final ReadPileup pileup = GATKProtectedVariantContextUtils.getPileup(loc, Arrays.asList(read1, read2, read3, read4)); final int[] counts = pileup.getBaseCounts(); Assert.assertEquals(counts, new int[]{1, 1, 0, 0}); }
Source:
<code>private void cleanup() { if (runIdGenerator.isPresent()) { <START> runIdGenerator.get().close(); <END> } if (coordinationUtils.isPresent()) { coordinationUtils.get().close(); } }</code><technical_language>nit: simplified runIdGenerator::ifPresent(RunIdGenerator::close); for coordinationUtils</technical_language>

Target:
private void cleanup() { runIdGenerator.ifPresent(RunIdGenerator::close); coordinationUtils.ifPresent(CoordinationUtils::close); }
Source:
<code>public void loadXMLConfig() { if (deviceID == null) { logger.info("Device ID was null, reading from openhab.cfg"); deviceID = deviceIDFromConfig; } try { logger.debug("Loading XML-Config for device ID: {}",deviceID); <START> logger.info("Using Config for device ID: {}",deviceID); <END> URL mapping = FrameworkUtil.getBundle(ResolVBUSBinding.class).getEntry("xml/mapping.cfg"); if (mapping == null) { config = null; logger.error("Unable to load mapping.xml"); return; } InputStream in = mapping.openStream(); Properties prop = new Properties(); prop.load(in); deviceIDFile = prop.getProperty(deviceID); logger.debug("Using file: for configuration",deviceIDFile); } catch (IOException e1) { e1.printStackTrace(); } URL entry = FrameworkUtil.getBundle(ResolVBUSConfig.class).getEntry("xml/"+deviceIDFile); if (entry == null) { config = null; logger.error("Unable to load {}",deviceIDFile); return; } XStream xstream = new XStream(new StaxDriver()); xstream.alias("vbusSpecification",ResolVBUSConfig.class); xstream.alias("device",ResolVBUSDevice.class); xstream.alias("field",ResolVBUSField.class); xstream.alias("packet",ResolVBUSPacket.class); xstream.alias("value", ResolVBUSValue.class); xstream.processAnnotations(ResolVBUSConfig.class); try { InputStream x = entry.openStream(); config = (ResolVBUSConfig) xstream.fromXML(x); } catch (IOException e) { logger.error("Couldn't read XML Config: ",e.getMessage()); } }</code><technical_language>need for log entries; please remove .info</technical_language>

Target:
public void loadXMLConfig() { if (deviceID == null) { logger.info("Device ID was null, reading from openhab.cfg"); deviceID = deviceIDFromConfig; } try { logger.debug("Loading XML-Config for device ID: {}",deviceID); URL mapping = FrameworkUtil.getBundle(ResolVBUSBinding.class).getEntry("xml/mapping.cfg"); if (mapping == null) { config = null; logger.error("Unable to load mapping.cfg"); return; } InputStream in = mapping.openStream(); Properties prop = new Properties(); prop.load(in); deviceIDFile = prop.getProperty(deviceID); logger.debug("Using file: for configuration",deviceIDFile); } catch (IOException e) { logger.debug(e.getMessage()); } URL entry = FrameworkUtil.getBundle(ResolVBUSConfig.class).getEntry("xml/"+deviceIDFile); if (entry == null) { config = null; logger.error("Unable to load {}",deviceIDFile); return; } XStream xstream = new XStream(new StaxDriver()); xstream.alias("vbusSpecification",ResolVBUSConfig.class); xstream.alias("device",ResolVBUSDevice.class); xstream.alias("field",ResolVBUSField.class); xstream.alias("packet",ResolVBUSPacket.class); xstream.alias("value", ResolVBUSValue.class); xstream.processAnnotations(ResolVBUSConfig.class); try { InputStream x = entry.openStream(); config = (ResolVBUSConfig) xstream.fromXML(x); } catch (IOException e) { logger.error("Couldn't read XML Config: ",e.getMessage()); } }
Source:
<code>public MatchResult matcher(HttpServletRequest request) { if (!matches(request)) { return MatchResult.notMatch(); } <START> if (this.matcher == null) { <END> return MatchResult.match(); } String url = getRequestPath(request); return MatchResult.match(this.matcher.extractUriTemplateVariables(url)); }</code><technical_language>Changing semantics in a minor release worries a bit. is a null matcher a match instead of a match</technical_language>

Target:
public MatchResult matcher(HttpServletRequest request) { if (this.matcher == null || !matches(request)) { return MatchResult.notMatch(); } String url = getRequestPath(request); return MatchResult.match(this.matcher.extractUriTemplateVariables(url)); }
Source:
<code>public void makeUnDiscoverablePatchForbiddenTest() throws Exception { context.turnOffAuthorisationSystem(); parentCommunity = CommunityBuilder.createCommunity(context) .withName("Parent Community") .build(); Community child1 = CommunityBuilder.createSubCommunity(context, parentCommunity) .withName("Sub Community") .build(); Collection col1 = CollectionBuilder.createCollection(context, child1).withName("Collection 1").build(); Item item = ItemBuilder.createItem(context, col1) .withTitle("Public item 1") .withIssueDate("2017-10-17") .withAuthor("Smith, Donald").withAuthor("Doe, John") .withSubject("ExtraEntry") .build(); String token = getAuthToken(eperson.getEmail(), password); String tokenAdmin = getAuthToken(admin.getEmail(), password); List<Operation> ops = new ArrayList<Operation>(); <START> ReplaceOperation replaceOperation = new ReplaceOperation("/discoverable", "false"); <END> ops.add(replaceOperation); String patchBody = getPatchContent(ops); getClient(token).perform(patch("/api/core/items/" + item.getID()) .content(patchBody) .contentType(MediaType.APPLICATION_JSON_PATCH_JSON)) .andExpect(status().isForbidden()); getClient(tokenAdmin).perform(get("/api/core/items/" + item.getID())) .andExpect(status().isOk()) .andExpect(jsonPath("$.uuid", Matchers.is(item.getID().toString()))) .andExpect(jsonPath("$.discoverable", Matchers.is(true))); }</code><technical_language>official true instead "true"</technical_language>

Target:
public void makeUnDiscoverablePatchForbiddenTest() throws Exception { context.turnOffAuthorisationSystem(); parentCommunity = CommunityBuilder.createCommunity(context) .withName("Parent Community") .build(); Community child1 = CommunityBuilder.createSubCommunity(context, parentCommunity) .withName("Sub Community") .build(); Collection col1 = CollectionBuilder.createCollection(context, child1).withName("Collection 1").build(); Item item = ItemBuilder.createItem(context, col1) .withTitle("Public item 1") .withIssueDate("2017-10-17") .withAuthor("Smith, Donald").withAuthor("Doe, John") .withSubject("ExtraEntry") .build(); String token = getAuthToken(eperson.getEmail(), password); String tokenAdmin = getAuthToken(admin.getEmail(), password); List<Operation> ops = new ArrayList<Operation>(); ReplaceOperation replaceOperation = new ReplaceOperation("/discoverable", false); ops.add(replaceOperation); String patchBody = getPatchContent(ops); getClient(token).perform(patch("/api/core/items/" + item.getID()) .content(patchBody) .contentType(MediaType.APPLICATION_JSON_PATCH_JSON)) .andExpect(status().isForbidden()); getClient(tokenAdmin).perform(get("/api/core/items/" + item.getID())) .andExpect(status().isOk()) .andExpect(jsonPath("$.uuid", Matchers.is(item.getID().toString()))) .andExpect(jsonPath("$.discoverable", Matchers.is(true))); }
Source:
<code>private void initializeTrackablesAction() { for (final TrackableLog trackable : trackables) { if (trackableState == null) { if (Settings.isTrackableAutoVisit()) { trackable.action = LogTypeTrackable.VISITED; } } else { <START> final Integer tbStateId = trackableState.getInt(trackable.trackCode); <END> if (tbStateId > 0) { trackable.action = LogTypeTrackable.getById(tbStateId); } else { if (Settings.isTrackableAutoVisit()) { trackable.action = LogTypeTrackable.VISITED; } } } } }</code><technical_language>suggestion final int tbStateId = trackableState.getInt(trackable.trackCode);</technical_language>

Target:
private void initializeTrackablesAction() { for (final TrackableLog trackable : trackables) { if (trackableState != null) { final int tbStateId = trackableState.getInt(trackable.trackCode); if (tbStateId > 0) { trackable.action = LogTypeTrackable.getById(tbStateId); continue; } } if (Settings.isTrackableAutoVisit()) { trackable.action = LogTypeTrackable.VISITED; } } }
Source:
<code>public void preparePartitionsTobeRegistered(String streamName) throws InterruptedException { if (!isStreamHCatEnabled(streamName)) { LOG.info("Hcat is not enabled for " + streamName + " stream"); return; } String tableName = getTableName(streamName); HCatClient hcatClient = getHCatClient(); if (hcatClient == null) { <START> LOG.info("Didn't get any hcat client from pool hence not adding partitions"); <END> return; } try { long lastAddedTime = lastAddedPartitionMap.get(tableName); if (lastAddedTime == EMPTY_PARTITION_LIST) { LOG.info("there are no partitions in "+ tableName +" table. "); return; } else if (lastAddedTime == FAILED_GET_PARTITIONS) { try { findLastPartition(hcatClient, streamName); lastAddedTime = lastAddedPartitionMap.get(tableName); if (lastAddedTime == EMPTY_PARTITION_LIST) { LOG.info("there are no partitions in "+ tableName +" table. "); return; } } catch (HCatException e) { LOG.error("Got exception while trying to get the last added partition ", e); return; } } findDiffBetweenLastAddedAndFirstPath(lastAddedTime, streamName, tableName); } finally { addToPool(hcatClient); } }</code><technical_language>this log.warn</technical_language>

Target:
private void preparePartitionsTobeRegistered(String streamName) throws InterruptedException { if (!isStreamHCatEnabled(streamName)) { LOG.info("Hcat is not enabled for " + streamName + " stream"); return; } String tableName = getTableName(streamName); HCatClient hcatClient = getHCatClient(); if (hcatClient == null) { LOG.warn("Didn't get any hcat client from pool hence not adding partitions"); ConduitMetrics.updateSWGuage(getServiceType(), FAILED_TO_GET_HCAT_CLIENT_COUNT, streamName, 1); return; } try { long lastAddedTime = lastAddedPartitionMap.get(tableName); if (lastAddedTime == EMPTY_PARTITION_LIST) { LOG.info("there are no partitions in "+ tableName +" table. "); return; } else if (lastAddedTime == FAILED_GET_PARTITIONS) { try { findLastPartition(hcatClient, streamName); lastAddedTime = lastAddedPartitionMap.get(tableName); if (lastAddedTime == EMPTY_PARTITION_LIST) { LOG.info("there are no partitions in "+ tableName +" table. "); return; } } catch (HCatException e) { LOG.error("Got exception while trying to get the last added partition ", e); return; } } findDiffBetweenLastAddedAndFirstPath(lastAddedTime, streamName, tableName); } finally { addToPool(hcatClient); } }
Source:
<code>private static Map<String, String> load() { Map<String, String> outputClasses = Maps.newHashMap(); Set<Class> restOutputClasses = ClassUtil.findClasses(AbstractStreamingOutput.class, "org.apache.tajo.ws.rs.resources.outputs"); for (Class eachClass : restOutputClasses) { if (eachClass.isInterface() || Modifier.isAbstract(eachClass.getModifiers())) { continue; } AbstractStreamingOutput streamingOutput = null; try { <START> streamingOutput = (AbstractStreamingOutput) eachClass.getDeclaredConstructor( <END> new Class[]{NonForwardQueryResultScanner.class, Integer.class, Integer.class}).newInstance(null, 0, 0); } catch (Exception e) { LOG.warn(eachClass + " cannot instantiate Function class because of " + e.getMessage(), e); continue; } String className = streamingOutput.getClass().getCanonicalName(); String headerType = streamingOutput.getClass().getAnnotation(RestReturnType.class).headerType(); String description = streamingOutput.getClass().getAnnotation(RestReturnType.class).description(); if (StringUtils.isNotEmpty(headerType)) { outputClasses.put(headerType, className); } } return outputClasses; }</code><technical_language>streamingOutput instance is created unnecessarily</technical_language>

Target:
private static Map<String, String> load() { Map<String, String> outputClasses = Maps.newHashMap(); Set<Class> restOutputClasses = ClassUtil.findClasses(AbstractStreamingOutput.class, "org.apache.tajo.ws.rs.resources.outputs"); for (Class eachClass : restOutputClasses) { if (eachClass.isInterface() || Modifier.isAbstract(eachClass.getModifiers())) { continue; } AbstractStreamingOutput streamingOutput = null; try { streamingOutput = (AbstractStreamingOutput) eachClass.getDeclaredConstructor( new Class[]{NonForwardQueryResultScanner.class, Integer.class, Integer.class}).newInstance(null, 0, 0); } catch (Exception e) { LOG.warn(eachClass + " cannot instantiate Function class because of " + e.getMessage(), e); continue; } String className = streamingOutput.getClass().getCanonicalName(); String headerType = streamingOutput.getClass().getAnnotation(RestReturnType.class).mimeType(); if (StringUtils.isNotEmpty(headerType)) { outputClasses.put(headerType, className); } } return outputClasses; }
Source:
<code>public SipMessage.Builder<T> withRecordRouteHeaders(final List<RecordRouteHeader> recordRoutes) { if (recordRoutes != null && !recordRoutes.isEmpty()) { this.recordRouteHeaders = ensureList(this.recordRouteHeaders); this.recordRouteHeaders.clear(); for (final RecordRouteHeader rr : recordRoutes) { this.recordRouteHeaders.add(rr); <START> recordRouteHeader = rr; <END> } } return this; }</code><technical_language>this wrong. track of one</technical_language>

Target:
public SipMessage.Builder<T> withRecordRouteHeaders(final List<RecordRouteHeader> recordRoutes) { if (recordRoutes != null && !recordRoutes.isEmpty()) { this.recordRouteHeaders = ensureList(this.recordRouteHeaders); this.recordRouteHeaders.clear(); recordRouteHeader = recordRoutes.get(0); this.recordRouteHeaders.addAll(recordRoutes); } return this; }
Source:
<code>private Throwable runMultiPreparerSetup(IMultiTargetPreparer preparer, ITestLogger logger) { if (preparer.isDisabled()) { return null; } CLog.d("Running setup <START> Multi <END> preparer: %s", preparer.getClass().getSimpleName()); try { if (preparer instanceof ITestLoggerReceiver) { ((ITestLoggerReceiver) preparer).setTestLogger(logger); } if (preparer instanceof IInvocationContextReceiver) { ((IInvocationContextReceiver) preparer) .setInvocationContext(mModuleInvocationContext); } preparer.setUp(mModuleInvocationContext); return null; } catch (BuildError | TargetSetupError | DeviceNotAvailableException | RuntimeException | AssertionError e) { CLog.e("Unexpected Exception from preparer: %s", preparer.getClass().getName()); CLog.e(e); return e; } }</code><technical_language>m</technical_language>

Target:
private Throwable runMultiPreparerSetup(IMultiTargetPreparer preparer, ITestLogger logger) { if (preparer.isDisabled()) { return null; } CLog.d("Running setup multi preparer: %s", preparer.getClass().getSimpleName()); try { if (preparer instanceof ITestLoggerReceiver) { ((ITestLoggerReceiver) preparer).setTestLogger(logger); } if (preparer instanceof IInvocationContextReceiver) { ((IInvocationContextReceiver) preparer) .setInvocationContext(mModuleInvocationContext); } preparer.setUp(mModuleInvocationContext); return null; } catch (BuildError | TargetSetupError | DeviceNotAvailableException | RuntimeException | AssertionError e) { CLog.e("Unexpected Exception from preparer: %s", preparer.getClass().getName()); CLog.e(e); return e; } }
Source:
<code>public void addToOrderBook(Order order) { if (order.getClass() == BuyOrder.class) { <START> ArrayList<Order> newOrders = buyOrders.get(order.getStockSymbol()); if (newOrders == null) { newOrders = new ArrayList<Order>(); newOrders.add(order); buyOrders.put(order.getStockSymbol(), newOrders); } else { newOrders.add(order); buyOrders.put(order.getStockSymbol(), newOrders); } <END> } else { ArrayList<Order> newOrders = sellOrders.get(order.getStockSymbol()); if (newOrders == null) { newOrders = new ArrayList<Order>(); newOrders.add(order); sellOrders.put(order.getStockSymbol(), newOrders); } else { newOrders.add(order); sellOrders.put(order.getStockSymbol(), newOrders); } } }</code><technical_language>i suggest create new function call addBuyOrderToOrderBook move this portion</technical_language>

Target:
public void addToOrderBook(Order order) { if (order.getClass() == BuyOrder.class) { addNewOrders(order,buyOrders); } else { addNewOrders(order,sellOrders); } }