auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public boolean performFinishingActions() { String projectLocation = myState.get(PROJECT_LOCATION_KEY); if (projectLocation != null) { File projectRoot = new File(projectLocation); File moduleRoot = new File(projectRoot, myState.get(myModuleNameKey)); try { Template.checkedCreateDirectoryIfMissing(moduleRoot); } catch (IOException e) { LOG.error(e); return false; } Template template = Template.createFromPath(myTemplateFile); Map<String, Object> templateState = FormFactorUtils.scrubFormFactorPrefixes(myFormFactor, myState.flatten()); template.render(projectRoot, moduleRoot, templateState, myWizard.getProject()); TemplateEntry templateEntry = myState.get(KEY_SELECTED_TEMPLATE); if (templateEntry == null) { return true; } Template activityTemplate = templateEntry.getTemplate(); for (Parameter parameter : templateEntry.getMetadata().getParameters()) { templateState.put(parameter.id, myState.get(myParameterStep.getParameterKey(parameter))); } activityTemplate.render(projectRoot, moduleRoot, templateState, myWizard.getProject()); List<File> filesToOpen = myState.get(WizardConstants.FILES_TO_OPEN_KEY); <START> if (filesToOpen != null) { <END> filesToOpen.addAll(activityTemplate.getFilesToOpen()); } return true; } else { return false; } }</code><technical_language>this expected null? this assert other checks (in NewModuleWizardDynamic:156)</technical_language>

Target:
public boolean performFinishingActions() { String projectLocation = myState.get(PROJECT_LOCATION_KEY); if (projectLocation != null) { File projectRoot = new File(projectLocation); File moduleRoot = new File(projectRoot, myState.get(myModuleNameKey)); try { Template.checkedCreateDirectoryIfMissing(moduleRoot); } catch (IOException e) { LOG.error(e); return false; } Template template = Template.createFromPath(myTemplateFile); Map<String, Object> templateState = FormFactorUtils.scrubFormFactorPrefixes(myFormFactor, myState.flatten()); template.render(projectRoot, moduleRoot, templateState, myWizard.getProject()); TemplateEntry templateEntry = myState.get(KEY_SELECTED_TEMPLATE); if (templateEntry == null) { return true; } Template activityTemplate = templateEntry.getTemplate(); for (Parameter parameter : templateEntry.getMetadata().getParameters()) { templateState.put(parameter.id, myState.get(myParameterStep.getParameterKey(parameter))); } activityTemplate.render(projectRoot, moduleRoot, templateState, myWizard.getProject()); List<File> filesToOpen = myState.get(FILES_TO_OPEN_KEY); assert filesToOpen != null; filesToOpen.addAll(activityTemplate.getFilesToOpen()); return true; } else { return false; } }
Source:
<code>public void testUnrecoverableErrorCount() throws Exception{ ServerMetrics.resetAll(); PrepRequestProcessor processor =new PrepRequestProcessor(new ZooKeeperServer(), new MyRequestProcessor()); processor.start(); processor.processRequest(createRquest(1L, 1)); <START> Thread.sleep(200); <END> processor.shutdown(); Map<String, Object> values = ServerMetrics.getAllValues(); Assert.assertEquals(1L, values.get("unrecoverable_error_count")); }</code><technical_language>Is this sleep needed</technical_language>

Target:
public void testUnrecoverableErrorCount() { ServerMetrics.resetAll(); ZooKeeperServer zks = new ZooKeeperServer(); ZooKeeperCriticalThread thread = new ZooKeeperCriticalThread("test", zks.getZooKeeperServerListener()); thread.handleException("test", new Exception()); Map<String, Object> values = ServerMetrics.getAllValues(); Assert.assertEquals(1L, values.get("unrecoverable_error_count")); }
Source:
<code>public static Cardinality fromId(String id) { <START> return cardinalityMap.get(id); <END> }</code><technical_language>change implementation Stream.of(Cardinality.values()).filter(c -> c.getId().equals(id)).findFirst().get();, remove cardinalityMap presence</technical_language>

Target:
public static Cardinality fromId(String id) { return Stream.of(values()) .filter(x -> x.getId().equals(id)) .findFirst().get(); }
Source:
<code>public String convertMemberName(Member member) { if (member instanceof Field) { Field f = (Field) member; if (f.isAnnotationPresent(JsonIgnore.class)) { return null; } if (f.isAnnotationPresent(JsonProperty.class)) { String propertyName = f.getDeclaredAnnotation(JsonProperty.class).value(); return CoreUtils.isNullOrEmpty(propertyName) ? f.getName() : propertyName; } } if (member instanceof Method) { Method m = (Method) member; if (m.isAnnotationPresent(JsonIgnore.class)) { return null; } if (m.isAnnotationPresent(JsonProperty.class)) { String propertyName = m.getDeclaredAnnotation(JsonProperty.class).value(); return CoreUtils.isNullOrEmpty(propertyName) ? m.getName() : propertyName; } } <START> return member.getName(); <END> }</code><technical_language>This Jackson default handles a JsonProperty annotated method, attempt remove Java bean prefix of get is</technical_language>

Target:
public String convertMemberName(Member member) { if (Modifier.isTransient(member.getModifiers())) { return null; } if (member instanceof Field) { Field f = (Field) member; if (f.isAnnotationPresent(JsonIgnore.class)) { return null; } if (f.isAnnotationPresent(JsonProperty.class)) { String propertyName = f.getDeclaredAnnotation(JsonProperty.class).value(); return CoreUtils.isNullOrEmpty(propertyName) ? f.getName() : propertyName; } return member.getName(); } if (member instanceof Method) { Method m = (Method) member; if (m.isAnnotationPresent(JsonIgnore.class)) { return null; } if (m.isAnnotationPresent(JsonProperty.class)) { String propertyName = m.getDeclaredAnnotation(JsonProperty.class).value(); return CoreUtils.isNullOrEmpty(propertyName) ? m.getName() : propertyName; } return member.getName(); } return null; }
Source:
<code>public void testFindDistinctChromosomesByStudyId() { <START> List<String> chromosomeList = variantEntityRepository.findDistinctChromosomes(); <END> Set<String> expectedChromosomeSet = new HashSet<>(); expectedChromosomeSet.add("11"); expectedChromosomeSet.add("9"); expectedChromosomeSet.add("2"); assertEquals(expectedChromosomeSet, new HashSet<>(chromosomeList)); }</code><technical_language>distinct, more sense return a Set instead of a List</technical_language>

Target:
public void testFindDistinctChromosomesByStudyId() { Set<String> chromosomeSet = variantEntityRepository.findDistinctChromosomes(); Set<String> expectedChromosomes = new HashSet<>(); expectedChromosomes.add("11"); expectedChromosomes.add("9"); expectedChromosomes.add("2"); assertEquals(expectedChromosomes, chromosomeSet); }
Source:
<code>protected Optional<PlanNodeStatsEstimate> doCalculate(TableScanNode node, StatsProvider sourceStats, Lookup lookup, Session session, TypeProvider types) { Constraint<ColumnHandle> constraint = new Constraint<>(node.getCurrentConstraint()); TableStatistics tableStatistics = metadata.getTableStatistics(session, node.getTable(), constraint); Map<VariableReferenceExpression, VariableStatsEstimate> outputVariableStats = new HashMap<>(); for (Map.Entry<VariableReferenceExpression, ColumnHandle> entry : node.getAssignments().entrySet()) { <START> ColumnHandle columnHandle = entry.getValue().withRequiredSubfields(ImmutableList.of()); <END> Optional<ColumnStatistics> columnStatistics = Optional.ofNullable(tableStatistics.getColumnStatistics().get(columnHandle)); outputVariableStats.put(entry.getKey(), columnStatistics.map(statistics -> toSymbolStatistics(tableStatistics, statistics)).orElse(VariableStatsEstimate.unknown())); } return Optional.of(PlanNodeStatsEstimate.builder() .setOutputRowCount(tableStatistics.getRowCount().getValue()) .addVariableStatistics(outputVariableStats) .build()); }</code><technical_language>This some implicit assumptions getTableStatistics implementation. feels list of column handles passed getTableStatistics, connector assign statistics for of handles passed</technical_language>

Target:
protected Optional<PlanNodeStatsEstimate> doCalculate(TableScanNode node, StatsProvider sourceStats, Lookup lookup, Session session, TypeProvider types) { Constraint<ColumnHandle> constraint = new Constraint<>(node.getCurrentConstraint()); TableStatistics tableStatistics = metadata.getTableStatistics(session, node.getTable(), ImmutableList.copyOf(node.getAssignments().values()), constraint); Map<VariableReferenceExpression, VariableStatsEstimate> outputVariableStats = new HashMap<>(); for (Map.Entry<VariableReferenceExpression, ColumnHandle> entry : node.getAssignments().entrySet()) { Optional<ColumnStatistics> columnStatistics = Optional.ofNullable(tableStatistics.getColumnStatistics().get(entry.getValue())); outputVariableStats.put(entry.getKey(), columnStatistics.map(statistics -> toSymbolStatistics(tableStatistics, statistics)).orElse(VariableStatsEstimate.unknown())); } return Optional.of(PlanNodeStatsEstimate.builder() .setOutputRowCount(tableStatistics.getRowCount().getValue()) .addVariableStatistics(outputVariableStats) .build()); }
Source:
<code>public Function<Result<TimeseriesResultValue>, Result<TimeseriesResultValue>> makeMetricManipulatorFn( final TimeseriesQuery query, final MetricManipulationFn fn ) { return new Function<Result<TimeseriesResultValue>, Result<TimeseriesResultValue>>() { @Override public Result<TimeseriesResultValue> apply(Result<TimeseriesResultValue> result) { final Map<String, Object> values = Maps.newHashMap(); final TimeseriesResultValue holder = result.getValue(); for (AggregatorFactory agg : query.getAggregatorSpecs()) { values.put(agg.getName(), fn.manipulate(agg, holder.getMetric(agg.getName()))); } for (PostAggregator postAgg : query.getPostAggregatorSpecs()) { Object computedPostAggValue = holder.getMetric(postAgg.getName()); <START> if (computedPostAggValue != null) { <END> values.put(postAgg.getName(), computedPostAggValue); } else { values.put(postAgg.getName(), postAgg.compute(values)); } } return new Result<TimeseriesResultValue>( result.getTimestamp(), new TimeseriesResultValue(values) ); } }; }</code><technical_language>cases in this null</technical_language>

Target:
public Function<Result<TimeseriesResultValue>, Result<TimeseriesResultValue>> makeMetricManipulatorFn( final TimeseriesQuery query, final MetricManipulationFn fn ) { return new Function<Result<TimeseriesResultValue>, Result<TimeseriesResultValue>>() { @Override public Result<TimeseriesResultValue> apply(Result<TimeseriesResultValue> result) { final Map<String, Object> values = Maps.newHashMap(); final TimeseriesResultValue holder = result.getValue(); for (AggregatorFactory agg : query.getAggregatorSpecs()) { values.put(agg.getName(), fn.manipulate(agg, holder.getMetric(agg.getName()))); } for (PostAggregator postAgg : query.getPostAggregatorSpecs()) { values.put(postAgg.getName(), postAgg.compute(values)); } return new Result<TimeseriesResultValue>( result.getTimestamp(), new TimeseriesResultValue(values) ); } }; }
Source:
<code>public void testEventLookup() { Set<ITmfEventType> eventTypes = fixture.getEventTypeSet(); Set<String> eventNames = TmfEventTypeCollectionHelper.getEventNames(eventTypes); assertTrue(eventNames.contains("sched_switch")); assertFalse(eventNames.contains("Sched_switch")); String[] events = { "sched_switch", "sched_wakeup", "timer_init" }; assertTrue(eventNames.containsAll(Arrays.asList(events))); Set<String> copy = new HashSet<>(eventNames); copy.retainAll(Arrays.asList(events)); <START> assertTrue(!copy.isEmpty()); <END> String[] names = { "inexistent", "sched_switch", "SomeThing" }; copy = new HashSet<>(eventNames); copy.retainAll(Arrays.asList(names)); assertTrue(!copy.isEmpty()); assertFalse(eventNames.containsAll(Arrays.asList(names))); }</code><technical_language>assertFalse instead</technical_language>

Target:
public void testEventLookup() { Set<ITmfEventType> eventTypes = fixture.getEventTypes(); Set<String> eventNames = TmfEventTypeCollectionHelper.getEventNames(eventTypes); assertTrue(eventNames.contains("sched_switch")); assertFalse(eventNames.contains("Sched_switch")); String[] events = { "sched_switch", "sched_wakeup", "timer_init" }; assertTrue(eventNames.containsAll(Arrays.asList(events))); Set<String> copy = new HashSet<>(eventNames); copy.retainAll(Arrays.asList(events)); assertTrue(!copy.isEmpty()); String[] names = { "inexistent", "sched_switch", "SomeThing" }; copy = new HashSet<>(eventNames); copy.retainAll(Arrays.asList(names)); assertTrue(!copy.isEmpty()); assertFalse(eventNames.containsAll(Arrays.asList(names))); }
Source:
<code>public DottedVersion dottedVersion(String version) throws EvalException { try { return DottedVersion.fromString(version); } catch (IllegalArgumentException e) { <START> throw new EvalException(null, e.getMessage()); <END> } }</code><technical_language>catch IllegalArgumentException here. change DottedVersion.fromString throw else, catch a more precise exception? (using unchecked exception is simpler avoid changing call sites)</technical_language>

Target:
public DottedVersion dottedVersion(String version) throws EvalException { try { return DottedVersion.fromString(version); } catch (DottedVersion.InvalidDottedVersionException e) { throw new EvalException(null, e.getMessage()); } }
Source:
<code>private GitUser getCommitCommitter(RevCommit commit) { PersonIdent committerIdentity = commit.getCommitterIdent(); <START> GitUser oCommitter = createDto(GitUser.class).withName(committerIdentity.getName()) <END> .withEmail(committerIdentity.getEmailAddress()); return oCommitter; }</code><technical_language>Please explain is createDto method declared</technical_language>

Target:
private GitUser getCommitCommitter(RevCommit commit) { PersonIdent committerIdentity = commit.getCommitterIdent(); GitUser committer = createDto(GitUser.class).withName(committerIdentity.getName()) .withEmail(committerIdentity.getEmailAddress()); return committer; }
Source:
<code><START> public String getCACertsDir(CAType caType) { <END> return Paths.get(getCAParentPath(caType), "certs").toString(); }</code><technical_language>here, return type Path</technical_language>

Target:
public Path getCACertsDir(CAType caType) { return Paths.get(getCAParentPath(caType), "certs"); }
Source:
<code>public ClientCertificateCredential build() { List<String> missing = new ArrayList<>(); if (clientId == null) { missing.add("clientId"); } if (tenantId == null) { missing.add("tenantId"); } if (clientCertificate == null) { missing.add("clientCertificate"); } if (missing.size() > 0) { throw new IllegalArgumentException("Must provide non-null values for " + String.join(", ", missing) + " properties in " + this.getClass().getSimpleName()); <START> } <END> return new ClientCertificateCredential(tenantId, clientId, clientCertificate, clientCertificatePassword, identityClientOptions); }</code><technical_language>code a general-purpose util for validation of parameters. interesting challenge some point</technical_language>

Target:
public ClientCertificateCredential build() { ValidationUtil.validate(getClass().getSimpleName(), new HashMap<String, Object>() {{ put("clientId", clientId); put("tenantId", tenantId); put("clientCertificate", clientCertificate); }}); return new ClientCertificateCredential(tenantId, clientId, clientCertificate, clientCertificatePassword, identityClientOptions); }
Source:
<code>public AgentLauncher find(String agentName, String machineType) { return launchers.stream().filter(l -> agentName.equals(l.getAgentName()) <START> && machineType.equals(l.getMachineType())) <END> .findAny() .orElse(defaultLauncher); }</code><technical_language>strange stream wrapping. forget wrap filter method new line</technical_language>

Target:
public AgentLauncher find(String agentName, String machineType) { return launchers.stream() .filter(l -> l.getAgentName().equals(agentName)) .filter(l -> l.getMachineType().equals(machineType)) .findAny() .orElse(defaultLauncher); }
Source:
<code>public ParenthesisedExpressionTree PARENTHESIZED_EXPRESSION() { return b.<ParenthesisedExpressionTree>nonterminal(Kind.PARENTHESISED_EXPRESSION).is( f.parenthesizedExpression( b.token(LPARENTHESIS), <START> b.firstOf( <END> EXPRESSION()), b.token(RPARENTHESIS))); }</code><technical_language>is reason anymore a firstOf()</technical_language>

Target:
public ParenthesisedExpressionTree PARENTHESIZED_EXPRESSION() { return b.<ParenthesisedExpressionTree>nonterminal(Kind.PARENTHESISED_EXPRESSION).is( f.parenthesizedExpression( b.token(LPARENTHESIS), EXPRESSION(), b.token(RPARENTHESIS))); }
Source:
<code>public void addBrokerConnection(MqttBrokerConnection connection) { synchronized (brokerConnections) { <START> brokerConnections.put(connection.getName(), connection); <END> for (MqttBrokersObserver o : brokersObservers) { o.brokerAdded(connection); } } }</code><technical_language>Is guaranteed externally created BrokerConnections case name? able get MqttService (see line 144)</technical_language>

Target:
public boolean addBrokerConnection(MqttBrokerConnection connection) { synchronized (brokerConnections) { final String brokerID = connection.getName().toLowerCase(); if (brokerConnections.containsKey(brokerID)) { return false; } brokerConnections.put(brokerID, connection); for (MqttBrokersObserver o : brokersObservers) { o.brokerAdded(connection); } } return true; }
Source:
<code>public void testIfColonPresentAtTheStartAndEndInUriCreds() { locator.setUri("http://:foobar:@localhost:9999"); locator.setPassword("secret"); assertEquals("http://localhost:9999", locator.getRawUri()); <START> assertEquals(":foobar", locator.getUsername()); <END> assertEquals("secret", locator.getPassword()); }</code><technical_language>This test is invalid user name empty string password foobar:</technical_language>

Target:
public void testIfColonPresentAtTheStartAndEndInUriCreds() { locator.setUri("http://:foobar:@localhost:9999"); assertEquals("http://localhost:9999", locator.getRawUri()); assertEquals("", locator.getUsername()); assertEquals("foobar:", locator.getPassword()); }
Source:
<code>private BoundedContext createContext() { Class<? extends AbstractCommandBusTestSuite> cls = getClass(); String name = cls.getSimpleName(); return (multitenant ? BoundedContext.multitenant(name) <START> : BoundedContext.singleTenant(name)) <END> .build(); }</code><technical_language>Please extract instance of BoundedContextBuilder a variable</technical_language>

Target:
private BoundedContext createContext() { Class<? extends AbstractCommandBusTestSuite> cls = getClass(); String name = cls.getSimpleName(); BoundedContextBuilder builder = multitenant ? BoundedContext.multitenant(name) : BoundedContext.singleTenant(name); return builder.build(); }
Source:
<code>protected JwtClaims buildJwtClaims(final SingleLogoutRequest request) { val oidc = configurationContext.getCasProperties().getAuthn().getOidc(); val claims = new JwtClaims(); claims.setIssuer(oidc.getIssuer()); claims.setSubject(request.getTicketGrantingTicket().getAuthentication().getPrincipal().getId()); claims.setAudience(((OidcRegisteredService) request.getRegisteredService()).getClientId()); <START> claims.setIssuedAtToNow(); <END> claims.setJwtId(UUID.randomUUID().toString()); val events = new HashMap<String, Object>(); events.put("<LINK_0>", new HashMap()); claims.setClaim("events", events); claims.setClaim(OidcConstants.CLAIM_SESSIOND_ID, DigestUtils.sha(request.getTicketGrantingTicket().getId())); return claims; }</code><technical_language>Is a need for exp claim, do need account for time skew</technical_language>

Target:
protected JwtClaims buildJwtClaims(final SingleLogoutRequest request) { val oidc = configurationContext.getCasProperties().getAuthn().getOidc(); val claims = new JwtClaims(); claims.setIssuer(oidc.getIssuer()); claims.setSubject(request.getTicketGrantingTicket().getAuthentication().getPrincipal().getId()); claims.setAudience(((OidcRegisteredService) request.getRegisteredService()).getClientId()); claims.setIssuedAtToNow(); claims.setJwtId(UUID.randomUUID().toString()); val events = new HashMap<String, Object>(); events.put("<LINK_0>", new HashMap<>()); claims.setClaim("events", events); claims.setClaim(OidcConstants.CLAIM_SESSIOND_ID, DigestUtils.sha(request.getTicketGrantingTicket().getId())); return claims; }
Source:
<code>public String getETag() { <START> return DigestUtils.sha1Hex(toString()); <END> }</code><technical_language>toString() compute etag; this repository/data model. Feel free leave for a TODO. @cwbriones if otherwise</technical_language>

Target:
public String getETag() { return _eTag; }
Source:
<code>void setClippingInPixels(int x, int y, int width, int height) { if (width < 0) { x = x + width; width = -width; } if (height < 0) { y = y + height; height = -height; } Rectangle requested = new Rectangle(x, y, width, height); <START> Rectangle intersect = clipping.intersection(requested); <END> GdkRectangle rect = new GdkRectangle(); rect.x = intersect.x; rect.y = intersect.y; rect.width = intersect.width; rect.height = intersect.height; long clipRgn = GDK.gdk_region_new(); GDK.gdk_region_union_with_rect(clipRgn, rect); setClipping(clipRgn); GDK.gdk_region_destroy(clipRgn); }</code><technical_language>Current assumption some missing parts in WS is apply current transform clipping intersect requested one. investigating in this direction</technical_language>

Target:
void setClippingInPixels(int x, int y, int width, int height) { if (width < 0) { x = x + width; width = -width; } if (height < 0) { y = y + height; height = -height; } GdkRectangle rect = new GdkRectangle(); rect.x = x; rect.y = y; rect.width = width; rect.height = height; long clipRgn = GDK.gdk_region_new(); GDK.gdk_region_union_with_rect(clipRgn, rect); setClipping(clipRgn); GDK.gdk_region_destroy(clipRgn); }
Source:
<code>public void reloadServer() throws Exception { try (ManagementClient managementClient = getManagementClient()) { block(managementClient); long timeout = SHUTDOWN_WAITING_TIME + System.currentTimeMillis(); try { ModelNode result = managementClient.getControllerClient().execute( Operations.createOperation(RELOAD, new ModelNode().setEmptyList())); Assert.assertEquals("success", result.get(OUTCOME).asString()); } catch (IOException e) { final Throwable cause = e.getCause(); if (!(cause instanceof ExecutionException) && !(cause instanceof CancellationException)) { throw new RuntimeException(e); } <START> } <END> while (System.currentTimeMillis() < timeout) { Thread.sleep(FREQUENCY); try { managementClient.isServerInRunningState(); } catch (RuntimeException ex) { break; } } Assert.assertFalse(System.currentTimeMillis() < timeout); timeout = RESTART_WAITING_TIME + System.currentTimeMillis(); while (System.currentTimeMillis() < timeout) { Thread.sleep(FREQUENCY); try { managementClient.isServerInRunningState(); } catch (RuntimeException ex) { break; } } } }</code><technical_language>Thanks for this. a util class, ServerReload, for this kind of thing. moving this test missed. block ServerReload.executeReload(managementClient.getControllerClient(), false) please instead. I thought be, ServerReload.executeReloadAndWaitForCompletion call is this test is asserting some intermediate state while awaiting completion</technical_language>

Target:
public void reloadServer() throws Exception { try (ManagementClient managementClient = getManagementClient()) { block(managementClient); long timeout = SHUTDOWN_WAITING_TIME + System.currentTimeMillis(); ServerReload.executeReload(managementClient.getControllerClient(), false); while (System.currentTimeMillis() < timeout) { Thread.sleep(FREQUENCY); try { managementClient.isServerInRunningState(); } catch (RuntimeException ex) { break; } } Assert.assertFalse(System.currentTimeMillis() < timeout); timeout = RESTART_WAITING_TIME + System.currentTimeMillis(); while (System.currentTimeMillis() < timeout) { Thread.sleep(FREQUENCY); try { managementClient.isServerInRunningState(); } catch (RuntimeException ex) { break; } } } }
Source:
<code>public Base(final Request req) throws IOException { super(req); <START> this.body = Base.body(req); <END> this.buffer = Base.buffer(req); this.map = this.requests(req); }</code><technical_language>@dalifreire making a static method is a workaround a solution. store stream a field create Channel in requests method pass created variable copy make</technical_language>

Target:
public Base(final Request req) throws IOException { super(req); this.stream = new RqLengthAware(req).body(); this.buffer = ByteBuffer.allocate( Math.min(8192, this.stream.available()) ); this.map = this.requests(req); }
Source:
<code>default Properties asProperties() { ImmutableMap.Builder<String, String> mb = ImmutableMap.builder(); try { if (getVoltDBRoot() == null) { throw new SettingsException("Missing VoltDB root " + "information in path.properties file."); } File voltDBRoot = getVoltDBRoot(); if (voltDBRoot.isAbsolute()) { mb.put(VOLTDBROOT_PATH_KEY, voltDBRoot.getCanonicalPath()); for (Map.Entry<String, File> e: getManagedArtifactPaths().entrySet()) { mb.put(e.getKey(), e.getValue().getCanonicalPath()); } } else { mb.put(VOLTDBROOT_PATH_KEY, voltDBRoot.getPath()); for (Map.Entry<String, File> e: getManagedArtifactPaths().entrySet()) { <START> mb.put(e.getKey(), e.getValue().getName()); <END> } } mb.put(LOCAL_SITES_COUNT_KEY, Integer.toString(getLocalSitesCount())); } catch (IOException e) { throw new SettingsException("failed to canonicalize" + this); } Properties props = new Properties(); props.putAll(mb.build()); return props; }</code><technical_language>I this work for cases. a deeply/nested/directory/like/this? getName() returns outer subdirectory, is adequate control paths (voltdbroot/log for example)</technical_language>

Target:
default Properties asProperties() { ImmutableMap.Builder<String, String> mb = ImmutableMap.builder(); try { if (getVoltDBRoot() == null) { throw new SettingsException("Missing VoltDB root " + "information in path.properties file."); } File voltdbroot = getVoltDBRoot().getCanonicalFile(); mb.put(VOLTDBROOT_PATH_KEY, voltdbroot.getCanonicalPath()); for (Map.Entry<String, File> e: getManagedArtifactPaths().entrySet()) { File path = e.getValue(); if (path.isAbsolute()) { mb.put(e.getKey(), path.getCanonicalPath()); } else { mb.put(e.getKey(), voltdbroot.toPath().relativize(path.getCanonicalFile().toPath()).toString()); } } mb.put(LOCAL_SITES_COUNT_KEY, Integer.toString(getLocalSitesCount())); } catch (IOException e) { throw new SettingsException("failed to canonicalize" + this); } Properties props = new Properties(); props.putAll(mb.build()); return props; }
Source:
<code>@Nonnull private static <T> Set<T> union(@Nonnull Set<T> a, @Nonnull Set<T> b) { Set<T> set = new LinkedHashSet<>(); if (a.stream().allMatch(x -> x == None.INSTANCE) && a.equals(b)) { return set; } <START> set.addAll(a.stream().filter(x -> x != None.INSTANCE).collect(Collectors.toCollection(LinkedHashSet::new))); <END> set.addAll(b.stream().filter(x -> x != None.INSTANCE).collect(Collectors.toCollection(LinkedHashSet::new))); Optional<T> star = set.stream().filter(x -> x instanceof HostSource && ((HostSource) x).isWildcard()).findAny(); if (star.isPresent()) { set.removeIf(y -> y instanceof HostSource); set.add(star.get()); } return set; }</code><technical_language>add unconditionally remove None.INSTANCE after</technical_language>

Target:
@Nonnull private static <T> Set<T> union(@Nonnull Set<T> a, @Nonnull Set<T> b) { Set<T> set = new LinkedHashSet<>(); set.addAll(a); set.addAll(b); set.remove(None.INSTANCE); Optional<T> star = set.stream().filter(x -> x instanceof HostSource && ((HostSource) x).isWildcard()).findAny(); if (star.isPresent()) { set.removeIf(y -> y instanceof HostSource); set.add(star.get()); } return set; }
Source:
<code>public List<?> getOutput(List<List<Map<String, Object>>> accumulatedValue) { <START> if (setters == null) { <END> createSetters(); keySetStream2 = new HashSet<>(); keySetStream1 = new HashSet<>(); for (int i = 0; i < keys.length; i = i + 2) { keySetStream1.add(keys[i]); keySetStream2.add(keys[i + 1]); } } List<Map<String, Object>> result = getAllCombo(0, accumulatedValue, null); List<Object> out = new ArrayList<>(); for (Map<String, Object> resultMap : result) { Object o; try { o = outClass.newInstance(); } catch (Throwable e) { throw Throwables.propagate(e); } for (KeyValPair<String, PojoUtils.Setter> setter : setters) { if (resultMap.get(setter.getKey()) != null) { setter.getValue().set(o, resultMap.get(setter.getKey())); } } out.add(o); } return out; }</code><technical_language>A minor knit... modular... if (seters == null) { // create setters } if (keySetStream1 == null) { // populate set. }</technical_language>

Target:
public List<?> getOutput(List<List<Map<String, Object>>> accumulatedValue) { if (setters == null) { createSetters(); keySetStream2 = new HashSet<>(); keySetStream1 = new HashSet<>(); for (int i = 0; i < keys.length; i = i + 2) { keySetStream1.add(keys[i]); keySetStream2.add(keys[i + 1]); } } List<Map<String, Object>> result = getAllCombo(0, accumulatedValue, null); List<Object> out = new ArrayList<>(); for (Map<String, Object> resultMap : result) { Object o; try { o = outClass.newInstance(); } catch (Throwable e) { throw Throwables.propagate(e); } for (Map.Entry<String, PojoUtils.Setter> setter : setters.entrySet()) { if (resultMap.get(setter.getKey()) != null) { setter.getValue().set(o, resultMap.get(setter.getKey())); } } out.add(o); } return out; }
Source:
<code>private void applyNewPermissions(Application.Permission updatedPermission, boolean addRole) { Permissions permissions = updatedPermission.getPermissions(); Map<Authorization, List<String>> data = new HashMap<>(); for (Authorization auth : Authorization.values()) { <START> List<String> roles = new ArrayList<>(permissions.get(auth)); <END> if (auth == Authorization.READ || auth == Authorization.WRITE) { if (addRole) { roles.add(properties.getUserRole()); } else { roles.remove(properties.getUserRole()); } } data.put(auth, roles); } Permissions newPermissions = Permissions.factory(data); updatedPermission.setPermissions(newPermissions); }</code><technical_language>I notice do this type of unpacking rebuilding of Permissions in places. add a public method Permissions this: public Map<Authorization, List<String>> unpack() { return Arrays.stream(Authorization.values()).collect(toMap(identity(), this::get)); } call permissions.unpack()</technical_language>

Target:
private void applyNewPermissions(Application.Permission updatedPermission, boolean addRole) { Permissions permissions = updatedPermission.getPermissions(); Map<Authorization, List<String>> unpackedPermissions = permissions.unpack(); unpackedPermissions.forEach( (key, value) -> { List<String> roles = new ArrayList<>(value); if (key == Authorization.READ || key == Authorization.WRITE) { if (addRole) { roles.add(properties.getUserRole()); } else { roles.remove(properties.getUserRole()); } } unpackedPermissions.put(key, roles); }); Permissions newPermissions = Permissions.factory(unpackedPermissions); updatedPermission.setPermissions(newPermissions); }
Source:
<code>void unionType() { GraphQLUnionType PetType = newUnionType() <START> .name("Pet") <END> .possibleType(CatType) .possibleType(DogType) .typeResolver(object -> { if (object instanceof GarfieldSchema.Cat) { return CatType; } if (object instanceof GarfieldSchema.Dog) { return DogType; } return null; }) .build(); }</code><technical_language>out for uber clarity</technical_language>

Target:
void unionType() { GraphQLUnionType PetType = newUnionType() .name("Pet") .possibleType(CatType) .possibleType(DogType) .typeResolver(new TypeResolver() { @Override public GraphQLObjectType getType(Object object) { if (object instanceof GarfieldSchema.Cat) { return CatType; } if (object instanceof GarfieldSchema.Dog) { return DogType; } return null; } }) .build(); }
Source:
<code>private GridGenerator(Dimension size, int numPlayers, Random r){ this.r = r; grid = new Grid(size); List<Point> points = new ArrayList<>(grid.keySet()); for (Point point : points){ if (canPlaceNonHidable(point) && pillarLoc(point)){ grid.set(new Pillar(), point); } } for (Point point : points){ if (chance(WALL_DENSITY) && canPlaceNonHidable(point)){ grid.set(new Wall(), point); } } boolean placed = false; while (!placed){ Point p = points.get(r.nextInt(points.size())); grid.set(new Door(), p); <START> placed = true; <END> } int playersPlaced = 0; while (playersPlaced < numPlayers){ Point p = points.get(r.nextInt(points.size())); if (canPlaceNonHidable(p)){ grid.set(new Player("Player " + ++playersPlaced), p); } } }</code><technical_language>glance this a bug me. I want do: = grid.set(new Door(), p);</technical_language>

Target:
private GridGenerator(Dimension size, int numPlayers, Random r){ this.r = r; grid = new Grid(size); List<Point> points = new ArrayList<>(grid.keySet()); for (Point point : points){ if (grid.isPassable(point) && pillarLoc(point)){ grid.set(new Pillar(), point); } } for (Point point : points){ if (chance(WALL_DENSITY) && grid.isPassable(point)){ grid.set(new Wall(), point); } } boolean placed = false; while (!placed){ Point p = points.get(r.nextInt(points.size())); placed = grid.set(new Door(), p); } int playersPlaced = 0; while (playersPlaced < numPlayers){ Point p = points.get(r.nextInt(points.size())); if (grid.isPassable(p)){ grid.set(new Player("Player " + ++playersPlaced), p); } } }
Source:
<code>protected String[] getRequiredMinishiftHomeChildren() { <START> return new String[] { CDKConstants.CDK_RESOURCE_CDK, "config", "config/config.json" }; <END> }</code><technical_language>extract a constant increases visibility for hard-coded values</technical_language>

Target:
protected String[] getRequiredMinishiftHomeChildren() { return new String[] { CDKConstants.CDK_RESOURCE_CDK, CONFIG, CONFIG + "/" + CONFIG_JSON }; }
Source:
<code>private Map<String, Object> getGrpcServiceConfig() { <START> Map<String, Object> name = ImmutableMap.of("service", readOptions.getGrpcServiceName()); <END> Map<String, Object> retryPolicy = ImmutableMap.<String, Object>builder() .put("maxAttempts", GRPC_MAX_RETRY_ATTEMPTS) .put( "initialBackoff", Durations.fromMillis(readOptions.getBackoffInitialIntervalMillis()).toString()) .put( "maxBackoff", Durations.fromMillis(readOptions.getBackoffMaxIntervalMillis()).toString()) .put("backoffMultiplier", readOptions.getBackoffMultiplier()) .put("retryableStatusCodes", ImmutableList.of("UNAVAILABLE", "RESOURCE_EXHAUSTED")) .build(); Map<String, Object> methodConfig = ImmutableMap.of("name", ImmutableList.of(name), "retryPolicy", retryPolicy); Map<String, Object> pickFirstStrategy = ImmutableMap.of("pick_first", ImmutableMap.of()); Map<String, Object> childPolicy = ImmutableMap.of("childPolicy", ImmutableList.of(pickFirstStrategy)); Map<String, Object> grpcLbPolicy = ImmutableMap.of("grpclb", childPolicy); return ImmutableMap.of( "methodConfig", ImmutableList.of(methodConfig), "loadBalancingConfig", ImmutableList.of(grpcLbPolicy)); }</code><technical_language>I override this instead: <LINK_1></technical_language>

Target:
private Map<String, Object> getGrpcServiceConfig() { Map<String, Object> name = ImmutableMap.of("service", "google.storage.v1.Storage"); Map<String, Object> retryPolicy = ImmutableMap.<String, Object>builder() .put("maxAttempts", GRPC_MAX_RETRY_ATTEMPTS) .put( "initialBackoff", Durations.fromMillis(readOptions.getBackoffInitialIntervalMillis()).toString()) .put( "maxBackoff", Durations.fromMillis(readOptions.getBackoffMaxIntervalMillis()).toString()) .put("backoffMultiplier", readOptions.getBackoffMultiplier()) .put("retryableStatusCodes", ImmutableList.of("UNAVAILABLE", "RESOURCE_EXHAUSTED")) .build(); Map<String, Object> methodConfig = ImmutableMap.of("name", ImmutableList.of(name), "retryPolicy", retryPolicy); Map<String, Object> pickFirstStrategy = ImmutableMap.of("pick_first", ImmutableMap.of()); Map<String, Object> childPolicy = ImmutableMap.of("childPolicy", ImmutableList.of(pickFirstStrategy)); Map<String, Object> grpcLbPolicy = ImmutableMap.of("grpclb", childPolicy); return ImmutableMap.of( "methodConfig", ImmutableList.of(methodConfig), "loadBalancingConfig", ImmutableList.of(grpcLbPolicy)); }
Source:
<code>public GroupedAccumulator createGroupedAccumulator() { GroupedAccumulator accumulator; if (distinct) { accumulator = instantiateGroupedAccumulator( inputChannels.stream() .map(value -> value + 1) .collect(Collectors.toList()), Optional.of(0)); List<Type> argumentTypes = new ArrayList<>(); for (int input : inputChannels) { argumentTypes.add(sourceTypes.get(input)); } accumulator = new SpillableGroupedAccumulator( sourceTypes, new DistinctingGroupedAccumulator(accumulator, argumentTypes, inputChannels, maskChannel, session, joinCompiler)); } else { accumulator = instantiateGroupedAccumulator(inputChannels, maskChannel); } if (!hasOrderBy()) { return accumulator; } <START> return new SpillableGroupedAccumulator( <END> sourceTypes, new OrderingGroupedAccumulator(accumulator, sourceTypes, orderByChannels, orderings, pagesIndexFactory)); }</code><technical_language>This a bug: if accumulator distinct orderBy, accumulator - SpillableGroupedAccumulator wrapping - OrderingGroupedAccumulator wrapping - another SpillableGroupedAccumulator finally wrapping - DistinctingGroupedAccumulator. However, - SpillableGroupedAccumulator wrapping - OrderingGroupedAccumulator wrapping - DistinctingGroupedAccumulator</technical_language>

Target:
public GroupedAccumulator createGroupedAccumulator() { GroupedAccumulator accumulator; if (hasDistinct()) { accumulator = instantiateGroupedAccumulator( inputChannels.stream() .map(value -> value + 1) .collect(Collectors.toList()), Optional.of(0)); List<Type> argumentTypes = new ArrayList<>(); for (int input : inputChannels) { argumentTypes.add(sourceTypes.get(input)); } accumulator = new DistinctingGroupedAccumulator(accumulator, argumentTypes, inputChannels, maskChannel, session, joinCompiler); } else { accumulator = instantiateGroupedAccumulator(inputChannels, maskChannel); } if (orderByChannels.isEmpty()) { return accumulator; } return new OrderingGroupedAccumulator(accumulator, sourceTypes, orderByChannels, orderings, pagesIndexFactory); }
Source:
<code>public void shouldGetExpirationTime() throws Exception { Date expectedDate = new Date(1477592 * 1000); Clock clock = mock(Clock.class); <START> when(clock.getNow()).thenReturn(expectedDate.toInstant()); <END> String token = "eyJhbGciOiJIUzI1NiJ9.eyJleHAiOjE0Nzc1OTJ9.x_ZjkPkKYUV5tdvc0l8go6D_z2kez1MQcOxokXrDc3k"; JWTVerifier.BaseVerification verification = (JWTVerifier.BaseVerification) JWT.require(Algorithm.HMAC256("secret")); DecodedJWT jwt = verification .build(clock) .verify(token); assertThat(jwt, is(notNullValue())); assertThat(jwt.getExpiresAt(), is(instanceOf(Date.class))); assertThat(jwt.getExpiresAt(), is(notNullValue())); assertThat(jwt.getExpiresAt(), is(equalTo(expectedDate))); }</code><technical_language>thoughts 3 tests. this is (soon be) deprecated behavior want check Date stuff works. If case changing getToday getNow? I it, this Date stuff. If not, refactor expectedDate is instant instead of a date. Applies 3 (legacy tests) below</technical_language>

Target:
public void shouldGetExpirationTime() throws Exception { Instant expectedInstant = Instant.ofEpochSecond(1477592); Clock clock = mock(Clock.class); when(clock.getNow()).thenReturn(expectedInstant); String token = "eyJhbGciOiJIUzI1NiJ9.eyJleHAiOjE0Nzc1OTJ9.x_ZjkPkKYUV5tdvc0l8go6D_z2kez1MQcOxokXrDc3k"; JWTVerifier.BaseVerification verification = (JWTVerifier.BaseVerification) JWT.require(Algorithm.HMAC256("secret")); DecodedJWT jwt = verification .build(clock) .verify(token); assertThat(jwt, is(notNullValue())); assertThat(jwt.getExpiresAt(), is(instanceOf(Date.class))); assertThat(jwt.getExpiresAt(), is(notNullValue())); assertThat(jwt.getExpiresAt(), is(equalTo(Date.from(expectedInstant)))); }
Source:
<code><START> public GroupedExecutionProperties visitRowNumber(RowNumberNode node, Void context) <END> { return visitWindowFunctionNodeInternal(node); }</code><technical_language>getter accessing private field directly</technical_language>

Target:
public GroupedExecutionProperties visitRowNumber(RowNumberNode node, Void context) { return visitWindowFunctionNode(node); }
Source:
<code>public void write(List<? extends List<Annotation>> annotations) throws Exception { <START> BulkOperations bulk = mongoOperations.bulkOps(BulkOperations.BulkMode.UNORDERED, collection); <END> for (List<Annotation> annotationList : annotations) { prepareBulk(annotationList, bulk); bulk.execute(); } }</code><technical_language>of this, originally this sound if initialize once, I if expect underlying implementation clean elements in bulk execute operation</technical_language>

Target:
public void write(List<? extends List<Annotation>> annotations) throws Exception { for (List<Annotation> annotationList : annotations) { BulkOperations bulk = mongoOperations.bulkOps(BulkOperations.BulkMode.UNORDERED, collection); prepareBulk(annotationList, bulk); bulk.execute(); } }
Source:
<code>public HPCCFile setProjectList(String projectList) throws Exception { this.columnPruner = new ColumnPruner(projectList); <START> this.projectedRecordDefinition = this.columnPruner.pruneRecordDefinition(this.recordDefinition); <END> return this; }</code><technical_language>Lets add a null check for this.recordDefinition creating projectedRecordDefinition</technical_language>

Target:
public HPCCFile setProjectList(String projectList) throws Exception { this.columnPruner = new ColumnPruner(projectList); if (this.recordDefinition != null) { this.projectedRecordDefinition = this.columnPruner.pruneRecordDefinition(this.recordDefinition); } return this; }
Source:
<code>public void testValidateModifiedBondSlavesWhenSlaveInterfaceDoesNotExist() throws Exception { Bond bond = createBond(); bond.setSlaves(Arrays.asList("slaveA", "slaveB")); HostSetupNetworksValidator validator = new HostSetupNetworksValidatorBuilder() <START> .setParams(new ParametersBuilder().addBonds(CreateOrUpdateBond.fromBond(bond))) <END> .build(); doTestValidateModifiedBondSlaves( spy(validator), new ValidationResult(EngineMessage.HOST_NETWORK_INTERFACE_NOT_EXIST), ValidationResult.VALID, failsWith(EngineMessage.HOST_NETWORK_INTERFACE_NOT_EXIST)); }</code><technical_language>#838</technical_language>

Target:
public void testValidateModifiedBondSlavesWhenSlaveInterfaceDoesNotExist() throws Exception { CreateOrUpdateBond createOrUpdateBond = createNewCreateOrUpdateBond(Guid.newGuid(), "bond1", "slaveA", "slaveB"); HostSetupNetworksValidator validator = new HostSetupNetworksValidatorBuilder() .setParams(new ParametersBuilder().addBonds(createOrUpdateBond)) .build(); doTestValidateModifiedBondSlaves( spy(validator), new ValidationResult(EngineMessage.HOST_NETWORK_INTERFACE_NOT_EXIST), ValidationResult.VALID, failsWith(EngineMessage.HOST_NETWORK_INTERFACE_NOT_EXIST)); }
Source:
<code><START> public void updatePurchasedNumber() throws UnauthorizedException, GeneralException, NotFoundException { <END> final String phoneNumber = "15625267429"; final String url = String.format("%s/v1/phone-numbers/%s", NUMBERS_CALLS_BASE_URL, phoneNumber); PurchasedNumber updatedNumberMock = new PurchasedNumber(); MessageBirdService messageBirdServiceMock = mock(MessageBirdService.class); MessageBirdClient messageBirdClientMock = new MessageBirdClient(messageBirdServiceMock); final Map<String, List<String>> payload = new HashMap<String, List<String>>(); payload.put("tags", Arrays.asList("tag")); when(messageBirdServiceMock.sendPayLoad("PATCH", url, payload, PurchasedNumber.class)) .thenReturn(updatedNumberMock); final PurchasedNumber response = messageBirdClientMock.updateNumber(phoneNumber, "tag"); verify(messageBirdServiceMock, times(1)).sendPayLoad("PATCH", url, payload, PurchasedNumber.class); assertNotNull(response); assertEquals(response, updatedNumberMock); }</code><technical_language>need throw NotFoundException</technical_language>

Target:
public void updatePurchasedNumber() throws UnauthorizedException, GeneralException { final String phoneNumber = "15625267429"; final String url = String.format("%s/phone-numbers/%s", NUMBERS_CALLS_BASE_URL, phoneNumber); PurchasedNumber updatedNumberMock = new PurchasedNumber(); MessageBirdService messageBirdServiceMock = mock(MessageBirdService.class); MessageBirdClient messageBirdClientMock = new MessageBirdClient(messageBirdServiceMock); final Map<String, List<String>> payload = new HashMap<String, List<String>>(); payload.put("tags", Collections.singletonList("tag")); when(messageBirdServiceMock.sendPayLoad("PATCH", url, payload, PurchasedNumber.class)) .thenReturn(updatedNumberMock); final PurchasedNumber response = messageBirdClientMock.updateNumber(phoneNumber, "tag"); verify(messageBirdServiceMock, times(1)).sendPayLoad("PATCH", url, payload, PurchasedNumber.class); assertNotNull(response); assertEquals(response, updatedNumberMock); }
Source:
<code>public BoDCharacter(int id, Point2D position, double width, double height, int speed, Image image) { super(id); this.body = new Body(this, position, width, height, TYPE); this.physics = new Physics(this, speed); this.view = new View(this, image); this.weapon = new Weapon(this, 5, 20, 9); this.health = new Health(100); <START> score = 0; <END> }</code><technical_language>remvoe this</technical_language>

Target:
public BoDCharacter(int id, Point2D position, double width, double height, int speed, Image image) { super(id); this.body = new Body(this, position, width, height, TYPE); this.physics = new Physics(this, speed); this.view = new View(this, image); this.weapon = new Weapon(this, 5, 20, 9); this.health = new Health(100); }
Source:
<code><START> public static double singleNewtonArgmaxUpdate(final Function<Double, Double> function, final double min, final double max, final double guess) { <END> final double fx = function.apply(guess); final double fxPlusEps = function.apply(guess + EPSILON); final double fxMinusEps = function.apply(guess - EPSILON); final double secondDerivative = (fxPlusEps + fxMinusEps - 2 * fx) / (EPSILON * EPSILON); final double firstDerivative = (fxPlusEps - fxMinusEps)/(2*EPSILON); final double argmax = guess - firstDerivative / secondDerivative; if (Math.abs(firstDerivative) < 1e-8) { return guess; } return argmax < min ? min : (argmax > max ? max : argmax); }</code><technical_language>idea exposing EPSILON 1e-8 (if not, rename EPSILON more specific this method)</technical_language>

Target:
public static double singleNewtonArgmaxUpdate(final Function<Double, Double> function, final double min, final double max, final double guess) { return singleNewtonArgmaxUpdate(function, min, max, guess, DEFAULT_EPSILON_FOR_NUMERIC_DERIVATIVES, DEFAULT_DERIVATIVE_THRESHOLD); }
Source:
<code>protected void releaseInternal() { synchronized (lock) { <START> isFinished = true; END> if (readers.isEmpty()) { if (resultFile != null) { resultFile.deleteQuietly(); resultFile = null; } } } }</code><technical_language>proper misuse variable of isFinished here. If want fail writing faster, of isReleased tag tagged true ResultPartition this execution. In other words, if releaseInternal() is triggered view consumption, data writing finished before. If is triggered writing data, executed task thread, means writing process exited before</technical_language>

Target:
protected void releaseInternal() { synchronized (lock) { if (resultFile == null) { fileWriter.releaseQuietly(); } if (readers.isEmpty()) { if (resultFile != null) { resultFile.deleteQuietly(); resultFile = null; } } } }
Source:
<code>public static void checkValidPath(String path) throws InvalidPathException { boolean isWindows = SystemReader.getInstance().isWindows(); boolean isOSX = SystemReader.getInstance().isMacOS(); boolean ignCase = isOSX || isWindows; byte[] bytes; try { bytes = path.getBytes(Constants.CHARACTER_ENCODING); } catch (UnsupportedEncodingException e) { <START> throw new Error(e); <END> } int p0 = 0; int p1; L0: while (p0 < bytes.length) { p1 = p0 + 1; while (p1 < bytes.length) { if (bytes[p1] == '/') { checkValidPathSegment(isWindows, ignCase, bytes, p0, p1, path); p0 = p1 + 1; continue L0; } p1++; } checkValidPathSegment(isWindows, ignCase, bytes, p0, p1, path); p0 = p1; } }</code><technical_language>throwing InvalidPathException in this case</technical_language>

Target:
public static void checkValidPath(String path) throws InvalidPathException { boolean isWindows = SystemReader.getInstance().isWindows(); boolean isOSX = SystemReader.getInstance().isMacOS(); boolean ignCase = isOSX || isWindows; byte[] bytes; try { bytes = path.getBytes(Constants.CHARACTER_ENCODING); } catch (UnsupportedEncodingException e) { throw new Error(e); } int segmentStart = 0; for (int i = 0; i < bytes.length; i++) { if (bytes[i] == '/') { checkValidPathSegment(isWindows, ignCase, bytes, segmentStart, i, path); segmentStart = i + 1; } } if (segmentStart < bytes.length) checkValidPathSegment(isWindows, ignCase, bytes, segmentStart, bytes.length, path); }