auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private void commonStatusChangeHandler(BindingValidationStatus<?> event, AbstractTextField<?> field) { Label statusLabel = (Label) field.getData(); setVisible(statusLabel, !event.getStatus().equals(Status.UNRESOLVED)); <START> switch (event.getStatus()) { <END> case OK: statusLabel.setText(" "); statusLabel.setClassName("ok"); statusLabel.removeClassName("error"); ((HasStyle) statusLabel.getParent().get()).setClassName(VALID); break; case ERROR: statusLabel.removeClassName("ok"); statusLabel.setClassName("error"); statusLabel.setText(event.getMessage().orElse("Unknown error")); ((HasStyle) statusLabel.getParent().get()).removeClassName(VALID); default: break; } }</code><technical_language>![INFO](<LINK_1> 'Severity: INFO') Switch statement in com.vaadin.flow.demo.registrationform.ui.RegistrationForm.commonStatusChangeHandler(BindingValidationStatus, AbstractTextField) default case is missing [![rule](<LINK_2>](<LINK_0></technical_language>

Target:
private void commonStatusChangeHandler(BindingValidationStatus<?> event, AbstractTextField<?> field) { Label statusLabel = (Label) field.getData(); setVisible(statusLabel, !event.getStatus().equals(Status.UNRESOLVED)); switch (event.getStatus()) { case OK: statusLabel.setText(""); statusLabel.setClassName(OK); statusLabel.removeClassName(ERROR); ((HasStyle) statusLabel.getParent().get()).setClassName(VALID); break; case ERROR: statusLabel.removeClassName(OK); statusLabel.setClassName(ERROR); statusLabel.setText(event.getMessage().orElse("Unknown error")); ((HasStyle) statusLabel.getParent().get()).removeClassName(VALID); default: break; } }
Source:
<code>public boolean getBoolean(int columnIndex) throws SQLException { checkResultSet(columnIndex); if (wasNullFlag) { return false; } int col = columnIndex - 1; if (Oid.BOOL == fields[col].getOID()) { <START> return 't' == (char) (this_row[col][0] & 0xFF); <END> } if (isBinary(columnIndex)) { return BooleanTypeUtil.castToBoolean(readDoubleValue(this_row[col], fields[col].getOID(), "boolean")); } return BooleanTypeUtil.castToBoolean(getString(columnIndex)); }</code><technical_language>Index bounds checked in this function. faster, allocate new objects. for understanding: is necessary check TEXT_FORMAT/BINARY_FORMAT</technical_language>

Target:
public boolean getBoolean(int columnIndex) throws SQLException { checkResultSet(columnIndex); if (wasNullFlag) { return false; } int col = columnIndex - 1; if (Oid.BOOL == fields[col].getOID()) { final byte[] v = this_row[col]; return (1 == v.length) && (116 == v[0]); } if (isBinary(columnIndex)) { return BooleanTypeUtil.castToBoolean(readDoubleValue(this_row[col], fields[col].getOID(), "boolean")); } return BooleanTypeUtil.castToBoolean(getString(columnIndex)); }
Source:
<code><START> public Seq<CharSeq> split(String regex, int limit) { <END> final String[] javaStrings = back.split(regex, limit); final IndexedSeq<CharSeq> result = Vector.empty(); for (int i = 0; i < javaStrings.length; i++) { result.append(CharSeq.of(javaStrings[i])); } return result; }</code><technical_language>please amend previous commit instead, in case a mistake</technical_language>

Target:
public Seq<CharSeq> split(String regex, int limit) { final String[] javaStrings = back.split(regex, limit); final CharSeq[] strings = new CharSeq[javaStrings.length]; for (int i = 0; i < strings.length; i++) { strings[i] = of(javaStrings[i]); } return Vector.of(strings); }
Source:
<code>public PTableStatsImpl() { <START> regionGuidePosts = new HashMap<String, byte[][]>(); <END> }</code><technical_language>need this - regionGuidePosts is set in other constructor set in readFields method</technical_language>

Target:
public PTableStatsImpl() { }
Source:
<code>private void encode() { List<byte[]> dataListRLP = new ArrayList<>(); for (Value value: dataList) { if (value == null) continue; <START> dataListRLP.add(value.asBytes()); <END> } byte[][] encodedElementArray = dataListRLP.toArray(new byte[dataListRLP.size()][]); this.encoded = RLP.encodeList(encodedElementArray); }</code><technical_language>results in a list encoded elements</technical_language>

Target:
private void encode() { List<byte[]> dataListRLP = new ArrayList<>(); for (Value value: dataList) { if (value == null) continue; dataListRLP.add(RLP.encodeElement(value.asBytes())); } byte[][] encodedElementArray = dataListRLP.toArray(new byte[dataListRLP.size()][]); this.encoded = RLP.encodeList(encodedElementArray); }
Source:
<code>public final void drain() { long n; boolean term; synchronized (this) { if (emitting) { return; } emitting = true; term = terminated; } <START> n = requestedCount.get(); <END> boolean skipFinal = false; try { BackpressureQueueCallback a = actual; while (true) { int emitted = 0; while (n > 0 || term) { Object o; if (term) { o = a.peek(); if (o == null) { skipFinal = true; Throwable e = exception; a.complete(e); return; } if (n == 0) { break; } } o = a.poll(); if (o == null) { break; } else { if (a.accept(o)) { skipFinal = true; return; } n--; emitted++; } } synchronized (this) { term = terminated; boolean more = a.peek() != null; if (requestedCount.get() == Long.MAX_VALUE) { if (!more && !term) { skipFinal = true; emitting = false; return; } n = Long.MAX_VALUE; } else { n = requestedCount.addAndGet(-emitted); if ((n == 0 || !more) && (!term || more)) { skipFinal = true; emitting = false; return; } } } } } finally { if (!skipFinal) { synchronized (this) { emitting = false; } } } }</code><technical_language>If inlined, requestedCount reference read a local variable loop</technical_language>

Target:
public final void drain() { long n; boolean term; synchronized (this) { if (emitting) { return; } emitting = true; term = terminated; } n = get(); boolean skipFinal = false; try { BackpressureQueueCallback a = actual; while (true) { int emitted = 0; while (n > 0 || term) { Object o; if (term) { o = a.peek(); if (o == null) { skipFinal = true; Throwable e = exception; a.complete(e); return; } if (n == 0) { break; } } o = a.poll(); if (o == null) { break; } else { if (a.accept(o)) { skipFinal = true; return; } n--; emitted++; } } synchronized (this) { term = terminated; boolean more = a.peek() != null; if (get() == Long.MAX_VALUE) { if (!more && !term) { skipFinal = true; emitting = false; return; } n = Long.MAX_VALUE; } else { n = addAndGet(-emitted); if ((n == 0 || !more) && (!term || more)) { skipFinal = true; emitting = false; return; } } } } } finally { if (!skipFinal) { synchronized (this) { emitting = false; } } } }
Source:
<code>private void addSupportForCustomServiceOffering(long vmId, long serviceOfferingId, long vmSnapshotId) { ServiceOfferingVO serviceOfferingVO = _serviceOfferingDao.findById(serviceOfferingId); if (serviceOfferingVO.isDynamic()) { List<UserVmDetailVO> vmDetails = _userVmDetailsDao.listDetails(vmId); for (UserVmDetailVO detail : vmDetails) { if(detail.getName().equalsIgnoreCase("cpuNumber") || detail.getName().equalsIgnoreCase("cpuSpeed") || detail.getName().equalsIgnoreCase("memory")) { <START> _vmSnapshotDetailsDao.addDetail(vmSnapshotId, detail.getName(), detail.getValue(), true); <END> } } } }</code><technical_language>saveDetails() instead of multiple addDetail() is transaction consistent</technical_language>

Target:
protected void addSupportForCustomServiceOffering(long vmId, long serviceOfferingId, long vmSnapshotId) { ServiceOfferingVO serviceOfferingVO = _serviceOfferingDao.findById(serviceOfferingId); if (serviceOfferingVO.isDynamic()) { List<UserVmDetailVO> vmDetails = _userVmDetailsDao.listDetails(vmId); List<VMSnapshotDetailsVO> vmSnapshotDetails = new ArrayList<VMSnapshotDetailsVO>(); for (UserVmDetailVO detail : vmDetails) { if(detail.getName().equalsIgnoreCase("cpuNumber") || detail.getName().equalsIgnoreCase("cpuSpeed") || detail.getName().equalsIgnoreCase("memory")) { vmSnapshotDetails.add(new VMSnapshotDetailsVO(vmSnapshotId, detail.getName(), detail.getValue(), detail.isDisplay())); } } _vmSnapshotDetailsDao.saveDetails(vmSnapshotDetails); } }
Source:
<code>private void initializeOutput(FetchRequest req) { <START> Set<String> caps = req.getClientCapabilities(); boolean sideband = caps.contains(OPTION_SIDE_BAND) || caps.contains(OPTION_SIDE_BAND_64K); <END> if (sideband) { errOut = new SideBandErrorWriter(); int bufsz = SideBandOutputStream.SMALL_BUF; if (req.getClientCapabilities().contains(OPTION_SIDE_BAND_64K)) { bufsz = SideBandOutputStream.MAX_BUF; } packOut = new SideBandOutputStream(SideBandOutputStream.CH_DATA, bufsz, rawOut); if (!req.getClientCapabilities().contains(OPTION_NO_PROGRESS)) { msgOut = new SideBandOutputStream( SideBandOutputStream.CH_PROGRESS, bufsz, rawOut); progressMonitor = new SideBandProgressMonitor(msgOut); } } else { packOut = rawOut; } }</code><technical_language>isSideband()</technical_language>

Target:
private void initializeOutput(FetchRequest req) { boolean sideband = isSideband(req); if (sideband) { errOut = new SideBandErrorWriter(); int bufsz = SideBandOutputStream.SMALL_BUF; if (req.getClientCapabilities().contains(OPTION_SIDE_BAND_64K)) { bufsz = SideBandOutputStream.MAX_BUF; } packOut = new SideBandOutputStream(SideBandOutputStream.CH_DATA, bufsz, rawOut); if (!req.getClientCapabilities().contains(OPTION_NO_PROGRESS)) { msgOut = new SideBandOutputStream( SideBandOutputStream.CH_PROGRESS, bufsz, rawOut); monitor = new SideBandProgressMonitor(msgOut); } } else { packOut = rawOut; } }
Source:
<code>public static EObject getParentOf(EObject eObject) { if (eObject == null) { return null; } CDOObject cdoObject = CDOUtil.getCDOObject(eObject); if (cdoObject.cdoView() == null || cdoObject.cdoView().isClosed()) { return null; <START> } <END> EObject container = eObject.eContainer(); if (container != null) { return container; } if (eObject instanceof CDOResource) { CDOResource resource = (CDOResource)eObject; if (resource.isRoot()) { return null; } } Resource resource = eObject.eResource(); if (resource instanceof CDOResource) { return (CDOResource)resource; } if (eObject instanceof CDOResourceNode) { CDOView view = ((CDOResourceNode)eObject).cdoView(); if (view != null) { return view.getRootResource(); } } return null; }</code><technical_language>Please change this to: CDOObject cdoObject = CDOUtil.getCDOObject(eObject, false); if (cdoObject != null && FSMUtil.isInvalid(cdoObject)) { return null; }</technical_language>

Target:
public static EObject getParentOf(EObject eObject) { if (eObject == null) { return null; } CDOObject cdoObject = CDOUtil.getCDOObject(eObject, false); if (cdoObject != null && FSMUtil.isInvalid(cdoObject)) { return null; } EObject container = eObject.eContainer(); if (container != null) { return container; } if (eObject instanceof CDOResource) { CDOResource resource = (CDOResource)eObject; if (resource.isRoot()) { return null; } } Resource resource = eObject.eResource(); if (resource instanceof CDOResource) { return (CDOResource)resource; } if (eObject instanceof CDOResourceNode) { CDOView view = ((CDOResourceNode)eObject).cdoView(); if (view != null) { return view.getRootResource(); } } return null; }
Source:
<code>public void testLoadPropertiesWithEmptyPropertiesFile() throws Exception { File emptyFile = temporaryFolder.newFile("tempFile"); <START> Properties testProperties = PROPERTIES_LOADER.loadProperties(emptyFile.getPath(), null); <END> Properties emptyProperties = new Properties(); Assert.assertEquals("Returns empty properties", emptyProperties, testProperties); }</code><technical_language>move this @BeforeClass setup initialization occurs in place</technical_language>

Target:
public void testLoadPropertiesWithEmptyPropertiesFile() throws Exception { File emptyFile = temporaryFolder.newFile("tempFile"); Properties testProperties = PROPERTIES_LOADER.loadProperties(emptyFile.getPath(), null); assertThat(testProperties.entrySet(), is(empty())); }
Source:
<code>private void runCallback() { try { callback.runWithRetry(); } catch (Exception e) { log.error("Callback failed and was not able to perform its cleanup task. " + "Closing the TransactionManager.", e); callbackException = Optional.of(e); close(); return; } <START> callbackDone = true; <END> }</code><technical_language>Move this of try block for clarity, right I read exception handling code find this if I spot return in exception handling I this is set code paths. TransactionManager in a number of states (initialising, done, closed, closed_by_callback_failure), represent states internal enum more easily understand transitions retrieve state</technical_language>

Target:
private void runCallback() { try { callback.runWithRetry(txManager); checkAndSetStatus(ImmutableSet.of(State.INITIALIZING), State.READY); } catch (Throwable e) { log.error("Callback failed and was not able to perform its cleanup task. " + "Closing the TransactionManager.", e); callbackThrowable = e; closeInternal(State.CLOSED_BY_CALLBACK_FAILURE); } }
Source:
<code>private static boolean in(Object x, Object y, Environment env, Location location) throws EvalException { if (env.getSemantics().incompatibleDepsetIsNotIterable() && y instanceof SkylarkNestedSet) { throw new EvalException( location, "argument of type '" + EvalUtils.getDataTypeName(y) + "' is not iterable. " + "in operator only works on lists, tuples, dicts and strings. " + "Use --incompatible_depset_is_not_iterable=false to temporarily disable " + "this check."); } else if (y instanceof SkylarkDict && !EvalUtils.isImmutable(x)) { throw new EvalException( location, "'in <dict>' requires hashable type as left operand, not '" + EvalUtils.getDataTypeName(x) <START> + "'"); <END> } else if (y instanceof SkylarkQueryable) { return ((SkylarkQueryable) y).containsKey(x, location, env.getStarlarkContext()); } else if (y instanceof String) { if (x instanceof String) { return ((String) y).contains((String) x); } else { throw new EvalException( location, "'in <string>' requires string as left operand, not '" + EvalUtils.getDataTypeName(x) + "'"); } } else { throw new EvalException( location, "argument of type '" + EvalUtils.getDataTypeName(y) + "' is not iterable. " + "in operator only works on lists, tuples, dicts and strings."); } }</code><technical_language>I cleaner move this code SkylarkDict.containsKey</technical_language>

Target:
private static boolean in(Object x, Object y, Environment env, Location location) throws EvalException { if (env.getSemantics().incompatibleDepsetIsNotIterable() && y instanceof SkylarkNestedSet) { throw new EvalException( location, "argument of type '" + EvalUtils.getDataTypeName(y) + "' is not iterable. " + "in operator only works on lists, tuples, dicts and strings. " + "Use --incompatible_depset_is_not_iterable=false to temporarily disable " + "this check."); } else if (y instanceof SkylarkQueryable) { return ((SkylarkQueryable) y).containsKey(x, location, env.getStarlarkContext()); } else if (y instanceof String) { if (x instanceof String) { return ((String) y).contains((String) x); } else { throw new EvalException( location, "'in <string>' requires string as left operand, not '" + EvalUtils.getDataTypeName(x) + "'"); } } else { throw new EvalException( location, "argument of type '" + EvalUtils.getDataTypeName(y) + "' is not iterable. " + "in operator only works on lists, tuples, dicts and strings."); } }
Source:
<code>public List<Container> listContainers(final ListContainersParam... params) throws DockerException, InterruptedException { WebTarget resource = resource() .path("containers").path("json"); final Map<String, List<String>> filters = newHashMap(); for (ListContainersParam param : params) { <START> if (param instanceof ListContainersFilterParam) { <END> List<String> filterValueList; if (filters.containsKey(param.name())) { filterValueList = filters.get(param.name()); } else { filterValueList = Lists.newArrayList(); } filterValueList.add(param.value()); filters.put(param.name(), filterValueList); } else { try { final String encodedName = URLEncoder.encode(param.name(), UTF_8.name()); final String encodedValue = URLEncoder.encode(param.value(), UTF_8.name()); resource = resource.queryParam(encodedName, encodedValue); } catch (UnsupportedEncodingException e) { throw new DockerException(e); } } } try { if (!filters.isEmpty()) { final StringWriter writer = new StringWriter(); final JsonGenerator generator = objectMapper().getFactory().createGenerator(writer); generator.writeObject(filters); generator.close(); final String encoded = URLEncoder.encode(writer.toString(), UTF_8.name()); resource = resource.queryParam("filters", encoded); } } catch (IOException e) { throw new DockerException(e); } return request(GET, CONTAINER_LIST, resource, resource.request(APPLICATION_JSON_TYPE)); }</code><technical_language>move lines 369-387 a private method in public List<Image> listImages(final ListImagesParam... params) well. If awkward instanceof bother</technical_language>

Target:
public List<Container> listContainers(final ListContainersParam... params) throws DockerException, InterruptedException { WebTarget resource = resource() .path("containers").path("json"); final Map<String, List<String>> filters = newHashMap(); for (ListContainersParam param : params) { if (param instanceof ListContainersFilterParam) { List<String> filterValueList; if (filters.containsKey(param.name())) { filterValueList = filters.get(param.name()); } else { filterValueList = Lists.newArrayList(); } filterValueList.add(param.value()); filters.put(param.name(), filterValueList); } else { try { final String encodedName = URLEncoder.encode(param.name(), UTF_8.name()); final String encodedValue = URLEncoder.encode(param.value(), UTF_8.name()); resource = resource.queryParam(encodedName, encodedValue); } catch (UnsupportedEncodingException e) { throw new DockerException(e); } } } resource = resource.queryParam("filters", urlEncodeFilters(filters)); return request(GET, CONTAINER_LIST, resource, resource.request(APPLICATION_JSON_TYPE)); }
Source:
<code>private void completeMissingDataInParameters() { NicNameNicIdCompleter nicNameNicIdCompleter = new NicNameNicIdCompleter(getExistingNics()); nicNameNicIdCompleter.completeNetworkAttachments(getParameters().getNetworkAttachments()); nicNameNicIdCompleter.completeBonds(getParameters().getCreateOrUpdateBonds()); nicNameNicIdCompleter.completeNetworkAttachments(getExistingAttachments()); nicNameNicIdCompleter.completeLabels(getParameters().getLabels()); getParameters().getNetworkAttachments() .stream() .map(NetworkAttachment::getIpConfiguration) .forEach(ipConfigurationCompleter::completeDefaultIpConfiguration); networkIdNetworkNameCompleter.completeNetworkAttachments( getParameters().getNetworkAttachments(), getNetworkBusinessEntityMap()); networkIdNetworkNameCompleter.completeNetworkAttachments( getExistingAttachments(), getNetworkBusinessEntityMap()); NicLabelsCompleter labelsCompleter = new NicLabelsCompleter(getParameters(), getExistingAttachments(), getClusterNetworks(), getExistingNicsBusinessEntityMap()); labelsCompleter.completeNetworkAttachments(); <START> fillInUnsetIpConfigs(); <END> }</code><technical_language>Please move 'fillInUnsetIpConfigs' 'IpConfigurationCompleter'. sense places code treat completion of ip config</technical_language>

Target:
private void completeMissingDataInParameters() { NicNameNicIdCompleter nicNameNicIdCompleter = new NicNameNicIdCompleter(getExistingNics()); nicNameNicIdCompleter.completeNetworkAttachments(getParameters().getNetworkAttachments()); nicNameNicIdCompleter.completeBonds(getParameters().getCreateOrUpdateBonds()); nicNameNicIdCompleter.completeNetworkAttachments(getExistingAttachments()); nicNameNicIdCompleter.completeLabels(getParameters().getLabels()); ipConfigurationCompleter.fillInUnsetIpConfigs(getParameters().getNetworkAttachments()); networkIdNetworkNameCompleter.completeNetworkAttachments( getParameters().getNetworkAttachments(), getNetworkBusinessEntityMap()); networkIdNetworkNameCompleter.completeNetworkAttachments( getExistingAttachments(), getNetworkBusinessEntityMap()); NicLabelsCompleter labelsCompleter = new NicLabelsCompleter(getParameters(), getExistingAttachments(), getClusterNetworks(), getExistingNicsBusinessEntityMap()); labelsCompleter.completeNetworkAttachments(); }
Source:
<code>public void deleteElementAllRevisions() { when(service.getDateTime()).thenReturn(TIMESTAMP); <START> when(dao.getElementRevisions(TEST_STUDY, "id", false)).thenReturn(ELEMENTS); <END> service.deleteElementAllRevisions(TEST_STUDY, "id"); for(AppConfigElement element : ELEMENTS) { assertTrue(element.isDeleted()); assertNotEquals(TIMESTAMP.getMillis(), element.getCreatedOn()); assertEquals(TIMESTAMP.getMillis(), element.getModifiedOn()); } verify(dao, times(2)).saveElementRevision(elementCaptor.capture()); assertTrue(elementCaptor.getAllValues().get(0).isDeleted()); assertTrue(elementCaptor.getAllValues().get(1).isDeleted()); }</code><technical_language>This test modifies app config elements in static member ELEMENTS. If this test runs, this weird happen if another test ELEMENTS. Recommend creating clean elements instead. (Similarly in deleteElementAllRevisionsPermanently().)</technical_language>

Target:
public void deleteElementAllRevisions() { when(dao.getElementRevisions(TEST_STUDY, "id", false)).thenReturn(elements); service.deleteElementAllRevisions(TEST_STUDY, "id"); for(AppConfigElement element : elements) { assertTrue(element.isDeleted()); assertNotEquals(TIMESTAMP.getMillis(), element.getCreatedOn()); assertEquals(TIMESTAMP.getMillis(), element.getModifiedOn()); } verify(dao, times(2)).saveElementRevision(elementCaptor.capture()); assertTrue(elementCaptor.getAllValues().get(0).isDeleted()); assertTrue(elementCaptor.getAllValues().get(1).isDeleted()); }
Source:
<code>public void getStatesByApplicationIdShouldThrowIllegalArgumentExceptionWhenApplicationIsNull() { given(applicationsRepository.findOne(FIRST_ID)).willReturn(null); <START> given(statesRepository.findByApplicationEntityOrderByStateIndexDesc(null)).willThrow(IllegalArgumentException.class); <END> statesService.getStatesByApplicationId(FIRST_ID); }</code><technical_language>this statement is necessary anymore</technical_language>

Target:
public void getStatesByApplicationIdShouldThrowIllegalArgumentExceptionWhenApplicationIsNull() { given(applicationsRepository.findOne(FIRST_ID)).willReturn(null); statesService.getStatesByApplicationId(FIRST_ID); }
Source:
<code>protected static RawQuery parseRawQuery(final String rawQuery, final Clause.Occur occur) throws RuleParseException { final List<String> rawQueryParts = Arrays.asList(rawQuery.split("%%", -1)); final int size = rawQueryParts.size(); if (size % 2 == 0) { throw new RuleParseException("Invalid use of parametrization in the definition of a RawQuery. " + "Parameters must begin and end with %%"); } if (size == 1) { return new StringRawQuery(null, rawQuery, occur, false); } else { final List<ParametrizedRawQuery.Part> parts = IntStream.range(0, size) .mapToObj(index -> index % 2 == 0 ? new ParametrizedRawQuery.Part(rawQueryParts.get(index), ParametrizedRawQuery.Part.Type.QUERY_PART) : new ParametrizedRawQuery.Part(rawQueryParts.get(index).trim(), ParametrizedRawQuery.Part.Type.PARAMETER)) <START> .filter(part -> !part.isEmpty()) <END> .collect(Collectors.toList()); return new ParametrizedRawQuery(null, parts, occur, false); } }</code><technical_language>99.9% do want empty parts if needs it. I guess hurt leave in?</technical_language>

Target:
protected static RawQuery parseRawQuery(final String rawQuery, final Clause.Occur occur) throws RuleParseException { final List<String> rawQueryParts = Arrays.asList(rawQuery.split("%%", -1)); final int size = rawQueryParts.size(); if (size % 2 == 0) { throw new RuleParseException("Invalid use of parametrization in the definition of a RawQuery. " + "Parameters must begin and end with %%"); } if (size == 1) { return new StringRawQuery(null, rawQuery, occur, false); } else { final List<ParametrizedRawQuery.Part> parts = IntStream.range(0, size) .mapToObj(index -> index % 2 == 0 ? new ParametrizedRawQuery.Part(rawQueryParts.get(index), ParametrizedRawQuery.Part.Type.QUERY_PART) : new ParametrizedRawQuery.Part(rawQueryParts.get(index), ParametrizedRawQuery.Part.Type.PARAMETER)) .collect(Collectors.toList()); return new ParametrizedRawQuery(null, parts, occur, false); } }
Source:
<code>public Object createGeometry(Instance instance, int srsDimension, IOProvider reader) throws GeometryNotSupportedException { @SuppressWarnings("unchecked") DefaultGeometryProperty<LineString> lineStringGeomProperty = (DefaultGeometryProperty<LineString>) super.createGeometry( instance, srsDimension, reader); double maxPositionalError = reader <START> .getParameter(InterpolationConstant.INTERPOL_MAX_POSITION_ERROR).as(Double.class); <END> Interpolation<LineString> interpolation = new ArcInterpolation( lineStringGeomProperty.getGeometry().getCoordinates(), maxPositionalError); LineString interpolatedArc = interpolation.interpolateRawGeometry(); if (interpolatedArc != null) return new DefaultGeometryProperty<LineString>( lineStringGeomProperty.getCRSDefinition(), interpolatedArc); return null; }</code><technical_language>declared parameter optional, this fail if parameter is provided. default play</technical_language>

Target:
public Object createGeometry(Instance instance, int srsDimension, IOProvider reader) throws GeometryNotSupportedException { @SuppressWarnings("unchecked") DefaultGeometryProperty<LineString> lineStringGeomProperty = (DefaultGeometryProperty<LineString>) super.createGeometry( instance, srsDimension, reader); Double maxPositionalError = reader .getParameter(InterpolationConstant.INTERPOL_MAX_POSITION_ERROR).as(Double.class); if (maxPositionalError == null || maxPositionalError.doubleValue() <= 0) { log.warn( "Value of Max positional error parameter, for interpolation operation, is not valid. Default value has been taken."); maxPositionalError = InterpolationConstant.DEFAULT_INTERPOL_MAX_POSITION_ERROR; } Interpolation<LineString> interpolation = new ArcInterpolation( lineStringGeomProperty.getGeometry().getCoordinates(), maxPositionalError.doubleValue()); LineString interpolatedArc = interpolation.interpolateRawGeometry(); if (interpolatedArc != null) return new DefaultGeometryProperty<LineString>( lineStringGeomProperty.getCRSDefinition(), interpolatedArc); return null; }
Source:
<code>protected void onResume() { super.onResume(); if (mOsmv == null) { mOsmv = new MapView(this); <START> this.mOsmv.setTilesScaledToDpi(true); <END> this.mOsmv.setBuiltInZoomControls(true); this.mOsmv.getController().setZoom(18); mProvider = new MapTileProviderBasic(getApplicationContext()); mProvider.setTileSource(TileSourceFactory.DEFAULT_TILE_SOURCE); this.mTilesOverlay = new TilesOverlay(mProvider, this.getBaseContext()); this.mOsmv.getOverlays().add(this.mTilesOverlay); rl = new RelativeLayout(this); rl.addView(this.mOsmv, new RelativeLayout.LayoutParams( LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT)); this.setContentView(rl); } mIALocationManager.requestLocationUpdates(IALocationRequest.create(), mListener); mIALocationManager.registerRegionListener(mRegionListener); }</code><technical_language>this keyword is redundant mXx naming convention</technical_language>

Target:
protected void onResume() { super.onResume(); if (mOsmv == null) { mOsmv = new MapView(this); mOsmv.setTilesScaledToDpi(true); mOsmv.setBuiltInZoomControls(true); mOsmv.getController().setZoom(18); mProvider = new MapTileProviderBasic(getApplicationContext()); mProvider.setTileSource(TileSourceFactory.DEFAULT_TILE_SOURCE); mTilesOverlay = new TilesOverlay(mProvider, getBaseContext()); mOsmv.getOverlays().add(mTilesOverlay); mLayout = new RelativeLayout(this); mLayout.addView(mOsmv, new RelativeLayout.LayoutParams( LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT)); setContentView(mLayout); } mIALocationManager.requestLocationUpdates(IALocationRequest.create(), mListener); mIALocationManager.registerRegionListener(mRegionListener); }
Source:
<code>public DerivativeDataSourceMetadata( @JsonProperty("baseDataSource") String baseDataSource, @JsonProperty("dimensions") Set<String> dimensions, @JsonProperty("metrics") Set<String> metrics ) { this.dimensions = Preconditions.checkNotNull(dimensions, "dimensions cannot be null. This is not a valid DerivativeDataSourceMetadata."); this.metrics = Preconditions.checkNotNull(metrics, "metrics cannot be null. This is not a valid DerivativeDataSourceMetadata."); Preconditions.checkArgument(!Strings.isNullOrEmpty(baseDataSource), "baseDataSource cannot be null or empty. Please provide a baseDataSource."); <START> this.baseDataSource = baseDataSource; <END> }</code><technical_language>nit: Please change initialization order. good if aligned definition order</technical_language>

Target:
public DerivativeDataSourceMetadata( @JsonProperty("baseDataSource") String baseDataSource, @JsonProperty("dimensions") Set<String> dimensions, @JsonProperty("metrics") Set<String> metrics ) { Preconditions.checkArgument(!Strings.isNullOrEmpty(baseDataSource), "baseDataSource cannot be null or empty. Please provide a baseDataSource."); this.baseDataSource = baseDataSource; this.dimensions = Preconditions.checkNotNull(dimensions, "dimensions cannot be null. This is not a valid DerivativeDataSourceMetadata."); this.metrics = Preconditions.checkNotNull(metrics, "metrics cannot be null. This is not a valid DerivativeDataSourceMetadata."); }
Source:
<code>private RGB getRGBFromTheme(String value) { if (Platform.getBundle("org.eclipse.e4.ui.css.swt.theme") != null) { String backgroundColor = E4ThemeColor.getCssValueFromTheme(display, value); if (backgroundColor != null) { RGB themeColor = E4ThemeColor.getRGBFromCssString(backgroundColor); if (themeColor != null) { return themeColor; } } } <START> return getImpliedBackground().getRGB(); <END> }</code><technical_language>odd for getRGBFromTheme call getImpliedBackground. Instead a method getBackground calls getRGBFromTheme getImpliedBackground</technical_language>

Target:
private RGB getRGBFromTheme(String value) { if (Platform.getBundle("org.eclipse.e4.ui.css.swt.theme") != null) { String backgroundColor = E4ThemeColor.getCssValueFromTheme(display, value); if (backgroundColor != null) { RGB themeColor = E4ThemeColor.getRGBFromCssString(backgroundColor); if (themeColor != null) { return themeColor; } } } return null; }
Source:
<code>public IEventDeclaration getEventDeclaration(int eventIndex) { if (eventIndex == EventDeclaration.UNSET_EVENT_ID) { <START> return fEventUnsetId; <END> } return fEvents.get(eventIndex); }</code><technical_language>get(0) if a SingletonList (see below) if UNSET_EVENT_ID 0..</technical_language>

Target:
public IEventDeclaration getEventDeclaration(int eventIndex) { if (eventIndex == EventDeclaration.UNSET_EVENT_ID) { return fEvents.get(0); } return fEvents.get(eventIndex); }
Source:
<code>public void testMultiAdditionMethods() { Bean<Axe> bean = getUniqueBean(Axe.class, new TwoHanded.TwoHandedLiteral(), new Reforged.ReforgedLiteral()); Set<Annotation> qualifiers = bean.getQualifiers(); Set<Class<? extends Annotation>> stereotypes = bean.getStereotypes(); Set<Type> types = bean.getTypes(); assertTrue(bean.getScope().equals(RequestScoped.class)); assertTrue(qualifiers.contains(new Reforged.ReforgedLiteral()) && qualifiers.contains(new TwoHanded.TwoHandedLiteral())); assertTrue(stereotypes.contains(Melee.class) && stereotypes.contains(Equipment.class)); <START> assertTrue(types.contains(Weapon.class) && types.contains(Tool.class)); <END> assertTrue(bean.isAlternative()); }</code><technical_language>I replace logical ands. compare entire collection</technical_language>

Target:
public void testMultiAdditionMethods() { Bean<Axe> bean = getUniqueBean(Axe.class, TwoHanded.TwoHandedLiteral.INSTANCE, Reforged.ReforgedLiteral.INSTANCE); Set<Annotation> qualifiers = bean.getQualifiers(); Set<Class<? extends Annotation>> stereotypes = bean.getStereotypes(); Set<Type> types = bean.getTypes(); assertTrue(bean.getScope().equals(RequestScoped.class)); assertTrue(qualifiers.containsAll(new HashSet<>(Arrays.asList(Reforged.ReforgedLiteral.INSTANCE, TwoHanded.TwoHandedLiteral.INSTANCE)))); assertTrue(stereotypes.containsAll(new HashSet<>(Arrays.asList(Melee.class, Equipment.class)))); assertTrue(types.containsAll(new HashSet<>(Arrays.asList(Weapon.class, Tool.class)))); assertTrue(bean.isAlternative()); }
Source:
<code>public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; TurboUser that = (TurboUser) o; <START> return (loginName == that.loginName || (loginName != null && loginName.equals(that.loginName))) && <END> (realName == that.realName || (realName != null && realName.equals(that.realName))) && (avatarURL == that.avatarURL || (avatarURL != null && avatarURL.equals(that.avatarURL))); }</code><technical_language>this fixed moving null checks User constructor instead (and defaulting "")? I hoping avoid null in model classes</technical_language>

Target:
public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; TurboUser that = (TurboUser) o; return loginName.equals(that.loginName) && realName.equals(that.realName) && avatarURL.equals(that.avatarURL); }
Source:
<code>public String toJSON() throws IOException { JsonGenerator g = jsonGeneratorThreadLocal.get(); g.writeStartObject(); g.writeStringField("database", this.database); g.writeStringField("table", this.table); g.writeStringField("type", this.rowType); g.writeNumberField("ts", this.timestamp); if ( this.xid != null ) g.writeNumberField("xid", this.xid); if ( this.txCommit ) g.writeBooleanField("commit", true); if ( this.excludeColumns == null) { writeMapToJSON("data", this.data, false); if ( !this.oldData.isEmpty()) { writeMapToJSON("old", this.oldData, true); } } else { for (String column : this.excludeColumns) { this.data.remove(column); this.oldData.remove(column); } if ( !this.data.isEmpty() ) writeMapToJSON("data", this.data, true); if ( !this.oldData.isEmpty() ) <START> writeMapToJSON("old", this.oldData, true); <END> } g.writeEndObject(); g.flush(); return jsonFromStream(); }</code><technical_language>this code simplified; iterate remove excluded columns, execute code path -- need do if excluded columns not</technical_language>

Target:
public String toJSON() throws IOException { JsonGenerator g = jsonGeneratorThreadLocal.get(); g.writeStartObject(); g.writeStringField("database", this.database); g.writeStringField("table", this.table); g.writeStringField("type", this.rowType); g.writeNumberField("ts", this.timestamp); if ( this.xid != null ) g.writeNumberField("xid", this.xid); if ( this.txCommit ) g.writeBooleanField("commit", true); if ( this.excludeColumns != null ) { Set<String> keys = new HashSet<String>(); keys.addAll(this.data.keySet()); keys.addAll(this.oldData.keySet()); for ( Pattern p : this.excludeColumns ) { for ( String key : keys ) { if ( p.matcher(key).matches() ) { this.data.remove(key); this.oldData.remove(key); } } } } writeMapToJSON("data", this.data, false); if ( !this.oldData.isEmpty() ) { writeMapToJSON("old", this.oldData, true); } g.writeEndObject(); g.flush(); return jsonFromStream(); }
Source:
<code>public void createVmDataCommand(final VirtualRouter router, final UserVm vm, final NicVO nic, final String publicKey, final Commands cmds) { <START> if (vm != null && router != null && nic != null) { <END> final String serviceOffering = _serviceOfferingDao.findByIdIncludingRemoved(vm.getId(), vm.getServiceOfferingId()).getDisplayText(); final String zoneName = _dcDao.findById(router.getDataCenterId()).getName(); final IPAddressVO staticNatIp = _ipAddressDao.findByVmIdAndNetworkId(nic.getNetworkId(), vm.getId()); Host host = _hostDao.findById(vm.getHostId()); final Account caller = CallContext.current().getCallingAccount(); String destHostname = (VirtualMachineManager.AllowExposeHypervisorHostname.value() && VirtualMachineManager.AllowExposeHypervisorHostnameAccountLevel.valueIn(caller.getId())) ? host.getName() : null; cmds.addCommand( "vmdata", generateVmDataCommand(router, nic.getIPv4Address(), vm.getUserData(), serviceOffering, zoneName, staticNatIp == null || staticNatIp.getState() != IpAddress.State.Allocated ? null : staticNatIp.getAddress().addr(), vm.getHostName(), vm.getInstanceName(), vm.getId(), vm.getUuid(), publicKey, nic.getNetworkId(), destHostname)); } }</code><technical_language>this needed before</technical_language>

Target:
public void createVmDataCommand(final VirtualRouter router, final UserVm vm, final NicVO nic, final String publicKey, final Commands cmds) { if (vm != null && router != null && nic != null) { final String serviceOffering = _serviceOfferingDao.findByIdIncludingRemoved(vm.getId(), vm.getServiceOfferingId()).getDisplayText(); final String zoneName = _dcDao.findById(router.getDataCenterId()).getName(); final IPAddressVO staticNatIp = _ipAddressDao.findByVmIdAndNetworkId(nic.getNetworkId(), vm.getId()); Host host = _hostDao.findById(vm.getHostId()); String destHostname = VirtualMachineManager.getHypervisorHostname(host.getName()); cmds.addCommand( "vmdata", generateVmDataCommand(router, nic.getIPv4Address(), vm.getUserData(), serviceOffering, zoneName, staticNatIp == null || staticNatIp.getState() != IpAddress.State.Allocated ? null : staticNatIp.getAddress().addr(), vm.getHostName(), vm.getInstanceName(), vm.getId(), vm.getUuid(), publicKey, nic.getNetworkId(), destHostname)); } }
Source:
<code>public List<String> getURLsFromPage(Document doc) { List<String> imageURLs = new ArrayList<String>(); Pattern imgRegex = Pattern.compile(".*/user/([a-zA-Z0-9\\-_]+)/(\\d+)/.*"); for (Element thumb : doc.select("td > a:first-child")) { if (isStopped()) { break; } Matcher imgMatcher = imgRegex.matcher(thumb.attr("href")); if (!imgMatcher.matches()) { logger.info("Couldn't find user & image ID in " + thumb.attr("href")); continue; } <START> String[] titleSplit = thumb.attr("herf").split("/"); <END> String title = titleSplit[titleSplit.length -1]; String user = imgMatcher.group(1), imageId = imgMatcher.group(2); String image = "<LINK_1>"; image += user.toLowerCase().charAt(0); image += "/" + user + "/" + imageId + "/" + user + "-" + imageId + title + ".png"; imageURLs.add(image); } return imageURLs; }</code><technical_language>herf typo in patch site what</technical_language>

Target:
public List<String> getURLsFromPage(Document doc) { List<String> imageURLs = new ArrayList<String>(); Pattern imgRegex = Pattern.compile(".*/user/([a-zA-Z0-9\\-_]+)/(\\d+)/.*"); for (Element thumb : doc.select("div.thumb_square > a.thumbLink")) { if (isStopped()) { break; } Matcher imgMatcher = imgRegex.matcher(thumb.attr("href")); if (!imgMatcher.matches()) { logger.info("Couldn't find user & image ID in " + thumb.attr("href")); continue; } Document imagePage; try { Response resp = Http.url("<LINK_0>").response(); cookies = resp.cookies(); resp = Http.url("<LINK_0>?enterAgree=1&size=1500") .referrer("<LINK_0>") .cookies(cookies) .response(); cookies.putAll(resp.cookies()); logger.info("grabbing " + "<LINK_3>" + thumb.attr("href")); imagePage = Http.url("<LINK_3>" + thumb.attr("href")).cookies(cookies).get(); } catch (IOException e) { logger.debug(e.getMessage()); logger.debug("Warning: imagePage is null!"); imagePage = null; } if (imagePage.select("div.boxbody > img.center").attr("src").contains("thumbs.") == true) { imageURLs.add("http:" + imagePage.select("div.boxbody > img.center").attr("onclick").replace("this.src=", "").replace("'", "").replace("; $(#resize_message).hide();", "")); } else { imageURLs.add("http:" + imagePage.select("div.boxbody > img.center").attr("src")); } } return imageURLs; }
Source:
<code>public void shouldReturnTrueIfUserCanViewAtLeastOneTemplate() { <START> ArrayList<PipelineTemplateConfig> templateList = new ArrayList<>(); <END> templateList.add(PipelineTemplateConfigMother.createTemplate("template1")); CaseInsensitiveString templateViewUser = new CaseInsensitiveString("template-view"); templateList.add(PipelineTemplateConfigMother.createTemplate("template100", new Authorization(new ViewConfig(new AdminUser(templateViewUser))), StageConfigMother.manualStage("stage-name"))); TemplatesConfig templates = new TemplatesConfig(templateList.toArray(new PipelineTemplateConfig[0])); assertThat(templates.canUserViewTemplates(templateViewUser, null), is(true)); }</code><technical_language>pull out a configForUserWhoCanViewATemplate method. in this change</technical_language>

Target:
public void shouldReturnTrueIfUserCanViewAtLeastOneTemplate() { CaseInsensitiveString templateViewUser = new CaseInsensitiveString("template-view"); TemplatesConfig templates = configForUserWhoCanViewATemplate(); templates.add(PipelineTemplateConfigMother.createTemplate("template200", new Authorization(new ViewConfig(new AdminUser(templateViewUser))), StageConfigMother.manualStage("stage-name"))); assertThat(templates.canUserViewTemplates(templateViewUser, null, false), is(true)); }
Source:
<code>static int getWatchListCount(final String page) { int count; String sCount = TextUtils.getMatch(page, GCConstants.PATTERN_WATCHLIST_COUNT, true, 1, "notFound", false); if (sCount.equals("notFound")) return -1; try { <START> count = Integer.parseInt(sCount); <END> } catch(NumberFormatException nfe) { Log.i("Could not parse " + nfe); return -1; } return count; }</code><technical_language>return result parseInt here, need for count variable</technical_language>

Target:
static int getWatchListCount(final String page) { final String sCount = TextUtils.getMatch(page, GCConstants.PATTERN_WATCHLIST_COUNT, true, 1, "notFound", false); if (sCount.equals("notFound")) { return -1; } try { return Integer.parseInt(sCount); } catch(final NumberFormatException nfe) { Log.e("Could not parse", nfe); return -1; } }
Source:
<code>protected boolean canAddVm(ArrayList<String> reasons, Collection<storage_domains> destStorages) { VmStatic vmStaticFromParams = getParameters().getVmStaticData(); boolean returnValue = canAddVm(reasons, vmStaticFromParams.getVmName(), getStoragePoolId() .getValue(), vmStaticFromParams.getPriority()); if (returnValue) { List<ValidationError> validationErrors = validateCustomProperties(vmStaticFromParams); if (!validationErrors.isEmpty()) { VmHandler.handleCustomPropertiesError(validationErrors, reasons); returnValue = false; } } if (returnValue && shouldCheckSpaceInStorageDomains()) { if (!getStoragePoolId().equals(getStoragePoolIdFromSourceImageContainer())) { reasons.add(VdcBllMessages.ACTION_TYPE_FAILED_STORAGE_POOL_NOT_MATCH.toString()); returnValue = false; } else { for (storage_domains domain : destStorages) { <START> if (validate(new StorageDomainValidator(getStorageDomain()).isDomainWithinThresholds())) { <END> return false; } if (!StorageDomainSpaceChecker.hasSpaceForRequest(domain, getNeededDiskSize(domain.getId()))) { returnValue = false; reasons.add(VdcBllMessages.ACTION_TYPE_FAILED_DISK_SPACE_LOW.toString()); break; } } } } if (returnValue) { returnValue = isDedicatedVdsOnSameCluster(vmStaticFromParams); } return returnValue; }</code><technical_language>if(!validate..</technical_language>

Target:
protected boolean canAddVm(ArrayList<String> reasons, Collection<storage_domains> destStorages) { VmStatic vmStaticFromParams = getParameters().getVmStaticData(); boolean returnValue = canAddVm(reasons, vmStaticFromParams.getVmName(), getStoragePoolId() .getValue(), vmStaticFromParams.getPriority()); if (returnValue) { List<ValidationError> validationErrors = validateCustomProperties(vmStaticFromParams); if (!validationErrors.isEmpty()) { VmHandler.handleCustomPropertiesError(validationErrors, reasons); returnValue = false; } } if (returnValue && shouldCheckSpaceInStorageDomains()) { if (!getStoragePoolId().equals(getStoragePoolIdFromSourceImageContainer())) { reasons.add(VdcBllMessages.ACTION_TYPE_FAILED_STORAGE_POOL_NOT_MATCH.toString()); returnValue = false; } else { for (storage_domains domain : destStorages) { StorageDomainValidator storageDomainValidator = new StorageDomainValidator(domain); if (!validate(storageDomainValidator.isDomainWithinThresholds()) || !validate(storageDomainValidator.isDomainHasSpaceForRequest(getNeededDiskSize(domain.getId())))) { return false; } } } } if (returnValue) { returnValue = isDedicatedVdsOnSameCluster(vmStaticFromParams); } return returnValue; }
Source:
<code>protected void onCreate(Bundle savedInstanceState) { ((OsmandApplication) getApplication()).applyTheme(this); super.onCreate(savedInstanceState); getSherlock().setUiOptions(ActivityInfo.UIOPTION_SPLIT_ACTION_BAR_WHEN_NARROW); getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setTitle("Sherpafy"); if (!(getMyApplication().getAppCustomization() instanceof SherpafyCustomization)) { getMyApplication().setAppCustomization(new SherpafyCustomization()); } customization = (SherpafyCustomization) getMyApplication().getAppCustomization(); <START> if (customization.getTourInformations().isEmpty()) <END> { customization.onIndexingFiles(new IProgress() { @Override public void startTask(String taskName, int work) { } @Override public void startWork(int work) { } @Override public void progress(int deltaWork) { } @Override public void remaining(int remainingWork) { } @Override public void finishTask() { } @Override public boolean isIndeterminate() { return false; } @Override public boolean isInterrupted() { return false; } }, new ConcurrentHashMap<String, String>() ); } if (customization.getSelectedTour() == null) { startProgressDialog = new ProgressDialog(this); getMyApplication().checkApplicationIsBeingInitialized(this, startProgressDialog); updateDefaultView(); } else { super.setContentView(R.layout.custom_tour_info); updateTourView(); } }</code><technical_language>Strange condition is call for initializeApplicationinBackground (to load maps)</technical_language>

Target:
protected void onCreate(Bundle savedInstanceState) { ((OsmandApplication) getApplication()).applyTheme(this); super.onCreate(savedInstanceState); getSherlock().setUiOptions(ActivityInfo.UIOPTION_SPLIT_ACTION_BAR_WHEN_NARROW); getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setTitle("Sherpafy"); if (!(getMyApplication().getAppCustomization() instanceof SherpafyCustomization)) { getMyApplication().setAppCustomization(new SherpafyCustomization()); } customization = (SherpafyCustomization) getMyApplication().getAppCustomization(); ProgressDialog startProgressDialog = new ProgressDialog(this); getMyApplication().checkApplicationIsBeingInitialized(this, startProgressDialog); if (startProgressDialog.isShowing()) { startProgressDialog.setOnDismissListener(new DialogInterface.OnDismissListener() { @Override public void onDismiss(DialogInterface dialogInterface) { onStartDialogClose(); } }); } else { onStartDialogClose(); } }
Source:
<code>public static boolean containsSqlScriptDelimiters(String script, String delim) { boolean inLiteral = false; boolean inEscape = false; for (int i = 0; i < script.length(); i++) { char thisChar = script.charAt(i); if (thisChar == '\\') <START> { <END> inEscape = !inEscape; continue; } else if (inEscape) { inEscape = false; continue; } if (thisChar == '\'') { inLiteral = !inLiteral; } if (!inLiteral && script.startsWith(delim, i)) { return true; } } return false; }</code><technical_language>Please move opening curly bracket previous line in codebase</technical_language>

Target:
public static boolean containsSqlScriptDelimiters(String script, String delim) { boolean inLiteral = false; boolean inEscape = false; for (int i = 0; i < script.length(); i++) { char c = script.charAt(i); if (c == '\\') { inEscape = !inEscape; continue; } else if (inEscape) { inEscape = false; continue; } if (c == '\'') { inLiteral = !inLiteral; } if (!inLiteral && script.startsWith(delim, i)) { return true; } } return false; }