auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code><RequestT extends StorageRequest<?>> RequestT initializeRequest( RequestT request, String bucketName) throws IOException { <START> if (authorizationHandler.isAuthorizationHandlerSet()) { <END> logger.atFine().log( "initializeRequest(%s, %s) calling authorization handler.", request, bucketName); authorizationHandler.authorize(request, bucketName); } return configureRequest(request, bucketName); }</code><technical_language>Replace nullness check</technical_language>

Target:
<RequestT extends StorageRequest<?>> RequestT initializeRequest( RequestT request, String bucketName) throws IOException { if (storageRequestAuthorizer != null) { logger.atFine().log( "initializeRequest(%s, %s) calling authorization handler.", request, bucketName); storageRequestAuthorizer.authorize(request, bucketName); } return configureRequest(request, bucketName); }
Source:
<code>public Object start(IApplicationContext context) throws Exception { cleanWS(); ArgumentsParser <START> myRunnerArguments = <END> new ArgumentsParser(context); Generator generator = new Generator(myRunnerArguments); generator.generate(); IStatus status = generator.getStatus(); if (status != null && !status.isOK()) { throw new RuntimeException("Generation faild:" + status.getMessage()); } return IApplicationContext.EXIT_ASYNC_RESULT; }</code><technical_language>my</technical_language>

Target:
public Object start(IApplicationContext context) throws Exception { myWorkspaceHelper = new WorkspaceHelper(); ArgumentsParser runnerArguments = null; try { runnerArguments = new ArgumentsParser(context); List<String> projectsToImport = new LinkedList<String>(runnerArguments.getRelatedProjects()); projectsToImport.add(runnerArguments.getGMFGENProjectLocation()); initWorkspace(projectsToImport); GenEditorGenerator editorGen = GMFGeneratorUtil.loadEditorGen(runnerArguments.getGMFGENProjectLocation(), runnerArguments.getGMFGENResourceLocation()); initPluginProject(runnerArguments.getGenerateProjectLocation(), editorGen.getPluginDirectory()); CodegenEmittersWithXtend2 emitters = getCodegenEmitters(editorGen, runnerArguments.getCustomEmitterBundleName(), runnerArguments.getCustomEmitterClassName()); GeneratorBase generator = new GeneratorWithXtend2(editorGen, emitters, loadFormatter(runnerArguments.getFormatter())); generator.run(new NullProgressMonitor()); } catch (Exception e) { if (runnerArguments != null && runnerArguments.shouldTrace()) { e.printStackTrace(); } throw new RuntimeException("Generation faild", e); } return IApplicationContext.EXIT_ASYNC_RESULT; }
Source:
<code>public static boolean isQuoted(final String name, final Dialect dialect) { if ( name == null || name.isEmpty() ) { return false; } final char first = name.charAt( 0 ); final char last = name.charAt( name.length() - 1 ); return ( ( first == last ) && <START> ( first == '`' || first == '"' || first == dialect.closeQuote() ) ); <END> }</code><technical_language>is right, same. For example, SQLServerDialect.openQuote() returns '[', closeQuote() returns ']'</technical_language>

Target:
public static boolean isQuoted(final String name, final Dialect dialect) { if ( name == null || name.isEmpty() ) { return false; } final char first = name.charAt( 0 ); final char last = name.charAt( name.length() - 1 ); return ( ( first == last ) && ( first == '`' || first == '"' ) ) || ( first == dialect.openQuote() && last == dialect.closeQuote() ); }
Source:
<code>public ObjectSpecification getExternalDownloadSpecification(String objectId, long offset, long length) throws IOException { log.debug("Endpoint: {}", endpoint); return retry.execute(new RetryCallback<ObjectSpecification, IOException>() { @Override public ObjectSpecification doWithRetry(RetryContext ctx) throws IOException { HttpEntity<Object> requestEntity = new HttpEntity<Object>(defaultHeaders()); return serviceRequest.exchange( <START> endpoint + "/download/{object-id}?offset={offset}&length={length}&external=1", <END> HttpMethod.GET, requestEntity, ObjectSpecification.class, objectId, offset, length).getBody(); } }); }</code><technical_language>external a boolean</technical_language>

Target:
public ObjectSpecification getExternalDownloadSpecification(String objectId, long offset, long length) throws IOException { log.debug("Endpoint: {}", endpoint); return retry.execute(new RetryCallback<ObjectSpecification, IOException>() { @Override public ObjectSpecification doWithRetry(RetryContext ctx) throws IOException { val requestEntity = new HttpEntity<Object>(defaultHeaders()); return serviceRequest.exchange( endpoint + "/download/{object-id}?offset={offset}&length={length}&external=true", HttpMethod.GET, requestEntity, ObjectSpecification.class, objectId, offset, length).getBody(); } }); }
Source:
<code>public void testGetClustersHavingHosts() { List<VDSGroup> <START> vdsGroups = <END> ((VdsGroupDAODbFacadeImpl) dao).getClustersHavingHosts(); assertNotNull(vdsGroups); assertEquals(4, vdsGroups.size()); }</code><technical_language>rename clusters</technical_language>

Target:
public void testGetClustersHavingHosts() { List<VDSGroup> clusters = ((VdsGroupDAODbFacadeImpl) dao).getClustersHavingHosts(); assertNotNull(clusters); assertThat(clusters, hasSize(4)); }
Source:
<code>private static Map<String, ApiTemplate> loadJSONConfig(JsonNode node) { Preconditions.checkNotNull(node, "Must have services node"); final Map<String, ApiTemplate> config = <START> new HashMap<>(); <END> node.fieldNames().forEachRemaining(serviceName -> { config.put(serviceName, ApiTemplate.fromJSON(node.get(serviceName))); }); return config; }</code><technical_language>Fun facts, HashMap is threadsafe (and fail in surprising ways!). In this case, saved implicit barrier end of constructor (and fact is enough time construction reading of list). Still, ImmutableMap safer / nicer (<LINK_0></technical_language>

Target:
private static Map<String, ApiTemplate> loadJSONConfig(JsonNode node) { Preconditions.checkNotNull(node, "Must have services node"); return Streams.stream(node.fieldNames()) .collect(ImmutableMap.toImmutableMap( fieldName -> fieldName, fieldName -> ApiTemplate.fromJSON(node.get(fieldName)))); }
Source:
<code>private void refreshVdsRunTimeInfo() { boolean isVdsUpOrGoingToMaintenance = _vds.getStatus() == VDSStatus.Up || _vds.getStatus() == VDSStatus.PreparingForMaintenance || _vds.getStatus() == VDSStatus.Error || _vds.getStatus() == VDSStatus.NonOperational; try { if (isVdsUpOrGoingToMaintenance) { if (_vdsManager.getRefreshStatistics() || _vds.getStatus() == VDSStatus.PreparingForMaintenance) { refreshVdsStats(); } else { } } else { final AtomicBoolean processHardwareNeededAtomic = new AtomicBoolean(); VDSStatus refreshReturnStatus = _vdsManager.refreshCapabilities(processHardwareNeededAtomic, _vds); processHardwareCapsNeeded = processHardwareNeededAtomic.get(); refreshedCapabilities = true; if (refreshReturnStatus != VDSStatus.NonOperational) { _vdsManager.setStatus(VDSStatus.Up, _vds); } _saveVdsDynamic = true; } beforeFirstRefreshTreatment(isVdsUpOrGoingToMaintenance); refreshVmStats(); } catch (VDSRecoveringException e) { if (_vds.getStatus() != VDSStatus.PreparingForMaintenance) { throw e; } } catch (ClassCastException cce) { log.error("Failure to refresh Vds runtime info. Incorrect vdsm version for cluster", cce); if (_vds.getStatus() != VDSStatus.PreparingForMaintenance && _vds.getStatus() != VDSStatus.Maintenance) { <START> _vds.setStatus(VDSStatus.Error); <END> _saveVdsDynamic = true; } } catch (Throwable t) { log.error("Failure to refresh Vds runtime info", t); throw t; } moveVDSToMaintenanceIfNeeded(); }</code><technical_language>host statuses change SetVdsStatusCommand call this this code runVdsCommand in ResourceManager</technical_language>

Target:
private void refreshVdsRunTimeInfo() { boolean isVdsUpOrGoingToMaintenance = _vds.getStatus() == VDSStatus.Up || _vds.getStatus() == VDSStatus.PreparingForMaintenance || _vds.getStatus() == VDSStatus.Error || _vds.getStatus() == VDSStatus.NonOperational; try { if (isVdsUpOrGoingToMaintenance) { if (_vdsManager.getRefreshStatistics() || _vds.getStatus() == VDSStatus.PreparingForMaintenance) { refreshVdsStats(); } else { } } else { final AtomicBoolean processHardwareNeededAtomic = new AtomicBoolean(); VDSStatus refreshReturnStatus = _vdsManager.refreshCapabilities(processHardwareNeededAtomic, _vds); processHardwareCapsNeeded = processHardwareNeededAtomic.get(); refreshedCapabilities = true; if (refreshReturnStatus != VDSStatus.NonOperational) { _vdsManager.setStatus(VDSStatus.Up, _vds); } _saveVdsDynamic = true; } beforeFirstRefreshTreatment(isVdsUpOrGoingToMaintenance); refreshVmStats(); } catch (VDSRecoveringException e) { if (_vds.getStatus() != VDSStatus.PreparingForMaintenance) { throw e; } } catch (ClassCastException cce) { log.error(String.format("Failure to refresh Vds %s runtime info. Incorrect vdsm version for cluster %s", _vds.getName(), _vds.getVdsGroupName()), cce); if (_vds.getStatus() != VDSStatus.PreparingForMaintenance && _vds.getStatus() != VDSStatus.Maintenance) { ResourceManager.getInstance().runVdsCommand(VDSCommandType.SetVdsStatus, new SetVdsStatusVDSCommandParameters(_vds.getId(), VDSStatus.Error)); } } catch (Throwable t) { log.error("Failure to refresh Vds runtime info", t); throw t; } moveVDSToMaintenanceIfNeeded(); }
Source:
<code><START> public void deployJarsFrowWar() throws Exception { <END> RepositorySystemSession session = newSession(newRepositorySystem()); assertThat(checksIfArtifactIsPresent(session)).isFalse(); File file = new File("target/test-classes/org/guvnor/m2repo/backend/server/uberfire-m2repo-editor-backend-100-SNAPSHOT.jar"); assertThat(file).exists(); M2ServletContextListener listener = new M2ServletContextListener(); GAV deployed = listener.deployJar(file.getAbsolutePath(), session); assertThat(deployed.getGroupId()).isEqualTo("org.uberfire"); assertThat(deployed.getArtifactId()).isEqualTo("uberfire-m2repo-editor-backend"); assertThat(deployed.getVersion()).isEqualTo("100-SNAPSHOT"); ArtifactRequest artifactRequest = new ArtifactRequest(); artifactRequest.setArtifact(getArtifact()); ArtifactResult result = Aether.getAether().getSystem().resolveArtifact(session, artifactRequest); assertThat(result.isMissing()).isFalse(); assertThat(result.isResolved()).isTrue(); }</code><technical_language>please add check for .pom files</technical_language>

Target:
public void deployJarsFrowWar() throws Exception { RepositorySystemSession session = newSession(newRepositorySystem()); assertThat(checksIfArtifactIsPresent(session)).isFalse(); File file = new File("target/test-classes/org/guvnor/m2repo/backend/server/uberfire-m2repo-editor-backend-100-SNAPSHOT.jar"); assertThat(file).exists(); M2ServletContextListener listener = new M2ServletContextListener(); GAV deployed = listener.deployJar(file.getAbsolutePath(), session); assertThat(deployed.getGroupId()).isEqualTo("org.uberfire"); assertThat(deployed.getArtifactId()).isEqualTo("uberfire-m2repo-editor-backend"); assertThat(deployed.getVersion()).isEqualTo("100-SNAPSHOT"); ArtifactRequest artifactRequest = new ArtifactRequest(); artifactRequest.setArtifact(getArtifact()); ArtifactResult result = Aether.getAether().getSystem().resolveArtifact(session, artifactRequest); assertThat(result.isMissing()).isFalse(); assertThat(result.isResolved()).isTrue(); String absolutePath = result.getArtifact().getFile().toString(); String folder = absolutePath.substring(0, absolutePath.lastIndexOf(File.separator)); File remoteRepos = new File(folder + File.separator + "_remote.repositories"); assertThat(remoteRepos.exists()).isTrue(); File metadata = new File(folder + File.separator + "maven-metadata-local.xml"); assertThat(metadata.exists()).isTrue(); File pom = new File(folder + File.separator + "uberfire-m2repo-editor-backend-100-SNAPSHOT.pom"); assertThat(pom.exists()).isTrue(); }
Source:
<code>default int getCharge(@Nonnull Location l) { Validate.notNull(l, "Location was null!"); <START> if (!isChargeable()) return 0; <END> String charge = BlockStorage.getLocationInfo(l, "energy-charge"); if (charge != null) { return Integer.parseInt(charge); } else { return 0; } }</code><technical_language>eehhh, great I get needs for this. refactor it? suggestion // Emergency fallback, this hold a charge, return zero if (!isChargeable()) { return 0; }</technical_language>

Target:
default int getCharge(@Nonnull Location l) { Validate.notNull(l, "Location was null!"); if (!isChargeable()) { return 0; } String charge = BlockStorage.getLocationInfo(l, "energy-charge"); if (charge != null) { return Integer.parseInt(charge); } else { return 0; } }
Source:
<code>public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case MENU_SORT: createSortMenu(); return true; case MENU_MAP: try { Class.forName("com.google.android.maps.MapActivity"); } <START> catch (Throwable e1) { <END> Logger.log(AndroidLogger.TYPE_ERROR_CONFIG_STRUCTURE, "Could not load maps: " + e1); Toast noMaps = Toast.makeText(EntitySelectActivity.this, "Google Maps aren't available on this device. Please contact technical support for more information.", Toast.LENGTH_LONG); noMaps.show(); return true; } Intent i = new Intent(this, EntityMapActivity.class); this.startActivityForResult(i, MAP_SELECT); return true; case MENU_ACTION: triggerDetailAction(); return true; } return super.onOptionsItemSelected(item); }</code><technical_language>a good idea explicit exception caught? In this case "ClassNotFoundException"</technical_language>

Target:
public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case MENU_SORT: createSortMenu(); return true; case MENU_MAP: Intent i = new Intent(this, EntityMapActivity.class); this.startActivityForResult(i, MAP_SELECT); return true; case MENU_ACTION: triggerDetailAction(); return true; } return super.onOptionsItemSelected(item); }
Source:
<code>public void setUp() throws Exception { <START> harness = GerritFixture.forVersion(2, 12).harness(); END> client = harness.client(); }</code><technical_language>commit this change</technical_language>

Target:
public void setUp() throws Exception { harness = GerritFixture.current().harness(); client = harness.client(); }
Source:
<code>private void throwDice(GameBean game) { Integer diceFirstValue = randomUtil.pullRandomDiceNumber(new ArrayList<Integer>(asList(1, 2, 3, 4, 5, 6))); <START> Integer diceSecondValue = randomUtil.pullRandomDiceNumber(new ArrayList<Integer>(asList(1, 2, 3, 4, 5, 6))); <END> game.setDiceFirstValue(diceFirstValue); game.setDiceSecondValue(diceSecondValue); game.setDiceThrown(true); if (diceFirstValue + diceSecondValue != 7) { mainStageUtil.distributeResources(game); } }</code><technical_language>ok i create new one, name of method randomUtil.pullRandomDiceNumber changed coz is correct. done</technical_language>

Target:
private void throwDice(GameBean game) { Integer diceFirstValue = randomUtil.getRandomDiceNumber(); Integer diceSecondValue = randomUtil.getRandomDiceNumber(); log.info("First dice: " + diceFirstValue); log.info("Second dice: " + diceSecondValue); game.setDiceFirstValue(diceFirstValue); game.setDiceSecondValue(diceSecondValue); game.setDiceThrown(true); if (!isRobbersActivity(diceFirstValue, diceSecondValue)) { List<HexBean> hexesWithCurrentDiceValue = game.fetchHexesWithCurrentDiceValue(); log.debug("Hexes with current dice value:" + hexesWithCurrentDiceValue); mainStageUtil.produceResourcesFromActiveDiceHexes(hexesWithCurrentDiceValue); } else{ log.debug("Robbers activity due to dice value 7"); } }
Source:
<code>public String toString() { <START> return "ChePlugin{" + "editors=" + editors + "} " + super.toString(); <END> }</code><technical_language>a good idea output ChePlugin{editors=[....]} PluginBase{name=qwe...}</technical_language>

Target:
public String toString() { return "ChePlugin{" + "name='" + getName() + '\'' + ", id='" + getId() + '\'' + ", version='" + getVersion() + '\'' + ", containers=" + getContainers() + ", endpoints=" + getEndpoints() + ", editors=" + getEditors() + '}'; }
Source:
<code>private String readRequestToString(InputStream inputStream) throws IOException { BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream)); StringWriter writer = new StringWriter(); <START> String line; <END> while ((line = bufferedReader.readLine()) != null) { if (line.isEmpty()) { break; } writer.write(line); writer.write('\n'); } return writer.toString(); }</code><technical_language>please dont remove explicit initialization</technical_language>

Target:
private String readRequestToString(InputStream inputStream) throws IOException { BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream)); StringWriter writer = new StringWriter(); String line = null; while ((line = bufferedReader.readLine()) != null) { if (line.isEmpty()) { break; } writer.write(line); writer.write('\n'); } return writer.toString(); }
Source:
<code>public RequiredData2014Reviewer(ErrorMessageUtil msgUtil, CertificationResultRules certRules) { <START> super(msgUtil, certRules); <END> this.msgUtil = msgUtil; this.certRules = certRules; }</code><technical_language>This extends RequiredDataReviewer, protected msgUtil certRules. this method need private versions</technical_language>

Target:
public RequiredData2014Reviewer(ErrorMessageUtil msgUtil, CertificationResultRules certRules) { super(msgUtil, certRules); }
Source:
<code>public void completed(final Exchange exchange) { if (exchange.getOrigin() == Origin.LOCAL) { Request originRequest = exchange.getCurrentRequest(); if (!originRequest.hasMID()) { } else { KeyMID idByMID = KeyMID.fromOutboundMessage(exchange.getCurrentRequest()); exchangeStore.remove(idByMID); } KeyToken idByToken = KeyToken.fromOutboundMessage(originRequest); exchangeStore.remove(idByToken); if(!exchange.getCurrentRequest().getOptions().hasObserve()) { exchangeStore.releaseToken(idByToken); } LOGGER.log(Level.FINER, "Exchange [{0}, {1}] completed", new Object[]{idByToken, exchange.getOrigin()}); } else { Response response = exchange.getCurrentResponse(); Request request = exchange.getCurrentRequest(); if (response != null && response.getType() != Type.ACK) { KeyMID midKey = KeyMID.fromOutboundMessage(response); exchangeStore.remove(midKey); <START> LOGGER.log(Level.FINER, "Exchange [{0}, {1}] completed", new Object[]{midKey, exchange.getOrigin()}); <END> } ObserveRelation relation = exchange.getRelation(); if (relation != null) { removeNotificationsOf(relation); } } }</code><technical_language>if (!exchange.getCurrentRequest().getOptions().hasObserve()) { exchangeStore.releaseToken(idByToken); } in TcpMatcher, request observe option 1 cleaned completion. rebase new Request.isObserve()</technical_language>

Target:
public void completed(final Exchange exchange) { if (exchange.getOrigin() == Origin.LOCAL) { Request originRequest = exchange.getCurrentRequest(); if (!originRequest.hasMID()) { } else { KeyMID idByMID = KeyMID.fromOutboundMessage(originRequest); exchangeStore.remove(idByMID); } KeyToken idByToken = KeyToken.fromOutboundMessage(originRequest); exchangeStore.remove(idByToken); if(!originRequest.getOptions().hasObserve()) { exchangeStore.releaseToken(idByToken); } LOGGER.log(Level.FINER, "Exchange [{0}, origin: {1}] completed", new Object[]{idByToken, exchange.getOrigin()}); } else { Response response = exchange.getCurrentResponse(); Request request = exchange.getCurrentRequest(); if (response != null && response.getType() != Type.ACK) { KeyMID midKey = KeyMID.fromOutboundMessage(response); exchangeStore.remove(midKey); LOGGER.log(Level.FINER, "Exchange [{0}, {1}] completed", new Object[]{midKey, exchange.getOrigin()}); } ObserveRelation relation = exchange.getRelation(); if (relation != null) { removeNotificationsOf(relation); } } }
Source:
<code>public boolean test(HermesResponse response) { return response == null || isClientTimeoutOrServerError(response) || isFailedExceptionally(response) <START> || isSocketTimeoutException(response.getFailureCause()); <END> }</code><technical_language>code more common, change isSocketTimeoutException param HermesResponse ? WDYT</technical_language>

Target:
public boolean test(HermesResponse response) { return response == null || isClientTimeoutOrServerError(response) || isFailedExceptionally(response) || isSocketTimeoutException(response); }
Source:
<code>private void releaseByteBuf() { if (entries != null) { <START> for (LedgerEntry entry : entries) { <END> entry.getEntryBuffer().release(1); } } }</code><technical_language>entries.forEach(LedgerEntry::close()); entries.clear(); entries = null;</technical_language>

Target:
private void releaseByteBuf() { if (entries != null) { entries.forEach(LedgerEntry::close); entries.clear(); entries = null; } }
Source:
<code>private void buildClaim( ProcessedClaimCollection claimsColl, Principal principal, URI claimType, Object value) { if (value == null) { return; } ProcessedClaim c = new ProcessedClaim(); c.setClaimType(claimType); c.setPrincipal(principal); <START> Pattern p = Pattern.compile("^\\[(.*)\\]$"); <END> Matcher m = p.matcher((String) value); if (m.matches()) { for (String s : m.group(1).split(",")) { c.addValue(s.trim()); } } else { c.addValue(value); } claimsColl.add(c); }</code><technical_language>compile pattern a class field instead need compile times</technical_language>

Target:
private void buildClaim( ProcessedClaimCollection claimsColl, Principal principal, URI claimType, Object value) { if (value == null) { return; } ProcessedClaim c = new ProcessedClaim(); c.setClaimType(claimType); c.setPrincipal(principal); Matcher m = attributePattern.matcher((String) value); if (m.matches()) { for (String s : m.group(1).split(",")) { c.addValue(s.trim()); } } else { c.addValue(value); } claimsColl.add(c); }
Source:
<code>public boolean sendFIR(int mediaSenderSSRC) { KeyframeRequester oldRequester = kfRequesters.putIfAbsent( <START> mediaSenderSSRC, new KeyframeRequester(mediaSenderSSRC)); <END> KeyframeRequester kfRequester = kfRequesters.get(mediaSenderSSRC); if (oldRequester == null) { recurringProcessibleExecutor .registerRecurringProcessible(kfRequester); } return kfRequester.maybeRequest(true); }</code><technical_language>afraid I get it... initialize a new KeyframeRequester instance time want send a FIR if need instance? I feel comfortable that. please explain case</technical_language>

Target:
public boolean sendFIR(int mediaSenderSSRC) { boolean registerRecurringProcessible = false; synchronized (kfRequesters) { if (!kfRequesters.containsKey(mediaSenderSSRC)) { kfRequesters.put( mediaSenderSSRC, new KeyframeRequester(mediaSenderSSRC)); registerRecurringProcessible = true; } } KeyframeRequester kfRequester = kfRequesters.get(mediaSenderSSRC); if (registerRecurringProcessible) { recurringProcessibleExecutor .registerRecurringProcessible(kfRequester); } return kfRequester.maybeRequest(true); }
Source:
<code>public void visitToken(DetailAST ast) { <START> DetailAST annotationsNode = ast.findFirstToken(TokenTypes.MODIFIERS); <END> if (annotationsNode == null) { annotationsNode = ast.findFirstToken(TokenTypes.ANNOTATIONS); } if (annotationsNode != null) { checkAnnotations(annotationsNode); } }</code><technical_language>this is good update rename variable. searched for modifiers, modifiers node. is good reuse variable</technical_language>

Target:
public void visitToken(DetailAST ast) { DetailAST node = ast.findFirstToken(TokenTypes.MODIFIERS); if (node == null) { node = ast.findFirstToken(TokenTypes.ANNOTATIONS); } checkAnnotations(node, getExpectedAnnotationIndentation(node)); }
Source:
<code>protected void contribute(IndexSchemaFieldDefinitionHelper<String> helper, LuceneIndexSchemaNodeCollector collector, LuceneIndexSchemaObjectNode parentNode) { if ( Sortable.YES.equals( sortable ) && analyzer != null ) { throw log.cannotUseAnalyzerOnSortableField( getSchemaContext().getEventContext() ); <START> } <END> if ( analyzer != null && normalizer != null ) { throw log.cannotApplyAnalyzerAndNormalizer( getSchemaContext().getEventContext() ); } Analyzer analyzerOrNormalizer = analyzer != null ? analyzer : normalizer; QueryBuilder queryBuilder = analyzerOrNormalizer != null ? new QueryBuilder( analyzerOrNormalizer ) : null; StringFieldConverter converter = new StringFieldConverter( helper.createUserIndexFieldConverter(), analyzerOrNormalizer ); LuceneIndexSchemaFieldNode<String> schemaNode = new LuceneIndexSchemaFieldNode<>( parentNode, getRelativeFieldName(), converter, new StringFieldCodec( sortable, getFieldType( getStore(), analyzer != null ), analyzerOrNormalizer ), new StringFieldPredicateBuilderFactory( converter, analyzer != null, queryBuilder ), StringFieldSortContributor.INSTANCE ); helper.initialize( new LuceneIndexFieldAccessor<>( schemaNode ) ); collector.collectFieldNode( schemaNode.getAbsoluteFieldPath(), schemaNode ); if ( analyzerOrNormalizer != null ) { collector.collectAnalyzer( schemaNode.getAbsoluteFieldPath(), analyzerOrNormalizer ); } }</code><technical_language>In Es backend, this switch construct. brings plate (having a warning a new is added) in backends I simplify Es backend</technical_language>

Target:
protected void contribute(IndexSchemaFieldDefinitionHelper<String> helper, LuceneIndexSchemaNodeCollector collector, LuceneIndexSchemaObjectNode parentNode) { if ( analyzer != null ) { switch ( sortable ) { case DEFAULT: case NO: break; case YES: throw log.cannotUseAnalyzerOnSortableField( analyzerName, getSchemaContext().getEventContext() ); } if ( normalizer != null ) { throw log.cannotApplyAnalyzerAndNormalizer( analyzerName, normalizerName, getSchemaContext().getEventContext() ); } } Analyzer analyzerOrNormalizer = analyzer != null ? analyzer : normalizer; QueryBuilder queryBuilder = analyzerOrNormalizer != null ? new QueryBuilder( analyzerOrNormalizer ) : null; StringFieldConverter converter = new StringFieldConverter( helper.createUserIndexFieldConverter(), analyzerOrNormalizer ); LuceneIndexSchemaFieldNode<String> schemaNode = new LuceneIndexSchemaFieldNode<>( parentNode, getRelativeFieldName(), converter, new StringFieldCodec( sortable, getFieldType( getStore(), analyzer != null ), analyzerOrNormalizer ), new StringFieldPredicateBuilderFactory( converter, analyzer != null, queryBuilder ), StringFieldSortContributor.INSTANCE ); helper.initialize( new LuceneIndexFieldAccessor<>( schemaNode ) ); collector.collectFieldNode( schemaNode.getAbsoluteFieldPath(), schemaNode ); if ( analyzerOrNormalizer != null ) { collector.collectAnalyzer( schemaNode.getAbsoluteFieldPath(), analyzerOrNormalizer ); } }
Source:
<code>protected List<String> deleteTemporaryFilesCommand() { if (!Boolean.TRUE.equals(noDeleteAfterExec)) { return ImmutableList.of( "rm -f "+scriptPath+" < /dev/null", "rm -f "+stdoutPath+" < /dev/null", "rm -f "+stderrPath+" < /dev/null", "rm -f "+exitStatusPath+" < /dev/null", <START> "rm -f "+pidPath+" < /dev/null"); <END> } else { return ImmutableList.<String>of(); } }</code><technical_language>_could_ a single rm -f command</technical_language>

Target:
protected List<String> deleteTemporaryFilesCommand() { if (!Boolean.TRUE.equals(noDeleteAfterExec)) { return ImmutableList.of( "rm -f "+scriptPath+" "+stdoutPath+" "+stderrPath+" "+exitStatusPath+" "+pidPath+" < /dev/null"); } else { return ImmutableList.<String>of(); } }
Source:
<code>public void display() { setShowLoginProgress(false); LoginPrefs loginPrefs = preferencesService.getPreferences().getLogin(); String username = loginPrefs.getUsername(); String password = ""; try { password = loginPrefs.getPassword(); } catch (Exception e) { loginPrefs.setPassword(""); loginPrefs.setAutoLogin(false); logger.warn("Error during password decryption, password was thrown away:", e); <START> } <END> boolean isAutoLogin = loginPrefs.getAutoLogin(); usernameInput.setText(Strings.nullToEmpty(username)); autoLoginCheckBox.setSelected(isAutoLogin); if (loginPrefs.getAutoLogin() && !isNullOrEmpty(username) && !isNullOrEmpty(password)) { login(username, password, true); } else if (isNullOrEmpty(username)) { usernameInput.requestFocus(); } else { passwordInput.requestFocus(); } }</code><technical_language>put this getPassword *deobfuscation* (not *decryption*) happens, hacks stay place easier remove later</technical_language>

Target:
public void display() { setShowLoginProgress(false); LoginPrefs loginPrefs = preferencesService.getPreferences().getLogin(); String username = loginPrefs.getUsername(); String password = loginPrefs.getPassword(); boolean isAutoLogin = loginPrefs.getAutoLogin(); usernameInput.setText(Strings.nullToEmpty(username)); autoLoginCheckBox.setSelected(isAutoLogin); if (loginPrefs.getAutoLogin() && !isNullOrEmpty(username) && !isNullOrEmpty(password)) { login(username, password, true); } else if (isNullOrEmpty(username)) { usernameInput.requestFocus(); } else { passwordInput.requestFocus(); } }
Source:
<code>public void testRegexRecordsAreProcessedAfterReassignment() throws Exception { final String topic1 = "TEST-TOPIC-1"; <START> final String topic2 = "TEST-TOPIC-2"; <END> CLUSTER.createTopic(topic1); final StreamsBuilder builder = new StreamsBuilder(); final KStream<String, String> pattern1Stream = builder.stream(Pattern.compile("TEST-TOPIC-\\d")); pattern1Stream.to(outputTopic, Produced.with(Serdes.String(), Serdes.String())); streams = new KafkaStreams(builder.build(), streamsConfiguration); streams.start(); CLUSTER.createTopic(topic2); final KeyValue<String, String> record1 = new KeyValue<>("1", "1"); final KeyValue<String, String> record2 = new KeyValue<>("2", "2"); IntegrationTestUtils.produceKeyValuesSynchronously( topic1, Collections.singletonList(record1), TestUtils.producerConfig(CLUSTER.bootstrapServers(), StringSerializer.class, StringSerializer.class), CLUSTER.time ); IntegrationTestUtils.produceKeyValuesSynchronously( topic2, Collections.singletonList(record2), TestUtils.producerConfig(CLUSTER.bootstrapServers(), StringSerializer.class, StringSerializer.class), CLUSTER.time ); IntegrationTestUtils.waitUntilFinalKeyValueRecordsReceived( TestUtils.consumerConfig(CLUSTER.bootstrapServers(), StringDeserializer.class, StringDeserializer.class), outputTopic, Arrays.asList(record1, record2) ); CLUSTER.deleteTopicsAndWait(topic1, topic2); }</code><technical_language>nit: put topic2 initialization L196</technical_language>

Target:
public void testRegexRecordsAreProcessedAfterReassignment() throws Exception { final String topic1 = "TEST-TOPIC-1"; CLUSTER.createTopic(topic1); final StreamsBuilder builder = new StreamsBuilder(); final KStream<String, String> pattern1Stream = builder.stream(Pattern.compile("TEST-TOPIC-\\d")); pattern1Stream.to(outputTopic, Produced.with(Serdes.String(), Serdes.String())); streams = new KafkaStreams(builder.build(), streamsConfiguration); final String topic2 = "TEST-TOPIC-2"; streams.start(); CLUSTER.createTopic(topic2); final KeyValue<String, String> record1 = new KeyValue<>("1", "1"); final KeyValue<String, String> record2 = new KeyValue<>("2", "2"); IntegrationTestUtils.produceKeyValuesSynchronously( topic1, Collections.singletonList(record1), TestUtils.producerConfig(CLUSTER.bootstrapServers(), StringSerializer.class, StringSerializer.class), CLUSTER.time ); IntegrationTestUtils.produceKeyValuesSynchronously( topic2, Collections.singletonList(record2), TestUtils.producerConfig(CLUSTER.bootstrapServers(), StringSerializer.class, StringSerializer.class), CLUSTER.time ); IntegrationTestUtils.waitUntilFinalKeyValueRecordsReceived( TestUtils.consumerConfig(CLUSTER.bootstrapServers(), StringDeserializer.class, StringDeserializer.class), outputTopic, Arrays.asList(record1, record2) ); streams.close(); CLUSTER.deleteTopicsAndWait(topic1, topic2); }
Source:
<code>public void setList_unmanagedObjectThrows() { RealmResults<AllTypes> collection = realm.where(AllTypes.class).findAll(); realm.beginTransaction(); try { collection.setList(AllTypes.FIELD_REALMLIST, new RealmList<>(new Dog())); fail(); } catch (IllegalArgumentException e) { <START> assertTrue("Wrong error message: " + e.getMessage(), e.getMessage().contains("is not a valid a valid, managed Realm object.")); <END> } }</code><technical_language>remove double a valid test & implementation</technical_language>

Target:
public void setList_unmanagedObjectThrows() { RealmResults<AllTypes> collection = realm.where(AllTypes.class).findAll(); realm.beginTransaction(); try { collection.setList(AllTypes.FIELD_REALMLIST, new RealmList<>(new Dog())); fail(); } catch (IllegalArgumentException e) { assertTrue("Wrong error message: " + e.getMessage(), e.getMessage().contains("is not a valid, managed Realm object.")); } }
Source:
<code>protected JoinNode rewrite(Context context, JoinNode joinNode, BiMap<DereferenceExpression, VariableReferenceExpression> expressions) { Assignments.Builder leftSideDereferences = Assignments.builder(); Assignments.Builder rightSideDereferences = Assignments.builder(); for (Map.Entry<VariableReferenceExpression, DereferenceExpression> entry : expressions.inverse().entrySet()) { VariableReferenceExpression baseSymbol = getBase(entry.getValue(), context.getVariableAllocator().getTypes()); if (joinNode.getLeft().getOutputVariables().contains(baseSymbol)) { leftSideDereferences.put(entry.getKey(), castToRowExpression(entry.getValue())); } else { rightSideDereferences.put(entry.getKey(), castToRowExpression(entry.getValue())); } } PlanNode leftNode = createProjectBelow(joinNode.getLeft(), leftSideDereferences.build(), context.getIdAllocator()); PlanNode rightNode = createProjectBelow(joinNode.getRight(), rightSideDereferences.build(), context.getIdAllocator()); return new JoinNode( context.getIdAllocator().getNextId(), joinNode.getType(), leftNode, rightNode, joinNode.getCriteria(), ImmutableList.<VariableReferenceExpression>builder().addAll(leftNode.getOutputVariables()).addAll(rightNode.getOutputVariables()).build(), <START> joinNode.getFilter().map(expression -> castToRowExpression(ExpressionTreeRewriter.rewriteWith(new PushDownDereferences.DereferenceReplacer(expressions), castToExpression(expression)))), <END> joinNode.getLeftHashVariable(), joinNode.getRightHashVariable(), joinNode.getDistributionType()); }</code><technical_language>a helper method above: joinNode.getFilter().map(expression -> replaceDereferences(expression, expressions)),</technical_language>

Target:
protected JoinNode rewrite(Context context, JoinNode joinNode, BiMap<DereferenceExpression, VariableReferenceExpression> expressions) { Assignments.Builder leftSideDereferences = Assignments.builder(); Assignments.Builder rightSideDereferences = Assignments.builder(); for (Map.Entry<VariableReferenceExpression, DereferenceExpression> entry : expressions.inverse().entrySet()) { VariableReferenceExpression baseSymbol = getBase(entry.getValue(), context.getVariableAllocator().getTypes()); if (joinNode.getLeft().getOutputVariables().contains(baseSymbol)) { leftSideDereferences.put(entry.getKey(), castToRowExpression(entry.getValue())); } else { rightSideDereferences.put(entry.getKey(), castToRowExpression(entry.getValue())); } } PlanNode leftNode = createProject(joinNode.getLeft(), leftSideDereferences.build(), context.getIdAllocator()); PlanNode rightNode = createProject(joinNode.getRight(), rightSideDereferences.build(), context.getIdAllocator()); return new JoinNode( context.getIdAllocator().getNextId(), joinNode.getType(), leftNode, rightNode, joinNode.getCriteria(), ImmutableList.<VariableReferenceExpression>builder() .addAll(leftNode.getOutputVariables()) .addAll(rightNode.getOutputVariables()) .build(), joinNode.getFilter().map(expression -> replaceDereferences(expression, expressions)), joinNode.getLeftHashVariable(), joinNode.getRightHashVariable(), joinNode.getDistributionType()); }
Source:
<code>public static Archive<?> deploy() { WebArchive war = TestUtil.prepareArchive(AtomProviderTest.class.getSimpleName()); war.addClass(AtomProviderTest.class); <START> war.addAsManifestResource(PermissionUtil.createPermissionsXmlAsset( <END> new FilePermission("<<ALL FILES>>", "read"), new ReflectPermission("suppressAccessChecks"), new RuntimePermission("accessDeclaredMembers"), new RuntimePermission("getClassLoader")), "permissions.xml"); return TestUtil.finishContainerPrepare(war, null, AtomProviderResource.class, AtomProviderCustomer.class, AtomProviderDataCollectionRecord.class, ObjectFactory.class); }</code><technical_language><LINK_0> permission new RuntimePermission("accessDeclaredMembers")) is required test pass</technical_language>

Target:
public static Archive<?> deploy() { WebArchive war = TestUtil.prepareArchive(AtomProviderTest.class.getSimpleName()); war.addClass(AtomProviderTest.class); return TestUtil.finishContainerPrepare(war, null, AtomProviderResource.class, AtomProviderCustomer.class, AtomProviderDataCollectionRecord.class, ObjectFactory.class); }
Source:
<code>public void tick(WallClockTimestamp timestamp) { <START> operationType = OperationType.COMMAND; <END> long unixTimestamp = timestamp.unixTimestamp(); if (!scheduledTasks.isEmpty()) { Iterator<ScheduledTask> iterator = scheduledTasks.iterator(); while (iterator.hasNext()) { ScheduledTask task = iterator.next(); if (task.isRunnable(unixTimestamp)) { this.timestamp = task.time; this.operationType = OperationType.COMMAND; log.trace("Executing scheduled task {}", task); task.execute(); complete.add(task); iterator.remove(); } else { break; } } for (ScheduledTask task : complete) { task.reschedule(this.timestamp); } complete.clear(); } }</code><technical_language>This a bit weird, testing code..</technical_language>

Target:
public void tick(WallClockTimestamp timestamp) { long unixTimestamp = timestamp.unixTimestamp(); if (!scheduledTasks.isEmpty()) { Iterator<ScheduledTask> iterator = scheduledTasks.iterator(); while (iterator.hasNext()) { ScheduledTask task = iterator.next(); if (task.isRunnable(unixTimestamp)) { this.timestamp = task.time; this.operationType = OperationType.COMMAND; log.trace("Executing scheduled task {}", task); task.execute(); complete.add(task); iterator.remove(); } else { break; } } for (ScheduledTask task : complete) { task.reschedule(this.timestamp); } complete.clear(); } }
Source:
<code>public void testPermissionCheck() throws NameAlreadyUsedException, NoSuchProjectException, ProjectRenamingFailedException { reset(capabilityControl); <START> expect(capabilityControl.canRenameProject()).andReturn(false).anyTimes(); <END> replayMocks(); try { renameProject("dummysource", "dummydestination"); fail("No exception thrown, although user lacks permission to rename " + "projects"); } catch (PermissionDeniedException e) { assertTrue("PermissionDeniedException does not contain user name", e.getMessage().contains("dummyUserName")); } }</code><technical_language>This method added CapabilityControl</technical_language>

Target:
public void testPermissionCheck() throws NameAlreadyUsedException, NoSuchProjectException, ProjectRenamingFailedException { reset(capabilityControl); expect(capabilityControl.canAdministrateServer()).andReturn(false).anyTimes(); replayMocks(); try { renameProject("dummysource", "dummydestination"); fail("No exception thrown, although user lacks permission to rename " + "projects"); } catch (PermissionDeniedException e) { assertTrue("PermissionDeniedException does not contain user name", e.getMessage().contains("dummyUserName")); } }
Source:
<code>public void testWithoutFilter() throws Exception { Config config = createConfig(false); Hazelcast.newHazelcastInstance(config); sendJoinDatagram(new TestDeserialized()); Thread.sleep(500L); <START> assertTrueEventually(() -> assertTrue("Object was not deserializaed", TestDeserialized.isDeserialized)); <END> }</code><technical_language>minor: typo in deserializaed</technical_language>

Target:
public void testWithoutFilter() throws Exception { Config config = createConfig(false); Hazelcast.newHazelcastInstance(config); sendJoinDatagram(new TestDeserialized()); assertTrueEventually(() -> assertTrue("Object was not deserialized", TestDeserialized.isDeserialized)); }
Source:
<code>public void testUpdateVmDevicesBootOrder() { Map<Guid, Disk> idTodisk = new HashMap<Guid, Disk>(); List<VmNetworkInterface> interfaces = new LinkedList<VmNetworkInterface>(); VmDevice nic1 = createNetworkInterface(NIC_1_ID, true, NIC_1_NAME, interfaces); VmDevice nic2 = createNetworkInterface(NIC_2_ID, true, NIC_2_NAME, interfaces); <START> VmDevice nic3 = createNetworkInterface(NIC_3_ID, false, "", interfaces); <END> VmDevice disk1 = createDiskDevice(DISK_1_ID, true, idTodisk); VmDevice disk2 = createDiskDevice(DISK_2_ID, false, idTodisk); VmDevice cd = createCdRomDevice(CD_ID); doReturn(idTodisk).when(vm).getDiskMap(); doReturn(interfaces).when(vm).getInterfaces(); doReturn(false).when(vm).isRunOnce(); doReturn(BootSequence.DNC).when(vm).getDefaultBootSequence(); VmDeviceCommonUtils.updateVmDevicesBootOrder( vm, Arrays.asList(disk1, nic2, cd, nic1, disk2), false); int index = 1; assertTrue(String.format("CD should have boot order = %d, actual = %d", index, cd.getBootOrder()), cd.getBootOrder() == index); ++index; assertTrue(String.format("NIC 1 should have boot order = %d, actual = %d", index, nic1.getBootOrder()), nic1.getBootOrder() == index); ++index; assertTrue(String.format("NIC 2 should have boot order = %d, actual = %d", index, nic2.getBootOrder()), nic2.getBootOrder() == index); ++index; assertTrue("NIC 3 should have boot order = 0", nic3.getBootOrder() == 0); assertTrue(String.format("Disk 1 should have boot order = %d, actual = %d", index, disk1.getBootOrder()), disk1.getBootOrder() == index); assertTrue("Disk 2 should have boot order = 0", disk2.getBootOrder() == 0); }</code><technical_language>I give this a name bootable,covering case bootable NIC affect NICs ordering</technical_language>

Target:
public void testUpdateVmDevicesBootOrder() { Map<Guid, Disk> idToDisk = new HashMap<Guid, Disk>(); List<VmNetworkInterface> interfaces = new LinkedList<VmNetworkInterface>(); VmDevice nic1 = createNetworkInterface(true, NIC_1_NAME, interfaces); VmDevice nic2 = createNetworkInterface(true, NIC_2_NAME, interfaces); VmDevice nonBootableNic = createNetworkInterface(false, "", interfaces); VmDevice bootableDisk = createDiskDevice(true, idToDisk); VmDevice nonBootableDisk = createDiskDevice(false, idToDisk); VmDevice cd = createCdRomDevice(); doReturn(idToDisk).when(vm).getDiskMap(); doReturn(interfaces).when(vm).getInterfaces(); doReturn(false).when(vm).isRunOnce(); doReturn(BootSequence.DNC).when(vm).getDefaultBootSequence(); VmDeviceCommonUtils.updateVmDevicesBootOrder( vm, Arrays.asList(bootableDisk, nic2, cd, nic1, nonBootableDisk), false); int index = 1; assertEquals("Wrong boot order for CD", index++, cd.getBootOrder()); assertEquals("Wrong boot order for nic1", index++, nic1.getBootOrder()); assertEquals("Wrong boot order for nic2", index++, nic2.getBootOrder()); assertEquals("Wrong boot order for non bootable nic", 0, nonBootableNic.getBootOrder()); assertEquals("Wrong boot order for bootable disk", index++, bootableDisk.getBootOrder()); assertEquals("Wrong boot order for non bootable disk", 0, nonBootableDisk.getBootOrder()); }
Source:
<code>private boolean mutateSystemSetting(String name, String value, int runAsUserId, int operation) { if (!hasWriteSecureSettingsPermission()) { if (!Settings.checkAndNoteWriteSettingsOperation(getContext(), Binder.getCallingUid(), getCallingPackage(), true)) { return false; } } enforceRestrictedSystemSettingsMutationForCallingPackage(operation, name, <START> runAsUserId); <END> final int callingUserId = resolveCallingUserIdEnforcingPermissionsLocked(runAsUserId); final int owningUserId = resolveOwningUserIdForSystemSettingLocked(callingUserId, name); if (owningUserId != callingUserId) { return false; } synchronized (mLock) { switch (operation) { case MUTATION_OPERATION_INSERT: { validateSystemSettingValue(name, value); return mSettingsRegistry .insertSettingLocked(SettingsRegistry.SETTINGS_TYPE_SYSTEM, owningUserId, name, value, getCallingPackage()); } case MUTATION_OPERATION_DELETE: { return mSettingsRegistry.deleteSettingLocked( SettingsRegistry.SETTINGS_TYPE_SYSTEM, owningUserId, name); } case MUTATION_OPERATION_UPDATE: { validateSystemSettingValue(name, value); return mSettingsRegistry .updateSettingLocked(SettingsRegistry.SETTINGS_TYPE_SYSTEM, owningUserId, name, value, getCallingPackage()); } } return false; } }</code><technical_language>This callingUserId this is user behalf call is (in some cases if a managed profile asks a question answer parent)</technical_language>

Target:
private boolean mutateSystemSetting(String name, String value, int runAsUserId, int operation) { if (!hasWriteSecureSettingsPermission()) { if (!Settings.checkAndNoteWriteSettingsOperation(getContext(), Binder.getCallingUid(), getCallingPackage(), true)) { return false; } } final int callingUserId = resolveCallingUserIdEnforcingPermissionsLocked(runAsUserId); enforceRestrictedSystemSettingsMutationForCallingPackage(operation, name, callingUserId); final int owningUserId = resolveOwningUserIdForSystemSettingLocked(callingUserId, name); if (owningUserId != callingUserId) { return false; } synchronized (mLock) { switch (operation) { case MUTATION_OPERATION_INSERT: { validateSystemSettingValue(name, value); return mSettingsRegistry .insertSettingLocked(SettingsRegistry.SETTINGS_TYPE_SYSTEM, owningUserId, name, value, getCallingPackage()); } case MUTATION_OPERATION_DELETE: { return mSettingsRegistry.deleteSettingLocked( SettingsRegistry.SETTINGS_TYPE_SYSTEM, owningUserId, name); } case MUTATION_OPERATION_UPDATE: { validateSystemSettingValue(name, value); return mSettingsRegistry .updateSettingLocked(SettingsRegistry.SETTINGS_TYPE_SYSTEM, owningUserId, name, value, getCallingPackage()); } } return false; } }
Source:
<code><START> protected BlobHelper() { <END> }</code><technical_language>this constructor private methods in class static</technical_language>

Target:
private BlobHelper() { }
Source:
<code>public static int decodeHexNibble(final char c) { final int index = c; <START> assert index >= 0; <END> if (index >= HEX2B.length) { return -1; } if (PlatformDependent.hasUnsafe()) { return PlatformDependent.getByte(HEX2B, index); } else { return HEX2B[index]; } }</code><technical_language>redundant spec: "char: char data type is a single 16-bit Unicode character. a minimum of '\u0000' (or 0) a maximum of '\uffff' (or 65,535 inclusive)." <LINK_0></technical_language>

Target:
public static int decodeHexNibble(final char c) { assert HEX2B.length == (Character.MAX_VALUE + 1); final int index = c; return HEX2B[index]; }
Source:
<code>public Path(String pathString) throws IllegalArgumentException { checkPathArg( pathString ); if (hasWindowsDrive(pathString) && pathString.charAt(0) != '/') { pathString = "/" + pathString; } String scheme = null; String authority = null; int start = 0; int colon = pathString.indexOf(':'); int slash = pathString.indexOf('/'); <START> if ((colon != -1) && (colon == (slash-1))) { END> scheme = pathString.substring(0, colon); start = colon+1; } if (pathString.startsWith(" (pathString.length()-start > 2)) { int nextSlash = pathString.indexOf('/', start+2); int authEnd = nextSlash > 0 ? nextSlash : pathString.length(); authority = pathString.substring(start+2, authEnd); start = authEnd; } String path = pathString.substring(start, pathString.length()); if (!WINDOWS && !path.isEmpty() && path.charAt(0) != '/') { path = "./" + path; } initialize(scheme, authority, path, null); }</code><technical_language>@yufeldman In case, merge absolute relative path, in case, is attempt merge absolute path, handled differently if merging absolute path allowed all</technical_language>

Target:
public Path(String pathString) throws IllegalArgumentException { checkPathArg( pathString ); if (hasWindowsDrive(pathString) && pathString.charAt(0) != '/') { pathString = "/" + pathString; } String scheme = null; String authority = null; int start = 0; int colon = pathString.indexOf(':'); int slash = pathString.indexOf('/'); if ((colon > 0) && (colon == (slash-1))) { scheme = pathString.substring(0, colon); start = colon+1; } if (pathString.startsWith(" (pathString.length()-start > 2)) { int nextSlash = pathString.indexOf('/', start+2); int authEnd = nextSlash > 0 ? nextSlash : pathString.length(); authority = pathString.substring(start+2, authEnd); start = authEnd; } String path = pathString.substring(start, pathString.length()); if (!WINDOWS && !path.isEmpty() && path.charAt(0) != '/') { path = "./" + path; } initialize(scheme, authority, path, null); }