auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>protected void eventHandle(@NonNull ITmfEvent event) { ITmfStateSystemBuilder ss = getStateSystemBuilder(); if (ss == null) { return; } String phase = event.getContent().getFieldValue(String.class, ITraceEventConstants.PHASE); if (phase == null) { return; } long t = event.getTimestamp().toNanos(); int quark = ITmfStateSystem.INVALID_ATTRIBUTE; Object id = TmfTraceUtils.resolveEventAspectOfClassForEvent(event.getTrace(), TraceEventAspects.ID_ASPECT.getClass(), event); String name = String.valueOf(TmfTraceUtils.resolveAspectOfNameForEvent(event.getTrace(), "Name", event)); if (id == null) { return; } switch (phase) { case TraceEventPhases.OBJECT_CREATED: quark = ss.getQuarkAbsoluteAndAdd(name, String.valueOf(id)); ss.modifyAttribute(t, "", quark); break; case TraceEventPhases.OBJECT_SNAPSHOT: quark = ss.getQuarkAbsoluteAndAdd(name, String.valueOf(id)); ss.modifyAttribute(t, String.valueOf(TraceEventAspects.ARGS_ASPECT.resolve(event)), quark); break; case TraceEventPhases.OBJECT_DESTROYED: quark = ss.getQuarkAbsoluteAndAdd(name, String.valueOf(id)); ss.modifyAttribute(t, <START> TmfStateValue.nullValue(), quark); <END> break; default: break; } }</code><technical_language>nan</technical_language>

Target:
protected void eventHandle(@NonNull ITmfEvent event) { ITmfStateSystemBuilder ss = getStateSystemBuilder(); if (ss == null) { return; } String phase = event.getContent().getFieldValue(String.class, ITraceEventConstants.PHASE); if (phase == null) { return; } long t = event.getTimestamp().toNanos(); int quark = ITmfStateSystem.INVALID_ATTRIBUTE; Object id = TmfTraceUtils.resolveEventAspectOfClassForEvent(event.getTrace(), TraceEventAspects.ID_ASPECT.getClass(), event); String name = String.valueOf(TmfTraceUtils.resolveAspectOfNameForEvent(event.getTrace(), "Name", event)); if (id == null) { return; } switch (phase) { case TraceEventPhases.OBJECT_CREATED: quark = ss.getQuarkAbsoluteAndAdd(name, String.valueOf(id)); ss.modifyAttribute(t, "", quark); break; case TraceEventPhases.OBJECT_SNAPSHOT: quark = ss.getQuarkAbsoluteAndAdd(name, String.valueOf(id)); ss.modifyAttribute(t, String.valueOf(TraceEventAspects.ARGS_ASPECT.resolve(event)), quark); break; case TraceEventPhases.OBJECT_DESTROYED: quark = ss.getQuarkAbsoluteAndAdd(name, String.valueOf(id)); ss.modifyAttribute(t, (Object)null, quark); break; default: break; } }
Source:
<code>public void validate_shouldFailValidationIfNumRefillsIsNullForOutpatientCareSetting() throws Exception { DrugOrder OutpatientOrder = new DrugOrder(); CareSetting outpatientCareSetting = new CareSetting("OPD", "Outpatient", CareSetting.CareSettingType.OUTPATIENT); OutpatientOrder.setCareSetting(outpatientCareSetting); <START> OutpatientOrder.setNumRefills(null); <END> Errors OutpatientOrderErrors = new BindException(OutpatientOrder, "order"); new DrugOrderValidator().validate(OutpatientOrder, OutpatientOrderErrors); Assert.assertTrue(OutpatientOrderErrors.hasFieldErrors("numRefills")); DrugOrder inPatientOrder = new DrugOrder(); CareSetting inpatientCareSetting = new CareSetting("IPD", "Inpatient", CareSetting.CareSettingType.INPATIENT); inPatientOrder.setCareSetting(inpatientCareSetting); inPatientOrder.setNumRefills(null); Errors InpatientOrderErrors = new BindException(inPatientOrder, "order"); new DrugOrderValidator().validate(inPatientOrder, InpatientOrderErrors); Assert.assertFalse(InpatientOrderErrors.hasFieldErrors("numRefills")); }</code><technical_language>This redundant, I assume this is null default</technical_language>

Target:
public void validate_shouldFailValidationIfNumRefillsIsNullForOutpatientCareSetting() throws Exception { DrugOrder OutpatientOrder = new DrugOrder(); OutpatientOrder.setCareSetting(Context.getOrderService().getCareSetting(1)); OutpatientOrder.setNumRefills(null); Errors OutpatientOrderErrors = new BindException(OutpatientOrder, "order"); new DrugOrderValidator().validate(OutpatientOrder, OutpatientOrderErrors); Assert.assertTrue(OutpatientOrderErrors.hasFieldErrors("numRefills")); DrugOrder inPatientOrder = new DrugOrder(); inPatientOrder.setCareSetting(Context.getOrderService().getCareSetting(2)); inPatientOrder.setNumRefills(null); Errors InpatientOrderErrors = new BindException(inPatientOrder, "order"); new DrugOrderValidator().validate(inPatientOrder, InpatientOrderErrors); Assert.assertFalse(InpatientOrderErrors.hasFieldErrors("numRefills")); }
Source:
<code>private Boolean hasExistingTitle(Element mods) { <START> Boolean hasOldTitle; <END> try { Element title = mods.getChild("titleInfo", MODS_V3_NS).getChild("title", MODS_V3_NS); hasOldTitle = true; } catch (NullPointerException e) { hasOldTitle = false; } return hasOldTitle; }</code><technical_language>skip a variable immediately return true false (its fine return in catch block). Also, return type need a Boolean in this case, primative boolean fine</technical_language>

Target:
private boolean hasExistingTitle(Element mods) { boolean hasOldTitle; try { Element title = mods.getChild("titleInfo", MODS_V3_NS).getChild("title", MODS_V3_NS); hasOldTitle = true; } catch (NullPointerException e) { hasOldTitle = false; } return hasOldTitle; }
Source:
<code>public Builder(final ApiContext<AbiquoApi> context, final Datacenter datacenter) { super(); this.context = context; <START> this.datacenter = datacenter; <END> }</code><technical_language>this field is mandatory, add a checkNotNull check for it</technical_language>

Target:
public Builder(final ApiContext<AbiquoApi> context, final Datacenter datacenter) { this.context = checkNotNull(context, "missing context object"); this.datacenter = checkNotNull(datacenter, "missing datacenter object"); }
Source:
<code>public void testAggregateDisksSnapshots() { List<Disk> <START> diskImagesTestParam = <END> new ArrayList<>(); diskImagesTestParam.add(diskWithSnapshots); diskImagesTestParam.add(diskWithoutSnapshots); diskImagesTestParam.addAll(snapshotsList); diskImagesTestParam.add(ovfImage); diskImagesTestParam.add(cinderDisk); diskImagesTestParam.add(lunDisk); Collection<Disk> disks = getQuery().aggregateDisksSnapshots(diskImagesTestParam); assertAllDisksAreActive(disks); assertEquals("should be a total of four disks", 5, disks.size()); }</code><technical_language>nodes setUpDaoMocks? extract something? Plus, I name - contains disk images, is a test param</technical_language>

Target:
public void testAggregateDisksSnapshots() { List<Disk> disks = new ArrayList<>(Arrays.asList(diskWithSnapshots, diskWithoutSnapshots, ovfImage, cinderDisk, lunDisk)); disks.addAll(snapshotsList); Collection<Disk> result = getQuery().aggregateDisksSnapshots(disks); assertAllDisksAreActive(result); assertEquals("wrong number of disks returned", 5, result.size()); }
Source:
<code>public void store(Item item, String alias) { if (item.getState() instanceof UnDefType) { return; } if (!isProperlyConfigured) { logger.warn("Configuration for influxdb not yet loaded or broken."); return; } if (!isConnected()) { logger.warn("InfluxDB is not yet connected"); return; } String realName = item.getName(); String name = (alias != null) ? alias : realName; State state = null; if (item.getAcceptedCommandTypes().contains(HSBType.class)) { state = item.getStateAs(HSBType.class); logger.trace("got hsbtype", state.toString()); } else if (item.getAcceptedDataTypes().contains(PercentType.class)) { state = item.getStateAs(PercentType.class); logger.trace("percentype item found {}", name); } else { <START> logger.trace("other item found"); <END> state = item.getState(); } Object value = stateToObject(state); logger.trace("storing in influxdb value {}, {}", name, value, item); Point point = Point.measurement(name).field(VALUE_COLUMN_NAME, value) .time(System.currentTimeMillis(), timeUnit).build(); try { influxDB.write(dbName, "default", point); } catch (RuntimeException e) { logger.error("storing failed with exception for item: {}", name); handleDatabaseException(e); } }</code><technical_language>unify states logged in order ease debugging. linke "Tried get item {}"</technical_language>

Target:
public void store(Item item, String alias) { if (item.getState() instanceof UnDefType) { return; } if (!isProperlyConfigured) { logger.warn("Configuration for influxdb not yet loaded or broken."); return; } if (!isConnected()) { logger.warn("InfluxDB is not yet connected"); return; } String realName = item.getName(); String name = (alias != null) ? alias : realName; State state = null; if (item.getAcceptedCommandTypes().contains(HSBType.class)) { state = item.getStateAs(HSBType.class); logger.trace("Tried to get item as {}, state is {}", HSBType.class, state.toString()); } else if (item.getAcceptedDataTypes().contains(PercentType.class)) { state = item.getStateAs(PercentType.class); logger.trace("Tried to get item as {}, state is {}", PercentType.class, state.toString()); } else { state = item.getState(); logger.trace("Tried to get item from item class {}, state is {}", item.getClass(), state.toString()); } Object value = stateToObject(state); logger.trace("storing in influxdb value {}, {}", name, value, item); Point point = Point.measurement(name).field(VALUE_COLUMN_NAME, value) .time(System.currentTimeMillis(), timeUnit).build(); try { influxDB.write(dbName, "default", point); } catch (RuntimeException e) { logger.error("storing failed with exception for item: {}", name); handleDatabaseException(e); } }
Source:
<code>private Map<String, Object> getRootObject(InputStream input) throws CatalogTransformerException { Map<String, Object> rootObject; try { <START> rootObject = GSON.fromJson(new InputStreamReader(input), MAP_STRING_TO_OBJECT_TYPE); <END> } catch (JsonParseException e) { throw new CatalogTransformerException("Invalid JSON input", e); } if (rootObject == null) { throw new CatalogTransformerException("Unable to parse JSON for metacard."); } return rootObject; }</code><technical_language>Is default charset valid here</technical_language>

Target:
private Map<String, Object> getRootObject(InputStream input) throws CatalogTransformerException { Map<String, Object> rootObject; try { rootObject = GSON.fromJson( new InputStreamReader(input, StandardCharsets.UTF_8), MAP_STRING_TO_OBJECT_TYPE); } catch (JsonParseException e) { throw new CatalogTransformerException("Invalid JSON input", e); } if (rootObject == null) { throw new CatalogTransformerException("Unable to parse JSON for metacard."); } return rootObject; }
Source:
<code>public AlreadyReportedRepositoryAccessException(Exception e) { super(e.getMessage(), e.getCause()); checkState(e instanceof NoSuchPackageException || e instanceof IOException || e instanceof EvalException <START> || e instanceof ExternalPackageException); <END> }</code><technical_language>nit: add e a debugging parameter</technical_language>

Target:
public AlreadyReportedRepositoryAccessException(Exception e) { super(e.getMessage(), e.getCause()); checkState(e instanceof NoSuchPackageException || e instanceof IOException || e instanceof EvalException || e instanceof ExternalPackageException, e); }
Source:
<code>private void storeQuery(String query) { ContentValues cv = new ContentValues(); cv.put(SearchHistory.QUERY, query); <START> getContentResolver().insert(SearchHistory.CONTENT_URI, cv); <END> }</code><technical_language>this a background thread, block UI. example of do in Fennec: <LINK_0></technical_language>

Target:
private void storeQuery(String query) { final ContentValues cv = new ContentValues(); cv.put(SearchHistory.QUERY, query); queryHandler.startInsert(0, null, SearchHistory.CONTENT_URI, cv); }
Source:
<code>public String websocket() { String url = build().toString(); url = "wss" + url.substring(url.indexOf(":")); <START> LOG.debug(String.format("Built url: %s", url)); <END> return url; }</code><technical_language>LOG.debug("Built url: {}", url); .format() get evaluated if in debug mode</technical_language>

Target:
public String websocket() { String url = build().toString(); url = "wss" + url.substring(url.indexOf(":")); if(LOG.isDebugEnabled()) { LOG.debug(String.format("Built url: %s", url)); } return url; }
Source:
<code>public void owner(String owner) throws RestApiException { String restPath = getRequestPath() + "/owner"; <START> JsonElement result = gerritRestClient.putRequest(restPath, owner); <END> }</code><technical_language>Variable result removed</technical_language>

Target:
public void owner(String owner) throws RestApiException { String restPath = getRequestPath() + "/owner"; gerritRestClient.putRequest(restPath, owner); }
Source:
<code>public View getView(int position, View convertView, ViewGroup parent) { CommentView v; if (convertView == null) { v = new CommentView(mContext); } else { v = (CommentView) convertView; } Comment comment = getItem(position); v.buildView(comment); LinearLayout replyContainer = (LinearLayout) v.findViewById(R.id.comment_replies); replyContainer.removeAllViews(); for (Comment reply : comment.mReplies) { <START> if (reply.mParentid == comment.mCommentid) { <END> CommentView replyView = new CommentView(mContext); replyView.buildView(reply); replyView.setPadding(0, 0, 0, 0); replyContainer.addView(replyView); } } replyContainer.setVisibility(replyContainer.getChildCount() != 0 ? View.VISIBLE : View.GONE); return v; }</code><technical_language>this true</technical_language>

Target:
public View getView(int position, View convertView, ViewGroup parent) { CommentView v; if (convertView == null) { v = new CommentView(mContext); } else { v = (CommentView) convertView; } Comment comment = getItem(position); v.buildView(comment); LinearLayout replyContainer = (LinearLayout) v.findViewById(R.id.comment_replies); replyContainer.removeAllViews(); for (Comment reply : comment.mReplies) { CommentView replyView = new CommentView(mContext); replyView.buildView(reply); replyView.setPadding(0, 0, 0, 0); replyContainer.addView(replyView); } replyContainer.setVisibility(replyContainer.getChildCount() != 0 ? View.VISIBLE : View.GONE); return v; }
Source:
<code>public void showAvailableApps() { this.showDetailsView(null); <START> showRightView(availableApps); <END> }</code><technical_language>name of method showRightView is kind of misleading in this case, I expect set details view in this case, is "right" view shown user. I suggest rename else</technical_language>

Target:
public void showAvailableApps() { this.closeDetailsView(); setCenter(availableApps); }
Source:
<code>private Vector<ChangeBasedEvent> createEventsFromString(String eventsString) { Vector<ChangeBasedEvent> events = new Vector<ChangeBasedEvent>(); Scanner scanner = new Scanner(eventsString); while (scanner.hasNextLine()) { String line = scanner.nextLine(); logger.debug("found line: {}", line); JSONObject jsonObject = JSONObject.fromObject(line); GerritEvent evt = GerritJsonEventFactory.getEvent(jsonObject); <START> if (evt instanceof ChangeBasedEvent) { <END> Provider provider = new Provider(); provider.setName(serverName); ((GerritTriggeredEvent)evt).setProvider(provider); events.add((ChangeBasedEvent)evt); } } scanner.close(); return events; }</code><technical_language>ChangeBasedEvents? ref-updated well</technical_language>

Target:
private List<GerritTriggeredEvent> createEventsFromString(String eventsString) { List<GerritTriggeredEvent> events = Collections.synchronizedList(new ArrayList<GerritTriggeredEvent>()); Scanner scanner = new Scanner(eventsString); while (scanner.hasNextLine()) { String line = scanner.nextLine(); logger.debug("found line: {}", line); JSONObject jsonObject = JSONObject.fromObject(line); GerritEvent evt = GerritJsonEventFactory.getEvent(jsonObject); if (evt instanceof ChangeBasedEvent) { Provider provider = new Provider(); provider.setName(serverName); ((GerritTriggeredEvent)evt).setProvider(provider); events.add((ChangeBasedEvent)evt); } } scanner.close(); return events; }
Source:
<code>public void finished() { boolean processResults = result; if(!result) { DialogDisplayer.getDefault().notify(new NotifyDescriptor.Message( "Tool execution failed or canceled by user. Output files were not written.")); } progressHandle.finish(); Storage motion = null; if(analyzeTool().getStatesStorage()!=null) { motion = new Storage(analyzeTool().getStatesStorage()); } updateMotion(motion); if (staticOptimizationMode){ StaticOptimization soA = StaticOptimization.safeDownCast(getModel().getAnalysisSet().get("StaticOptimization")); Storage storage = soA.getActivationStorage(); <START> storage.print("soout.sto"); <END> MotionDisplayer motionDisplayer = new MotionDisplayer(storage, getOriginalModel()); MuscleColoringFunction mcbya = new MuscleColorByActivationStorage( OpenSimDB.getInstance().getContext(getOriginalModel()), storage); motionDisplayer.setMuscleColoringFunction(mcbya); } getModel().removeAnalysis(interruptingCallback, false); interruptingCallback = null; if(result) resetModified(); setExecuting(false); SimulationDB.getInstance().fireToolFinish(); worker = null; }</code><technical_language>Is this line necessary</technical_language>

Target:
public void finished() { boolean processResults = result; if(!result) { DialogDisplayer.getDefault().notify(new NotifyDescriptor.Message( "Tool execution failed or canceled by user. Output files were not written.")); } progressHandle.finish(); Storage motion = null; if(analyzeTool().getStatesStorage()!=null) { motion = new Storage(analyzeTool().getStatesStorage()); } updateMotion(motion); if (staticOptimizationMode){ StaticOptimization soA = StaticOptimization.safeDownCast(getModel().getAnalysisSet().get("StaticOptimization")); Storage storage = soA.getActivationStorage(); MotionDisplayer motionDisplayer = new MotionDisplayer(storage, getOriginalModel()); MuscleColoringFunction mcbya = new MuscleColorByActivationStorage( OpenSimDB.getInstance().getContext(getOriginalModel()), storage); motionDisplayer.setMuscleColoringFunction(mcbya); } getModel().removeAnalysis(interruptingCallback, false); interruptingCallback = null; if(result) resetModified(); setExecuting(false); SimulationDB.getInstance().fireToolFinish(); worker = null; }
Source:
<code>public ProgramState checkPreStatement(CheckerContext context, Tree syntaxNode) { if (syntaxNode.is(Tree.Kind.METHOD_INVOCATION)) { MethodInvocationTree mit = (MethodInvocationTree) syntaxNode; if (MAP_PUT.matches(mit)) { ProgramState ps = context.getState(); SymbolicValue keySV = ps.peekValue(1); SymbolicValue mapSV = ps.peekValue(2); <START> if(!isMethodInvocationThrowingCheckedException(mit.arguments().get(1))) { <END> mapGetInvocations.get(mapSV).stream() .filter(getOnSameMap -> getOnSameMap.withSameKey(keySV)) .findAny() .ifPresent(getOnSameMap -> { ObjectConstraint constraint = ps.getConstraint(getOnSameMap.value, ObjectConstraint.class); if (constraint != null && isInsideIfStatementWithNullCheckWithoutElse(mit)) { checkIssues.add(new CheckIssue(context.getNode(), getOnSameMap.mit, mit, getOnSameMap.value, constraint)); } }); } } } return super.checkPreStatement(context, syntaxNode); }</code><technical_language>I prefer merge if line 100 , logically equivalent I more clear</technical_language>

Target:
public ProgramState checkPreStatement(CheckerContext context, Tree syntaxNode) { if (syntaxNode.is(Tree.Kind.METHOD_INVOCATION)) { MethodInvocationTree mit = (MethodInvocationTree) syntaxNode; if (MAP_PUT.matches(mit) && !isMethodInvocationThrowingCheckedException(mit.arguments().get(1))) { ProgramState ps = context.getState(); SymbolicValue keySV = ps.peekValue(1); SymbolicValue mapSV = ps.peekValue(2); mapGetInvocations.get(mapSV).stream() .filter(getOnSameMap -> getOnSameMap.withSameKey(keySV)) .findAny() .ifPresent(getOnSameMap -> { ObjectConstraint constraint = ps.getConstraint(getOnSameMap.value, ObjectConstraint.class); if (constraint != null && isInsideIfStatementWithNullCheckWithoutElse(mit)) { checkIssues.add(new CheckIssue(context.getNode(), getOnSameMap.mit, mit, getOnSameMap.value, constraint)); } }); } } return super.checkPreStatement(context, syntaxNode); }
Source:
<code>public void replaceLambdaIssue1290() { MethodCallExpr methodCallExpr = parseExpression("callSomeFun(r -> r instanceof SomeType)").asMethodCallExpr(); LambdaExpr lambdaExpr = methodCallExpr.getArgument(0).asLambdaExpr(); MethodCallExpr lambdaWrapper = new MethodCallExpr("lambdaWrapper"); lambdaExpr.replace(lambdaWrapper); <START> assertEquals(2, methodCallExpr.getChildNodes().size()); <END> }</code><technical_language>add a check node replaced a null parent</technical_language>

Target:
public void replaceLambdaIssue1290() { MethodCallExpr methodCallExpr = parseExpression("callSomeFun(r -> r instanceof SomeType)").asMethodCallExpr(); LambdaExpr lambdaExpr = methodCallExpr.getArgument(0).asLambdaExpr(); MethodCallExpr lambdaWrapper = new MethodCallExpr("lambdaWrapper"); lambdaExpr.replace(lambdaWrapper); assertEquals(2, methodCallExpr.getChildNodes().size()); assertEquals(empty(), lambdaExpr.getParentNode()); }
Source:
<code>public void process() throws IOException { String name = regionInfo.getEncodedName(); LOG.trace("Processing close of {}", name); String encodedRegionName = regionInfo.getEncodedName(); HRegion region = (HRegion)rsServices.getRegion(encodedRegionName); if (region == null) { LOG.warn("Received CLOSE for region but currently not serving - ignoring", name); return; } if (region.close(abort) == null) { LOG.warn("Can't close region {}, was already closed during close()", name); return; } this.rsServices.removeRegion(region, destination); rsServices.reportRegionStateTransition(new RegionStateTransitionContext(TransitionCode.CLOSED, HConstants.NO_SEQNUM, Procedure.NO_PROC_ID, -1, regionInfo)); this.rsServices.getRegionsInTransitionInRS(). remove(this.regionInfo.getEncodedNameAsBytes(), Boolean.FALSE); <START> LOG.debug("Closed " + region.getRegionInfo().getRegionNameAsString()); <END> }</code><technical_language>LOG.debug("Closed {}", region.getRegionInfo().getRegionNameAsString());</technical_language>

Target:
public void process() throws IOException { String name = regionInfo.getEncodedName(); LOG.trace("Processing close of {}", name); String encodedRegionName = regionInfo.getEncodedName(); HRegion region = (HRegion)rsServices.getRegion(encodedRegionName); try { if (region == null) { LOG.warn("Received CLOSE for region but currently not serving - ignoring", name); return; } if (region.close(abort) == null) { LOG.warn("Can't close {}; already closed", name); return; } this.rsServices.removeRegion(region, destination); rsServices.reportRegionStateTransition(new RegionStateTransitionContext(TransitionCode.CLOSED, HConstants.NO_SEQNUM, Procedure.NO_PROC_ID, -1, regionInfo)); this.rsServices.getRegionsInTransitionInRS(). remove(this.regionInfo.getEncodedNameAsBytes(), Boolean.FALSE); LOG.debug("Closed {}" + region.getRegionInfo().getRegionNameAsString()); } finally { this.rsServices.getRegionsInTransitionInRS().remove(regionInfo.getEncodedNameAsBytes()); } }
Source:
<code>public void testFindAllIDs() throws DataException { List<Integer> allIDs = ServiceManager.getProcessService().findAllIDs(); <START> System.out.println(allIDs); <END> Assert.assertEquals("Wrong amount of id's in index", 7, allIDs.size()); Assert.assertTrue("id's contain wrong entries", allIDs.containsAll(Arrays.asList(5, 2, 6, 4, 1, 7, 3))); }</code><technical_language>suggestion</technical_language>

Target:
public void testFindAllIDs() throws DataException { List<Integer> allIDs = ServiceManager.getProcessService().findAllIDs(); Assert.assertEquals("Wrong amount of id's in index", 7, allIDs.size()); Assert.assertTrue("id's contain wrong entries", allIDs.containsAll(Arrays.asList(5, 2, 6, 4, 1, 7, 3))); }
Source:
<code>EnvironmentVariableContext getEnvironmentVariableContextFromEnvironment(String pipelineName) { <START> EnvironmentConfig environmentConfig = environmentConfigService.environmentForPipeline(pipelineName); <END> if (environmentConfig == null) { return null; } secretParamResolver.resolve(environmentConfig); EnvironmentVariableContext environmentVariableContext = new EnvironmentVariableContext(GO_ENVIRONMENT_NAME, CaseInsensitiveString.str(environmentConfig.name())); environmentConfig.getVariables().forEach(variable -> { environmentVariableContext.setProperty(variable.getName(), variable.valueForCommandline(), variable.isSecure() || variable.hasSecretParams()); }); return environmentVariableContext; }</code><technical_language>Optional: Consider renaming environmentConfig pipelineEnvironment environmentForPipeline</technical_language>

Target:
EnvironmentVariableContext getEnvironmentVariableContextFromEnvironment(String pipelineName) { EnvironmentConfig environmentForPipeline = environmentConfigService.environmentForPipeline(pipelineName); if (environmentForPipeline == null) { return null; } secretParamResolver.resolve(environmentForPipeline); EnvironmentVariableContext environmentVariableContext = new EnvironmentVariableContext(GO_ENVIRONMENT_NAME, CaseInsensitiveString.str(environmentForPipeline.name())); environmentForPipeline.getVariables().forEach(variable -> { environmentVariableContext.setProperty(variable.getName(), variable.valueForCommandline(), variable.isSecure() || variable.hasSecretParams()); }); return environmentVariableContext; }
Source:
<code>public synchronized Set<TopicPartition> getPartitionsNeedingInit() { <START> return _needingInit; <END> }</code><technical_language>Collections.unmodifiableSet()</technical_language>

Target:
public synchronized Set<TopicPartition> getPartitionsNeedingInit() { return Collections.unmodifiableSet(_needingInit); }
Source:
<code><START> public TaskStateModelFactory(HelixManager manager, Map<String, TaskFactory> taskFactoryRegistry, <END> ScheduledExecutorService taskExecutor) { _manager = manager; _taskFactoryRegistry = taskFactoryRegistry; _taskExecutor = taskExecutor; _timerTaskExecutor = createTimerTaskExecutor(); initializeTaskMonitor(); }</code><technical_language>Deprecate? if is this method, is current thread pool size in live instance node</technical_language>

Target:
public TaskStateModelFactory(HelixManager manager, Map<String, TaskFactory> taskFactoryRegistry, ScheduledExecutorService taskExecutor) { _manager = manager; _taskFactoryRegistry = taskFactoryRegistry; _taskExecutor = taskExecutor; _timerTaskExecutor = Executors.newSingleThreadScheduledExecutor(new ThreadFactory() { @Override public Thread newThread(Runnable r) { return new Thread(r, "TaskStateModelFactory-timeTask_thread"); } }); if (_taskExecutor instanceof ThreadPoolExecutor) { try { _monitor = new ThreadPoolExecutorMonitor(TaskConstants.STATE_MODEL_NAME, (ThreadPoolExecutor) _taskExecutor); } catch (JMException e) { LOG.warn("Error in creating ThreadPoolExecutorMonitor for TaskStateModelFactory.", e); } } }
Source:
<code>public String text(Barcodable barcodable) { return barcodable.visit(new BarcodableVisitor<String>() { @Override public String visitLibraryAliquotDetailed(DetailedLibraryAliquot libraryAliquot) { <START> return visitLibraryDetailed((DetailedLibrary) libraryAliquot.getLibrary()); <END> } @Override public String visitLibraryDetailed(DetailedLibrary library) { return library.getLibraryDesignCode().getCode(); } }); }</code><technical_language>Detailed aliquots design code</technical_language>

Target:
public String text(Barcodable barcodable) { return barcodable.getAlias(); }
Source:
<code>private void createDummyImages() throws IOException { URI processDirectory = serviceManager.getFileService().getProcessBaseUriForExistingProcess(this.prozessKopie); <START> String imageDirectoryName = this.prozessKopie.getTitle() + "_" + Config.getParameter("MetsEditorDefaultSuffix"); <END> URI imagesDirectory = serviceManager.getFileService().createDirectory( serviceManager.getFileService().createDirectory(processDirectory, "images"), imageDirectoryName); String numberOfDigits = extractNumber(Config.getParameter("ImagePrefix")); for (int i = 1; i <= this.guessedImages; i++) { serviceManager.getFileService().createResource(imagesDirectory, String.format("%0" + numberOfDigits + "d", i) + ".tif"); } }</code><technical_language>"logic of detecting directory" is for meta data editor. in case directory is named process title</technical_language>

Target:
private void createDummyImages() throws IOException { serviceManager.getFileService().createDummyImagesForProcess(this.prozessKopie, this.guessedImages); }
Source:
<code>private List<QueryTrace> queryTracesFromRetries(List<RetryException> retryExceptions) { Iterator<RetryException> iterator = retryExceptions.iterator(); List<QueryTrace> traces = new ArrayList<QueryTrace>(); long lastTS = 0; <START> while (iterator.hasNext()) { <END> RetryException re = iterator.next(); Throwable cause = re.getCause(); String message = ""; if (cause instanceof RuntimeNodeException) { RuntimeNodeException rne = (RuntimeNodeException) cause; message += rne.getUri() + " "; } message += "error=" + cause.getMessage(); long microTS = TimeUnit.MICROSECONDS.convert(re.getOffsetMillis(), TimeUnit.MILLISECONDS); QueryTrace trace = QueryTrace.of(new QueryTrace.Identifier(message), microTS - lastTS); lastTS = microTS; traces.add(trace); } return traces; }</code><technical_language>need iterator</technical_language>

Target:
private List<QueryTrace> queryTracesFromRetries(List<RetryException> retryExceptions) { final List<QueryTrace> traces = new ArrayList<QueryTrace>(); long lastTS = 0; for (final RetryException re : retryExceptions) { final long microTS = TimeUnit.MICROSECONDS.convert(re.getOffsetMillis(), TimeUnit.MILLISECONDS); final long elapsed = microTS - lastTS; final QueryTrace trace = QueryTrace.of(new QueryTrace.Identifier(getMessageFrom(re.getCause())), elapsed); lastTS = microTS; traces.add(trace); } return traces; }
Source:
<code>public void setRetainUntil(DocumentRef docRef, Calendar retainUntil, String comment) throws PropertyException { Document doc = resolveReference(docRef); checkPermission(doc, READ); if (!doc.isRecord()) { throw new PropertyException("Document is not a record"); } Calendar current = doc.getRetainUntil(); if (Objects.equals(current, retainUntil)) { return; } checkPermission(doc, SET_RETENTION); Map<String, Serializable> options = new HashMap<>(); options.put(CoreEventConstants.RETAIN_UNTIL, retainUntil); options.put("comment", retainUntil == null ? "" : retainUntil.toInstant().toString()); <START> DocumentModel docModel = readModel(doc); <END> boolean currentIndeterminate = current == null || RETAIN_UNTIL_INDETERMINATE.compareTo(current) == 0; String beforeRetentionEvent = currentIndeterminate ? DocumentEventTypes.BEFORE_SET_RETENTION : DocumentEventTypes.BEFORE_EXTEND_RETENTION; notifyEvent(beforeRetentionEvent, docModel, options, null, null, true, false); doc.setRetainUntil(retainUntil); docModel = readModel(doc); String afterRetentionEvent = currentIndeterminate ? DocumentEventTypes.AFTER_SET_RETENTION : DocumentEventTypes.AFTER_EXTEND_RETENTION; notifyEvent(afterRetentionEvent, docModel, options, null, null, true, false); }</code><technical_language>this client side, concern is date format match is expected user. Also, for UI this is a string rendered, logic information is provided (e.g. type format)</technical_language>

Target:
public void setRetainUntil(DocumentRef docRef, Calendar retainUntil, String comment) throws PropertyException { Document doc = resolveReference(docRef); checkPermission(doc, READ); if (!doc.isRecord()) { throw new PropertyException("Document is not a record"); } Calendar current = doc.getRetainUntil(); if (current!=null && retainUntil!=null && current.compareTo(retainUntil) == 0) { return; } checkPermission(doc, SET_RETENTION); Map<String, Serializable> options = new HashMap<>(); options.put(CoreEventConstants.RETAIN_UNTIL, retainUntil); boolean retainUntilIndeterminate = retainUntil == null || RETAIN_UNTIL_INDETERMINATE.compareTo(retainUntil) == 0; options.put("comment", retainUntilIndeterminate ? "" : retainUntil.toInstant().toString()); DocumentModel docModel = readModel(doc); boolean currentIndeterminate = current == null || RETAIN_UNTIL_INDETERMINATE.compareTo(current) == 0; String beforeRetentionEvent = currentIndeterminate ? DocumentEventTypes.BEFORE_SET_RETENTION : DocumentEventTypes.BEFORE_EXTEND_RETENTION; notifyEvent(beforeRetentionEvent, docModel, options, null, null, true, false); doc.setRetainUntil(retainUntil); docModel = readModel(doc); String afterRetentionEvent = currentIndeterminate ? DocumentEventTypes.AFTER_SET_RETENTION : DocumentEventTypes.AFTER_EXTEND_RETENTION; notifyEvent(afterRetentionEvent, docModel, options, null, null, true, false); }
Source:
<code>public void debug(String message, Object... objects) { <START> LOG.warn(message, objects); <END> }</code><technical_language>debug warn</technical_language>

Target:
public void debug(String message, Object... objects) { LOG.debug(message, objects); }
Source:
<code>private TreeViewer createTreeViewer(final Composite parent) { final int style = SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER; tree = SWTUtil.createFilteredTree(parent, style, new EObjectFilter()); <START> try { Method setQuickSelection = FilteredTree.class.getMethod("setQuickSelectionMode", Boolean.TYPE); if (setQuickSelection != null) { setQuickSelection.invoke(tree, true); } } catch (NoSuchMethodException e) { } catch (SecurityException e) { } catch (IllegalAccessException e) { } catch (IllegalArgumentException e) { } catch (InvocationTargetException e) { } <END> final TreeViewer viewer = tree.getViewer(); final GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true); viewer.getControl().setLayoutData(gridData); viewer.getTree().setHeaderVisible(false); viewer.getTree().setLinesVisible(false); viewer.setContentProvider(new SessionContentProvider()); viewer.setLabelProvider(new AdapterFactoryLabelProvider(ViewHelper.INSTANCE.createAdapterFactory())); return viewer; }</code><technical_language>ReflectionHelper.invokeMethodWithoutException() avoid this boilerplate</technical_language>

Target:
private TreeViewer createTreeViewer(final Composite parent) { final int style = SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER; tree = SWTUtil.createFilteredTree(parent, style, new EObjectFilter()); ReflectionHelper.invokeMethodWithoutException(tree, "setQuickSelectionMode", new Class[] { Boolean.TYPE }, new Object[] { true }); final TreeViewer viewer = tree.getViewer(); final GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true); viewer.getControl().setLayoutData(gridData); viewer.getTree().setHeaderVisible(false); viewer.getTree().setLinesVisible(false); viewer.setContentProvider(new SessionContentProvider()); viewer.setLabelProvider(new AdapterFactoryLabelProvider(ViewHelper.INSTANCE.createAdapterFactory())); return viewer; }
Source:
<code>public void addBuildVersionInfo() { String versionName = ""; int buildVersion = 0; PackageManager packageManager = this.getActivity().getPackageManager(); String packageName = this.getActivity().getPackageName(); try { versionName = packageManager.getPackageInfo(packageName, 0).versionName; ApplicationInfo ai = packageManager.getApplicationInfo(packageName, PackageManager.GET_META_DATA); buildVersion = ai.metaData.getInt("buildVersion"); } catch (PackageManager.NameNotFoundException e) { mPresenter.logException("Failed to load meta-data, NameNotFound: " + e.getMessage()); } catch (NullPointerException e) { mPresenter.logException("Failed to load meta-data, NullPointer: " + e.getMessage()); } TextView appName = root.findViewById(R.id.frag_settings_app_name_tv); TextView version = root.findViewById(R.id.frag_settings_version_tv); appName.setText(getResources().getString(R.string.app_name)); <START> version.setText(versionName + " Build: " + buildVersion); <END> }</code><technical_language>Place this is strings.xml instead, translated</technical_language>

Target:
public void addBuildVersionInfo() { String versionName = ""; int buildVersion = 0; PackageManager packageManager = this.getActivity().getPackageManager(); String packageName = this.getActivity().getPackageName(); try { versionName = packageManager.getPackageInfo(packageName, 0).versionName; ApplicationInfo ai = packageManager.getApplicationInfo(packageName, PackageManager.GET_META_DATA); buildVersion = ai.metaData.getInt("buildVersion"); } catch (PackageManager.NameNotFoundException e) { mPresenter.logException("Failed to load meta-data, NameNotFound: " + e.getMessage()); } catch (NullPointerException e) { mPresenter.logException("Failed to load meta-data, NullPointer: " + e.getMessage()); } TextView appName = root.findViewById(R.id.frag_settings_app_name_tv); TextView version = root.findViewById(R.id.frag_settings_version_tv); appName.setText(getResources().getString(R.string.app_name)); version.setText(versionName + getContext().getString(R.string.frag_settings_build) + buildVersion); }
Source:
<code>protected List<KubernetesNamespaceMeta> fetchNamespaces() <START> throws KubernetesClientException, InfrastructureException { <END> try { return clientFactory .create() .namespaces() .list() .getItems() .stream() .map(this::asNamespaceMeta) .collect(Collectors.toList()); } catch (KubernetesClientException e) { throw new InfrastructureException( "Error occurred when tried to list all available namespaces. Cause: " + e.getMessage(), e); } }</code><technical_language>KubernetesClientException thrown</technical_language>

Target:
protected List<KubernetesNamespaceMeta> fetchNamespaces() throws InfrastructureException { try { return clientFactory .create() .namespaces() .list() .getItems() .stream() .map(this::asNamespaceMeta) .collect(Collectors.toList()); } catch (KubernetesClientException e) { throw new InfrastructureException( "Error occurred when tried to list all available namespaces. Cause: " + e.getMessage(), e); } }
Source:
<code>public ValidationResult isStorageFormatCompatibleWithDomain() { StorageFormatType storageFormat = storageDomain.getStorageFormat(); StorageType storageType = storageDomain.getStorageType(); StorageDomainType storageDomainFunction = storageDomain.getStorageDomainType(); boolean validationSucceeded = true; if (storageFormat == StorageFormatType.V2) { if ( !(storageDomainFunction.isDataDomain() && storageType.isBlockDomain()) ) { validationSucceeded = false; } } if <START> (storageFormat == StorageFormatType.V3 || storageFormat == StorageFormatType.V4) { <END> if (!storageDomainFunction.isDataDomain()) { validationSucceeded = false; } } return validationSucceeded? ValidationResult.VALID : new ValidationResult(EngineMessage.ACTION_TYPE_FAILED_STORAGE_DOMAIN_FORMAT_ILLEGAL_HOST, String.format("$storageFormat %1$s", storageDomain.getStorageFormat())); }</code><technical_language>future proof code: if (storageFormat.compareTo(StorageFormatType.V3) >= 0)</technical_language>

Target:
public ValidationResult isStorageFormatCompatibleWithDomain() { StorageFormatType storageFormat = storageDomain.getStorageFormat(); StorageType storageType = storageDomain.getStorageType(); StorageDomainType storageDomainFunction = storageDomain.getStorageDomainType(); boolean validationSucceeded = true; if (storageFormat == StorageFormatType.V2) { if ( !(storageDomainFunction.isDataDomain() && storageType.isBlockDomain()) ) { validationSucceeded = false; } } if (storageFormat.compareTo(StorageFormatType.V3) > 0) { if (!storageDomainFunction.isDataDomain()) { validationSucceeded = false; } } return validationSucceeded? ValidationResult.VALID : new ValidationResult(EngineMessage.ACTION_TYPE_FAILED_STORAGE_DOMAIN_FORMAT_ILLEGAL_HOST, String.format("$storageFormat %1$s", storageDomain.getStorageFormat())); }
Source:
<code>public static synchronized void cancelAll(String id) { Set<Entry<Runnable, TaskInfo>> entrySet = TASKS.entrySet(); <START> synchronized (TASKS) { <END> Iterator<Entry<Runnable, TaskInfo>> iterator = entrySet.iterator(); while (iterator.hasNext()) { Entry<Runnable, TaskInfo> next = iterator.next(); Runnable task = next.getKey(); TaskInfo info = next.getValue(); if (info.id.equals(id)) { Handler handler = info.handlerReference.get(); if (handler != null) { handler.removeCallbacks(task); } } } } }</code><technical_language>a synchronization class, need a synchronized section</technical_language>

Target:
public static synchronized void cancelAll(String id) { Set<Entry<Runnable, TaskInfo>> entrySet = TASKS.entrySet(); Iterator<Entry<Runnable, TaskInfo>> iterator = entrySet.iterator(); while (iterator.hasNext()) { Entry<Runnable, TaskInfo> next = iterator.next(); Runnable task = next.getKey(); TaskInfo info = next.getValue(); if (info.id.equals(id)) { info.handler.removeCallbacks(task); } } }
Source:
<code>public void testNonBlockingAcquireBuffer() { SslBufferPool pool = new ThreadLocalSslBufferPool(1, true, true, 1); ByteBuffer buf1 = pool.acquireBuffer(); Assert.assertEquals(pool.getUnacquiredPoolSize(), 0); ByteBuffer buf2 = pool.acquireBuffer(); <START> pool.releaseBuffer(buf1); <END> pool.releaseBuffer(buf2); }</code><technical_language>put 2 in a finally block. acquire throw exception a runtime exception. similarly in other tests</technical_language>

Target:
public void testNonBlockingAcquireBuffer() { SslBufferPool pool = new ThreadLocalSslBufferPool(1, true, true, 1); ByteBuffer buf1 = null; ByteBuffer buf2 = null; try { buf1 = pool.acquireBuffer(); Assert.assertEquals(pool.getUnacquiredPoolSize(), 0); buf2 = pool.acquireBuffer(); } finally { pool.releaseBuffer(buf1); pool.releaseBuffer(buf2); } }
Source:
<code>public void initialize(TransformContext context) throws Exception { super.initialize(context); metrics = context.getMetrics(); <START> logger = LoggerFactory.getLogger(ScriptTransform.class.getName() + " - Stage:" + context.getStageName()); <END> try { Class<?> somClass = Class.forName("jdk.nashorn.api.scripting.ScriptObjectMirror"); somValuesMethod = somClass.getMethod("values"); } catch (NoSuchMethodException e) { throw new RuntimeException( "Failed to get method ScriptObjectMirror#values() for converting ScriptObjectMirror to List. " + "Please check your version of Nashorn is supported.", e); } catch (ClassNotFoundException e) { } init(context); }</code><technical_language>this needed anymore logging changes app, normal logger LoggerFactory.getLogger(ScriptTransform.class)</technical_language>

Target:
public void initialize(TransformContext context) throws Exception { super.initialize(context); metrics = context.getMetrics(); try { Class<?> somClass = Class.forName("jdk.nashorn.api.scripting.ScriptObjectMirror"); somValuesMethod = somClass.getMethod("values"); } catch (NoSuchMethodException e) { throw new RuntimeException( "Failed to get method ScriptObjectMirror#values() for converting ScriptObjectMirror to List. " + "Please check your version of Nashorn is supported.", e); } catch (ClassNotFoundException e) { } init(context); }
Source:
<code>public T LIMIT(int value) { sql().limit = String.valueOf(value); sql().limitingRowsStrategy = SQLStatement.LimitingRowsStrategy.OFFSET_LIMIT; <START> return getSelf(); <END> }</code><technical_language>newly added line DRY for some reason. :D about... java return LIMIT(String.valueOf(value));</technical_language>

Target:
public T LIMIT(int value) { return LIMIT(String.valueOf(value)); }
Source:
<code>public void testServerShouldTerminateConnectionIdleForTooLong() throws InterruptedException { int inactivityTime = 3; Server server = new Server(randomPort); server.setClientInactivityTimeout(inactivityTime); Runnable serverTask = () -> { try { server.listen(); } catch (InterruptedException e) { e.printStackTrace(); } }; Thread thread = new Thread(serverTask); thread.start(); EventLoopGroup group = new NioEventLoopGroup(); try { Bootstrap b = new Bootstrap(); b.group(group) .channel(NioSocketChannel.class) .handler(new ChannelInitializer<SocketChannel>() { @Override public void initChannel(SocketChannel ch) throws Exception { } } ); Long started = System.currentTimeMillis() / 1000L; ChannelFuture f = b.connect("localhost", randomPort).sync(); f.channel().closeFuture().sync(); Long ended = System.currentTimeMillis() / 1000L; int diff = (int) (ended - started); <START> assertThat(diff, is(greaterThanOrEqualTo(inactivityTime))); <END> } finally { group.shutdownGracefully(); server.stop(); } }</code><technical_language>stricter equality this? import static org.hamcrest.number.IsCloseTo.closeTo ... assertThat(diff, is(closeTo(inactivityTime, 0.1)))</technical_language>

Target:
public void testServerShouldTerminateConnectionIdleForTooLong() throws InterruptedException { int inactivityTime = 3; Server server = new Server(randomPort, inactivityTime); Runnable serverTask = () -> { try { server.listen(); } catch (InterruptedException e) { e.printStackTrace(); } }; Thread thread = new Thread(serverTask); thread.start(); EventLoopGroup group = new NioEventLoopGroup(); try { Bootstrap b = new Bootstrap(); b.group(group) .channel(NioSocketChannel.class) .handler(new ChannelInitializer<SocketChannel>() { @Override public void initChannel(SocketChannel ch) throws Exception { } } ); Long started = System.currentTimeMillis() / 1000L; ChannelFuture f = b.connect("localhost", randomPort).sync(); f.channel().closeFuture().sync(); Long ended = System.currentTimeMillis() / 1000L; double diff = ended - started; assertThat(diff, is(closeTo(inactivityTime, 0.1))); } finally { group.shutdownGracefully(); server.stop(); } }
Source:
<code>public double getBatteryResistanceSafely() throws InvalidSensorException { readStatus3(); if (System.currentTimeMillis() - lastRead > PDP.MAX_AGE) { <START> throw new InvalidSensorException("Can not read voltage from PDP"); <END> } return cachedResistance; }</code><technical_language>wrong error message</technical_language>

Target:
public double getBatteryResistanceSafely() throws InvalidSensorException { readStatus(3); if (System.currentTimeMillis() - lastRead > PDP.MAX_AGE) { throw new InvalidSensorException("Can not read battery resistance from PDP"); } return cachedResistance; }
Source:
<code>public XMLTagScanner() { IToken string = new Token(new TextAttribute(Preferences.getInstance() .getColor(PreferenceKey.COLOR_STRING))); IToken interpolation = new Token(new TextAttribute(Preferences .getInstance().getColor(PreferenceKey.COLOR_INTERPOLATION))); List<IRule> l = new ArrayList<IRule>(); l.add(new StringSubRule(LexicalConstants.QUOT_STRING, DOLLAR_LEFT_BRACE, 2, string)); l.add(new InterpolationRule(LexicalConstants.DOLLAR, interpolation)); l.add(new InterpolationRule(LexicalConstants.HASH, interpolation)); l.add(new SingleLineRule(LexicalConstants.QUOT_STRING, LexicalConstants.QUOT_STRING, string, LexicalConstants.BACKSLASH)); l.add(new SingleLineRule(LexicalConstants.APOS_STRING, LexicalConstants.APOS_STRING, string, LexicalConstants.BACKSLASH)); l.add(new WhitespaceRule(new WhitespaceDetector())); <START> setRules(l.toArray(new IRule[l.size()])); <END> }</code><technical_language>I do java setRules( new IRule[] { new StringSubRule(LexicalConstants.QUOT_STRING, DOLLAR_LEFT_BRACE, 2, string), new InterpolationRule(LexicalConstants.DOLLAR, interpolation), new InterpolationRule(LexicalConstants.HASH, interpolation), new SingleLineRule(LexicalConstants.QUOT_STRING, LexicalConstants.QUOT_STRING, string, LexicalConstants.BACKSLASH), new SingleLineRule(LexicalConstants.APOS_STRING, LexicalConstants.APOS_STRING, string, LexicalConstants.BACKSLASH), new WhitespaceRule(new WhitespaceDetector()) }); number of rules is a constant, object create</technical_language>

Target:
public XMLTagScanner() { IToken string = new Token(new TextAttribute(Preferences.getInstance() .getColor(PreferenceKey.COLOR_STRING))); IToken interpolation = new Token(new TextAttribute(Preferences .getInstance().getColor(PreferenceKey.COLOR_INTERPOLATION))); setRules(new IRule[] { new StringSubRule(LexicalConstants.QUOT_STRING, DOLLAR_LEFT_BRACE, 2, string), new InterpolationRule(LexicalConstants.DOLLAR, interpolation), new InterpolationRule(LexicalConstants.HASH, interpolation), new SingleLineRule(LexicalConstants.QUOT_STRING, LexicalConstants.QUOT_STRING, string, LexicalConstants.BACKSLASH), new SingleLineRule(LexicalConstants.APOS_STRING, LexicalConstants.APOS_STRING, string, LexicalConstants.BACKSLASH), new WhitespaceRule(new WhitespaceDetector()) }); }