auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void test_enqueuing_exceptional_yields() { BytecodeCFGBuilder.BytecodeCFG cfg = BytecodeCFGBuilderTest.getBytecodeCFG("tryCatch", "src/test/java/org/sonar/java/bytecode/se/BytecodeEGWalkerExecuteTest.java"); BytecodeCFGBuilder.Block b2 = cfg.blocks().get(2); SquidClassLoader squidClassLoader = new SquidClassLoader(new ArrayList<>(FileUtils.listFiles(new File("target/test-jars"), new String[] {"jar", "zip"}, true))); BytecodeEGWalker walker = new BytecodeEGWalker(new BehaviorCache(null, squidClassLoader)); walker.programState = ProgramState.EMPTY_STATE.stackValue(new SymbolicValue()).stackValue(new SymbolicValue()); walker.programPosition = new ProgramPoint(b2).next().next(); walker.executeInstruction(b2.elements().get(3)); assertThat(walker.workList).hasSize(3); <START> <END> cfg = BytecodeCFGBuilderTest.getBytecodeCFG("tryWrongCatch", "src/test/java/org/sonar/java/bytecode/se/BytecodeEGWalkerExecuteTest.java"); b2 = cfg.blocks().get(2); cfg.blocks().forEach(b-> System.out.println(b.printBlock())); walker.workList.clear(); walker.programState = ProgramState.EMPTY_STATE.stackValue(new SymbolicValue()).stackValue(new SymbolicValue()); walker.programPosition = new ProgramPoint(b2).next().next(); walker.executeInstruction(b2.elements().get(3)); assertThat(walker.workList).hasSize(3); }</code><technical_language>this test file is big tests focus structure, I in a new file</technical_language>

Target:
public void test_enqueuing_exceptional_yields() { BytecodeCFGBuilder.BytecodeCFG cfg = BytecodeCFGBuilderTest.getBytecodeCFG("tryCatch", "src/test/java/org/sonar/java/bytecode/se/BytecodeEGWalkerExecuteTest.java"); BytecodeCFGBuilder.Block b2 = cfg.blocks().get(2); SquidClassLoader squidClassLoader = new SquidClassLoader(new ArrayList<>(FileUtils.listFiles(new File("target/test-jars"), new String[] {"jar", "zip"}, true))); BytecodeEGWalker walker = new BytecodeEGWalker(new BehaviorCache(null, squidClassLoader)); walker.programState = ProgramState.EMPTY_STATE.stackValue(new SymbolicValue()).stackValue(new SymbolicValue()); walker.programPosition = new ProgramPoint(b2).next().next(); walker.executeInstruction(b2.elements().get(3)); assertThat(walker.workList).hasSize(3); cfg = BytecodeCFGBuilderTest.getBytecodeCFG("tryWrongCatch", "src/test/java/org/sonar/java/bytecode/se/BytecodeEGWalkerExecuteTest.java"); b2 = cfg.blocks().get(2); walker.workList.clear(); walker.programState = ProgramState.EMPTY_STATE.stackValue(new SymbolicValue()).stackValue(new SymbolicValue()); walker.programPosition = new ProgramPoint(b2).next().next(); walker.executeInstruction(b2.elements().get(3)); assertThat(walker.workList).hasSize(3); assertThat(walker.workList.pop().programState.exitValue()).isNotNull().isInstanceOf(SymbolicValue.ExceptionalSymbolicValue.class); assertThat(walker.workList.pop().programState.exitValue()).isNotNull().isInstanceOf(SymbolicValue.ExceptionalSymbolicValue.class); assertThat(walker.workList.pop().programState.exitValue()).isNull(); }
Source:
<code>private boolean validateTimeRange() { boolean isEmpty = fStartTimeRangeText.getText().isEmpty() || fEndTimeRangeText.getText().isEmpty(); return !isEmpty && parseTimeRange() && fStartTimestamp.compareTo(fEndTimestamp) <= 0; <START> } <END></code><technical_language>this < 0? do want import a 0 nanosecond range</technical_language>

Target:
private boolean validateTimeRange() { boolean isEmpty = fStartTimeRangeText.getText().isEmpty() || fEndTimeRangeText.getText().isEmpty(); return !isEmpty && parseTimeRange() && fStartTimestamp.compareTo(fEndTimestamp) < 0; }
Source:
<code>DictIdSeeker( IntBuffer dimConversions ) { this.dimConversions = dimConversions; this.currIndex = 0; this.currVal = -1; <START> this.lastVal = -1; <END> }</code><technical_language>defined in constructor seek method</technical_language>

Target:
DictIdSeeker( IntBuffer dimConversions ) { this.dimConversions = dimConversions; this.currIndex = 0; this.currVal = NOT_INIT; this.lastVal = NOT_INIT; }
Source:
<code>public ProtocolInfoAttribute getAttribute( ProtocolInfoAttributeName attributeName, String attributeValue ) throws ParseException { if (DLNAOrgOperations.NAME.equals(attributeName)) { throw new IllegalArgumentException( "Cannot get DLNA.ORG_FLAGS instance because protocol information is needed " + <START> "- use an overloaded version of this method which takes a protocol arguement"); <END> } return getAttribute(attributeName, attributeValue, null); }</code><technical_language>"argument" more correct</technical_language>

Target:
public ProtocolInfoAttribute getAttribute( ProtocolInfoAttributeName attributeName, String attributeValue ) throws ParseException { if (DLNAOrgOperations.NAME.equals(attributeName)) { throw new IllegalArgumentException( "Cannot get DLNA.ORG_FLAGS instance because protocol information is needed " + "- use an overloaded version of this method which takes a protocol argument"); } return getAttribute(attributeName, attributeValue, null); }
Source:
<code>private void runInParentContainer(final CloneOperation op) { Runnable runInParentContainer = new Runnable() { public void run() { try { parentContainer.run(true, true, new IRunnableWithProgress() { public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { executeCloneOperation(op, monitor); } }); } catch (InvocationTargetException e) { <START> Activator.handleError(e.getMessage(), e, true); <END> } catch (InterruptedException e) { } } }; Display.getCurrent().asyncExec(runInParentContainer); }</code><technical_language>Is pass e.getCause() handleError? This brings real top</technical_language>

Target:
private void runInParentContainer(final CloneOperation op) { Runnable runInParentContainer = new Runnable() { public void run() { try { parentContainer.run(true, true, new IRunnableWithProgress() { public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { executeCloneOperation(op, monitor); } }); } catch (InvocationTargetException e) { Activator.handleError(UIText.GitCloneWizard_failed, e.getCause(), true); } catch (InterruptedException e) { } } }; Display.getCurrent().asyncExec(runInParentContainer); }
Source:
<code>SetSesssionSoftLimitCommandParameters() { <START> super(); <END> }</code><technical_language>call "super()" needed</technical_language>

Target:
SetSesssionSoftLimitCommandParameters() { }
Source:
<code>public MainDesktop() throws URISyntaxException { this.injector = Guice.createInjector(this); Client client = new Client("localhost", this.configureRendererProtocol()); RenderController cntrl = this.injector.getInstance(RenderController.class); cntrl.setClient(client); client.setController(cntrl); this.eventDispatcher = this.injector.getInstance(EventDispatcher.class); this.setupGraphics(); client.connect(); <START> try { <END> Thread.sleep(2000); } catch (InterruptedException e) { e.printStackTrace(); } AnimalAddedEvent ev; for (int i = 0; i < 5; i++) { try { Thread.sleep(100); } catch (InterruptedException e) { e.printStackTrace(); } ev = new AnimalAddedEvent(); ev.setAnimal(i); ev.setTeam(i % 2); this.eventDispatcher.dispatch(ev); } this.eventDispatcher.dispatch(new GameAboutToStartEvent()); this.eventDispatcher.dispatch(new GameStartedEvent()); try { Thread.sleep(1000); } catch (InterruptedException e) { e.printStackTrace(); } }</code><technical_language>This removed</technical_language>

Target:
public MainDesktop() throws URISyntaxException { this.injector = Guice.createInjector(this); Client client = new Client("localhost", this.configureRendererProtocol()); RenderController cntrl = this.injector.getInstance(RenderController.class); cntrl.setClient(client); client.setController(cntrl); this.eventDispatcher = this.injector.getInstance(EventDispatcher.class); this.setupGraphics(); client.connect(); }
Source:
<code>public Node visitFunctionCall(SqlBaseParser.FunctionCallContext context) { var window = visitIfPresent(context.over(), Window.class); var filter = visitIfPresent(context.filter(), Expression.class); if (filter.isPresent() && window.isPresent()) { throw new UnsupportedOperationException( <START> "The filter clause in window function calls is not supported"); <END> } return new FunctionCall( getQualifiedName(context.qname()), isDistinct(context.setQuant()), visitCollection(context.expr(), Expression.class), window, filter ); }</code><technical_language>if this is a good place for current limitation for window functions. limitation applies for non-aggregate functions limit anyway. remove this limitation parser level</technical_language>

Target:
public Node visitFunctionCall(SqlBaseParser.FunctionCallContext context) { return new FunctionCall( getQualifiedName(context.qname()), isDistinct(context.setQuant()), visitCollection(context.expr(), Expression.class), visitIfPresent(context.over(), Window.class), visitIfPresent(context.filter(), Expression.class) ); }
Source:
<code>@Test public void getItemsPredicate() throws IOException { final Folder d = r.jenkins.createProject(Folder.class, "d"); <START> final FreeStyleProject p1 = d.createProject(FreeStyleProject.class, "p1"); FreeStyleProject p2 = d.createProject(FreeStyleProject.class, "p2"); FreeStyleProject c1 = d.createProject(FreeStyleProject.class, "c1"); <END> assertThat(d.getItems(p -> p.getDisplayName().startsWith("p")), containsInAnyOrder(p1, p2)); }</code><technical_language>suggestion final FreeStyleProject p1 = d.createProject(FreeStyleProject.class, "p1"); final FreeStyleProject p2 = d.createProject(FreeStyleProject.class, "p2"); final FreeStyleProject c1 = d.createProject(FreeStyleProject.class, "c1");</technical_language>

Target:
@Test public void getItemsPredicate() throws IOException { final Folder d = r.jenkins.createProject(Folder.class, "d"); final FreeStyleProject p1 = d.createProject(FreeStyleProject.class, "p1"); final FreeStyleProject p2 = d.createProject(FreeStyleProject.class, "p2"); final FreeStyleProject c1 = d.createProject(FreeStyleProject.class, "c1"); assertThat(d.getItems(p -> p.getDisplayName().startsWith("p")), containsInAnyOrder(p1, p2)); }
Source:
<code><START> public void testNotificationManager() throws Exception { <END> manager.changeNotificationSetting(courseId1, channelId1, false); manager.checkCourseEnrollment(new ArrayList<EnrolledCoursesResponse>()); manager.isSubscribedByCourseId(courseId1); manager.resubscribeAll( ); manager.subscribeAndUnsubscribeToServer(channelId1,true); manager.unsubscribeAll(); manager.syncWithServer(); }</code><technical_language>this test do</technical_language>

Target:
public void testNotificationManager() throws Exception { final String courseId1 = "course_id_1"; final String channelId1 = "channel_id_1"; manager.changeNotificationSetting(courseId1, channelId1, false); manager.checkCourseEnrollment(new ArrayList<EnrolledCoursesResponse>()); manager.isSubscribedByCourseId(courseId1); manager.resubscribeAll( ); manager.subscribeAndUnsubscribeToServer(channelId1,true); manager.unsubscribeAll(); manager.syncWithServer(); }
Source:
<code>public void tagRouterRuleParseTest(){ String tagRouterRuleConfig = "---\n" + "force: false\n" + "runtime: true\n" + "enabled: false\n" + "priority: 1\n" + "key: demo-provider\n" + "tags:\n" + " - name: tag1\n" + " addresses: null\n" + " - name: tag2\n" + " addresses: [\"30.5.120.37:20880\"]\n" + " - name: tag3\n" + " addresses: []\n" + " - name: tag4\n" + " addresses: ~\n" + "..."; TagRouterRule tagRouterRule = TagRuleParser.parse(tagRouterRuleConfig); assert tagRouterRule.getTagNames().contains("tag1"); assert tagRouterRule.getTagNames().contains("tag2"); assert tagRouterRule.getTagNames().contains("tag3"); assert tagRouterRule.getTagNames().contains("tag4"); assert tagRouterRule.getAddresses().contains("30.5.120.37:20880"); <START> assert tagRouterRule.getTagnameToAddresses().get("tag1")==null; <END> assert tagRouterRule.getTagnameToAddresses().get("tag2").size()==1; assert tagRouterRule.getTagnameToAddresses().get("tag3")==null; assert tagRouterRule.getTagnameToAddresses().get("tag4")==null; }</code><technical_language>assert tagRouterRule.getAddresses().size==1</technical_language>

Target:
public void tagRouterRuleParseTest(){ String tagRouterRuleConfig = "---\n" + "force: false\n" + "runtime: true\n" + "enabled: false\n" + "priority: 1\n" + "key: demo-provider\n" + "tags:\n" + " - name: tag1\n" + " addresses: null\n" + " - name: tag2\n" + " addresses: [\"30.5.120.37:20880\"]\n" + " - name: tag3\n" + " addresses: []\n" + " - name: tag4\n" + " addresses: ~\n" + "..."; TagRouterRule tagRouterRule = TagRuleParser.parse(tagRouterRuleConfig); assert tagRouterRule.getTagNames().contains("tag1"); assert tagRouterRule.getTagNames().contains("tag2"); assert tagRouterRule.getTagNames().contains("tag3"); assert tagRouterRule.getTagNames().contains("tag4"); assert tagRouterRule.getAddresses().contains("30.5.120.37:20880"); assert tagRouterRule.getTagnameToAddresses().get("tag1")==null; assert tagRouterRule.getTagnameToAddresses().get("tag2").size()==1; assert tagRouterRule.getTagnameToAddresses().get("tag3")==null; assert tagRouterRule.getTagnameToAddresses().get("tag4")==null; assert tagRouterRule.getAddresses().size()==1; }
Source:
<code>public static PeriodGranularity toPeriodGranularity( final Expr periodArg, final Expr originArg, final Expr timeZoneArg, final Expr.ObjectBinding bindings ) { final Period period = new Period(periodArg.eval(bindings).asString()); final DateTime origin; final DateTimeZone timeZone; if (timeZoneArg == null) { timeZone = null; } else { final String value = timeZoneArg.eval(bindings).asString(); timeZone = value != null ? DateTimeZone.forID(value) : null; } <START> Chronology chronology = timeZone == null ? ISOChronology.getInstanceUTC() : ISOChronology.getInstance(timeZone); <END> if (originArg == null) { origin = null; } else { final Object value = originArg.eval(bindings).value(); origin = value != null ? new DateTime(value, chronology) : null; } return new PeriodGranularity(period, origin, timeZone); }</code><technical_language>Chronology is needed in else case, right? limited in scope code block</technical_language>

Target:
public static PeriodGranularity toPeriodGranularity( final Expr periodArg, final Expr originArg, final Expr timeZoneArg, final Expr.ObjectBinding bindings ) { final Period period = new Period(periodArg.eval(bindings).asString()); final DateTime origin; final DateTimeZone timeZone; if (timeZoneArg == null) { timeZone = null; } else { final String value = timeZoneArg.eval(bindings).asString(); timeZone = value != null ? DateTimeZone.forID(value) : null; } if (originArg == null) { origin = null; } else { Chronology chronology = timeZone == null ? ISOChronology.getInstanceUTC() : ISOChronology.getInstance(timeZone); final Object value = originArg.eval(bindings).value(); origin = value != null ? new DateTime(value, chronology) : null; } return new PeriodGranularity(period, origin, timeZone); }
Source:
<code>public void doesNotFire() { RuleApplication ruleApplication = applyRule(); if (ruleApplication.wasRuleApplied()) { fail(String.format( "Expected %s to not fire for:\n%s", rule.getClass().getName(), <START> inTransaction(session -> textLogicalPlan(plan, ruleApplication.types, metadata.getFunctionRegistry(), new StatsAndCosts(ImmutableMap.of(), ImmutableMap.of()), session, 2)))); <END> } }</code><technical_language>StatsAndCosts.empty()</technical_language>

Target:
public void doesNotFire() { RuleApplication ruleApplication = applyRule(); if (ruleApplication.wasRuleApplied()) { fail(String.format( "Expected %s to not fire for:\n%s", rule.getClass().getName(), inTransaction(session -> textLogicalPlan(plan, ruleApplication.types, metadata.getFunctionRegistry(), StatsAndCosts.empty(), session, 2)))); } }
Source:
<code>public static QuotaModeType map(QuotaEnforcementTypeEnum type) { switch (type) { case DISABLED: return QuotaModeType.DISABLED; case HARD_ENFORCEMENT: return QuotaModeType.ENABLED; case SOFT_ENFORCEMENT: return QuotaModeType.AUDIT; default: <START> return null; <END> } }</code><technical_language>Throw exception indicating mapped, this: throw new IllegalArgumentException("Unknown quota enforcement type \"" + type + "\"");</technical_language>

Target:
public static QuotaModeType map(QuotaEnforcementTypeEnum type) { switch (type) { case DISABLED: return QuotaModeType.DISABLED; case HARD_ENFORCEMENT: return QuotaModeType.ENABLED; case SOFT_ENFORCEMENT: return QuotaModeType.AUDIT; default: throw new IllegalArgumentException("Unknown quota enforcement type \"" + type + "\""); } }
Source:
<code>@Override public EnumerableCorrelate copy(RelTraitSet traitSet, RelNode left, RelNode right, CorrelationId correlationId, ImmutableBitSet requiredColumns, JoinRelType joinType) { ImmutableList<RelCollation> newCollations = ImmutableList.copyOf( RelMdCollation.enumerableCorrelate( getCluster().getMetadataQuery(), left, right, joinType)); if (!newCollations.isEmpty()) { <START> traitSet = traitSet.replace(newCollations); <END> } return new EnumerableCorrelate(getCluster(), traitSet, left, right, correlationId, requiredColumns, joinType); }</code><technical_language>this wrong way, hard. If call ProjectJoinTransposeRule a MergeJoin (which requires sorted input), Project not, pushed down, give sorted output, rule abort. a thought</technical_language>

Target:
@Override public EnumerableCorrelate copy(RelTraitSet traitSet, RelNode left, RelNode right, CorrelationId correlationId, ImmutableBitSet requiredColumns, JoinRelType joinType) { return new EnumerableCorrelate(getCluster(), traitSet, left, right, correlationId, requiredColumns, joinType); }
Source:
<code>public Trigger orphanMemberTrigger(String tenantId, String memberId) throws Exception { if (isEmpty(tenantId)) { throw new IllegalArgumentException("TenantId must be not null"); } if (isEmpty(memberId)) { throw new IllegalArgumentException("TriggerId must be not null"); } <START> checkTenantId(tenantId, memberId); <END> Trigger member = getTrigger(tenantId, memberId); if (null == member) { throw new NotFoundException(Trigger.class.getName(), tenantId, memberId); } if (!member.isMember()) { throw new IllegalArgumentException("Trigger is not a member trigger: [" + tenantId + "/" + memberId + "]"); } if (member.isOrphan()) { throw new IllegalArgumentException("Trigger is already an orphan: [" + tenantId + "/" + memberId + "]"); } member.setOrphan(true); return updateTrigger(member); }</code><technical_language>In this case checkTenantId is needed. This helper method is ensure Trigger/Dampening/Tag objects tenantId correctly. arguments is of that, omitted</technical_language>

Target:
public Trigger orphanMemberTrigger(String tenantId, String memberId) throws Exception { if (isEmpty(tenantId)) { throw new IllegalArgumentException("TenantId must be not null"); } if (isEmpty(memberId)) { throw new IllegalArgumentException("TriggerId must be not null"); } Trigger member = getTrigger(tenantId, memberId); if (null == member) { throw new NotFoundApplicationException(Trigger.class.getName(), tenantId, memberId); } if (!member.isMember()) { throw new IllegalArgumentException("Trigger is not a member trigger: [" + tenantId + "/" + memberId + "]"); } if (member.isOrphan()) { throw new IllegalArgumentException("Trigger is already an orphan: [" + tenantId + "/" + memberId + "]"); } member.setOrphan(true); return updateTrigger(member); }
Source:
<code>public void updateRoutingTable(final EMRoutingTable routingTable) { final Map<Integer, List<Integer>> storeIdToBlockIds = routingTable.getStoreIdToBlockIds(); numTotalBlocks = routingTable.getNumTotalBlocks(); storeIdToEndpointId.putAll(routingTable.getStoreIdToEndpointId()); for (final Map.Entry<Integer, List<Integer>> entry : storeIdToBlockIds.entrySet()) { final int storeId = entry.getKey(); for (final int blockId : entry.getValue()) { blockIdToStoreId.put(blockId, storeId); } } initialized = true; synchronized (this) { <START> notify(); <END> } }</code><technical_language>this.notify() consistent L63</technical_language>

Target:
public void updateRoutingTable(final EMRoutingTable routingTable) { final Map<Integer, List<Integer>> storeIdToBlockIds = routingTable.getStoreIdToBlockIds(); numTotalBlocks = routingTable.getNumTotalBlocks(); storeIdToEndpointId.putAll(routingTable.getStoreIdToEndpointId()); for (final Map.Entry<Integer, List<Integer>> entry : storeIdToBlockIds.entrySet()) { final int storeId = entry.getKey(); for (final int blockId : entry.getValue()) { blockIdToStoreId.put(blockId, storeId); } } initialized = true; synchronized (this) { this.notify(); } }
Source:
<code>private TagName saveToCase(SleuthkitCase caseDb) { TagName tagName = null; try { tagName = caseDb.addOrUpdateTagName(displayName, description, color, knownStatusDenoted); } catch (TskCoreException ex) { <START> Exceptions.printStackTrace(ex); <END> } return tagName; }</code><technical_language>Oops</technical_language>

Target:
private TagName saveToCase(SleuthkitCase caseDb) { TagName tagName = null; try { tagName = caseDb.addOrUpdateTagName(displayName, description, color, knownStatusDenoted); } catch (TskCoreException ex) { LOGGER.log(Level.SEVERE, "Error updating non-file object ", ex); } return tagName; }
Source:
<code>public GenericRecord transform(StructuredRecord structuredRecord) throws IOException { co.cask.cdap.api.data.schema.Schema structuredRecordSchema = structuredRecord.getSchema(); Schema avroSchema; if (outputAvroSchema != null) { avroSchema = outputAvroSchema; } else { int hashCode = structuredRecordSchema.hashCode(); if (schemaCache.containsKey(hashCode)) { avroSchema = schemaCache.get(hashCode); } else { avroSchema = new Schema.Parser().parse(structuredRecordSchema.toString()); schemaCache.put(hashCode, avroSchema); } } GenericRecordBuilder recordBuilder = new GenericRecordBuilder(avroSchema); for (Schema.Field field : avroSchema.getFields()) { String fieldName = field.name(); co.cask.cdap.api.data.schema.Schema.Field schemaField = structuredRecordSchema.getField(fieldName); if (schemaField == null) { throw new IllegalArgumentException("Input record does not contain the " + fieldName + " field."); } <START> if (schemaField.getSchema().getType() == co.cask.cdap.api.data.schema.Schema.Type.RECORD) { <END> recordBuilder.set(fieldName, new StructuredToAvroTransformer(field.schema().toString()) .transform((StructuredRecord) structuredRecord.get(fieldName))); } else { recordBuilder.set(fieldName, convertField(structuredRecord.get(fieldName), schemaField.getSchema())); } } return recordBuilder.build(); }</code><technical_language>this is a good fix it. convertField a switch statement field type, duplicate logic here, creating a new transformer for recursive call. Instead, remove outputAvroSchema variable completely. avro schema calculated cdap schema</technical_language>

Target:
public GenericRecord transform(StructuredRecord structuredRecord) throws IOException { return transform(structuredRecord, outputCDAPSchema == null ? structuredRecord.getSchema() : outputCDAPSchema); }
Source:
<code><START> public double getMedian() { <END> return median; }</code><technical_language>I this method private</technical_language>

Target:
private double getMedian() { return median; }
Source:
<code>public void before(){ browser.navigate().refresh(); Graphene.goTo(TransactionsMetricsPage.class); <START> browser.manage().window().maximize(); <END> Console.withBrowser(browser).waitUntilLoaded(); }</code><technical_language>consider org.jboss.hal.testsuite.util.Console.maximizeWindow() instead</technical_language>

Target:
public void before() { browser.navigate().refresh(); Graphene.goTo(TransactionsMetricsPage.class); Console.withBrowser(browser).maximizeWindow().waitUntilLoaded(); }
Source:
<code>public static <T> LinkedBindingBuilder<T> bind(Binder binder, TypeLiteral<T> type) { <START> return binder.bind(type).annotatedWith(UniqueAnnotations.create()); <END> }</code><technical_language>is a single item allowed, is reason annotations of kind. drop annotatedWith drop next method altogether</technical_language>

Target:
public static <T> LinkedBindingBuilder<T> bind(Binder binder, TypeLiteral<T> type) { return binder.bind(type); }
Source:
<code>public Control post(@Valid MetricCollection metricCollection, @Context HttpServletRequest request) { try { List<Metric> metrics = metricCollection.getMetrics(); log.debug("POST: metrics/store: len(metrics)={}", (metrics == null) ? -1 : metrics.size()); if (metrics != null) { metricService.incrementReceived(metrics.size()); } log.debug("Tagging metrics with http parameter prefixes: {}", configuration.getHttpParameterTags()); Utils.tagMetrics(request, metrics, configuration.getHttpParameterTags()); if (configuration.isAuthEnabled()) { Subject subject = security.getSubject(); ZenossTenant tenant = subject.getPrincipals().oneByType(ZenossTenant.class); log.debug("Tagging metrics with tenant-id: {}", tenant.id()); Utils.injectTag("zenoss_tenant_id", tenant.id(), metrics); } Utils.filterMetricTags(metrics, configuration.getTagWhiteList()); String remoteIp = Utils.remoteAddress(request); return metricService.push(metrics, remoteIp, null); <START> } catch (Exception e) { <END> log.info("post(metricCollection={}, request={}", metricCollection, request); log.error("Unexpected exception: " + e.getMessage(), e); return Control.error(e.getMessage()); } }</code><technical_language>able catch RuntimeException, if provides benefit</technical_language>

Target:
public Control post(@Valid MetricCollection metricCollection, @Context HttpServletRequest request) throws Exception { try { List<Metric> metrics = metricCollection.getMetrics(); log.debug("POST: metrics/store: len(metrics)={}", (metrics == null) ? -1 : metrics.size()); if (metrics != null) { metricService.incrementReceived(metrics.size()); } log.debug("Tagging metrics with http parameter prefixes: {}", configuration.getHttpParameterTags()); Utils.tagMetrics(request, metrics, configuration.getHttpParameterTags()); if (configuration.isAuthEnabled()) { Subject subject = security.getSubject(); ZenossTenant tenant = subject.getPrincipals().oneByType(ZenossTenant.class); log.debug("Tagging metrics with tenant-id: {}", tenant.id()); Utils.injectTag("zenoss_tenant_id", tenant.id(), metrics); } Utils.filterMetricTags(metrics, configuration.getTagWhiteList()); String remoteIp = Utils.remoteAddress(request); return metricService.push(metrics, remoteIp, null); } catch (Exception e) { log.info("post(metricCollection={}, request={}", metricCollection, request); log.error("Unexpected exception: " + e.getMessage(), e); throw(e); } }
Source:
<code>public LiveServers apply(final InputStream inputStream) { final Load load = new Load(new LoadSettingsBuilder().build()); final Map<?, ?> yamlProps; try { yamlProps = (Map<?, ?>) load.loadFromInputStream(inputStream); } catch (final ClassCastException e) { throw new IllegalArgumentException("Invalid yaml format"); } if (yamlProps == null) { throw new IllegalArgumentException("Invalid yaml file"); } final String latest = (String) <START> Optional.ofNullable(yamlProps.get("latest")) <END> .orElseThrow( () -> new IllegalArgumentException("No 'latest' property found: " + yamlProps)); final List<ServerProperties> serverProperties = ((List<Map<String, String>>) yamlProps.get("servers")) .stream().map(this::mapToServerProperties).collect(Collectors.toList()); return LiveServers.builder() .latestEngineVersion(new Version(latest)) .servers(serverProperties) .build(); }</code><technical_language>I want get formatting argument here, I cleaner do string casting Optional#ofNullable</technical_language>

Target:
public LiveServers apply(final InputStream inputStream) { final Load load = new Load(new LoadSettingsBuilder().build()); final Map<?, ?> yamlProps; try { yamlProps = (Map<?, ?>) load.loadFromInputStream(inputStream); } catch (final ClassCastException e) { throw new IllegalArgumentException("Invalid yaml format"); } if (yamlProps == null) { throw new IllegalArgumentException("Invalid yaml file"); } final String latest = Optional.ofNullable((String) yamlProps.get("latest")) .orElseThrow( () -> new IllegalArgumentException("No 'latest' property found: " + yamlProps)); final List<ServerProperties> serverProperties = ((List<Map<String, String>>) yamlProps.get("servers")) .stream().map(this::mapToServerProperties).collect(Collectors.toList()); return LiveServers.builder() .latestEngineVersion(new Version(latest)) .servers(serverProperties) .build(); }
Source:
<code>public void serverPublishUnserialize(DataInputStream stream) { Block sixNodeCacheBlockOld = sixNodeCacheBlock; super.serverPublishUnserialize(stream); try { sixNodeCacheBlock = Block.getBlockById(stream.readInt()); sixNodeCacheBlockMeta = stream.readByte(); <START> int idx; for (idx = 0; idx < 6; idx++) { short id = stream.readShort(); if (id == 0) { elementRenderIdList[idx] = (short) 0; elementRenderList[idx] = null; } else { if (id != elementRenderIdList[idx]) { elementRenderIdList[idx] = id; SixNodeDescriptor descriptor = Eln.sixNodeItem.getDescriptor(id); elementRenderList[idx] = (SixNodeElementRender) descriptor.RenderClass.getConstructor(SixNodeEntity.class, Direction.class, SixNodeDescriptor.class).newInstance(this, Direction.fromInt(idx), descriptor); } elementRenderList[idx].publishUnserialize(stream); } } } catch (IOException e) { e.printStackTrace(); } catch (InstantiationException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (IllegalArgumentException e) { e.printStackTrace(); } catch (InvocationTargetException e) { e.printStackTrace(); } catch (NoSuchMethodException e) { e.printStackTrace(); } catch (SecurityException e) { <END> e.printStackTrace(); } if (sixNodeCacheBlock != sixNodeCacheBlockOld) { Chunk chunk = worldObj.getChunkFromBlockCoords(pos); chunk.generateHeightMap(); Utils.updateSkylight(chunk); chunk.generateSkylightMap(); Utils.updateAllLightTypes(worldObj, xCoord, yCoord, zCoord); } }</code><technical_language>This is worse</technical_language>

Target:
public void serverPublishUnserialize(DataInputStream stream) { super.serverPublishUnserialize(stream); try { sixNodeCacheBlock = Block.getBlockById(stream.readInt()); sixNodeCacheBlockMeta = stream.readByte(); int idx; for (idx = 0; idx < 6; idx++) { short id = stream.readShort(); if (id == 0) { elementRenderIdList[idx] = (short) 0; elementRenderList[idx] = null; } else { if (id != elementRenderIdList[idx]) { elementRenderIdList[idx] = id; SixNodeDescriptor descriptor = null; elementRenderList[idx] = (SixNodeElementRender) descriptor.RenderClass.getConstructor(SixNodeEntity.class, Direction.class, SixNodeDescriptor.class).newInstance(this, Direction.fromInt(idx), descriptor); } elementRenderList[idx].publishUnserialize(stream); } } } catch (IOException | InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException | NoSuchMethodException | SecurityException e) { e.printStackTrace(); } }
Source:
<code>public void initialize(AdvancedCache<?, ?> cache) { if (hsQuery == null) { QueryEngine<?> queryEngine = getQueryEngine(cache); HsQueryRequest hsQueryRequest; if (indexedType != null && sortableFields != null) { IndexedTypeMap<CustomTypeMetadata> metadata = createMetadata(); hsQueryRequest = queryEngine.createHsQuery(queryString, metadata, namedParameters); } else { hsQueryRequest = queryEngine.createHsQuery(queryString, null, namedParameters); } hsQuery = hsQueryRequest.getHsQuery(); sort = hsQueryRequest.getSort(); hsQuery.projection(hsQueryRequest.getProjections()); } <START> hsQuery.firstResult(firstResult); <END> hsQuery.maxResults(maxResults); }</code><technical_language>version of code setting firstResult maxResults time, if hsQuery == null</technical_language>

Target:
public void initialize(AdvancedCache<?, ?> cache) { if (hsQuery == null) { QueryEngine<?> queryEngine = getQueryEngine(cache); HsQueryRequest hsQueryRequest; if (indexedType != null && sortableFields != null) { IndexedTypeMap<CustomTypeMetadata> metadata = createMetadata(); hsQueryRequest = queryEngine.createHsQuery(queryString, metadata, namedParameters); } else { hsQueryRequest = queryEngine.createHsQuery(queryString, null, namedParameters); } hsQuery = hsQueryRequest.getHsQuery(); sort = hsQueryRequest.getSort(); hsQuery.projection(hsQueryRequest.getProjections()); hsQuery.firstResult(firstResult); hsQuery.maxResults(maxResults); } }
Source:
<code>public void waitForPageToLoad() { <START> waitFor(driver -> { <END> JavascriptExecutor javascriptExecutor = (JavascriptExecutor) checkNotNull(driver); return "complete".equals(javascriptExecutor.executeScript("return document.readyState")); }); }</code><technical_language>This replaced browser.waitForPageToLoad()</technical_language>

Target:
public void waitForPageToLoad() { browser.waitForPageLoad(); }
Source:
<code>public void testRocksDBKeyMayExistApi() throws Exception { try (RDBStore newStore = new RDBStore(folder.newFolder(), options, configSet)) { RocksDB db = newStore.getDb(); for (int i = 0; i < 100; i++) { db.put(StringUtils.getBytesUtf16("key" + i), StringUtils.getBytesUtf16("Value" + i)); } long start = System.nanoTime(); for (int i = 0; i < 50; i++) { Assert.assertTrue(db.get( StringUtils.getBytesUtf16("key" + i))!= null); } long end = System.nanoTime(); long keyGetLatency = end - start; start = System.nanoTime(); for (int i = 50; i < 100; i++) { Assert.assertTrue(db.get( StringUtils.getBytesUtf16("key" + i))!= null); <START> } <END> end = System.nanoTime(); long keyMayExistLatency = end - start; Assert.assertTrue(keyMayExistLatency < keyGetLatency); } }</code><technical_language>I understood this test is testing API</technical_language>

Target:
public void testRocksDBKeyMayExistApi() throws Exception { try (RDBStore newStore = new RDBStore(folder.newFolder(), options, configSet)) { RocksDB db = newStore.getDb(); long start = System.nanoTime(); for (int i = 0; i < 50; i++) { Assert.assertTrue(db.get( StringUtils.getBytesUtf16("key" + i))== null); } long end = System.nanoTime(); long keyGetLatency = end - start; start = System.nanoTime(); for (int i = 0; i < 50; i++) { Assert.assertFalse(db.keyMayExist( StringUtils.getBytesUtf16("key" + i), new StringBuilder())); } end = System.nanoTime(); long keyMayExistLatency = end - start; Assert.assertTrue(keyMayExistLatency < keyGetLatency); } }
Source:
<code>public boolean match(final ChangeData object) throws OrmException { for (PatchSetApproval p : object.currentApprovals(dbProvider)) { if (p.getCategoryId().equals(category)) { short psVal = p.getValue(); if (test.match(psVal, expVal)) { try { <START> ChangeControl cc = ccFactory.controlFor(object.change(dbProvider), END> userFactory.create(dbProvider, p.getAccountId())); if (!cc.isVisible()) { continue; } psVal = cc.normalize(category, psVal); } catch (NoSuchChangeException e) { continue; } if (test.match(psVal, expVal)) { return true; } } } } return false; }</code><technical_language>need ProjectState here. :-)</technical_language>

Target:
public boolean match(final ChangeData object) throws OrmException { for (PatchSetApproval p : object.currentApprovals(dbProvider)) { if (p.getCategoryId().equals(category)) { short psVal = p.getValue(); if (test.match(psVal, expVal)) { Change c = object.change(dbProvider); IdentifiedUser user = userFactory.create(dbProvider, p.getAccountId()); ChangeControl cc = object.projectState(dbProvider, projectCache).controlFor(user) .controlFor(c); if (!cc.isVisible()) { continue; } psVal = cc.normalize(category, psVal); if (test.match(psVal, expVal)) { return true; } } } } return false; }
Source:
<code>private static SimpleBlobStore createHttp(RemoteOptions options, Credentials creds) { Preconditions.checkNotNull(options.remoteCache, "remoteCache"); <START> Preconditions.checkArgument(options.remoteCache.startsWith("http"), "remoteCache should start with http"); <END> try { URI uri = URI.create(options.remoteCache); if (options.remoteCacheProxy != null) { if (options.remoteCacheProxy.startsWith("unix:")) { return HttpBlobStore.create( new DomainSocketAddress(options.remoteCacheProxy.replaceFirst("^unix:", "")), uri, options.remoteTimeout, options.remoteMaxConnections, creds); } else { throw new Exception("Remote cache proxy unsupported: " + options.remoteCacheProxy); } } else { return HttpBlobStore.create( uri, options.remoteTimeout, options.remoteMaxConnections, creds); } } catch (Exception e) { throw new RuntimeException(e); } }</code><technical_language>handle malformed user input gracefully. Throwing a runtime exception crashes server. Consider throwing a UserExecException instead</technical_language>

Target:
private static SimpleBlobStore createHttp(RemoteOptions options, Credentials creds) { Preconditions.checkNotNull(options.remoteCache, "remoteCache"); Preconditions.checkArgument(options.remoteCache.toLowerCase().startsWith("http"), "remoteCache should start with http"); try { URI uri = URI.create(options.remoteCache); if (options.remoteCacheProxy != null) { if (options.remoteCacheProxy.startsWith("unix:")) { return HttpBlobStore.create( new DomainSocketAddress(options.remoteCacheProxy.replaceFirst("^unix:", "")), uri, options.remoteTimeout, options.remoteMaxConnections, creds); } else { throw new Exception("Remote cache proxy unsupported: " + options.remoteCacheProxy); } } else { return HttpBlobStore.create( uri, options.remoteTimeout, options.remoteMaxConnections, creds); } } catch (Exception e) { throw new RuntimeException(e); } }
Source:
<code>public synchronized ZkHelixPropertyStore<ZNRecord> getHelixPropertyStore() { checkConnected(); if (_helixPropertyStore == null) { String path = PropertyPathConfig.getPath(PropertyType.PROPERTYSTORE, _clusterName); <START> String fallbackPath = String.format("/%s/%s", _clusterName, "PROPERTYSTORE"); <END> _helixPropertyStore = new AutoFallbackPropertyStore<ZNRecord>(new ZkBaseDataAccessor<ZNRecord>(_zkclient), path, fallbackPath); } return _helixPropertyStore; }</code><technical_language>This is for compatibility, need this users upgrade 0.6.2 newer versions</technical_language>

Target:
public synchronized ZkHelixPropertyStore<ZNRecord> getHelixPropertyStore() { checkConnected(); if (_helixPropertyStore == null) { String path = PropertyPathConfig.getPath(PropertyType.PROPERTYSTORE, _clusterName); String fallbackPath = String.format("/%s/%s", _clusterName, "HELIX_PROPERTYSTORE"); _helixPropertyStore = new AutoFallbackPropertyStore<ZNRecord>(new ZkBaseDataAccessor<ZNRecord>(_zkclient), path, fallbackPath); } return _helixPropertyStore; }
Source:
<code>public void testRegionServerPort() throws Exception { final TableName tableName = TableName.valueOf(name.getMethodName()); initTableRegions(tableName); MiniHBaseCluster cluster = TEST_UTIL.getHBaseCluster(); HRegionServer regionServer = cluster.getRegionServer(0); String rsName = regionServer.getServerName().getHostname(); final int PORT = 16021; Configuration conf = TEST_UTIL.getConfiguration(); String originalPort = conf.get(HConstants.REGIONSERVER_PORT); conf.set(HConstants.REGIONSERVER_PORT, Integer.toString(PORT)); RegionMoverBuilder rmBuilder = new RegionMoverBuilder(rsName, conf); assertEquals(PORT, rmBuilder.port); if (originalPort != null) { conf.set(HConstants.REGIONSERVER_PORT, originalPort); } <START> TEST_UTIL.getAdmin().disableTable(tableName); <END> TEST_UTIL.getAdmin().deleteTable(tableName); }</code><technical_language>in annotated method</technical_language>

Target:
public void testRegionServerPort() throws Exception { MiniHBaseCluster cluster = TEST_UTIL.getHBaseCluster(); HRegionServer regionServer = cluster.getRegionServer(0); String rsName = regionServer.getServerName().getHostname(); final int PORT = 16021; Configuration conf = TEST_UTIL.getConfiguration(); String originalPort = conf.get(HConstants.REGIONSERVER_PORT); conf.set(HConstants.REGIONSERVER_PORT, Integer.toString(PORT)); RegionMoverBuilder rmBuilder = new RegionMoverBuilder(rsName, conf); assertEquals(PORT, rmBuilder.port); if (originalPort != null) { conf.set(HConstants.REGIONSERVER_PORT, originalPort); } }
Source:
<code><START> public DatasetSourceTarget(URI uri, AvroType<E> avroType) { <END> this(Datasets.<E, View<E>>load(uri), avroType); }</code><technical_language>want expose this. Joey's work add types datasets, I thought get rid of type passing do of this internally</technical_language>

Target:
public DatasetSourceTarget(URI uri, AvroType<E> avroType) { this(Datasets.load(uri, avroType.getTypeClass()), avroType); }
Source:
<code>public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { final String authorization = ((HttpServletRequest) request).getHeader("Authorization"); if (isValidAuthorizationHeader(authorization)) { try { chain.doFilter(request, response); } finally { <START> MDC.remove(GATEWAY_ACCOUNT_ID); <END> } } else { ((HttpServletResponse) response).sendError(UNAUTHORIZED.getStatusCode(), UNAUTHORIZED.getReasonPhrase()); } }</code><technical_language>This incongruent - define a dedicated filter for managing request-lifecycle MDC keys</technical_language>

Target:
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { final String authorization = ((HttpServletRequest) request).getHeader("Authorization"); if (isValidAuthorizationHeader(authorization)) { chain.doFilter(request, response); } else { ((HttpServletResponse) response).sendError(UNAUTHORIZED.getStatusCode(), UNAUTHORIZED.getReasonPhrase()); } }
Source:
<code>private void updateParentContainerStructureFrom(CollectionElementVariable2 elemVar, ConstraintVariable2 v1) { ConstraintVariable2 elemContainer= elemVar.getParentConstraintVariable(); ParametricStructure elemContainerStructure= elemStructure(elemContainer); if (elemContainerStructure == ParametricStructure.NONE) return; if (elemContainerStructure == null) { elemContainerStructure= newParametricType(elemContainer.getType()); setStructureAndPush(elemContainer, elemContainerStructure); } ParametricStructure v1Structure= elemStructure(v1); int parmIdx= elemVar.getDeclarationTypeVariableIndex(); if (parmIdx == CollectionElementVariable2.NOT_DECLARED_TYPE_VARIABLE_INDEX) return; if (elemContainerStructure == v1Structure || containsSubStructure(v1Structure, elemContainerStructure)) { if <START> ((elemStructure(elemVar) != ParametricStructure.NONE)) <END> setStructureAndPush(elemVar, ParametricStructure.NONE); if (elemContainerStructure.getParameters()[parmIdx] == null) { elemContainerStructure.getParameters()[parmIdx]= ParametricStructure.NONE; fWorkList2.push(elemContainer); } } else if (updateStructureOfIthParamFrom(elemContainerStructure, parmIdx, v1Structure)) { setStructureAndPush(elemVar, elemContainerStructure.getParameters()[parmIdx]); fWorkList2.push(elemContainer); if (DEBUG_INITIALIZATION) System.out.println(" updated structure of " + elemContainer + " to " + elemContainerStructure); } }</code><technical_language>Another case of a refactoring sense improve readability. brackets removed then</technical_language>

Target:
private void updateParentContainerStructureFrom(CollectionElementVariable2 elemVar, ConstraintVariable2 v1) { ConstraintVariable2 elemContainer= elemVar.getParentConstraintVariable(); ParametricStructure elemContainerStructure= elemStructure(elemContainer); if (elemContainerStructure == ParametricStructure.NONE) return; if (elemContainerStructure == null) { elemContainerStructure= newParametricType(elemContainer.getType()); setStructureAndPush(elemContainer, elemContainerStructure); } ParametricStructure v1Structure= elemStructure(v1); int parmIdx= elemVar.getDeclarationTypeVariableIndex(); if (parmIdx == CollectionElementVariable2.NOT_DECLARED_TYPE_VARIABLE_INDEX) return; if (elemContainerStructure == v1Structure || containsSubStructure(v1Structure, elemContainerStructure)) { if (elemStructure(elemVar) != ParametricStructure.NONE) setStructureAndPush(elemVar, ParametricStructure.NONE); if (elemContainerStructure.getParameters()[parmIdx] == null) { elemContainerStructure.getParameters()[parmIdx]= ParametricStructure.NONE; fWorkList2.push(elemContainer); } } else if (updateStructureOfIthParamFrom(elemContainerStructure, parmIdx, v1Structure)) { setStructureAndPush(elemVar, elemContainerStructure.getParameters()[parmIdx]); fWorkList2.push(elemContainer); if (DEBUG_INITIALIZATION) System.out.println(" updated structure of " + elemContainer + " to " + elemContainerStructure); } }
Source:
<code>protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); try { onCreateAware(savedInstanceState); } catch (SessionUnavailableException e) { SessionActivityRegistration.redirectToLogin(this); <START> } <END> }</code><technical_language>I try find alternative exposing onCreateAware wrapping call in a try/catch. is good avoid wrapping large pieces of code in try/catch statements lets lazy fail. poke if I ideas</technical_language>

Target:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); try { onCreateSessionSafe(savedInstanceState); } catch (SessionUnavailableException e) { SessionActivityRegistration.redirectToLogin(this); } }
Source:
<code>public void testDownloadVersion() throws Exception { File[] files = HazelcastVersionLocator.locateVersion("4.0", folder.getRoot(), true); assertHash(files[HAZELCAST_JAR_INDEX], "bc409b12b96ece6d05c3bd1e99b202bb", "OS"); assertHash(files[1], "220509ece9fc152525c91ba7c75ce600", "OS tests"); <START> assertHash(files[2], "765816e628ca4ca57d5bd7387e761eaa", "EE"); <END> assertHash(files[3], "162bcb2412570845e6fd91ee61b54f94", "EE tests"); }</code><technical_language>HAZELCAST_EE_JAR_INDEX</technical_language>

Target:
public void testDownloadVersion() throws Exception { File[] files = HazelcastVersionLocator.locateVersion("4.0", folder.getRoot(), true); assertHash(files[HAZELCAST_JAR_INDEX], "bc409b12b96ece6d05c3bd1e99b202bb", "OS"); assertHash(files[HAZELCAST_TESTS_JAR_INDEX], "220509ece9fc152525c91ba7c75ce600", "OS tests"); assertHash(files[HAZELCAST_EE_JAR_INDEX], "765816e628ca4ca57d5bd7387e761eaa", "EE"); assertHash(files[HAZELCAST_EE_TESTS_JAR_INDEX], "162bcb2412570845e6fd91ee61b54f94", "EE tests"); }
Source:
<code>public void addDrugReferenceMap(DrugReferenceMap drugReferenceMap) { if (drugReferenceMap != null && !drugReferenceMaps.contains(drugReferenceMap)) { drugReferenceMap.setDrug(this); if (drugReferenceMap.getConceptMapType() == null) { drugReferenceMap.setConceptMapType(Context.getConceptService().getDefaultConceptMapType()); } <START> drugReferenceMaps.add(drugReferenceMap); <END> } }</code><technical_language>get a NullPointerException here, this instead: getDrugReferenceMaps().add(drugReferenceMap); getDrugReferenceMaps() checks if null instantiates collection</technical_language>

Target:
public void addDrugReferenceMap(DrugReferenceMap drugReferenceMap) { if (drugReferenceMap != null && !getDrugReferenceMaps().contains(drugReferenceMap)) { drugReferenceMap.setDrug(this); if (drugReferenceMap.getConceptMapType() == null) { drugReferenceMap.setConceptMapType(Context.getConceptService().getDefaultConceptMapType()); } getDrugReferenceMaps() .add(drugReferenceMap); } }
Source:
<code>private void deleteCachedFileIfNeeded(Path filePath) { try { if (Files.isDirectory(filePath)) { return; } FileTime lastAccessTime = Files.readAttributes(filePath, BasicFileAttributes.class).lastAccessTime(); if (lastAccessTime.toMillis() + cacheLifeTime < calendar.getTimeInMillis()) { <START> System.out.println("deleting: " + filePath.toString()); <END> Files.deleteIfExists(filePath); } } catch (IOException e) { e.printStackTrace(); } }</code><technical_language>1 Euro for System.out.println pls</technical_language>

Target:
private void deleteCachedFileIfNeeded(Path filePath) { try { ResourceLocks.acquireDiskLock(); FileTime lastAccessTime = Files.readAttributes(filePath, BasicFileAttributes.class).lastAccessTime(); OffsetDateTime comparableLastAccessTime = OffsetDateTime.ofInstant(lastAccessTime.toInstant(), ZoneId.systemDefault()); final boolean olderThanCacheTime = comparableLastAccessTime.plusDays(preferencesService.getPreferences().getCacheLifeTimeInDays()).isBefore(OffsetDateTime.now()); final boolean gameDataCacheActivated = preferencesService.getPreferences().isGameDataCacheActivated(); if (olderThanCacheTime || !gameDataCacheActivated) { log.debug("Deleting cached file ''{}'' ", filePath.toString()); Files.deleteIfExists(filePath); } } catch (IOException e) { log.error("Exception during deleting the cache files", e); } finally { ResourceLocks.freeDiskLock(); } }