auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public Builder fromContainer(Container in) { return this.id(in.id()).name(in.name()).created(in.created()).path(in.path()).args(in.args()) .config(in.config()).state(in.state()).image(in.image()).networkSettings(in.networkSettings()) .sysInitPath(in.sysInitPath()).resolvConfPath(in.resolvConfPath()).driver(in.driver()) .execDriver(in.execDriver()).volumes(in.volumes()).hostConfig(in.hostConfig()).volumesRW(in.volumesRW()) .command(in.command()).status(in.status()).ports(in.ports()).hostnamePath(in.hostnamePath()) <START> .hostsPath(in.hostsPath()).mountLabel(in.mountLabel()).processLabel(in.processLabel()).node(in.node().get()); <END> }</code><technical_language>This fail node is Optional.absent()</technical_language>

Target:
public Builder fromContainer(Container in) { return this.id(in.id()).name(in.name()).created(in.created()).path(in.path()).args(in.args()) .config(in.config()).state(in.state()).image(in.image()).networkSettings(in.networkSettings()) .sysInitPath(in.sysInitPath()).resolvConfPath(in.resolvConfPath()).driver(in.driver()) .execDriver(in.execDriver()).volumes(in.volumes()).hostConfig(in.hostConfig()).volumesRW(in.volumesRW()) .command(in.command()).status(in.status()).ports(in.ports()).hostnamePath(in.hostnamePath()) .hostsPath(in.hostsPath()).mountLabel(in.mountLabel()).processLabel(in.processLabel()).node(in.node().orNull()); }
Source:
<code>public void onError(CommandEnvelope envelope, RuntimeException exception) { checkNotNull(envelope); checkNotNull(exception); <START> if (causedByRejection(exception)) { <END> final Rejection rejection = Commands.reject(envelope.getCommand(), exception); getBoundedContext().getRejectionBus() .post(rejection); } else { logError("Error dispatching command (class: %s id: %s).", envelope, exception); throw exception; } }</code><technical_language>a code duplicate. discuss do better</technical_language>

Target:
public void onError(CommandEnvelope envelope, RuntimeException exception) { commandErrorHandler.handleError(envelope, exception); }
Source:
<code>public void iCanBulkDownloadASingleFile() throws IOException, OperationException, InterruptedException { <START> System.setProperty(RandomBug.MODE_PROPERTY, RandomBug.Mode.STRICT.toString()); <END> testWithNbFiles(1); }</code><technical_language>I need anymore (or import), do you</technical_language>

Target:
public void iCanBulkDownloadASingleFile() throws IOException, OperationException, InterruptedException { testWithNbFiles(1); }
Source:
<code>public void closeCloseCurrentConnection() throws SQLException { synchronized (this) { if (_theConnection != null) { _theConnection.close(); _theConnection = null; <START> _theXAResource = null; <END> _theTransaction = null; } } }</code><technical_language>A call java reset () neater here. similarly for IndirectRecoverableConnection below</technical_language>

Target:
public void closeCloseCurrentConnection() throws SQLException { synchronized (this) { if (_theConnection != null) { _theConnection.close(); _theConnection = null; reset(); } } }
Source:
<code>public void testCheckpointingWithDelayedAssignment() throws Exception { StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment(); env.setParallelism(1); env.setRestartStrategy(new RestartStrategies.NoRestartStrategyConfiguration()); env.enableCheckpointing(50, CheckpointingMode.EXACTLY_ONCE); final SingleOutputStreamOperator<Long> stream = env .fromSequence(0, 100) .map(x -> { <START> Thread.sleep(10); <END> return x; }); final CompletableFuture<Collection<Long>> result = collector.collect(stream); env.execute(); assertArrayEquals(LongStream.rangeClosed(0, 100).boxed().toArray(), result.get().toArray()); }</code><technical_language>Sleeping for a bit longer (50 in setup) 2nd issue (missing hasNext) fail more likely</technical_language>

Target:
public void testCheckpointingWithDelayedAssignment() throws Exception { StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment(); env.setParallelism(1); env.setRestartStrategy(new RestartStrategies.NoRestartStrategyConfiguration()); env.enableCheckpointing(10, CheckpointingMode.EXACTLY_ONCE); final SingleOutputStreamOperator<Long> stream = env .fromSequence(0, 100) .map(x -> { Thread.sleep(10); return x; }); final CompletableFuture<Collection<Long>> result = collector.collect(stream); env.execute(); assertArrayEquals(LongStream.rangeClosed(0, 100).boxed().toArray(), result.get().toArray()); }
Source:
<code>public int processLineContent(String line, int offset) { if (blockLineCount == 0) { <START> String idprefix = getAsciiDocState().getAttribute(AsciiDocContentState.ATTRIBUTE_IDPREFIX); String idseparator = getAsciiDocState().getAttribute(AsciiDocContentState.ATTRIBUTE_IDSEPARATOR); String headingId = LanguageSupport.computeHeadingId(line, idprefix, idseparator); <END> HeadingAttributes attributes = new HeadingAttributes(); attributes.setId(headingId); builder.beginHeading(level, attributes); builder.characters(line.trim()); } else { builder.endHeading(); setClosed(true); } blockLineCount++; return -1; }</code><technical_language>this duplicated code consider extracting logic a separate class reusable consider implementing IdGenerationStrategy facilitate generation of a table of contents</technical_language>

Target:
public int processLineContent(String line, int offset) { if (blockLineCount == 0) { HeadingAttributes attributes = new HeadingAttributes(); attributes.setId(state.getIdGenerator().newId(null, line)); builder.beginHeading(level, attributes); builder.characters(line.trim()); } else { builder.endHeading(); setClosed(true); } blockLineCount++; return -1; }
Source:
<code>private static char[][] internSimpleNames(char[][] simpleNames, boolean removeWellKnown, boolean doSort) { if (simpleNames == null) return EmptySimpleNames; int length = simpleNames.length; if (length == 0) return EmptySimpleNames; char[][] keepers = new char[length][]; char[] prev = null; boolean isSorted = true; int index = 0; next : for (int i = 0; i < length; i++) { char[] name = simpleNames[i]; int sLength = name.length; for (int j = 0, m = WellKnownSimpleNames.length; j < m; j++) { char[] wellKnownName = WellKnownSimpleNames[j]; if (sLength > wellKnownName.length) break; if (CharOperation.equals(name, wellKnownName)) { if (!removeWellKnown) { keepers[index++] = wellKnownName; if (doSort && isSorted) { if (prev == null) { <START> prev = name; <END> } else { if (compareCharArray(prev, name) > 0) { isSorted = false; } } prev = name; } } continue next; } } NameSet internedNames = InternedSimpleNames[sLength < MaxSimpleNames ? sLength : 0]; keepers[index++] = internedNames.add(name); if (doSort && isSorted) { if (prev == null) { prev = name; } else { if (compareCharArray(prev, name) > 0) { isSorted = false; } } prev = name; } } if (length > index) { if (index == 0) return EmptySimpleNames; System.arraycopy(keepers, 0, keepers = new char[index][], 0, index); } if (doSort && !isSorted) { Arrays.sort(keepers, CHAR_ARR_COMPARATOR); } return keepers; }</code><technical_language>assignment is needed, code if/else same</technical_language>

Target:
private static char[][] internSimpleNames(char[][] simpleNames, boolean removeWellKnown, boolean doSort) { if (simpleNames == null) return EmptySimpleNames; int length = simpleNames.length; if (length == 0) return EmptySimpleNames; char[][] keepers = new char[length][]; char[] prev = null; boolean isSorted = true; int index = 0; next : for (int i = 0; i < length; i++) { char[] name = simpleNames[i]; int sLength = name.length; for (int j = 0, m = WellKnownSimpleNames.length; j < m; j++) { char[] wellKnownName = WellKnownSimpleNames[j]; if (sLength > wellKnownName.length) break; if (CharOperation.equals(name, wellKnownName)) { if (!removeWellKnown) { keepers[index++] = wellKnownName; if (doSort && isSorted) { if (prev != null && compareCharArray(prev, name) > 0) { isSorted = false; } prev = name; } } continue next; } } NameSet internedNames = InternedSimpleNames[sLength < MaxSimpleNames ? sLength : 0]; keepers[index++] = internedNames.add(name); if (doSort && isSorted) { if (prev != null && compareCharArray(prev, name) > 0) { isSorted = false; } prev = name; } } if (length > index) { if (index == 0) return EmptySimpleNames; System.arraycopy(keepers, 0, keepers = new char[index][], 0, index); } if (doSort && !isSorted) { Arrays.sort(keepers, CHAR_ARR_COMPARATOR); } return keepers; }
Source:
<code>public static List<String> getNotableTagDisplayNames() { List<String> tagDisplayNames = new ArrayList<>(); for (TagNameDefinition tagDef : TagNameDefinition.getTagNameDefinitions()) { if (tagDef.getKnownStatus() == TskData.FileKnown.BAD) { tagDisplayNames.add(tagDef.getDisplayName()); } } try { TagsManager tagsManager = Case.getCurrentCaseThrows().getServices().getTagsManager(); for (TagName tagName : tagsManager.getAllTagNames()) { if(tagName.getKnownStatus() == TskData.FileKnown.BAD && !tagDisplayNames.contains(tagName.getDisplayName())) { tagDisplayNames.add(tagName.getDisplayName()); } } } catch (NoCurrentCaseException ignored) { } catch(TskCoreException ex) { <START> LOGGER.log(Level.SEVERE, "Faile to get list of TagNams from tagsManager."); <END> } return tagDisplayNames; }</code><technical_language>I this meant "Failed get list of TagNames TagsManager."</technical_language>

Target:
public static List<String> getNotableTagDisplayNames() { List<String> tagDisplayNames = new ArrayList<>(); for (TagNameDefinition tagDef : TagNameDefinition.getTagNameDefinitions()) { if (tagDef.getKnownStatus() == TskData.FileKnown.BAD) { tagDisplayNames.add(tagDef.getDisplayName()); } } try { TagsManager tagsManager = Case.getCurrentCaseThrows().getServices().getTagsManager(); for (TagName tagName : tagsManager.getAllTagNames()) { if(tagName.getKnownStatus() == TskData.FileKnown.BAD && !tagDisplayNames.contains(tagName.getDisplayName())) { tagDisplayNames.add(tagName.getDisplayName()); } } } catch (NoCurrentCaseException ignored) { } catch(TskCoreException ex) { LOGGER.log(Level.SEVERE, "Failed to get list of TagNames from TagsManager.", ex); } return tagDisplayNames; }
Source:
<code>static void parseCoreEnvironmentElement(final XMLExtendedStreamReader reader, final ModelNode operation) throws XMLStreamException { final int count = reader.getAttributeCount(); for (int i = 0; i < count; i++) { requireNoNamespaceAttribute(reader, i); final String value = reader.getAttributeValue(i); final Attribute attribute = Attribute.forName(reader.getAttributeLocalName(i)); switch (attribute) { case NODE_IDENTIFIER: TransactionSubsystemRootResourceDefinition.NODE_IDENTIFIER.parseAndSetParameter(value, operation, reader); break; case PATH: case RELATIVE_TO: <START> throw new XMLStreamException("the attribute '" + attribute.getLocalName() + "' is no longer supported", reader.getLocation()); <END> default: throw unexpectedAttribute(reader, i); } } final EnumSet<Element> required = EnumSet.of(Element.PROCESS_ID); final EnumSet<Element> encountered = EnumSet.noneOf(Element.class); while (reader.hasNext() && reader.nextTag() != END_ELEMENT) { final Element element = Element.forName(reader.getLocalName()); required.remove(element); switch (element) { case PROCESS_ID: { if (!encountered.add(element)) { throw duplicateNamedElement(reader, reader.getLocalName()); } parseProcessIdEnvironmentElement(reader, operation); break; } default: throw unexpectedElement(reader); } } if (!required.isEmpty()) { throw missingRequiredElement(reader, required); } }</code><technical_language>This needs done in i18n manner, a new method in org.jboss.as.txn.logging.TransactionLogger class. This throw TransactionLogger.ROOT_LOGGER.unsupportedAttribute(attribute.getLocalName(), reader.getLocation()); Also, please "The attribute"</technical_language>

Target:
static void parseCoreEnvironmentElement(final XMLExtendedStreamReader reader, final ModelNode operation) throws XMLStreamException { final int count = reader.getAttributeCount(); for (int i = 0; i < count; i++) { requireNoNamespaceAttribute(reader, i); final String value = reader.getAttributeValue(i); final Attribute attribute = Attribute.forName(reader.getAttributeLocalName(i)); switch (attribute) { case NODE_IDENTIFIER: TransactionSubsystemRootResourceDefinition.NODE_IDENTIFIER.parseAndSetParameter(value, operation, reader); break; case PATH: case RELATIVE_TO: throw TransactionLogger.ROOT_LOGGER.unsupportedAttribute(attribute.getLocalName(), reader.getLocation()); default: throw unexpectedAttribute(reader, i); } } final EnumSet<Element> required = EnumSet.of(Element.PROCESS_ID); final EnumSet<Element> encountered = EnumSet.noneOf(Element.class); while (reader.hasNext() && reader.nextTag() != END_ELEMENT) { final Element element = Element.forName(reader.getLocalName()); required.remove(element); switch (element) { case PROCESS_ID: { if (!encountered.add(element)) { throw duplicateNamedElement(reader, reader.getLocalName()); } parseProcessIdEnvironmentElement(reader, operation); break; } default: throw unexpectedElement(reader); } } if (!required.isEmpty()) { throw missingRequiredElement(reader, required); } }
Source:
<code>protected String getValueOutOfPaymentWorksCustomFieldDTO(PaymentWorksCustomFieldDTO dto, PaymentWorksFieldMapping fieldMapping) { if (StringUtils.equalsIgnoreCase(fieldMapping.getCustomAttributeValueToUse(), PaymentWorksConstants.CustomAttributeValueToUse.FILE)) { return dto.getFile(); } else if (StringUtils.equalsIgnoreCase(fieldMapping.getCustomAttributeValueToUse(), PaymentWorksConstants.CustomAttributeValueToUse.FIELD_VALUE)) { return dto.getField_value(); } else { <START> throw new IllegalArgumentException("The custom attrbute value to use is not value: " + fieldMapping.getCustomAttributeValueToUse()); <END> } }</code><technical_language>is a misspelling in exception message. I message sense. "not value" end removed</technical_language>

Target:
protected String getValueOutOfPaymentWorksCustomFieldDTO(PaymentWorksCustomFieldDTO dto, PaymentWorksFieldMapping fieldMapping) { if (StringUtils.equalsIgnoreCase(fieldMapping.getCustomAttributeValueToUse(), PaymentWorksConstants.CustomAttributeValueToUse.FILE)) { return dto.getFile(); } else if (StringUtils.equalsIgnoreCase(fieldMapping.getCustomAttributeValueToUse(), PaymentWorksConstants.CustomAttributeValueToUse.FIELD_VALUE)) { return dto.getField_value(); } else { throw new IllegalArgumentException("The custom attrbute value to use is not valid: " + fieldMapping.getCustomAttributeValueToUse()); } }
Source:
<code>public Channel retrieve(VeluxBridge bridge) { logger.trace("retrieve() called."); GetFirmware bcp = bridge.bridgeAPI().getFirmware(); <START> if ((bridge.bridgeCommunicate(bcp)) && (bcp.isCommunicationSuccessful())) { <END> this.channel.firmwareVersion = new StringType(bcp.getFirmware().toString()); this.channel.isRetrieved = true; logger.trace("retrieve() found successfully firmware {}.", this.channel.firmwareVersion); return channel; } logger.trace("retrieve() finished with failure."); return null; }</code><technical_language>redundant parentheses</technical_language>

Target:
public Channel retrieve(VeluxBridge bridge) { logger.trace("retrieve() called."); GetFirmware bcp = bridge.bridgeAPI().getFirmware(); if (bridge.bridgeCommunicate(bcp) && bcp.isCommunicationSuccessful()) { this.channel.firmwareVersion = new StringType(bcp.getFirmware().toString()); this.channel.isRetrieved = true; logger.trace("retrieve() found successfully firmware {}.", this.channel.firmwareVersion); return channel; } logger.trace("retrieve() finished with failure."); return null; }
Source:
<code>public void deliverMessagesFrom(ShardIndex index) { NodeId currentNode = ServerEnvironment.instance() .nodeId(); Optional<ShardProcessingSession> picked = workRegistry.pickUp(index, currentNode); if (!picked.isPresent()) { return; } ShardProcessingSession session = picked.get(); try { Integer deliveredMsgCount = null; <START> while (deliveredMsgCount == null || deliveredMsgCount > 0) { <END> deliveredMsgCount = doDeliver(session); } } finally { session.complete(); } }</code><technical_language>a do-while spare need of declaring Integer instead of int</technical_language>

Target:
public void deliverMessagesFrom(ShardIndex index) { NodeId currentNode = ServerEnvironment.instance() .nodeId(); Optional<ShardProcessingSession> picked = workRegistry.pickUp(index, currentNode); if (!picked.isPresent()) { return; } ShardProcessingSession session = picked.get(); try { int deliveredMsgCount; do { deliveredMsgCount = doDeliver(session); } while (deliveredMsgCount > 0); } finally { session.complete(); } }
Source:
<code>public void execute() { final Setting setting = getActionContext().getSetting(); final EObject eObject = setting.getEObject(); final EStructuralFeature eStructuralFeature = setting.getEStructuralFeature(); <START> final EObject toDuplicate = (EObject) ((IStructuredSelection) getTableViewer().getSelection()) <END> .getFirstElement(); final EObject copy = copyElement( eObject, eStructuralFeature, getEditingDomainForContainment(), toDuplicate); getTableViewer().setSelection(new StructuredSelection(copy), true); }</code><technical_language>support copying object? Why</technical_language>

Target:
public void execute() { final Setting setting = getActionContext().getSetting(); final EObject eObject = setting.getEObject(); final EStructuralFeature eStructuralFeature = setting.getEStructuralFeature(); @SuppressWarnings("unchecked") final List<EObject> toDuplicate = ((IStructuredSelection) getTableViewer().getSelection()).toList(); final Collection<EObject> copies = copyElements( eObject, eStructuralFeature, getEditingDomainForContainment(), toDuplicate); getTableViewer().setSelection(new StructuredSelection(copies.iterator().next()), true); }
Source:
<code>@Nullable public String getClientSecret() { for (FormGroup formGroup : form) { <START> for (FormField formField : formGroup.getFields()) { <END> if (formField.getId().equals("clientSecret")) { return formField.getValue().toString(); } } } return null; }</code><technical_language>careful of nullable fields</technical_language>

Target:
@Nullable public String getClientSecret() { return getValueFromField(FormField.CLIENT_SECRET); }
Source:
<code>private void parseZkJsonAndPopulateZkInfo(String zkLayoutPath) throws IOException, JSONException { JSONObject root = new JSONObject(Utils.readStringFromFile(zkLayoutPath)); JSONArray all = (root).getJSONArray("zkHosts"); for (int i = 0; i < all.length(); i++) { JSONObject entry = all.getJSONObject(i); <START> dataCenterToZkAddress.put(entry.getString("datacenter"), <END> entry.getString("hostname") + ":" + entry.getString("port")); } }</code><technical_language>define static constants for strings</technical_language>

Target:
private void parseZkJsonAndPopulateZkInfo(String zkLayoutPath) throws IOException, JSONException { JSONObject root = new JSONObject(Utils.readStringFromFile(zkLayoutPath)); JSONArray all = (root).getJSONArray(ZKINFO_STR); for (int i = 0; i < all.length(); i++) { JSONObject entry = all.getJSONObject(i); dataCenterToZkAddress.put(entry.getString(DATACENTER_STR), entry.getString(ZKCONNECTSTR_STR)); } }
Source:
<code>public void openStreamTest() throws IOException { final String path = "path"; CloudFilesObjectApiProxy objectApi = createMock(CloudFilesObjectApiProxy.class); CloudFilesObject cloudFilesObject = createMock(CloudFilesObject.class); Payload payload = createMock(Payload.class); InputStream stream = createMock(InputStream.class); expect(objectApi.get(path)).andReturn(cloudFilesObject); expect(cloudFilesObject.getPayload()).andReturn(payload); expect(payload.openStream()).andReturn(stream); replayAll(); CloudFilesByteSource byteSource = new CloudFilesByteSource(objectApi, path); <START> byteSource.openStream(); <END> verifyAll(); }</code><technical_language>(non-blocking) Assert.assertEquals(stream, byteSource.openStream());</technical_language>

Target:
public void openStreamTest() throws IOException { final String path = "path"; CloudFilesObjectApiProxy objectApi = createMock(CloudFilesObjectApiProxy.class); CloudFilesObject cloudFilesObject = createMock(CloudFilesObject.class); Payload payload = createMock(Payload.class); InputStream stream = createMock(InputStream.class); expect(objectApi.get(path)).andReturn(cloudFilesObject); expect(cloudFilesObject.getPayload()).andReturn(payload); expect(payload.openStream()).andReturn(stream); payload.close(); replayAll(); CloudFilesByteSource byteSource = new CloudFilesByteSource(objectApi, path); assertEquals(stream, byteSource.openStream()); byteSource.closeStream(); verifyAll(); }
Source:
<code>private boolean isImplementingRecursive(Class commandClass, Class interfaceClass) { if (Arrays.asList(commandClass.getInterfaces()).contains(interfaceClass)) { return true; } else { <START> return commandClass.getSuperclass() != CommandBase.class <END> && isImplementingRecursive(commandClass.getSuperclass(), interfaceClass); } }</code><technical_language>equals instead of !=</technical_language>

Target:
private boolean isImplementingRecursive(Class commandClass, Class interfaceClass) { if (Arrays.asList(commandClass.getInterfaces()).contains(interfaceClass)) { return true; } else { return !commandClass.getSuperclass().equals(CommandBase.class) && isImplementingRecursive(commandClass.getSuperclass(), interfaceClass); } }
Source:
<code>public void shouldThrowIfPluginThrows() { TestPlugins.assertInitialized(); <START> assertNotNull(plugins.newPlugin( <END> TestPlugins.ALWAYS_THROW_EXCEPTION, new AbstractConfig(new ConfigDef(), Collections.emptyMap()), Converter.class )); }</code><technical_language>If assertion necessary for test, remove it</technical_language>

Target:
public void shouldThrowIfPluginThrows() { TestPlugins.assertAvailable(); plugins.newPlugin( TestPlugins.ALWAYS_THROW_EXCEPTION, new AbstractConfig(new ConfigDef(), Collections.emptyMap()), Converter.class ); }
Source:
<code><START> public String convertMemberName(Member member) { <END> if (Modifier.isTransient(member.getModifiers())) { return null; } if (member instanceof Field) { Field f = (Field) member; if (gson.excluder().excludeField(f, true)) { return null; } if (f.isAnnotationPresent(SerializedName.class)) { return f.getDeclaredAnnotation(SerializedName.class).value(); } } return member.getName(); }</code><technical_language>return null if Member is a Constructor Executable</technical_language>

Target:
public String convertMemberName(Member member) { if (Modifier.isTransient(member.getModifiers())) { return null; } if (member instanceof Field) { Field f = (Field) member; if (f.isAnnotationPresent(SerializedName.class)) { return f.getDeclaredAnnotation(SerializedName.class).value(); } return member.getName(); } return null; }
Source:
<code>public void unstarOrganization(@ApiParam(hidden = true) @Auth User user, @ApiParam(value = "Organization to unstar.", required = true) @PathParam("organizationId") Long organizationId) { Organization organization = organizationDAO.findById(organizationId); boolean doesOrgExist = doesOrganizationExistToUser(organizationId, user.getId()); if (!doesOrgExist) { String msg = "Organization not found"; LOG.info(msg); <START> throw new CustomWebApplicationException(msg, HttpStatus.SC_NOT_FOUND); <END> } Set<User> starredUsers = organization.getStarredUsers(); if (starredUsers.contains(user)) { organization.removeStarredUser(user); } else { throw new CustomWebApplicationException( "You cannot unstar the organization " + organization.getName() + " because you have not starred it.", HttpStatus.SC_BAD_REQUEST); } }</code><technical_language>Similar PUT, split separate function</technical_language>

Target:
public void unstarOrganization(@ApiParam(hidden = true) @Auth User user, @ApiParam(value = "Organization to unstar.", required = true) @PathParam("organizationId") Long organizationId) { Organization organization = organizationDAO.findApprovedById(organizationId); checkOrganization(organization); Set<User> starredUsers = organization.getStarredUsers(); if (starredUsers.contains(user)) { organization.removeStarredUser(user); } else { throw new CustomWebApplicationException( "You cannot unstar the organization " + organization.getName() + " because you have not starred it.", HttpStatus.SC_BAD_REQUEST); } }
Source:
<code>public void logsEndpointsSorted() { rc.register(DummyResource.class); rc.register(TestResource2.class); rc.register(TestResource.class); rc.register(ImplementingResource.class); <START> System.out.println(rc.getEndpointsInfo()); <END> assertThat(rc.getEndpointsInfo()) .contains(" GET / (io.dropwizard.jersey.dummy.DummyResource)\n" + " GET /another (io.dropwizard.jersey.DropwizardResourceConfigTest.ImplementingResource)\n" + " GET /async (io.dropwizard.jersey.dummy.DummyResource)\n" + " DELETE /dummy (io.dropwizard.jersey.DropwizardResourceConfigTest.TestResource2)\n" + " GET /dummy (io.dropwizard.jersey.DropwizardResourceConfigTest.TestResource)\n" + " POST /dummy (io.dropwizard.jersey.DropwizardResourceConfigTest.TestResource2)" ); }</code><technical_language>removed :)</technical_language>

Target:
public void logsEndpointsSorted() { rc.register(DummyResource.class); rc.register(TestResource2.class); rc.register(TestResource.class); rc.register(ImplementingResource.class); assertThat(rc.getEndpointsInfo()).matches(Pattern.compile(".*" + " GET / \\(io\\.dropwizard\\.jersey\\.dummy\\.DummyResource\\)." + " GET /another \\(io\\.dropwizard\\.jersey\\.DropwizardResourceConfigTest\\.ImplementingResource\\)." + " GET /async \\(io\\.dropwizard\\.jersey\\.dummy\\.DummyResource\\)." + " DELETE /dummy \\(io\\.dropwizard\\.jersey\\.DropwizardResourceConfigTest\\.TestResource2\\)." + " GET /dummy \\(io\\.dropwizard\\.jersey\\.DropwizardResourceConfigTest\\.TestResource\\)." + " POST /dummy \\(io\\.dropwizard\\.jersey\\.DropwizardResourceConfigTest\\.TestResource2\\).", Pattern.DOTALL)); }
Source:
<code>protected void startBundles(List<Bundle> bundles) { FrameworkWiring frameworkWiring = framework.adapt(FrameworkWiring.class); if (!frameworkWiring.resolveBundles(bundles)) { <START> logger.warn("Could not resolve all ${bundles.size} bundles."); <END> } List<Bundle> sortedByDependency = BundleDependencies.sortByDependencies(bundles); for (Bundle bundle : sortedByDependency) { if (!isFragmentBundle(bundle)) { this.startBundle(bundle); } } }</code><technical_language>bundles.size logged</technical_language>

Target:
protected void startBundles(List<Bundle> bundles) { FrameworkWiring frameworkWiring = framework.adapt(FrameworkWiring.class); if (!frameworkWiring.resolveBundles(bundles)) { logger.warn("Could not resolve all bundles.", bundles.size()); } List<Bundle> sortedByDependency = BundleDependencies.sortByDependencies(bundles); for (Bundle bundle : sortedByDependency) { if (!isFragmentBundle(bundle)) { this.startBundle(bundle); } } }
Source:
<code>private KeyStore getKeyStoreInstance(String type) throws CredentialStoreException { if (providers != null) { if (log.isTraceEnabled()) { <START> log.tracef("Obtaining KeyStore instance of type %s, providers: %s", type, providers); <END> } for (Provider p: providers) { try { KeyStore ks = KeyStore.getInstance(type, p); log.tracef("Obtained KeyStore instance: %s, provider: %s", ks, p.toString()); return ks; } catch (KeyStoreException e) { } } } try { if (log.isTraceEnabled()) { log.tracef("Obtaining KeyStore instance of type %s, providers: %s", type, Arrays.toString(Security.getProviders())); } KeyStore ks = KeyStore.getInstance(type); log.tracef("Obtained KeyStore instance: %s", ks); return ks; } catch (KeyStoreException e) { throw log.cannotInitializeCredentialStore(e); } }</code><technical_language>good Arrays.toString(providers)</technical_language>

Target:
private KeyStore getKeyStoreInstance(String type) throws CredentialStoreException { if (providers != null) { if (log.isTraceEnabled()) { log.tracef("Obtaining KeyStore instance of type %s, providers: %s", type, Arrays.toString(providers)); } for (Provider p: providers) { try { KeyStore ks = KeyStore.getInstance(type, p); log.tracef("Obtained KeyStore instance: %s, provider: %s", ks, p.toString()); return ks; } catch (KeyStoreException e) { } } } try { if (log.isTraceEnabled()) { log.tracef("Obtaining KeyStore instance of type %s, providers: %s", type, Arrays.toString(Security.getProviders())); } KeyStore ks = KeyStore.getInstance(type); log.tracef("Obtained KeyStore instance: %s", ks); return ks; } catch (KeyStoreException e) { throw log.cannotInitializeCredentialStore(e); } }
Source:
<code>public TaskBuilder async() { this.syncType = ScheduledTask.TaskSynchroncity.ASYNCHRONOUS; if (this.tickDelay != -1) { <START> this.delay = this.tickDelay * 50; <END> this.tickDelay = -1; } if (this.tickInterval != -1) { this.interval = this.tickInterval * 50; this.tickInterval = -1; } return this; }</code><technical_language>50 means...what? Magic numbers bad</technical_language>

Target:
public TaskBuilder async() { this.syncType = ScheduledTask.TaskSynchronicity.ASYNCHRONOUS; if (this.tickDelay != -1) { this.delay = this.tickDelay * TICK_DURATION; this.tickDelay = -1; } if (this.tickInterval != -1) { this.interval = this.tickInterval * TICK_DURATION; this.tickInterval = -1; } return this; }
Source:
<code><START> public void testFrameworkProducerCreate() throws Exception { <END> setupFrameworkProducer(false); Exchange mockExchange = mock(Exchange.class); Message message = mock(Message.class); when(mockExchange.getIn()).thenReturn(message); when(mockExchange.getOut()).thenReturn(message); when(mockExchange.getIn().getHeader(OPERATION_HEADER_KEY)).thenReturn(CREATE_OPERATION); when(mockExchange.getIn().getHeader(TIMEOUT_HEADER_KEY)).thenReturn(1000L); when(mockExchange.getIn().getBody()).thenReturn(new MetacardImpl()); when(mockExchange.getIn().getBody(any())).thenReturn(new MetacardImpl()); frameworkProducer.process(mockExchange); }</code><technical_language>This test needs a verification</technical_language>

Target:
public void testFrameworkProducerCreate() throws Exception { setupFrameworkProducer(false); Exchange mockExchange = mock(Exchange.class); Message message = mock(Message.class); when(mockExchange.getIn()).thenReturn(message); when(mockExchange.getOut()).thenReturn(message); when(mockExchange.getIn().getHeader(OPERATION_HEADER_KEY)).thenReturn(CREATE_OPERATION); when(mockExchange.getIn().getHeader(TIMEOUT_HEADER_KEY)).thenReturn(1000L); when(mockExchange.getIn().getBody()).thenReturn(new MetacardImpl()); when(mockExchange.getIn().getBody(any())).thenReturn(new MetacardImpl()); frameworkProducer.process(mockExchange); verify(catalogFramework).create(any(CreateRequest.class)); }
Source:
<code>private void initProgressIndicator() { progressIndicator = new SimplePanel(); getContainer().insert(progressIndicator, 0); getDetailModel().getPropertyChangedEvent().addListener((ev, sender, args) -> { if (getDetailModel().isNetworkOperationInProgress()) { progressIndicator.getElement().setInnerSafeHtml( templates.hostInterfaceOperationInProgressSpinner(constants.networkUpdating()) ); } else { <START> progressIndicator.getElement().setInnerSafeHtml(templates.sevenPixelPaddedEmptyPlaceholder()); <END> } }); }</code><technical_language>1. do need placeholder? bad without? 2. name 'networkUpdatingPlaceholder'</technical_language>

Target:
private void initProgressIndicator() { progressIndicator = new SimplePanel(); getContainer().insert(progressIndicator, 0); getDetailModel().getPropertyChangedEvent().addListener((ev, sender, args) -> { if (getDetailModel().isNetworkOperationInProgress()) { progressIndicator.getElement().setInnerSafeHtml( templates.hostInterfaceOperationInProgressSpinner(constants.networkUpdating()) ); } else { progressIndicator.getElement().setInnerSafeHtml(templates.networkUpdatingPlaceholder()); } }); }
Source:
<code>private void exitFormulaEditorFragment() { if (hasFormulaBeenChanged || formulaEditorEditText.getHistory().hasUnsavedChanges()) { AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); builder.setTitle(R.string.formula_editor_discard_changes_dialog_title) .setMessage(R.string.formula_editor_discard_changes_dialog_message) .setNegativeButton(R.string.no, new OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { <START> if (discardFormulaIfPossible()) { <END> ToastUtil.showError(getActivity(), R.string.formula_editor_changes_discarded); currentFormula.setDisplayText(null); onUserDismiss(); } } }) .setPositiveButton(R.string.yes, new OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { if (saveFormulaIfPossible()) { ToastUtil.showSuccess(getActivity(), R.string.formula_editor_changes_saved); hasFormulaBeenChanged = false; onUserDismiss(); } } }) .create() .show(); } else { onUserDismiss(); } }</code><technical_language>if this returns false for reason dialog away..</technical_language>

Target:
private void exitFormulaEditorFragment() { if (hasFormulaBeenChanged || formulaEditorEditText.getHistory().hasUnsavedChanges()) { AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); builder.setTitle(R.string.formula_editor_discard_changes_dialog_title) .setMessage(R.string.formula_editor_discard_changes_dialog_message) .setNegativeButton(R.string.no, new OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { saveInitialStates(); ToastUtil.showError(getActivity(), R.string.formula_editor_changes_discarded); currentFormula.setDisplayText(null); onUserDismiss(); } }) .setPositiveButton(R.string.yes, new OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { if (saveFormulaIfPossible()) { ToastUtil.showSuccess(getActivity(), R.string.formula_editor_changes_saved); hasFormulaBeenChanged = false; onUserDismiss(); } } }) .create() .show(); } else { onUserDismiss(); } }
Source:
<code>void updateBayCount(Entity e) { <START> if ((e instanceof Jumpship) || (e instanceof SmallCraft)) { <END> for (Bay bay : e.getTransportBays()) { if (bay instanceof MechBay) { setMechBayCount(getMechBayCount() + (int)bay.getCapacity()); } else if (bay instanceof BattleArmorBay) { setBaBayCount(getBaBayCount() + (int)bay.getCapacity()); } else if (bay instanceof InfantryBay) { setInfantryBayCount(getInfantryBayCount() + (int) (bay.getCapacity() / ((InfantryBay) bay).getPlatoonType().getWeight())); } else if (bay instanceof LightVehicleBay) { setLightVeeBayCount(getLightVeeBayCount() + (int) bay.getCapacity()); } else if (bay instanceof HeavyVehicleBay) { setHeavyVeeBayCount(getHeavyVeeBayCount() + (int) bay.getCapacity()); } else if (bay instanceof SuperHeavyVehicleBay) { setSuperHeavyVeeBayCount(getSuperHeavyVeeBayCount() + (int) bay.getCapacity()); } else if (bay instanceof ASFBay) { setFighterBayCount(getFighterBayCount() + (int) bay.getCapacity()); } else if (bay instanceof SmallCraftBay) { setSmallCraftBayCount(getSmallCraftBayCount() + (int) bay.getCapacity()); } } } }</code><technical_language>[Entity::getTransportBays](<LINK_0> returns a non-null Vector. I if this if test dropped simplify code (and future proof it). Thoughts @neoancient @mkerensky @NickAragua</technical_language>

Target:
void updateBayCount(Entity e) { if (((e instanceof Jumpship) || (e instanceof Dropship)) && !(e instanceof SpaceStation)) { for (Bay bay : e.getTransportBays()) { if (bay instanceof MechBay) { setMechBayCount(getMechBayCount() + (int)bay.getCapacity()); } else if (bay instanceof BattleArmorBay) { setBaBayCount(getBaBayCount() + (int)bay.getCapacity()); } else if (bay instanceof InfantryBay) { setInfantryBayCount(getInfantryBayCount() + (int) (bay.getCapacity() / ((InfantryBay) bay).getPlatoonType().getWeight())); } else if (bay instanceof LightVehicleBay) { setLightVeeBayCount(getLightVeeBayCount() + (int) bay.getCapacity()); } else if (bay instanceof HeavyVehicleBay) { setHeavyVeeBayCount(getHeavyVeeBayCount() + (int) bay.getCapacity()); } else if (bay instanceof SuperHeavyVehicleBay) { setSuperHeavyVeeBayCount(getSuperHeavyVeeBayCount() + (int) bay.getCapacity()); } else if (bay instanceof ASFBay) { setFighterBayCount(getFighterBayCount() + (int) bay.getCapacity()); } else if (bay instanceof SmallCraftBay) { setSmallCraftBayCount(getSmallCraftBayCount() + (int) bay.getCapacity()); } } } }
Source:
<code>protected S3Profile mapProfile(HierarchicalConfiguration<ImmutableNode> profileConfig) throws ConfigurationException { S3Profile profile = super.mapProfile(profileConfig); profile.setBucketName(getRequiredStringProperty(profileConfig, CONFIG_KEY_BUCKET)); <START> if(profileConfig.getString(CONFIG_KEY_ENDPOINT) != null && !profileConfig.getString(CONFIG_KEY_ENDPOINT).isEmpty()){ <END> profile.setEndpoint(getRequiredStringProperty(profileConfig, CONFIG_KEY_ENDPOINT)); } return profile; }</code><technical_language>this property is required, please ConfigUtils.getStringProperty, need for if</technical_language>

Target:
protected S3Profile mapProfile(HierarchicalConfiguration<ImmutableNode> profileConfig) throws ConfigurationException { S3Profile profile = super.mapProfile(profileConfig); profile.setBucketName(getRequiredStringProperty(profileConfig, CONFIG_KEY_BUCKET)); profile.setEndpoint(getStringProperty(profileConfig, CONFIG_KEY_ENDPOINT)); return profile; }
Source:
<code><START> void updateFileCommentVisibility(boolean forceHide) { <END> if (forceHide || (fileCommentPanelA.getBoxCount() == 0 && fileCommentPanelB.getBoxCount() == 0)) { UIObject.setVisible(patchsetNavRow, false); UIObject.setVisible(fileCommentRow, false); } else if (patchSelectBoxA.isFileCommentSetVisible()) { UIObject.setVisible(patchsetNavRow, true); UIObject.setVisible(fileCommentRow, true); } host.resizeCodeMirror(); }</code><technical_language>Whoops careless.. Yeah I remove link complicating a lot</technical_language>

Target:
void updateFileCommentVisibility(boolean forceHide) { if (forceHide) { UIObject.setVisible(patchsetNavRow, false); } if (forceHide || (fileCommentPanelA.getBoxCount() == 0 && fileCommentPanelB.getBoxCount() == 0)) { UIObject.setVisible(fileCommentRow, false); } else { UIObject.setVisible(patchsetNavRow, true); UIObject.setVisible(fileCommentRow, true); } host.resizeCodeMirror(); }
Source:
<code>private static LogEntry switchVolumes(LogEntry le, List<Pair<Path,Path>> replacements) { String switchedPath = switchVolume(le.filename, FileType.WAL, replacements); int numSwitched = 0; if (switchedPath != null) numSwitched++; else switchedPath = le.filename; String switchedLog = switchVolume(le.filename, FileType.WAL, replacements); <START> if (switchedLog != null) { <END> numSwitched++; } if (numSwitched == 0) { log.trace("Did not switch {}", le); return null; } LogEntry newLogEntry = new LogEntry(le.extent, le.timestamp, le.server, switchedPath); log.trace("Switched to {}", le, newLogEntry); return newLogEntry; }</code><technical_language>This need assigned a variable... check if method return is null</technical_language>

Target:
private static LogEntry switchVolumes(LogEntry le, List<Pair<Path,Path>> replacements) { String switchedPath = switchVolume(le.filename, FileType.WAL, replacements); int numSwitched = 0; if (switchedPath != null) numSwitched++; else switchedPath = le.filename; if (switchVolume(le.filename, FileType.WAL, replacements) != null) { numSwitched++; } if (numSwitched == 0) { log.trace("Did not switch {}", le); return null; } LogEntry newLogEntry = new LogEntry(le.extent, le.timestamp, le.server, switchedPath); log.trace("Switched to {}", le, newLogEntry); return newLogEntry; }
Source:
<code>private Object unmarshallSiteFileNode( Node field ) { ArrayList<NamedClusterSiteFile> namedClusterSiteFiles = new ArrayList<>(); Node siteFileWrapper = XMLHandler.getSubNode( field, CHILDREN ); if ( siteFileWrapper != null ) { List<Node> siteFilesNode = XMLHandler.getNodes( siteFileWrapper, CHILD ); <START> for ( Node siteFile : siteFilesNode ) { <END> NamedClusterSiteFileImpl namedClusterSiteFile = new NamedClusterSiteFileImpl(); List<Node> siteFields = XMLHandler.getNodes( XMLHandler.getSubNode( siteFile, CHILDREN ), CHILD ); for ( Node siteField : siteFields ) { String id = XMLHandler.getTagValue( siteField, ID ); if ( id != null && !id.isEmpty() ) { try { BeanUtils.setProperty( namedClusterSiteFile, id, XMLHandler.getTagValue( siteField, VALUE ) ); } catch ( IllegalAccessException | InvocationTargetException e ) { LOGGER.error( "Could not set field " + id + " in NamedClusterSiteFile", e ); } } } namedClusterSiteFiles.add( namedClusterSiteFile ); } } return namedClusterSiteFiles; }</code><technical_language>extract some of this deeply nested? I hit level of a nesting eyes start glaze over</technical_language>

Target:
private Object unmarshallSiteFileNode( Node field ) { ArrayList<NamedClusterSiteFile> namedClusterSiteFiles = new ArrayList<>(); Node siteFileWrapper = XMLHandler.getSubNode( field, CHILDREN ); if ( siteFileWrapper != null ) { unmarshallSiteFiles( namedClusterSiteFiles, XMLHandler.getNodes( siteFileWrapper, CHILD ) ); } return namedClusterSiteFiles; }
Source:
<code>public Response systemScopesRoleAliasesPut(RoleAliasListDTO body, MessageContext messageContext) throws APIManagementException { String tenantDomain = MultitenantUtils.getTenantDomain(RestApiUtil.getLoggedInUsername()); RoleAliasListDTO roleAliasListDTO = new RoleAliasListDTO(); JsonObject existingTenantConfObject = new JsonObject(); <START> <END> try { APIMRegistryService apimRegistryService = new APIMRegistryServiceImpl(); String existingTenantConf = apimRegistryService.getConfigRegistryResourceContent(tenantDomain, APIConstants.API_TENANT_CONF_LOCATION); existingTenantConfObject = new JsonParser().parse(existingTenantConf).getAsJsonObject(); } catch (RegistryException e) { APIUtil.handleException("Couldn't read tenant configuration from tenant registry", e); } catch (UserStoreException e) { APIUtil.handleException("Couldn't read tenant configuration from User Store", e); } JSONObject responseJson = SystemScopesMappingUtil.createJsonObjectOfRoleMapping(body); existingTenantConfObject.remove(APIConstants.REST_API_ROLE_MAPPINGS_CONFIG); JsonElement jsonElement = new JsonParser().parse(String.valueOf(responseJson)); existingTenantConfObject.add(APIConstants.REST_API_ROLE_MAPPINGS_CONFIG, jsonElement); try { ObjectMapper mapper = new ObjectMapper(); String formattedTenantConf = mapper.writerWithDefaultPrettyPrinter() .writeValueAsString(existingTenantConfObject.toString()); APIUtil.updateTenantConf(existingTenantConfObject.toString(), tenantDomain); if (log.isDebugEnabled()) { log.debug("Finalized tenant-conf.json: " + formattedTenantConf); } } catch (JsonProcessingException e) { throw new APIManagementException("Error while formatting tenant-conf.json of tenant: " + tenantDomain, e); } JSONObject tenantConfig = APIUtil.getTenantConfig(tenantDomain); JSONObject roleMapping = (JSONObject) tenantConfig.get(APIConstants.REST_API_ROLE_MAPPINGS_CONFIG); if (roleMapping != null) { roleAliasListDTO = SystemScopesMappingUtil.fromRoleAliasListToRoleAliasListDTO( SystemScopesMappingUtil.createMapOfRoleMapping((roleMapping))); } return Response.ok().entity(roleAliasListDTO).build(); }</code><technical_language>Remove empty line</technical_language>

Target:
public Response systemScopesRoleAliasesPut(RoleAliasListDTO body, MessageContext messageContext) throws APIManagementException { RoleAliasListDTO roleAliasListDTO = new RoleAliasListDTO(); JSONObject newRoleMappingJson = SystemScopesMappingUtil.createJsonObjectOfRoleMapping(body); String username = RestApiUtil.getLoggedInUsername(); String tenantDomain = MultitenantUtils.getTenantDomain(username); APIUtil.updateTenantConfRoleAliasMapping(newRoleMappingJson, username); JSONObject tenantConfig = APIUtil.getTenantConfig(tenantDomain); JSONObject roleMapping = (JSONObject) tenantConfig.get(APIConstants.REST_API_ROLE_MAPPINGS_CONFIG); if (roleMapping != null) { roleAliasListDTO = SystemScopesMappingUtil.fromRoleAliasListToRoleAliasListDTO( SystemScopesMappingUtil.createMapOfRoleMapping((roleMapping))); } return Response.ok().entity(roleAliasListDTO).build(); }
Source:
<code>public URI apply(@Nullable Object from) { <START> checkArgument(from != null && from instanceof String, "you must specify a region, as a String argument"); <END> return Suppliers2.getValueInMapOrNull(endpointsSupplier, (String) from).get(); }</code><technical_language>If null declare @Nullable</technical_language>

Target:
public URI apply(@Nullable Object from) { checkArgument(from != null && from instanceof String, "you must specify a region, as a String argument"); Map<String, Supplier<URI>> regionToEndpoint = endpointsSupplier.get(); checkState(regionToEndpoint.size() > 0, "no region name to endpoint mappings configured!"); checkArgument(regionToEndpoint.containsKey(from), "requested location %s, which is not in the configured locations: %s", from, regionToEndpoint); return regionToEndpoint.get(from).get(); }
Source:
<code>protected void scanTarget(MqttBrokerConnection testConnection) throws ConfigurationException, MqttException, InterruptedException { final Lock lock = new ReentrantLock(); lock.lock(); testConnection.addConnectionObserver((isConnected, error) -> lock.unlock()); testConnection.start(); lock.tryLock(TIMEOUT_IN_MS, TimeUnit.MILLISECONDS); if (testConnection.connectionState() == MqttConnectionState.CONNECTED) { <START> logger.trace("Found service device at {}", <END> testConnection.getHost() + ":" + String.valueOf(testConnection.getPort())); Map<String, Object> properties = new HashMap<>(); properties.put("host", testConnection.getHost()); properties.put("port", testConnection.getPort()); ThingUID thingUID = MqttThingID.getThingUID(testConnection.getHost(), testConnection.getPort()); thingDiscovered(DiscoveryResultBuilder.create(thingUID).withTTL(120).withProperties(properties) .withLabel("Mqtt Broker (" + testConnection.getHost() + ")").build()); } testConnection.stop(); }</code><technical_language>change fully parameterised logging: {}:{}</technical_language>

Target:
protected void scanTarget(MqttBrokerConnection testConnection) throws ConfigurationException, MqttException, InterruptedException { final Lock lock = new ReentrantLock(); lock.lock(); testConnection.addConnectionObserver((isConnected, error) -> lock.unlock()); testConnection.start(); lock.tryLock(TIMEOUT_IN_MS, TimeUnit.MILLISECONDS); if (testConnection.connectionState() == MqttConnectionState.CONNECTED) { logger.trace("Found service device at {}:{}", testConnection.getHost(), String.valueOf(testConnection.getPort())); Map<String, Object> properties = new HashMap<>(); properties.put("host", testConnection.getHost()); properties.put("port", testConnection.getPort()); ThingUID thingUID = MqttThingID.getThingUID(testConnection.getHost(), testConnection.getPort()); thingDiscovered(DiscoveryResultBuilder.create(thingUID).withTTL(120).withProperties(properties) .withRepresentationProperty("host").withLabel("MQTT Broker").build()); } testConnection.stop(); }
Source:
<code>public void init(FilterConfig arg0) throws ServletException { <START> if (allowedCorsOriginsConfig == null || "*".equals(allowedCorsOriginsConfig)) { <END> allowAnyOrigin = true; } else { allowAnyOrigin = false; try { allowedOrigins = OriginValidation.parseAllowedCorsOrigins(allowedCorsOriginsConfig); } catch (Exception e) { throw new ServletException(e); } } }</code><technical_language>allowedCorsOriginsConfig.trim() in case user adds spaces</technical_language>

Target:
public void init(FilterConfig arg0) throws ServletException { if (allowedCorsOriginsConfig == null || ALLOW_ALL_ORIGIN.equals(allowedCorsOriginsConfig.trim())) { allowAnyOrigin = true; } else { allowAnyOrigin = false; try { allowedOrigins = OriginValidation.parseAllowedCorsOrigins(allowedCorsOriginsConfig); } catch (Exception e) { throw new ServletException(e); } } }
Source:
<code>public boolean visit(Assignment node) { <START> if (ASTHelper.isSameLocalVariable(node.getLeftHandSide(), cursorSimpleName)) { <END> return DO_NOT_VISIT_SUBTREE; } return VISIT_SUBTREE; }</code><technical_language>Please change of ASTHelper methods fields static imports</technical_language>

Target:
public boolean visit(Assignment node) { if (isSameLocalVariable(node.getLeftHandSide(), cursorSimpleName)) { return DO_NOT_VISIT_SUBTREE; } return VISIT_SUBTREE; }