auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void testWhenDaemonIsUsedEndOfTheBuildIsNotReached() throws InterruptedException, TimeoutException { final InvocationRequest request = new DefaultInvocationRequest(); Invoker invoker = new DefaultInvoker(); request.setPomFile(new File(pathToJarSamplePom)); request.setGoals(Arrays.asList(new String[] { "clean", "verify" })); request.setProperties(getPropertiesWithSkipTests()); EmbeddedMaven .withMavenInvokerSet(request, invoker) .useAsDaemon() .build(); <START> Thread.sleep(1000); <END> Assertions.assertThat(outContent.toString()).contains("Embedded Maven build started"); Assertions.assertThat(outContent.toString()).doesNotContain("Embedded Maven build stopped"); }</code><technical_language>Is this number enough for environments? change awaitility</technical_language>

Target:
public void testWhenDaemonIsUsedEndOfTheBuildIsNotReached() throws InterruptedException { final InvocationRequest request = new DefaultInvocationRequest(); Invoker invoker = new DefaultInvoker(); request.setPomFile(new File(pathToJarSamplePom)); request.setGoals(Arrays.asList(new String[] { "clean", "package" })); request.setProperties(getPropertiesWithSkipTests()); final DaemonBuild daemonBuild = EmbeddedMaven .withMavenInvokerSet(request, invoker) .useAsDaemon() .build(); Awaitility.await("Wait till maven build is started").atMost(5, TimeUnit.SECONDS).until(new Callable<Boolean>() { @Override public Boolean call() throws Exception { return outContent.toString().contains("Embedded Maven build started"); } }); Assertions.assertThat(outContent.toString()).doesNotContain("Embedded Maven build stopped"); Awaitility.await("Wait till project is not be null").atMost(20, TimeUnit.SECONDS).until(new Callable<Boolean>() { @Override public Boolean call() throws Exception { return daemonBuild.getBuiltProject() != null; } }); Assertions.assertThat(daemonBuild.isAlive()).isFalse(); }
Source:
<code>public void azureCliCredentialAzNotLogInException() throws Exception { TokenRequestContext request = new TokenRequestContext().addScopes("AzureNotLogin"); IdentityClient identityClient = PowerMockito.mock(IdentityClient.class); when(identityClient.authenticateWithAzureCli(request)) .thenReturn(Mono.error(new Exception("Azure not Login"))); PowerMockito.whenNew(IdentityClient.class).withAnyArguments().thenReturn(identityClient); AzureCliCredential credential = new AzureCliCredentialBuilder().build(); StepVerifier.create(credential.getToken(request)) <START> .expectErrorMatches(e -> e instanceof CredentialUnavailableException && e.getMessage().contains("Azure not Login")) <END> .verify(); }</code><technical_language>actual error message additional space? clean if so. suggestion .expectErrorMatches(e -> e instanceof CredentialUnavailableException && e.getMessage().contains("Azure Login"))</technical_language>

Target:
public void azureCliCredentialAzNotLogInException() throws Exception { TokenRequestContext request = new TokenRequestContext().addScopes("AzureNotLogin"); IdentityClient identityClient = PowerMockito.mock(IdentityClient.class); when(identityClient.authenticateWithAzureCli(request)) .thenReturn(Mono.error(new Exception("Azure not Login"))); PowerMockito.whenNew(IdentityClient.class).withAnyArguments().thenReturn(identityClient); AzureCliCredential credential = new AzureCliCredentialBuilder().build(); StepVerifier.create(credential.getToken(request)) .expectErrorMatches(e -> e instanceof Exception && e.getMessage().contains("Azure not Login")) .verify(); }
Source:
<code>public void provideUniquePodsNames() throws Exception { when(runtimeIdentity.getWorkspaceId()).thenReturn(WORKSPACE_ID); final HashMap<String, Pod> pods = new HashMap<>(); pods.put(POD_NAME, newPod()); doReturn(pods).when(osEnv).getPods(); uniqueNamesProvisioner.provision(environment, osEnv, runtimeIdentity); final String expected = WORKSPACE_ID + SEPARATOR + POD_NAME; <START> assertEquals(osEnv.getPods().get(expected).getMetadata().getName(), expected); <END> }</code><technical_language>Please, validate added label</technical_language>

Target:
public void provideUniquePodsNames() throws Exception { when(runtimeIdentity.getWorkspaceId()).thenReturn(WORKSPACE_ID); final HashMap<String, Pod> pods = new HashMap<>(); pods.put(POD_NAME, newPod()); doReturn(pods).when(osEnv).getPods(); uniqueNamesProvisioner.provision(environment, osEnv, runtimeIdentity); final String expected = WORKSPACE_ID + SEPARATOR + POD_NAME; final ObjectMeta podMeta = osEnv.getPods().get(expected).getMetadata(); assertEquals(podMeta.getName(), expected); assertEquals(podMeta.getLabels().get(CHE_ORIGINAL_NAME_LABEL), POD_NAME); }
Source:
<code>public boolean isApplicable(VDSGroup oldCluster, VDSGroup newCluster) { if (!newCluster.supportsVirtService() || !oldCluster.supportsVirtService()) { return <START> true; <END> } newCpuName = newCluster.getCpuName(); final String oldCpuName = oldCluster.getCpuName(); return !newCpuName.equals(oldCpuName); }</code><technical_language>I this 'false' - want run check() method</technical_language>

Target:
public boolean isApplicable(VDSGroup oldCluster, VDSGroup newCluster) { if (!newCluster.supportsVirtService() || !oldCluster.supportsVirtService()) { return false; } newCpuName = newCluster.getCpuName(); final String oldCpuName = oldCluster.getCpuName(); return !newCpuName.equals(oldCpuName); }
Source:
<code>public void readsFromFile() throws IOException { final File file = new File(this.folder.newFolder(), "readable"); final String content = "read"; <START> Files.write(content.getBytes(), file); <END> final ByteArrayOutputStream stream = new ByteArrayOutputStream(); new MkDoc(file, "", "").read(stream); MatcherAssert.assertThat( new String(stream.toByteArray()), Matchers.equalTo(content) ); }</code><technical_language>content.getBytes() encoding in this case. In method writesToFile, line 132, encoding is content.getBytes(StandardCharsets.UTF_8). I suppose matter encoding for ASCII symbols, lets style (everything encoding everithing encoding)</technical_language>

Target:
public void readsFromFile() throws IOException { final File file = new File(this.folder.newFolder(), "readable"); final String content = "read"; Files.write(content.getBytes(StandardCharsets.UTF_8), file); final ByteArrayOutputStream stream = new ByteArrayOutputStream(); new MkDoc(file, "", "").read(stream); MatcherAssert.assertThat( new String(stream.toByteArray(), StandardCharsets.UTF_8), Matchers.equalTo(content) ); }
Source:
<code>public boolean start() throws Exception { <START> if (step.label != null && !step.label.isEmpty() && step.resource != null && !step.resource.isEmpty()) { <END> throw new Exception("Label and resource name cannot be specified simultaneously."); } if (step.label == null && LockableResourcesManager.get().createResource(step.resource)) { listener.getLogger().println("Resource [" + step + "] did not exist. Created."); } listener.getLogger().println("Trying to acquire lock on [" + step + "]"); List<String> resources = new ArrayList<String>(); if (step.resource != null) { resources.add(step.resource); } LockableResourcesStruct resourceHolder = new LockableResourcesStruct(resources, step.label, step.quantity); List<LockableResource> available = LockableResourcesManager.get().checkResourcesAvailability(resourceHolder, listener.getLogger(), null); if (available == null || !LockableResourcesManager.get().lock(available, run, getContext(), step.toString(), step.inversePrecedence)) { listener.getLogger().println("[" + step + "] is locked, waiting..."); LockableResourcesManager.get().queueContext(getContext(), resourceHolder, step.toString()); } return false; }</code><technical_language>Refactor a validate method LockStep throwing IllegalArgumentException</technical_language>

Target:
public boolean start() throws Exception { step.validate(); listener.getLogger().println("Trying to acquire lock on [" + step + "]"); List<String> resources = new ArrayList<String>(); if (step.resource != null) { if (LockableResourcesManager.get().createResource(step.resource)) { listener.getLogger().println("Resource [" + step + "] did not exist. Created."); } resources.add(step.resource); } LockableResourcesStruct resourceHolder = new LockableResourcesStruct(resources, step.label, step.quantity); List<LockableResource> available = LockableResourcesManager.get().checkResourcesAvailability(resourceHolder, listener.getLogger(), null); if (available == null || !LockableResourcesManager.get().lock(available, run, getContext(), step.toString(), step.inversePrecedence)) { listener.getLogger().println("[" + step + "] is locked, waiting..."); LockableResourcesManager.get().queueContext(getContext(), resourceHolder, step.toString()); } return false; }
Source:
<code>public RemoteTableDescriptor<K, V> withReadRetryPolicy(TableRetryPolicy retryPolicy) { Preconditions.checkNotNull(readFn, "null read function"); Preconditions.checkNotNull(retryPolicy, "null retry policy"); this.readRetryPolicy = retryPolicy; <START> this.readRetryPolicy.setTableId(String.format("%s.%s", tableId, READ_RETRY_POLICY)); <END> return this; }</code><technical_language>is reusing instance, tableId overwritten? add a check avoid this</technical_language>

Target:
public RemoteTableDescriptor<K, V> withReadRetryPolicy(TableRetryPolicy retryPolicy) { Preconditions.checkNotNull(readFn, "null read function"); Preconditions.checkNotNull(retryPolicy, "null retry policy"); this.readRetryPolicy = retryPolicy; return this; }
Source:
<code><START> private boolean writeNode(BinaryRawWriterEx writer, ClusterNode node) { <END> if (node.isClient()) return false; Object port = node.attribute(ClientListenerProcessor.CLIENT_LISTENER_PORT); if (!(port instanceof Integer)) return false; writeUuid(writer, node.id()); writer.writeInt((int) port); Collection<String> addrs = node.addresses(); Collection<String> hosts = node.hostNames(); writer.writeInt(addrs.size() + hosts.size()); for (String addr : addrs) writer.writeString(addr); for (String host : hosts) writer.writeString(host); return true; }</code><technical_language>methods static</technical_language>

Target:
private static boolean writeNode(BinaryRawWriterEx writer, ClusterNode node) { if (node.isClient()) return false; Object port = node.attribute(ClientListenerProcessor.CLIENT_LISTENER_PORT); if (!(port instanceof Integer)) return false; writeUuid(writer, node.id()); writer.writeInt((int) port); Collection<String> addrs = node.addresses(); Collection<String> hosts = node.hostNames(); writer.writeInt(addrs.size() + hosts.size()); for (String addr : addrs) writer.writeString(addr); for (String host : hosts) writer.writeString(host); return true; }
Source:
<code>public void first_withDefault() { <START> AllJavaTypes defaultObject = collection.get(0); <END> collection = createEmptyCollection(realm, collectionClass); assertEquals(defaultObject, collection.first(defaultObject)); assertEquals(null, collection.first(null)); }</code><technical_language>Nitpick, instead of object a collection defined this method create a standalone object</technical_language>

Target:
public void first_withDefault() { AllJavaTypes defaultObject = new AllJavaTypes(); collection = createEmptyCollection(realm, collectionClass); assertEquals(defaultObject, collection.first(defaultObject)); assertEquals(null, collection.first(null)); }
Source:
<code>@NotNull private Runnable textQueryTask(IgniteEx ignite, String clause, Set<Integer> exp) { return () -> { try { <START> TextQuery qry = new TextQuery<>(Person.class, clause).setLocal(false); <END> validateQueryResults(ignite, qry, exp, false); } catch (Exception e) { fail(e.getMessage()); } }; }</code><technical_language>need call setLocal(false) is a default value</technical_language>

Target:
@NotNull private Runnable textQueryTask(IgniteEx ignite, String clause, Set<Integer> exp) { return () -> { try { TextQuery qry = new TextQuery<>(Person.class, clause); validateQueryResults(ignite, qry, exp, false); } catch (Exception e) { fail(e.getMessage()); } }; }
Source:
<code>public void write( @Suspended AsyncResponse asyncResponse, @PathParam("tenantId") String tenantId, List<InfluxObject> influxObjects ) { <START> LOG.info("WRITE REQUEST"); <END> if (influxObjects == null) { asyncResponse.resume(errorResponse(BAD_REQUEST, "Null objects")); return; } try { objectValidator.validateInfluxObjects(influxObjects); } catch (InvalidObjectException e) { asyncResponse.resume(errorResponse(BAD_REQUEST, Throwables.getRootCause(e).getMessage())); return; } Observable<GaugeMetric> input = Observable.from(influxObjects) .map(InfluxSeriesHandler::influxToGauge) .map(gauge -> gauge.setTenantId(tenantId)); metricsService.addGaugeData(input).subscribe(new WriteObserver(asyncResponse)); }</code><technical_language>forgot remove debugging</technical_language>

Target:
public void write( @Suspended AsyncResponse asyncResponse, @PathParam("tenantId") String tenantId, List<InfluxObject> influxObjects ) { if (influxObjects == null) { asyncResponse.resume(errorResponse(BAD_REQUEST, "Null objects")); return; } try { objectValidator.validateInfluxObjects(influxObjects); } catch (InvalidObjectException e) { asyncResponse.resume(errorResponse(BAD_REQUEST, Throwables.getRootCause(e).getMessage())); return; } Observable<Metric<Double>> input = Observable.from(influxObjects) .map(influxObject -> influxToGauge(tenantId, influxObject)); metricsService.addGaugeData(input).subscribe(new WriteObserver(asyncResponse)); }
Source:
<code>private SettingsGroup makeRenameGroup() { JCheckBox renameCaseSensitive = new JCheckBox(); renameCaseSensitive.setSelected(settings.isRenameCaseSensitive()); renameCaseSensitive.addItemListener(e -> { settings.setRenameCaseSensitive(e.getStateChange() == ItemEvent.SELECTED); needReload(); }); JCheckBox renameValid = new JCheckBox(); renameValid.setSelected(settings.isRenameValid()); renameValid.addItemListener(e -> { settings.setRenameValid(e.getStateChange() == ItemEvent.SELECTED); needReload(); }); JCheckBox renamePrintable = new JCheckBox(); renamePrintable.setSelected(settings.isRenamePrintable()); renamePrintable.addItemListener(e -> { settings.setRenamePrintable(e.getStateChange() == ItemEvent.SELECTED); needReload(); }); SettingsGroup group = new SettingsGroup(NLS.str("preferences.rename")); JLabel renameCaseSensitiveLabel = group.addRow(NLS.str("preferences.rename_case"), renameCaseSensitive); group.addRow(NLS.str("preferences.rename_valid"), renameValid); group.addRow(NLS.str("preferences.rename_printable"), renamePrintable); File dir = FileUtils.createTempDir("jadx"); if (FileUtils.isCaseSensitiveFS(dir)) { renameCaseSensitive.setSelected(false); renameCaseSensitive.setEnabled(false); <START> renameCaseSensitiveLabel.setEnabled(false); <END> } try { Files.delete(dir.toPath()); } catch (IOException e) { } return group; }</code><technical_language>do this, leave selection choice user. Also, this check work for masOS, HFS case sensitivity determined user for drives</technical_language>

Target:
private SettingsGroup makeRenameGroup() { JCheckBox renameCaseSensitive = new JCheckBox(); renameCaseSensitive.setSelected(settings.isRenameCaseSensitive()); renameCaseSensitive.addItemListener(e -> { settings.setRenameCaseSensitive(e.getStateChange() == ItemEvent.SELECTED); needReload(); }); JCheckBox renameValid = new JCheckBox(); renameValid.setSelected(settings.isRenameValid()); renameValid.addItemListener(e -> { settings.setRenameValid(e.getStateChange() == ItemEvent.SELECTED); needReload(); }); JCheckBox renamePrintable = new JCheckBox(); renamePrintable.setSelected(settings.isRenamePrintable()); renamePrintable.addItemListener(e -> { settings.setRenamePrintable(e.getStateChange() == ItemEvent.SELECTED); needReload(); }); SettingsGroup group = new SettingsGroup(NLS.str("preferences.rename")); group.addRow(NLS.str("preferences.rename_case"), renameCaseSensitive); group.addRow(NLS.str("preferences.rename_valid"), renameValid); group.addRow(NLS.str("preferences.rename_printable"), renamePrintable); return group; }
Source:
<code>public void testExplicitCloseFrameSentWhenServerChannelClosed() throws Exception { WebSocketCloseStatus closeStatus = WebSocketCloseStatus.ENDPOINT_UNAVAILABLE; EmbeddedChannel client = createClient(); EmbeddedChannel server = createServer(); assertFalse(server.writeInbound(client.readOutbound())); assertFalse(client.writeInbound(server.readOutbound())); <START> server.writeOutbound(new CloseWebSocketFrame(closeStatus)); <END> server.close(); assertTrue(client.writeInbound(server.readOutbound())); assertFalse(server.isOpen()); CloseWebSocketFrame closeMessage = client.readInbound(); assertEquals(closeMessage.statusCode(), closeStatus.code()); closeMessage.release(); client.close(); assertTrue(ReferenceCountUtil.release(client.readOutbound())); assertFalse(client.finishAndReleaseAll()); assertFalse(server.finishAndReleaseAll()); }</code><technical_language>assert return</technical_language>

Target:
public void testExplicitCloseFrameSentWhenServerChannelClosed() throws Exception { WebSocketCloseStatus closeStatus = WebSocketCloseStatus.ENDPOINT_UNAVAILABLE; EmbeddedChannel client = createClient(); EmbeddedChannel server = createServer(); assertFalse(server.writeInbound(client.readOutbound())); assertFalse(client.writeInbound(server.readOutbound())); assertTrue(server.writeOutbound(new CloseWebSocketFrame(closeStatus))); server.close(); assertTrue(client.writeInbound(server.readOutbound())); assertFalse(server.isOpen()); CloseWebSocketFrame closeMessage = client.readInbound(); assertEquals(closeMessage.statusCode(), closeStatus.code()); closeMessage.release(); client.close(); assertTrue(ReferenceCountUtil.release(client.readOutbound())); assertFalse(client.finishAndReleaseAll()); assertFalse(server.finishAndReleaseAll()); }
Source:
<code>private JsonReportWriter( final Path outputDir, final String testClassName, final String testName) { this.testClassName = testClassName; this.testName = testName; final String logFilename = format("%s.%s.json", testClassName, testName).replace('$', '_'); final File logFile = outputDir.resolve(logFilename).toFile(); JsonGenerator jg = null; try { jg = new JsonFactory().createGenerator(logFile, JsonEncoding.UTF8); jg.writeStartArray(); } catch (IOException e) { log.error("exception creating event log: - {}", logFile.getAbsolutePath(), e); } finally { <START> this.jg = jg; <END> } }</code><technical_language>I guess this original source, fwiw this pattern finally strange me. I this be: java try { this.jg = new JsonFactory().createGenerator(logFile, JsonEncoding.UTF8) } catch (IOException e) { //log exception, set final field this.jg = null; } arguably this field need final if null set instance other times</technical_language>

Target:
private JsonReportWriter( final Path outputDir, final String testClassName, final String testName) { this.testClassName = testClassName; this.testName = testName; final String logFilename = format("%s.%s.json", testClassName, testName).replace('$', '_'); final File logFile = outputDir.resolve(logFilename).toFile(); JsonGenerator jg = null; try { jg = new JsonFactory().createGenerator(logFile, JsonEncoding.UTF8); jg.writeStartArray(); } catch (IOException e) { log.error("exception creating event log: - {}", logFile.getAbsolutePath(), e); } this.jg = jg; }
Source:
<code>public String getCurrencyName() { if (currencyCode.equalsIgnoreCase("VES")) { return "Venezuelan Bolívar"; } if (currencyCode.equalsIgnoreCase("USDC")) { return "USD Coin (USDC)"; <START> } <END> if (currencyName == null) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { currencyName = getCurrency().getDisplayName(); } else { currencyName = ""; } } return currencyName; }</code><technical_language>This handled #302 . remove this? appears other currencies names in list. Other currencies bitpay: XRP, PAX, MRU, Some currencies crash app. I try handle in #302 also</technical_language>

Target:
public String getCurrencyName() { if (currencyCode.equalsIgnoreCase("VES")) { return "Venezuelan Bolívar"; } if (currencyName == null) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { currencyName = getCurrency().getDisplayName(); } else { currencyName = ""; } } return currencyName; }
Source:
<code>private boolean[] determineSlotsAndDispatchables(final Object[] mixins, final HashSet<SlotDefinition> instanceSlots, final HashMap<SSymbol, Dispatchable> dispatchables) { boolean mixinsIncludeValue = false; boolean mixinsIncludeTransferObject = false; if (mixins != null) { HashMap<SSymbol, SlotDefinition> mixinSlots = new HashMap<>(); for (int i = 1; i < mixins.length; i++) { SClass mixin = (SClass) mixins[i]; if (mixin == Classes.valueClass) { mixinsIncludeValue = true; } else if (mixin == Classes.transferClass) { mixinsIncludeTransferObject = true; } MixinDefinition cdef = mixin.getMixinDefinition(); if (cdef.slots != null) { mixinSlots.putAll(cdef.slots); } for (Entry<SSymbol, Dispatchable> e : cdef.instanceDispatchables.entrySet()) { if (!e.getValue().isInitializer()) { dispatchables.put(e.getKey(), e.getValue()); } } SInitializer mixinInit = cdef.assembleMixinInitializer(i, this); dispatchables.put(mixinInit.getSignature(), mixinInit); } instanceSlots.addAll(mixinSlots.values()); <START> dispatchables.putAll(instanceScope.getDispatchables()); <END> if (slots != null) { instanceSlots.addAll(slots.values()); } } else { dispatchables.putAll(instanceScope.getDispatchables()); } if (slots != null) { instanceSlots.addAll(slots.values()); } return new boolean[] {mixinsIncludeValue, mixinsIncludeTransferObject}; }</code><technical_language>I suspect for loop changed a for loop mixins, need i anymore, I think</technical_language>

Target:
private boolean[] determineSlotsAndDispatchables(final Object[] mixins, final HashSet<SlotDefinition> instanceSlots, final HashMap<SSymbol, Dispatchable> dispatchables) { boolean mixinsIncludeValue = false; boolean mixinsIncludeTransferObject = false; if (mixins != null) { HashMap<SSymbol, SlotDefinition> mixinSlots = new HashMap<>(); for (int i = 1; i < mixins.length; i++) { SClass mixin = (SClass) mixins[i]; if (mixin == Classes.valueClass) { mixinsIncludeValue = true; } else if (mixin == Classes.transferClass) { mixinsIncludeTransferObject = true; } MixinDefinition cdef = mixin.getMixinDefinition(); if (cdef.slots != null) { mixinSlots.putAll(cdef.slots); } for (Entry<SSymbol, Dispatchable> e : cdef.instanceDispatchables.entrySet()) { if (!e.getValue().isInitializer()) { dispatchables.put(e.getKey(), e.getValue()); } } SInitializer mixinInit = cdef.assembleMixinInitializer(i); dispatchables.put(mixinInit.getSignature(), mixinInit); } instanceSlots.addAll(mixinSlots.values()); dispatchables.putAll(instanceScope.getDispatchables()); if (slots != null) { instanceSlots.addAll(slots.values()); } } else { dispatchables.putAll(instanceScope.getDispatchables()); } if (slots != null) { instanceSlots.addAll(slots.values()); } return new boolean[] {mixinsIncludeValue, mixinsIncludeTransferObject}; }
Source:
<code>private Map<String, Object> getKieMap() { try { Map<String, Object> kieMap = (Map) container.lookup(Map.class, "java.util.HashMap", "kieMap"); return Optional.ofNullable(kieMap).orElse(Collections.emptyMap()); } catch (ComponentLookupException cle) { <START> getLog().info("kieMap not present with compilationID and container present"); <END> return Collections.emptyMap(); } }</code><technical_language>this warning instead of info message? message "kieMap present compilationID container present" is a bit confusing Is kie map present? is present complationID? Imagine a user sees this log message. If message is good immediately wrong fixed. source code understand wrong :( is duplication of log messages line 194: getLog().info("Kie Map present"); - log this place</technical_language>

Target:
private Map<String, Object> getKieMap() { try { Map<String, Object> kieMap = (Map) container.lookup(Map.class, "java.util.HashMap", "kieMap"); return Optional.ofNullable(kieMap).orElse(Collections.emptyMap()); } catch (ComponentLookupException cle) { getLog().info("kieMap not present"); return Collections.emptyMap(); } }
Source:
<code>public void logins() throws IOException { final String tokenpath = "/uas/oauth2/accessToken"; <START> final String peoplepath = "/v1/people"; <END> final String firstname = "firstName"; final String lastname = "lastName"; final String frodo = "Frodo"; final String baggins = "Baggins"; final String code = RandomStringUtils.randomAlphanumeric(10); final String lapp = RandomStringUtils.randomAlphanumeric(10); final String lkey = RandomStringUtils.randomAlphanumeric(10); final String identifier = RandomStringUtils.randomAlphanumeric(10); final Take take = new TkFork( new FkRegex( tokenpath, new TokenTake(code, lapp, lkey, tokenpath) ), new FkRegex( peoplepath, new PeopleTake(identifier, firstname, lastname, frodo, baggins) ) ); new FtRemote(take).exec( new LinkedinScript( code, lapp, lkey, identifier, firstname, lastname, frodo, baggins ) ); }</code><technical_language>@rui-castro inline this variable</technical_language>

Target:
public void logins() throws IOException { final String tokenpath = "/uas/oauth2/accessToken"; final String firstname = "firstName"; final String lastname = "lastName"; final String frodo = "Frodo"; final String baggins = "Baggins"; final String code = RandomStringUtils.randomAlphanumeric(10); final String lapp = RandomStringUtils.randomAlphanumeric(10); final String lkey = RandomStringUtils.randomAlphanumeric(10); final String identifier = RandomStringUtils.randomAlphanumeric(10); final Take take = new TkFork( new FkRegex( tokenpath, new TokenTake(code, lapp, lkey, tokenpath) ), new FkRegex( "/v1/people", new PeopleTake(identifier, firstname, lastname, frodo, baggins) ) ); new FtRemote(take).exec( new LinkedinScript( code, lapp, lkey, identifier, firstname, lastname, frodo, baggins ) ); }
Source:
<code>public RelDistribution toDistribution(Map<String, Object> map) { <START> final RelDistribution.Type type = <END> Util.enumVal(RelDistribution.Type.class, (String) map.get("type")); ImmutableIntList list = EMPTY; if (map.containsKey("keys")) { List<Object> keysJson = (List<Object>) map.get("keys"); ArrayList<Integer> keys = new ArrayList<>(keysJson.size()); for (Object o : keysJson) { keys.add((Integer) o); } list = ImmutableIntList.copyOf(keys); } return RelDistributions.with(type, list); }</code><technical_language>Is a break change</technical_language>

Target:
public RelDistribution toDistribution(Map<String, Object> map) { final RelDistribution.Type type = Util.enumVal(RelDistribution.Type.class, (String) map.get("type")); ImmutableIntList list = EMPTY; if (map.containsKey("keys")) { List<Object> keysJson = (List<Object>) map.get("keys"); ArrayList<Integer> keys = new ArrayList<>(keysJson.size()); for (Object o : keysJson) { keys.add((Integer) o); } list = ImmutableIntList.copyOf(keys); } return RelDistributions.of(type, list); }
Source:
<code>private void saveSyntaxHighlighting(SensorContext context, List<HighlightingData> highlightingDataList, InputFile inputFile) { NewHighlighting highlighting = context.newHighlighting().onFile(inputFile); for (HighlightingData highlightingData : highlightingDataList) { <START> highlighting.highlight(highlightingData.startOffset(), highlightingData.endOffset(), highlightingData.highlightCode()); <END> } highlighting.save(); }</code><technical_language>![MINOR](<LINK_0> 'Severity: MINOR') Remove this of "highlight"; is deprecated. [![rule](<LINK_1>](<LINK_2></technical_language>

Target:
private static void saveSyntaxHighlighting(SensorContext context, List<HighlightingData> highlightingDataList, InputFile inputFile) { NewHighlighting highlighting = context.newHighlighting().onFile(inputFile); for (HighlightingData highlightingData : highlightingDataList) { highlighting.highlight(highlightingData.startOffset(), highlightingData.endOffset(), highlightingData.highlightCode()); } highlighting.save(); }
Source:
<code>public WebServer(Config config) { initServer(config); ServletContextHandler servletHandler = new ServletContextHandler(ServletContextHandler.SESSIONS); int sessionTimeout = config.getInteger("web.sessionTimeout"); if (sessionTimeout > 0) { servletHandler.getSessionHandler().setMaxInactiveInterval(sessionTimeout); } initApi(config, servletHandler); if (config.getBoolean("web.console")) { servletHandler.addServlet(new ServletHolder(new ConsoleServlet()), "/console/*"); } initWebApp(config, servletHandler); servletHandler.setErrorHandler(new ErrorHandler() { @Override protected void handleErrorPage( HttpServletRequest request, Writer writer, int code, String message) throws IOException { writer.write("<!DOCTYPE<html><head><title>Error</title></head><html><body>" + code + " - " + HttpStatus.getMessage(code) + "</body></html>"); } }); HandlerList handlers = new HandlerList(); initClientProxy(config, handlers); handlers.addHandler(servletHandler); handlers.addHandler(new GzipHandler()); server.setHandler(handlers); <START> if (config.getBoolean("web.logRequests")) { <END> NCSARequestLog requestLog = new NCSARequestLog("./logs/jetty-yyyy_mm_dd.request.log"); requestLog.setAppend(true); requestLog.setExtended(true); requestLog.setLogTimeZone("GMT"); requestLog.setLogLatency(true); requestLog.setRetainDays(7); server.setRequestLog(requestLog); } }</code><technical_language>configuration keys</technical_language>

Target:
public WebServer(Config config) { initServer(config); ServletContextHandler servletHandler = new ServletContextHandler(ServletContextHandler.SESSIONS); int sessionTimeout = config.getInteger("web.sessionTimeout"); if (sessionTimeout > 0) { servletHandler.getSessionHandler().setMaxInactiveInterval(sessionTimeout); } initApi(config, servletHandler); if (config.getBoolean("web.console")) { servletHandler.addServlet(new ServletHolder(new ConsoleServlet()), "/console/*"); } initWebApp(config, servletHandler); servletHandler.setErrorHandler(new ErrorHandler() { @Override protected void handleErrorPage( HttpServletRequest request, Writer writer, int code, String message) throws IOException { writer.write("<!DOCTYPE<html><head><title>Error</title></head><html><body>" + code + " - " + HttpStatus.getMessage(code) + "</body></html>"); } }); HandlerList handlers = new HandlerList(); initClientProxy(config, handlers); handlers.addHandler(servletHandler); handlers.addHandler(new GzipHandler()); server.setHandler(handlers); if (config.getBoolean(Keys.WEB_REQUEST_LOG_ENABLE)) { NCSARequestLog requestLog = new NCSARequestLog(config.getString(Keys.WEB_REQUEST_LOG_PATH)); requestLog.setAppend(true); requestLog.setExtended(true); requestLog.setLogLatency(true); requestLog.setRetainDays(config.getInteger(Keys.WEB_REQUEST_LOG_RETAIN_DAYS)); server.setRequestLog(requestLog); } }
Source:
<code>private void handleTitlePanel(String eventType, Element parent) { <START> if (title == "") { END> return; } titlePanel.setWidget(new Label(title)); if (BrowserEvents.MOUSEOVER.equals(eventType)) { titlePanel.showRelativeTo(parent); } else if (BrowserEvents.MOUSEOUT.equals(eventType)) { titlePanel.hide(); } }</code><technical_language>a small thing, do if (title.isEmpty()) ... alternatively if ("".equals(title)) ... I guess in end, generated JavaScript perspective</technical_language>

Target:
private void handleTitlePanel(String eventType, Element parent) { if (title.isEmpty()) { return; } titlePanel.setWidget(new Label(title)); if (BrowserEvents.MOUSEOVER.equals(eventType)) { titlePanel.showRelativeTo(parent); } else if (BrowserEvents.MOUSEOUT.equals(eventType)) { titlePanel.hide(); } }
Source:
<code>protected IStatus run(IProgressMonitor monitor) { SubMonitor progress = SubMonitor.convert(monitor, 3); String javaVersion = getUrlSafeProperty("java.version"); String operatingSystem = getUrlSafeProperty("os.name"); String operatingSystemVersion = getUrlSafeProperty("os.version"); String proxyProvider = ProxySelector.getDefaultProvider(); try { URI proxyTestUri = new URL(PROXY_TEST_URL).toURI(); <START> String proxyHostConfigured = getProxyHost(proxyTestUri).isPresent() ? "proxy-host-configured" : "noProxyHostConfigured"; END> String proxyUsernameConfigured = Proxies.getProxyUser(proxyTestUri).isPresent() ? "proxyUsernameConfigured" : "noProxyUsernameConfigured"; String proxyPasswordConfigured = Proxies.getProxyPassword(proxyTestUri).isPresent() ? "proxyPasswordConfigured" : "noProxyPasswordConfigured"; String authentication = getRequiredAuthentication(proxyTestUri, progress.newChild(1)); doApacheHeadRequest(toUri(format(REQUEST_URL, APACHE_HTTP_REQUEST_PART, javaVersion, operatingSystem, operatingSystemVersion, proxyProvider, authentication, proxyHostConfigured, proxyUsernameConfigured, proxyPasswordConfigured)), progress.newChild(1)); doP2HeadRequest(toUri(format(REQUEST_URL, P2_HTTP_REQUEST_PART, javaVersion, operatingSystem, operatingSystemVersion, proxyProvider, authentication, proxyHostConfigured, proxyUsernameConfigured, proxyPasswordConfigured)), progress.newChild(1)); } catch (Exception e) { Logs.log(LogMessages.ERROR_NETWORK_COMMUNICATION_URL_PARSING_FAILED, e); } return Status.OK_STATUS; }</code><technical_language>hyphens lowerCamelCase below? Also, I drop "configure" no-proxy-host no-username no-password proxy-host username password</technical_language>

Target:
protected IStatus run(IProgressMonitor monitor) { SubMonitor progress = SubMonitor.convert(monitor, 3); String javaVersion = getUrlSafeProperty("java.version"); String operatingSystem = getUrlSafeProperty("os.name"); String operatingSystemVersion = getUrlSafeProperty("os.version"); String proxyProvider = ProxySelector.getDefaultProvider(); try { URI proxyTestUri = new URL(PROXY_TEST_URL).toURI(); String proxyHostConfigured = getProxyHost(proxyTestUri).isPresent() ? "proxyHost" : "noProxyHost"; String proxyUsernameConfigured = Proxies.getProxyUser(proxyTestUri).isPresent() ? "proxyUsername" : "noProxyUsername"; String proxyPasswordConfigured = Proxies.getProxyPassword(proxyTestUri).isPresent() ? "proxyPassword" : "noProxyPassword"; String authentication = getRequiredAuthentication(proxyTestUri, progress.newChild(1)); doApacheHeadRequest(toUri(format(REQUEST_URL, APACHE_HTTP_REQUEST_PART, javaVersion, operatingSystem, operatingSystemVersion, proxyProvider, authentication, proxyHostConfigured, proxyUsernameConfigured, proxyPasswordConfigured)), progress.newChild(1)); doP2HeadRequest(toUri(format(REQUEST_URL, P2_HTTP_REQUEST_PART, javaVersion, operatingSystem, operatingSystemVersion, proxyProvider, authentication, proxyHostConfigured, proxyUsernameConfigured, proxyPasswordConfigured)), progress.newChild(1)); } catch (Exception e) { Logs.log(LogMessages.ERROR_NETWORK_COMMUNICATION_URL_PARSING_FAILED, e); } return Status.OK_STATUS; }
Source:
<code>public void testParsePureUnit() { assertThat(UnitUtils.parseUnit("°F"), is(ImperialUnits.FAHRENHEIT)); <START> assertThat(UnitUtils.parseUnit("m"), is(SIUnits.METRE)); <END> assertThat(UnitUtils.parseUnit("%"), is(SmartHomeUnits.PERCENT)); }</code><technical_language>Yes, rely I18nProviderImpl present running. nice, I agree</technical_language>

Target:
public void testParsePureUnit() { assertThat(UnitUtils.parseUnit("DU"), is(SmartHomeUnits.DOBSON_UNIT)); assertThat(UnitUtils.parseUnit("°F"), is(ImperialUnits.FAHRENHEIT)); assertThat(UnitUtils.parseUnit("m"), is(SIUnits.METRE)); assertThat(UnitUtils.parseUnit("%"), is(SmartHomeUnits.PERCENT)); }
Source:
<code>private Object getEntityFieldAsObject(JsonNode parentNode, String fieldName) { JsonNode valueNode = parentNode.get(fieldName); if (!TablesConstants.METADATA_KEYS.contains(fieldName) && !fieldName.endsWith("@odata.type")) { JsonNode typeNode = parentNode.get(fieldName + "@odata.type"); if (typeNode != null) { String type = typeNode.asText(); switch (type) { case "Edm.DateTime": try { return OffsetDateTime.parse(valueNode.asText()); } catch (DateTimeParseException e) { throw logger.logExceptionAsError(new IllegalArgumentException(String.format( "'%s' value is not a valid OffsetDateTime.", TablesConstants.TIMESTAMP_KEY), e)); } <START> default: <END> logger.warning("'%s' value has unknown OData type '%s'", fieldName, type); break; } } } return valueNode.asText(); }</code><technical_language>placeholder for is %s</technical_language>

Target:
private Object getEntityFieldAsObject(JsonNode parentNode, String fieldName) { JsonNode valueNode = parentNode.get(fieldName); if (!TablesConstants.METADATA_KEYS.contains(fieldName) && !fieldName.endsWith("@odata.type")) { JsonNode typeNode = parentNode.get(fieldName + "@odata.type"); if (typeNode != null) { String type = typeNode.asText(); switch (type) { case "Edm.DateTime": try { return OffsetDateTime.parse(valueNode.asText()); } catch (DateTimeParseException e) { throw logger.logExceptionAsError(new IllegalArgumentException(String.format( "'%s' value is not a valid OffsetDateTime.", TablesConstants.TIMESTAMP_KEY), e)); } default: logger.warning(String.format("'%s' value has unknown OData type '%s'", fieldName, type)); break; } } } return valueNode.asText(); }
Source:
<code>public Response chatStatus() { if (!sessionController.isLoggedIn()) { return Response.status(Status.FORBIDDEN).entity("Must be logged in").build(); } SchoolDataIdentifier identifier = sessionController.getLoggedUser(); if (identifier == null) { return Response.status(Status.INTERNAL_SERVER_ERROR).entity("Couldn't find logged user").build(); } String enabledUsersCsv = pluginSettingsController.getPluginSetting("chat", "enabledUsers"); if (enabledUsersCsv == null) { <START> return null; <END> } List<String> enabledUsers = Arrays.asList(enabledUsersCsv.split(",")); boolean chatEnabled = false; if (!enabledUsers.contains(identifier.toId())) { return Response.ok(new StatusRESTModel(false, false, null)).build(); } UserChatSettings userChatSettings = chatController.findUserChatSettings(identifier); if (userChatSettings != null) { UserChatVisibility visibility = userChatSettings.getVisibility(); if (visibility.toString().equals("VISIBLE_TO_ALL")) { chatEnabled = true; } } User user = userController.findUserByIdentifier(identifier); if (user == null) { return Response.status(Status.INTERNAL_SERVER_ERROR).entity("Logged user doesn't exist").build(); } if (chatEnabled) { return Response.ok(new StatusRESTModel(true, true, user.getDisplayName())).build(); } else { return Response.ok(new StatusRESTModel(false, true, null)).build(); } }</code><technical_language>means chat is configured? return something, Response.status(Status.INTERNAL_SERVER_ERROR).build() Status.NOT_IMPLEMENTED etc. w/e sense</technical_language>

Target:
public Response chatStatus() { if (!sessionController.isLoggedIn()) { return Response.status(Status.FORBIDDEN).entity("Must be logged in").build(); } SchoolDataIdentifier identifier = sessionController.getLoggedUser(); if (identifier == null) { return Response.status(Status.INTERNAL_SERVER_ERROR).entity("Couldn't find logged user").build(); } String enabledUsersCsv = pluginSettingsController.getPluginSetting("chat", "enabledUsers"); if (enabledUsersCsv == null) { return Response.status(Status.INTERNAL_SERVER_ERROR).build(); } List<String> enabledUsers = Arrays.asList(enabledUsersCsv.split(",")); boolean chatEnabled = false; if (!enabledUsers.contains(identifier.toId())) { return Response.ok(new StatusRESTModel(false, false, null)).build(); } UserChatSettings userChatSettings = chatController.findUserChatSettings(identifier); if (userChatSettings != null) { UserChatVisibility visibility = userChatSettings.getVisibility(); if (visibility == UserChatVisibility.VISIBLE_TO_ALL) { chatEnabled = true; } } User user = userController.findUserByIdentifier(identifier); if (user == null) { return Response.status(Status.INTERNAL_SERVER_ERROR).entity("Logged user doesn't exist").build(); } if (chatEnabled) { return Response.ok(new StatusRESTModel(true, true, user.getDisplayName())).build(); } else { return Response.ok(new StatusRESTModel(false, true, null)).build(); } }
Source:
<code>public void start() { boolean isOnSonarCloud = configuration.getBoolean(ProcessProperties.Property.SONARCLOUD_ENABLED.getKey()).orElse(false); this.globalDispatchers = notificationCenter.getDispatcherKeysForProperty(GLOBAL_NOTIFICATION, "true") .stream() <START> .filter(dispatcher -> !(isOnSonarCloud && GLOBAL_DISPATCHERS_NOT_FOR_SONAR_CLOUD.contains(dispatcher))) <END> .sorted() .collect(toList()); this.projectDispatchers = notificationCenter.getDispatcherKeysForProperty(PER_PROJECT_NOTIFICATION, "true") .stream() .sorted() .collect(toList()); }</code><technical_language>create a Predicate for</technical_language>

Target:
public void start() { boolean isOnSonarCloud = configuration.getBoolean(ProcessProperties.Property.SONARCLOUD_ENABLED.getKey()).orElse(false); this.globalDispatchers = notificationCenter.getDispatcherKeysForProperty(GLOBAL_NOTIFICATION, "true") .stream() .filter(filterDispatcherForSonarCloud(isOnSonarCloud)) .sorted() .collect(toList()); this.projectDispatchers = notificationCenter.getDispatcherKeysForProperty(PER_PROJECT_NOTIFICATION, "true") .stream() .sorted() .collect(toList()); }
Source:
<code>public String toHtml(CustomDatatype<T> datatype, String valueReference) { <START> return valueReference; <END> }</code><technical_language>this return name property this is metadata, if is blank, call toString()</technical_language>

Target:
public String toHtml(CustomDatatype<T> datatype, String valueReference) { SerializingCustomDatatype<T> dt = (SerializingCustomDatatype<T>) datatype; String result = ((OpenmrsMetadata) dt.deserialize(valueReference)).getName(); return result; }
Source:
<code>public void testExistingTargetFileButWithoutReadAccess() throws Exception { exit.expectSystemExitWithStatus(-1); exit.checkAssertionAfterwards(() -> { assertEquals("Unexpected output log", "Files to process must be specified, found 0." + System.lineSeparator(), systemOut.getLog()); assertEquals("Unexpected system error log", "", systemErr.getLog()); }); final Path path = Files.createTempFile("", ""); path.toFile().setReadable(false); Main.main("-c", "/google_checks.xml", path.toString()); <START> Files.delete(path); <END> }</code><technical_language>Files.delete wrapped in a try-finally incase Main threw exception</technical_language>

Target:
public void testExistingTargetFileButWithoutReadAccess() throws Exception { exit.expectSystemExitWithStatus(-1); exit.checkAssertionAfterwards(() -> { assertEquals("Unexpected output log", "Files to process must be specified, found 0." + System.lineSeparator(), systemOut.getLog()); assertEquals("Unexpected system error log", "", systemErr.getLog()); }); final File file = temporaryFolder.newFile("testExistingTargetFileButWithoutReadAccess"); file.setReadable(false); Main.main("-c", "/google_checks.xml", file.getCanonicalPath()); }
Source:
<code>public static String getJSON(String url) { StringBuilder builder = new StringBuilder(); HttpClient client = new DefaultHttpClient(); HttpGet siteHttp = new HttpGet(url); try { HttpResponse response = client.execute(siteHttp); StatusLine statusLine = response.getStatusLine(); int statusCode = statusLine.getStatusCode(); if (statusCode == 200) { HttpEntity entity = response.getEntity(); InputStream content = entity.getContent(); BufferedReader reader = new BufferedReader(new InputStreamReader(content)); String line; while ((line = reader.readLine() )!= null) { builder.append(line); } } else { System.out.println("Failed to Access Json!"); } } catch (ClientProtocolException e ) { <START> e.printStackTrace(); <END> } catch ( IOException e) { e.printStackTrace(); } return builder.toString(); }</code><technical_language>return a null string propagate exception. Right now, app crash</technical_language>

Target:
public static String getJSON(String url) { StringBuilder builder = new StringBuilder(); HttpClient client = new DefaultHttpClient(); HttpGet siteHttp = new HttpGet(url); try { HttpResponse response = client.execute(siteHttp); StatusLine statusLine = response.getStatusLine(); int statusCode = statusLine.getStatusCode(); if (statusCode == 200) { HttpEntity entity = response.getEntity(); InputStream content = entity.getContent(); BufferedReader reader = new BufferedReader(new InputStreamReader(content)); String line; while ((line = reader.readLine() )!= null) { builder.append(line); } } else { System.out.println("Failed to Access Json!"); return null; } } catch (ClientProtocolException e ) { e.printStackTrace(); } catch ( IOException e) { e.printStackTrace(); } return builder.toString(); }
Source:
<code>public GHAuthorization createOAuthTokenWebFlowStepTwo( @Nonnull String OAuthApplicationclient_id,@Nonnull String OAuthApplicationSecret, @Nonnull String temp_OAuth_Code, String state, java.net.URL redirect_after_auth) throws IOException { <START> Requester requester = createRequest() .setRawUrlPath("<LINK_0>") .with("client_id", OAuthApplicationclient_id) <END> .with("client_secret", OAuthApplicationSecret) .with("code", temp_OAuth_Code) ; if(state!=null) requester.with("state", state); if(redirect_after_auth!=null) requester.with("redirect_uri", redirect_after_auth); return requester.method("POST").fetch(GHAuthorization.class).wrap(this); }</code><technical_language>suggestion Requester requester = createRequest() .method("POST") .setRawUrlPath("<LINK_0>") .with("client_id", OAuthApplicationclient_id)</technical_language>

Target:
public GHAuthorization createOAuthTokenWebFlowStepTwo(@Nonnull String OAuthApplicationclient_id, @Nonnull String OAuthApplicationSecret, @Nonnull String temp_OAuth_Code, String state, java.net.URL redirect_after_auth) throws IOException { Requester requester = createRequest().method("POST") .setRawUrlPath("<LINK_0>") .with("client_id", OAuthApplicationclient_id) .with("client_secret", OAuthApplicationSecret) .with("code", temp_OAuth_Code) ; if (state != null) requester.with("state", state); if (redirect_after_auth != null) requester.with("redirect_uri", redirect_after_auth); return requester.method("POST").fetch(GHAuthorization.class).wrap(this); }
Source:
<code>public void addAlert(String authId, String journalKey, String subjectName) throws IOException { <START> String nedId = getUserIdFromAuthId(authId); <END> if (nedId == null) { throw new RuntimeException("failed to get NED ID"); } JsonArray alerts = userApi.requestObject(String.format("individuals/%s/alerts", nedId), JsonArray.class); JsonObject alert = findMatchingAlert(alerts, journalKey); if (alert != null) { addSubjectToAlert(alert, subjectName); } else { alert = createAlertForSubject(journalKey, subjectName); } if (alert.has("id")) { String alertId = String.valueOf(alert.getAsJsonPrimitive("id").getAsLong()); userApi.putObject(String.format("individuals/%s/alerts/%s", nedId, alertId), alert); } else { userApi.postObject(String.format("individuals/%s/alerts", nedId), alert); } }</code><technical_language>name this userId instead of nedId for consistency</technical_language>

Target:
public void addAlert(String authId, String journalKey, String subjectName) throws IOException { String userId = userApi.getUserIdFromAuthId(authId); List<Alert> alerts = fetchAlerts(userId); Alert alert = findMatchingAlert(alerts, journalKey) .map(a -> addSubjectToAlert(a, subjectName)) .orElseGet(() -> createAlertForSubject(journalKey, subjectName)); if (alert.getId() != null) { String alertId = alert.getId().toString(); userApi.putObject(String.format("individuals/%s/alerts/%s", userId, alertId), alert); } else { userApi.postObject(String.format("individuals/%s/alerts", userId), alert); } }
Source:
<code>public static Repository getRepository(final ServletRequest req) { Repository db = (Repository) req.getAttribute(ATTRIBUTE_REPOSITORY); if (db == null) <START> throw new IllegalStateException(HttpServerText.get().expectedrepositoryAttribute); <END> return db; }</code><technical_language>camel case ? s/expectedrepositoryAttribute/expectedRepositoryAttribute/</technical_language>

Target:
public static Repository getRepository(final ServletRequest req) { Repository db = (Repository) req.getAttribute(ATTRIBUTE_REPOSITORY); if (db == null) throw new IllegalStateException(HttpServerText.get().expectedRepositoryAttribute); return db; }