auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void onStartup(ServletContext sc) throws ServletException { AnnotationConfigWebApplicationContext context = new AnnotationConfigWebApplicationContext(); context.register(WebAppConfig.class); sc.addListener(new ContextLoaderListener(context)); DispatcherServlet dispatcherServlet = new DispatcherServlet(context); ServletRegistration.Dynamic dispatcher = sc.addServlet("dispatcher", dispatcherServlet); dispatcher.setLoadOnStartup(1); dispatcher.addMapping("/"); <START> FilterRegistration.Dynamic filter = sc.addFilter("stormpathFilter", new DelegatingFilterProxy()); <END> EnumSet<DispatcherType> types = EnumSet.of(DispatcherType.ERROR, DispatcherType.FORWARD, DispatcherType.INCLUDE, DispatcherType.REQUEST); filter.addMappingForUrlPatterns(types, false, "/*"); }</code><technical_language>Please copy this code consistency: <LINK_0></technical_language>

Target:
public void onStartup(ServletContext sc) throws ServletException { AnnotationConfigWebApplicationContext context = new AnnotationConfigWebApplicationContext(); context.register(WebAppConfig.class); sc.addListener(new ContextLoaderListener(context)); DispatcherServlet dispatcherServlet = new DispatcherServlet(context); ServletRegistration.Dynamic dispatcher = sc.addServlet("dispatcher", dispatcherServlet); dispatcher.setLoadOnStartup(1); dispatcher.addMapping("/"); FilterRegistration.Dynamic stormpathFilter = sc.addFilter(StormpathFilter.DEFAULT_FILTER_NAME, DelegatingFilterProxy.class); EnumSet<DispatcherType> types = EnumSet.of(DispatcherType.ERROR, DispatcherType.FORWARD, DispatcherType.INCLUDE, DispatcherType.REQUEST); stormpathFilter.addMappingForUrlPatterns(types, false, "/*"); }
Source:
<code>public GatewayConfigmapLabels( @Named("che.infra.kubernetes.singlehost.gateway.configmap_labels") String labelsProperty) throws InfrastructureException { <START> if (labelsProperty == null || labelsProperty.isEmpty()) { <END> throw new InfrastructureException( "for gateway single-host, 'che.infra.kubernetes.singlehost.gateway.configmap_labels' property must be defined"); } try { this.labels = Splitter.on(",").trimResults().withKeyValueSeparator("=").split(labelsProperty); } catch (IllegalArgumentException iae) { throw new InfrastructureException( "'che.infra.kubernetes.singlehost.gateway.configmap_labels' is set to invalid value. It must be in format `name1=value1,name2=value2`. Check the documentation for further details.", iae); } }</code><technical_language>com.google.common.base.Strings.isNullOrEmpty</technical_language>

Target:
public GatewayConfigmapLabels( @Named("che.infra.kubernetes.singlehost.gateway.configmap_labels") String labelsProperty) { if (isNullOrEmpty(labelsProperty)) { throw new ConfigurationException( "for gateway single-host, 'che.infra.kubernetes.singlehost.gateway.configmap_labels' property must be defined"); } try { this.labels = Splitter.on(",").trimResults().withKeyValueSeparator("=").split(labelsProperty); } catch (IllegalArgumentException iae) { throw new ConfigurationException( "'che.infra.kubernetes.singlehost.gateway.configmap_labels' is set to invalid value. It must be in format `name1=value1,name2=value2`. Check the documentation for further details.", iae); } }
Source:
<code>public Result invoke(Invocation inv) throws RpcException { if (destroyed.get()) { logger.warn("Invoker for service " + this + " on consumer " + NetUtils.getLocalHost() + " is destroyed, " + ", dubbo version is " + Version.getVersion() + ", this invoker should not be used any longer"); } RpcInvocation invocation = (RpcInvocation) inv; invocation.setInvoker(this); Map<String, String> contextAttachments = RpcContext.getContext().getAttachments(); if (contextAttachments != null && contextAttachments.size() != 0) { invocation.addAttachments(contextAttachments); } if (getUrl().getMethodParameter(invocation.getMethodName(), Constants.ASYNC_KEY, false)) { invocation.setAttachment(Constants.ASYNC_KEY, Boolean.TRUE.toString()); } RpcUtils.attachInvocationIdIfAsync(getUrl(), invocation); if (attachment != null && attachment.size() > 0) { <START> invocation.addAttachments(attachment); <END> } try { return doInvoke(invocation); } catch (InvocationTargetException e) { Throwable te = e.getTargetException(); if (te == null) { return new RpcResult(e); } else { if (te instanceof RpcException) { ((RpcException) te).setCode(RpcException.BIZ_EXCEPTION); } return new RpcResult(te); } } catch (RpcException e) { if (e.isBiz()) { return new RpcResult(e); } else { throw e; } } catch (Throwable e) { return new RpcResult(e); } }</code><technical_language>@carryxyh thanks for info</technical_language>

Target:
public Result invoke(Invocation inv) throws RpcException { if (destroyed.get()) { logger.warn("Invoker for service " + this + " on consumer " + NetUtils.getLocalHost() + " is destroyed, " + ", dubbo version is " + Version.getVersion() + ", this invoker should not be used any longer"); } RpcInvocation invocation = (RpcInvocation) inv; invocation.setInvoker(this); if (attachment != null && attachment.size() > 0) { invocation.addAttachmentsIfAbsent(attachment); } Map<String, String> contextAttachments = RpcContext.getContext().getAttachments(); if (contextAttachments != null && contextAttachments.size() != 0) { invocation.addAttachments(contextAttachments); } if (getUrl().getMethodParameter(invocation.getMethodName(), Constants.ASYNC_KEY, false)) { invocation.setAttachment(Constants.ASYNC_KEY, Boolean.TRUE.toString()); } RpcUtils.attachInvocationIdIfAsync(getUrl(), invocation); try { return doInvoke(invocation); } catch (InvocationTargetException e) { Throwable te = e.getTargetException(); if (te == null) { return new RpcResult(e); } else { if (te instanceof RpcException) { ((RpcException) te).setCode(RpcException.BIZ_EXCEPTION); } return new RpcResult(te); } } catch (RpcException e) { if (e.isBiz()) { return new RpcResult(e); } else { throw e; } } catch (Throwable e) { return new RpcResult(e); } }
Source:
<code>EMFCompareDiffTreeRuler(Composite parent, int style, WrappableTreeViewer treeViewer, DependencyData dependencyData, ICompareColor compareColor) { super(parent, style); fTreeViewer = treeViewer; this.dependencyData = dependencyData; <START> updateColors(compareColor); <END> annotationsData = Maps.newHashMap(); paintListener = new PaintListener() { public void paintControl(PaintEvent e) { handlePaintEvent(e); } }; addPaintListener(paintListener); mouseClickListener = new MouseListener() { public void mouseUp(MouseEvent e) { handleMouseClickEvent(e); } public void mouseDown(MouseEvent e) { } public void mouseDoubleClick(MouseEvent e) { } }; addMouseListener(mouseClickListener); mouseMoveListener = new MouseMoveListener() { public void mouseMove(MouseEvent e) { handleMouveMoveEvent(e); } }; addMouseMoveListener(mouseMoveListener); mouseTrackListener = new MouseTrackListener() { public void mouseHover(MouseEvent e) { handleMouseHoverEvent(e); } public void mouseExit(MouseEvent e) { } public void mouseEnter(MouseEvent e) { } }; addMouseTrackListener(mouseTrackListener); }</code><technical_language>i store a reference compareColor object</technical_language>

Target:
EMFCompareDiffTreeRuler(Composite parent, int style, WrappableTreeViewer treeViewer, DependencyData dependencyData, ICompareColor compareColor) { super(parent, style); fTreeViewer = treeViewer; this.dependencyData = dependencyData; this.compareColor = compareColor; annotationsData = Maps.newHashMap(); paintListener = new PaintListener() { public void paintControl(PaintEvent e) { handlePaintEvent(e); } }; addPaintListener(paintListener); mouseClickListener = new MouseListener() { public void mouseUp(MouseEvent e) { handleMouseClickEvent(e); } public void mouseDown(MouseEvent e) { } public void mouseDoubleClick(MouseEvent e) { } }; addMouseListener(mouseClickListener); mouseMoveListener = new MouseMoveListener() { public void mouseMove(MouseEvent e) { handleMouveMoveEvent(e); } }; addMouseMoveListener(mouseMoveListener); mouseTrackListener = new MouseTrackListener() { public void mouseHover(MouseEvent e) { handleMouseHoverEvent(e); } public void mouseExit(MouseEvent e) { } public void mouseEnter(MouseEvent e) { } }; addMouseTrackListener(mouseTrackListener); }
Source:
<code>public String[] getProbeVariableCompletions(String probe, String prefix){ TreeNode node = TapsetLibrary.getProbes(); node = node.getChildByName(getTapset(probe)); if (node == null ) return NO_MATCHES; node = node.getChildByName(probe); if (node == null ) return NO_MATCHES; String[] matchingChildren = getMatchingChildren(node, prefix); if(matchingChildren.length == 0) <START> return NO_MATCHES; <END> return matchingChildren; }</code><technical_language>if change NO_MATCHES of length 0 need this change array of length 0 do</technical_language>

Target:
public String[] getProbeVariableCompletions(String probe, String prefix){ TreeNode node = TapsetLibrary.getProbes(); node = node.getChildByName(getTapset(probe)); if (node == null ) return NO_MATCHES; node = node.getChildByName(probe); if (node == null ) return NO_MATCHES; return getMatchingChildren(node, prefix); }
Source:
<code>public void receiveResponse(@ExchangeType int exchangeType, List<IkePayload> payloadList) { if (!isAwaitingCreateResp()) { sendMessage( CMD_HANDLE_RECEIVED_RESPONSE, new ReceivedResponse(exchangeType, payloadList)); } IkeSaPayload saPayload = IkePayload.getPayloadForTypeInProvidedList( PAYLOAD_TYPE_SA, IkeSaPayload.class, payloadList); <START> if (saPayload != null) { int spi = registerProvisionalChildAndGetSpi(saPayload); sendMessage( CMD_HANDLE_RECEIVED_RESPONSE, new ReceivedCreateResponse(exchangeType, payloadList, spi)); } else { sendMessage( CMD_HANDLE_RECEIVED_RESPONSE, new ReceivedCreateResponse(exchangeType, payloadList)); } <END> }</code><technical_language>This above. abstract this out</technical_language>

Target:
public void receiveResponse(@ExchangeType int exchangeType, List<IkePayload> payloadList) { if (!isAwaitingCreateResp()) { sendMessage( CMD_HANDLE_RECEIVED_RESPONSE, new ReceivedResponse(exchangeType, payloadList)); } int spi = registerProvisionalChildAndGetSpi(payloadList); sendMessage( CMD_HANDLE_RECEIVED_RESPONSE, new ReceivedCreateResponse(exchangeType, payloadList, spi)); }
Source:
<code>public static String parsePackageName(String namespace, String defaultPackageName) { <START> return (defaultPackageName != null && !defaultPackageName.isEmpty()) <END> ? defaultPackageName : getPackageNameByNameSpaceURI(namespace); }</code><technical_language>important is in this context, .trim() is lost: !defaultPackageName.trim().isEmpty(). note, " ".isEmpty == false, " ".trim().isEmpty == true</technical_language>

Target:
public static String parsePackageName(String namespace, String defaultPackageName) { return (defaultPackageName != null && !defaultPackageName.trim().isEmpty()) ? defaultPackageName : getPackageNameByNameSpaceURI(namespace.trim()); }
Source:
<code>public Optional<WetData> build(DataView container) throws InvalidDataException { <START> if (container.contains(Keys.IS_WET.getQuery())) { <END> Optional<Boolean> isWet = container.getBoolean(Keys.IS_WET.getQuery()); if (isWet.isPresent()) { return Optional.<WetData>of(new SpongeWetData(isWet.get())); } } return Optional.absent(); }</code><technical_language>formatting</technical_language>

Target:
public Optional<WetData> build(DataView container) throws InvalidDataException { Boolean isWet = DataUtil.getData(container, Keys.IS_WET); return Optional.<WetData>of(new SpongeWetData(isWet)); }
Source:
<code>private void setupPropertiesForPySpark(Properties sparkProperties) { Object pysparkBaseProperty = new DefaultInterpreterProperty("SPARK_HOME", null, null).getValue(); String pysparkBasePath = pysparkBaseProperty != null ? pysparkBaseProperty.toString() : null; File pysparkPath; if (null == pysparkBasePath) { pysparkBasePath = new DefaultInterpreterProperty("ZEPPELIN_HOME", "zeppelin.home", "../") .getValue().toString(); pysparkPath = new File(pysparkBasePath, "interpreter" + File.separator + "spark" + File.separator + "pyspark"); } else { pysparkPath = new File(pysparkBasePath, "python" + File.separator + "lib"); } String[] pythonLibs = new String[]{"pyspark.zip", "py4j-0.9-src.zip", "py4j-0.8.2.1-src.zip", <START> "py4j-0.10.1-src.zip", "py4j-0.10.3-src.zip", "py4j-0.10.4-src.zip"}; <END> ArrayList<String> pythonLibUris = new ArrayList<>(); for (String lib : pythonLibs) { File libFile = new File(pysparkPath, lib); if (libFile.exists()) { pythonLibUris.add(libFile.toURI().toString()); } } pythonLibUris.trimToSize(); if (pythonLibUris.size() == 2) { String confValue = sparkProperties.getProperty("spark.yarn.dist.files"); if (confValue == null) { sparkProperties.setProperty("spark.yarn.dist.files", Joiner.on(",").join(pythonLibUris)); } else { sparkProperties.setProperty("spark.yarn.dist.files", confValue + "," + Joiner.on(",").join(pythonLibUris)); } sparkProperties.setProperty("spark.files", sparkProperties.getProperty("spark.yarn.dist.files")); sparkProperties.setProperty("spark.submit.pyArchives", Joiner.on(":").join(pythonLibs)); sparkProperties.setProperty("spark.submit.pyFiles", Joiner.on(",").join(pythonLibUris)); } }</code><technical_language>need fix this...</technical_language>

Target:
private void setupPropertiesForPySpark(Properties sparkProperties) { if (isYarnMode()) { sparkProperties.setProperty("spark.yarn.isPython", "true"); } }
Source:
<code>private boolean checkIfUserHasPermissionToManageStudentsInCourse() { boolean canManageStudents=false; String url = Utils.urlConstructor(Utils.URL_CHUNK_COURSES, courseId,"/permissions?as_user_id=",canvasUserId); ApiResultWrapper arw = Utils.makeApiCall(new HttpGet(url)); <START> String errMsg=String.format("The Permission check to grant access to the tool failed with status code %s due to %s in the course %s for the user %s" <END> ,arw.getStatus(),(arw.getApiResp().isEmpty()) ? arw.getMessage() : arw.getApiResp(),courseId,canvasUserId); if (!Utils.didApiReturnedWithOutErrors(errMsg, arw)) { return canManageStudents; } JSONObject permissionJson = new JSONObject(arw.getApiResp()); if (!permissionJson.isNull("manage_students")) { canManageStudents = (boolean) permissionJson.get("manage_students"); } return canManageStudents; }</code><technical_language>Suggest pulling out message text a separate variable format call a lot shorter easier understand</technical_language>

Target:
private boolean checkIfUserHasPermissionToManageStudentsInCourse() { boolean canManageStudents = false; String url = Utils.urlConstructor(Utils.URL_CHUNK_COURSES, courseId, "/permissions?as_user_id=", canvasUserId); ApiResultWrapper arw = Utils.makeApiCall(new HttpGet(url)); String errMsgString = "The Permission check to grant access to the tool failed with status code %s due to %s in the course %s for the user %s"; String apiResp = arw.getApiResp(); String errMsg = String.format(errMsgString, arw.getStatus(), (apiResp.isEmpty()) ? arw.getMessage() : apiResp, courseId, canvasUserId); if (!Utils.didApiReturnedWithOutErrors(errMsg, arw)) { return canManageStudents; } JSONObject permissionJson = new JSONObject(apiResp); if (!permissionJson.isNull("manage_students")) { canManageStudents = (boolean) permissionJson.get("manage_students"); } return canManageStudents; }
Source:
<code><START> private static String unescapeJavaAndTrim(String resourceUrl) { <END> int startInclusiveIndex = 0; while (startInclusiveIndex < resourceUrl.length() && resourceUrl.charAt(startInclusiveIndex) == Paths.ROOT_CHAR) { startInclusiveIndex++; } if (startInclusiveIndex == resourceUrl.length()) { return ""; } int endExclusiveIndex = resourceUrl.length(); while (endExclusiveIndex > startInclusiveIndex && resourceUrl.charAt(endExclusiveIndex - 1) == Paths.ROOT_CHAR) { endExclusiveIndex--; } for (int startLoopIndex = startInclusiveIndex; startLoopIndex < endExclusiveIndex; startLoopIndex++) { if (resourceUrl.charAt(startLoopIndex)== Paths.ESCAPE_CHAR) { return StringEscapeUtils.unescapeJava(StringUtils.strip(resourceUrl, Paths.ROOT)); } } if (startInclusiveIndex == 0 && endExclusiveIndex == resourceUrl.length()) { return resourceUrl; } return resourceUrl.substring(startInclusiveIndex, endExclusiveIndex); }</code><technical_language>please consider a unit test for unescapeJavaAndTrim() implementation escaping escaping case</technical_language>

Target:
public static String unescapeJavaAndTrim(String resourceUrl) { if (resourceUrl == null) { return null; } int startInclusiveIndex = 0; while (startInclusiveIndex < resourceUrl.length() && resourceUrl.charAt(startInclusiveIndex) == Paths.ROOT_CHAR) { startInclusiveIndex++; } if (startInclusiveIndex == resourceUrl.length()) { return ""; } int endExclusiveIndex = resourceUrl.length(); while (endExclusiveIndex > startInclusiveIndex && resourceUrl.charAt(endExclusiveIndex - 1) == Paths.ROOT_CHAR) { endExclusiveIndex--; } for (int startLoopIndex = startInclusiveIndex; startLoopIndex < endExclusiveIndex; startLoopIndex++) { if (resourceUrl.charAt(startLoopIndex)== Paths.ESCAPE_CHAR) { return StringEscapeUtils.unescapeJava(StringUtils.strip(resourceUrl, Paths.ROOT)); } } if (startInclusiveIndex == 0 && endExclusiveIndex == resourceUrl.length()) { return resourceUrl; } return resourceUrl.substring(startInclusiveIndex, endExclusiveIndex); }
Source:
<code><START> public static Object getMappingSource(final MutableTable table) { <END> if (table.getColumnByName(FIELD_ID) == null) { final MutableColumn idColumn = new MutableColumn(FIELD_ID, ColumnType.STRING).setTable(table).setPrimaryKey( true); table.addColumn(0, idColumn); } final Map<String, Map<String, String>> propertiesMap = new LinkedHashMap<>(); for (Column column : table.getColumns()) { final String columnName = column.getName(); if (FIELD_ID.equals(columnName)) { continue; } final String fieldName = getValidatedFieldName(columnName); final Map<String, String> propertyMap = new HashMap<>(); final String type = getType(column); propertyMap.put("type", type); propertiesMap.put(fieldName, propertyMap); } HashMap<String, Map<String, Map<String, String>>> docTypeMap = new HashMap<>(); docTypeMap.put("properties", propertiesMap); final Map<String, Map<String, Map<String, Map<String, String>>>> mapping = new HashMap<>(); mapping.put(table.getName(), docTypeMap); return mapping; }</code><technical_language>Map here</technical_language>

Target:
public static Map<String, ?> getMappingSource(final MutableTable table) { if (table.getColumnByName(FIELD_ID) == null) { final MutableColumn idColumn = new MutableColumn(FIELD_ID, ColumnType.STRING).setTable(table).setPrimaryKey( true); table.addColumn(0, idColumn); } final Map<String, Map<String, String>> propertiesMap = new LinkedHashMap<>(); for (Column column : table.getColumns()) { final String columnName = column.getName(); if (FIELD_ID.equals(columnName)) { continue; } final String fieldName = getValidatedFieldName(columnName); final Map<String, String> propertyMap = new HashMap<>(); final String type = getType(column); propertyMap.put("type", type); propertiesMap.put(fieldName, propertyMap); } HashMap<String, Map<String, Map<String, String>>> docTypeMap = new HashMap<>(); docTypeMap.put("properties", propertiesMap); final Map<String, Map<String, Map<String, Map<String, String>>>> mapping = new HashMap<>(); mapping.put(table.getName(), docTypeMap); return mapping; }
Source:
<code>public void updateExternalStatus(Guid id, ExternalStatus status) { MapSqlParameterSource parameterSource = getCustomMapSqlParameterSource() .addValue("vds_guid", id) .addValue("external_status", status); getCallsHandler().executeModification("UpdateVdsDynamiciExternalStatus", parameterSource); <START> } <END></code><technical_language>UpdateExternalStatus ? (it is in context of VdsDynamic, need repeat it)</technical_language>

Target:
public void updateExternalStatus(Guid id, ExternalStatus status) { MapSqlParameterSource parameterSource = getCustomMapSqlParameterSource() .addValue("vds_guid", id) .addValue("external_status", status); getCallsHandler().executeModification("UpdateExternalStatus", parameterSource); }
Source:
<code>public RepositoryPath fetchPath(RepositoryPath repositoryPath) throws IOException { RepositoryPath result = resolvePathDirectlyFromGroupPathIfPossible(repositoryPath); <START> if (result == null || RepositoryFiles.hasExpired(result)) <END> { RepositoryPath resolvedTraversal = resolvePathTraversal(repositoryPath); if (result == null) { result = resolvedTraversal; } } return result; }</code><technical_language>I if ( result != null && !RepositoryFiles.hasExpired(result)) this complexity, nested if</technical_language>

Target:
public RepositoryPath fetchPath(RepositoryPath repositoryPath) throws IOException { eventPublisher.publishEvent(new GroupRepositoryPathFetchEvent(repositoryPath)); RepositoryPath result = resolvePathDirectlyFromGroupPathIfPossible(repositoryPath); if (result != null) { return result; } return resolvePathTraversal(repositoryPath); }
Source:
<code>@Override public ClientClusterGroup forNodeId(UUID id, UUID ... ids) { Collection<UUID> nodeIds = U.newHashSet(1 + (ids == null ? 0 : ids.length)); nodeIds.add(id); <START> if (ids != null) <END> nodeIds.addAll(Arrays.asList(ids)); return new ClientClusterGroupImpl(nodeIds); }</code><technical_language>add condition ids.length > 0</technical_language>

Target:
@Override public ClientClusterGroup forNodeId(UUID id, UUID ... ids) { Collection<UUID> nodeIds = U.newHashSet(1 + (ids == null ? 0 : ids.length)); nodeIds.add(id); if (!F.isEmpty(ids)) nodeIds.addAll(Arrays.asList(ids)); return new ClientClusterGroupImpl(nodeIds); }
Source:
<code>private List<String> getCurrentLocks() { List<String> currentLocks = new ArrayList<>(); int i=0; short lockSetVal = lockSet.get(); for (Resource value : Resource.values()) { <START> if ((lockSetVal & value.setMask) == value.setMask) { <END> currentLocks.add(value.name); } } return currentLocks; }</code><technical_language>nit: this moved a helper function if possible. isLevelLocked?(Resource, lockSet); way, is a helper function is too. move this function Resource canlock ? isLocked</technical_language>

Target:
private List<String> getCurrentLocks() { List<String> currentLocks = new ArrayList<>(); int i=0; short lockSetVal = lockSet.get(); for (Resource value : Resource.values()) { if (value.isLevelLocked(lockSetVal)) { currentLocks.add(value.getName()); } } return currentLocks; }
Source:
<code>public Gun(SceletonActivity activity) { ITextureRegion gunTexture = activity.getResourceManager().getLoadedTextureRegion(R.drawable.gun); ZoomCamera camera = activity.getCamera(); PointF gunPosition = new PointF( camera.getCenterX() - gunTexture.getWidth() / 2 , camera.getYMax() - gunTexture.getHeight() * 0.6f); gunSprite = new Sprite( gunPosition.x , gunPosition.y , gunTexture , activity.getEngine().getVertexBufferObjectManager()); <START> gunSprite.setRotationCenter(gunSprite.getWidth() / 2, gunSprite.getHeight()); <END> }</code><technical_language>*0.5f</technical_language>

Target:
public Gun(SceletonActivity activity) { this.activity = activity; rotationEnabled = false; ITextureRegion gunTexture = activity.getResourceManager().getLoadedTextureRegion(R.drawable.gun); ZoomCamera camera = activity.getCamera(); PointF gunPosition = new PointF( camera.getCenterX() - gunTexture.getWidth() * 0.5f , camera.getYMax() - gunTexture.getHeight() * GUN_PART_ON_SCENE); gunSprite = new Sprite( gunPosition.x , gunPosition.y , gunTexture , activity.getEngine().getVertexBufferObjectManager()) { @Override protected void onManagedUpdate(float pSecondsElapsed) { super.onManagedUpdate(pSecondsElapsed); if (!rotationEnabled) { return; } if (rotateLeft) { if (gunSprite.getRotation() > -ROTATION_MAX_ANGLE) { gunSprite.setRotation(gunSprite.getRotation() - ROTATION_VELOCITY); } } else { if (gunSprite.getRotation() < ROTATION_MAX_ANGLE) { gunSprite.setRotation(gunSprite.getRotation() + ROTATION_VELOCITY); } } } }; gunSprite.setRotationCenter(gunSprite.getWidth() * 0.5f, gunSprite.getHeight()); }
Source:
<code>public void accumulateWithNextRowInOrder() { <START> assertThat(RESULTS.accumulateWith(OTHER_RESULTS)).is(new HamcrestCondition<>(Matchers.equalTo(COMBINED_RESULTS_AND_OTHER))); <END> }</code><technical_language>update refactor tolling transform Matchers.equalTo isEqualTo</technical_language>

Target:
public void accumulateWithNextRowInOrder() { assertThat(RESULTS.accumulateWith(OTHER_RESULTS)).isEqualTo(COMBINED_RESULTS_AND_OTHER); }
Source:
<code>public void testCompute() { LongLeastPostAggregator greatestPostAggregator; CountAggregator agg = new CountAggregator("rows"); agg.aggregate(); agg.aggregate(); agg.aggregate(); Map<String, Object> metricValues = new HashMap<String, Object>(); metricValues.put(agg.getName(), agg.get()); List<PostAggregator> postAggregatorList = Lists.newArrayList( new ConstantPostAggregator( "roku", 6 ), new FieldAccessPostAggregator( "rows", "rows" ) ); <START> greatestPostAggregator = new LongLeastPostAggregator("least", postAggregatorList); <END> Assert.assertEquals(Long.valueOf(3), greatestPostAggregator.compute(metricValues)); }</code><technical_language>"leastPostAggregator", in testComparator()</technical_language>

Target:
public void testCompute() { final String aggName = "rows"; LongLeastPostAggregator leastPostAggregator; CountAggregator agg = new CountAggregator(); agg.aggregate(); agg.aggregate(); agg.aggregate(); Map<String, Object> metricValues = new HashMap<String, Object>(); metricValues.put(aggName, agg.get()); List<PostAggregator> postAggregatorList = Lists.newArrayList( new ConstantPostAggregator( "roku", 6D ), new FieldAccessPostAggregator( "rows", aggName ) ); leastPostAggregator = new LongLeastPostAggregator("leastPostAggregator", postAggregatorList); Assert.assertEquals(Long.valueOf(3), leastPostAggregator.compute(metricValues)); }
Source:
<code>public String migrateIfNecessary(String rawXml) { rawXml = cleanUpUnusedNodes(rawXml); String fileVersion = extractVersion(rawXml); Function<String, String> migrator = getMigrationStrategy().start(); boolean supported; switch (fileVersion) { case "1.0": migrator = migrator.andThen(getMigrationStrategy().from1_0to1_1()); case "1.1": migrator = migrator.andThen(getMigrationStrategy().from1_1to1_2()); case "1.2": migrator = migrator.andThen(getMigrationStrategy().from1_2to1_3()); case "1.3": migrator = migrator.andThen(getMigrationStrategy().from1_3to1_4()); case "1.4": migrator = migrator.andThen(getMigrationStrategy().from1_4to1_5()); case "1.5": migrator = migrator.andThen(getMigrationStrategy().from1_5to1_6()); supported = true; break; default: <START> supported = currentVersion.equals(fileVersion); <END> } if (!supported) { throw new IllegalArgumentException(new StringBuilder().append("Version ").append(fileVersion) .append(" of the file is not supported. Current version is ") .append(currentVersion).toString()); } migrator = migrator.andThen(getMigrationStrategy().end()); return migrator.apply(rawXml); }</code><technical_language>Sonar complains case break I add for 1.5 (Sonar is analyzing new code). I refactor switch (to if/else probably) case do in another ticket. Wdyt</technical_language>

Target:
public String migrateIfNecessary(String rawXml) { rawXml = cleanUpUnusedNodes(rawXml); String fileVersion = extractVersion(rawXml); Function<String, String> migrator = getMigrationStrategy().start(); boolean supported; switch (fileVersion) { case "1.0": migrator = migrator.andThen(getMigrationStrategy().from1_0to1_1()); case "1.1": migrator = migrator.andThen(getMigrationStrategy().from1_1to1_2()); case "1.2": migrator = migrator.andThen(getMigrationStrategy().from1_2to1_3()); case "1.3": migrator = migrator.andThen(getMigrationStrategy().from1_3to1_4()); case "1.4": migrator = migrator.andThen(getMigrationStrategy().from1_4to1_5()); case "1.5": migrator = migrator.andThen(getMigrationStrategy().from1_5to1_6()); supported = true; break; default: supported = currentVersion.equals(fileVersion); break; } if (!supported) { throw new IllegalArgumentException(new StringBuilder().append("Version ").append(fileVersion) .append(" of the file is not supported. Current version is ") .append(currentVersion).toString()); } migrator = migrator.andThen(getMigrationStrategy().end()); return migrator.apply(rawXml); }
Source:
<code>public void getProjectBlogEntryDetailsTest() throws QuadrigaStorageException { IProjectBlogEntry projectBlogEntry = new ProjectBlogEntry(); projectBlogEntry.setTitle(TITLE_NEW); projectBlogEntry.setDescription(DESCRIPTION_NEW); projectBlogEntry.setProjectBlogEntryId(BLGE_ID_1); ProjectBlogEntryDTO projectBlogEntryDTO = createProjectBlogEntryDTO(UNIQUE_BLGE_ID, TITLE_NEW, DESCRIPTION_NEW); Mockito.when(projectBlogEntryDAO.getDTO(BLGE_ID_1)).thenReturn(projectBlogEntryDTO); Mockito.when(projectBlogEntryDTOMapper.getProjectBlogEntry(projectBlogEntryDTO)).thenReturn(projectBlogEntry); IProjectBlogEntry resultProjectBlogEntry = projectBlogEntryManagerUnderTest .getProjectBlogEntryDetails(BLGE_ID_1); assertEquals(resultProjectBlogEntry.getProjectBlogEntryId(), BLGE_ID_1); assertEquals(resultProjectBlogEntry.getTitle(), TITLE_NEW); assertEquals(resultProjectBlogEntry.getDescription(), DESCRIPTION_NEW); <START> IProjectBlogEntry resultProjectBlogEntryWhenIdNotExist = projectBlogEntryManagerUnderTest <END> .getProjectBlogEntryDetails(BLGE_ID_2); assertEquals(resultProjectBlogEntryWhenIdNotExist, null); }</code><technical_language>this in test method</technical_language>

Target:
public void getProjectBlogEntryDetailsTest() throws QuadrigaStorageException { IProjectBlogEntry projectBlogEntry = new ProjectBlogEntry(); projectBlogEntry.setTitle(TITLE_NEW); projectBlogEntry.setDescription(DESCRIPTION_NEW); projectBlogEntry.setProjectBlogEntryId(BLGE_ID_1); ProjectBlogEntryDTO projectBlogEntryDTO = createProjectBlogEntryDTO(UNIQUE_BLGE_ID, TITLE_NEW, DESCRIPTION_NEW); Mockito.when(projectBlogEntryDAO.getDTO(BLGE_ID_1)).thenReturn(projectBlogEntryDTO); Mockito.when(projectBlogEntryDTOMapper.getProjectBlogEntry(projectBlogEntryDTO)).thenReturn(projectBlogEntry); IProjectBlogEntry resultProjectBlogEntry = projectBlogEntryManagerUnderTest .getProjectBlogEntryDetails(BLGE_ID_1); assertEquals(resultProjectBlogEntry.getProjectBlogEntryId(), BLGE_ID_1); assertEquals(resultProjectBlogEntry.getTitle(), TITLE_NEW); assertEquals(resultProjectBlogEntry.getDescription(), DESCRIPTION_NEW); }
Source:
<code>public boolean supports(SCMSourceDescriptor descriptor) { <START> return false; <END> }</code><technical_language>I this correct value. Ideally do is this method final SCMSource version non-abstract. introduce protected abstract methods public final methods call (guarded a reflective check of non-implemented) This allow try infer if answer *should* true false for a non-implemented method based like: * Is in package SCMSource * Is SCMSource outer-class of this Builder I if of case dealing a legacy Builder implementation return true false, false negatives basically instantiate SCMSource</technical_language>

Target:
public final boolean supports(SCMSourceDescriptor descriptor) { if (Util.isOverridden(SCMFileSystem.Builder.class, getClass(), "supportsDescriptor", SCMSourceDescriptor.class)) { return supportsDescriptor(descriptor); } else { return descriptor.clazz.isAssignableFrom((getClass().getEnclosingClass())) || getClass().getPackage().equals(descriptor.clazz.getPackage()) || getClass().getPackage().getName().startsWith(descriptor.clazz.getPackage().getName()); } }
Source:
<code><START> public String setEncryptionKeyExchangeOnGMeter(final DlmsConnectionHolder conn, final DlmsDevice device, <END> final GMeterInfoDto gMeterInfo) throws ProtocolAdapterException, FunctionalException { LOGGER.info("Device for Set Encryption Key Exchange On G-Meter is: {}", device); DlmsDevice gMeterDevice; try { gMeterDevice = this.domainHelperService.findDlmsDevice(gMeterInfo.getDeviceIdentification()); } catch (final FunctionalException e) { throw new ProtocolAdapterException("Error while looking up G-Meter", e); } final ProtocolMeterInfo protocolMeterInfo = new ProtocolMeterInfo(gMeterInfo.getChannel(), gMeterInfo.getDeviceIdentification(), gMeterDevice.getValidSecurityKey(SecurityKeyType.G_METER_ENCRYPTION).getKey(), gMeterDevice.getValidSecurityKey(SecurityKeyType.G_METER_MASTER).getKey()); this.setEncryptionKeyExchangeOnGMeterCommandExecutor.execute(conn, device, protocolMeterInfo); return "Set Encryption Key Exchange On G-Meter Result is OK for device id: " + device.getDeviceIdentification(); }</code><technical_language>![MAJOR](<LINK_1> Refactor this method throw checked exception instead of: org.osgp.adapter.protocol.dlms.exceptions.ProtocolAdapterException, com.alliander.osgp.shared.exceptionhandling.FunctionalException [![rule](<LINK_2>](<LINK_0></technical_language>

Target:
public String setEncryptionKeyExchangeOnGMeter(final DlmsConnectionHolder conn, final DlmsDevice device, final GMeterInfoDto gMeterInfo) throws ProtocolAdapterException, FunctionalException { LOGGER.info("Device for Set Encryption Key Exchange On G-Meter is: {}", device); DlmsDevice gMeterDevice; gMeterDevice = this.domainHelperService.findDlmsDevice(gMeterInfo.getDeviceIdentification()); final ProtocolMeterInfo protocolMeterInfo = new ProtocolMeterInfo(gMeterInfo.getChannel(), gMeterInfo.getDeviceIdentification(), gMeterDevice.getValidSecurityKey(SecurityKeyType.G_METER_ENCRYPTION).getKey(), gMeterDevice.getValidSecurityKey(SecurityKeyType.G_METER_MASTER).getKey()); this.setEncryptionKeyExchangeOnGMeterCommandExecutor.execute(conn, device, protocolMeterInfo); return "Set Encryption Key Exchange On G-Meter Result is OK for device id: " + device.getDeviceIdentification(); }
Source:
<code>public String getRelativePathFrom(TestObject it) { if (it==this) { return "."; } StringBuilder buf = new StringBuilder(); TestObject next = this; TestObject cur = this; while (next!=null && it!=next) { cur = next; buf.insert(0,'/'); buf.insert(0,cur.getSafeName()); next = cur.getParent(); } if (it==next) { return buf.toString(); } else { AbstractTestResultAction action = getTestResultAction(); if (action==null) { LOGGER.warning("trying to get relative path, but we can't determine the action that owns this result."); return ""; } buf.insert(0,'/'); buf.insert(0,action.getUrlName()); Run<?,?> myBuild = cur.getRun(); if (myBuild ==null) { LOGGER.warning("trying to get relative path, but we can't determine the build that owns this result."); return ""; } buf.insert(0,'/'); buf.insert(0,myBuild.getUrl()); StaplerRequest req = Stapler.getCurrentRequest(); if (req!=null && myBuild instanceof Item) { buf.insert(0, '/'); Item myBuildAsItem = (Item) myBuild; buf.insert(0, Functions.getRelativeLinkTo(myBuildAsItem)); } else { <START> LOGGER.fine(() -> "trying to get relative path, but it is not my ancestor, and we are not in a stapler request. Trying absolute jenkins url..."); <END> String jenkinsUrl = Jenkins.get().getRootUrl(); if (jenkinsUrl == null || jenkinsUrl.length() == 0) { LOGGER.warning("Can't find anything like a decent hudson url. Punting, returning empty string."); return ""; } buf.insert(0, '/'); buf.insert(0, jenkinsUrl); } LOGGER.log(Level.FINE, "Here is our relative path: {0}", buf); return buf.toString(); } }</code><technical_language>is point of lazily evaluating a string literal</technical_language>

Target:
public String getRelativePathFrom(TestObject it) { if (it==this) { return "."; } StringBuilder buf = new StringBuilder(); TestObject next = this; TestObject cur = this; while (next!=null && it!=next) { cur = next; buf.insert(0,'/'); buf.insert(0,cur.getSafeName()); next = cur.getParent(); } if (it==next) { return buf.toString(); } else { AbstractTestResultAction action = getTestResultAction(); if (action==null) { LOGGER.warning("trying to get relative path, but we can't determine the action that owns this result."); return ""; } buf.insert(0,'/'); buf.insert(0,action.getUrlName()); Run<?,?> myBuild = cur.getRun(); if (myBuild ==null) { LOGGER.warning("trying to get relative path, but we can't determine the build that owns this result."); return ""; } buf.insert(0,'/'); buf.insert(0,myBuild.getUrl()); StaplerRequest req = Stapler.getCurrentRequest(); if (req!=null && myBuild instanceof Item) { buf.insert(0, '/'); Item myBuildAsItem = (Item) myBuild; buf.insert(0, Functions.getRelativeLinkTo(myBuildAsItem)); } else { LOGGER.fine("trying to get relative path, but it is not my ancestor, and we are not in a stapler request. Trying absolute jenkins url..."); String jenkinsUrl = Jenkins.get().getRootUrl(); if (jenkinsUrl == null || jenkinsUrl.length() == 0) { LOGGER.warning("Can't find anything like a decent hudson url. Punting, returning empty string."); return ""; } buf.insert(0, '/'); buf.insert(0, jenkinsUrl); } LOGGER.log(Level.FINE, "Here is our relative path: {0}", buf); return buf.toString(); } }
Source:
<code>public void setTablePrefix(String tablePrefix) { <START> this.tablePrefix = tablePrefix; <END> }</code><technical_language>check for null</technical_language>

Target:
public void setTablePrefix(String tablePrefix) { Assert.notNull(tablePrefix, "Null is not allowed as a tablePrfix (use an empty string if you don't want a prefix at all)."); this.tablePrefix = tablePrefix; }
Source:
<code>public void addWithExistingMacAddress() { VmNetworkInterface iface = createNewInterface(); try { <START> runAddAndVerify(iface, false, times(1)); <END> } catch (VdcBLLException e) { assertEquals(VdcBllErrors.MAC_ADDRESS_IS_IN_USE, e.getErrorCode()); } catch (Exception e) { fail(String.format("Expected to catch %s, but caught %s instead.", VdcBLLException.class.getSimpleName(), e.getClass().getSimpleName())); } verify(vmInterfaceManager).auditLogMacInUse(iface); }</code><technical_language>Also, a fail if this command succeeded. (Since expected fail)</technical_language>

Target:
public void addWithExistingMacAddress() { VmNetworkInterface iface = createNewInterface(); try { runAddAndVerify(iface, false, times(1)); fail(String.format("Expected to catch %s, but didn't.", VdcBLLException.class.getSimpleName())); } catch (VdcBLLException e) { assertEquals(VdcBllErrors.MAC_ADDRESS_IS_IN_USE, e.getErrorCode()); } catch (Exception e) { fail(String.format("Expected to catch %s, but caught %s instead.", VdcBLLException.class.getSimpleName(), e.getClass().getSimpleName())); } verify(vmInterfaceManager).auditLogMacInUse(iface); }
Source:
<code>public static boolean isDeviceRooted() { String buildTags = android.os.Build.TAGS; <START> if (buildTags != null && buildTags.contains("test-keys")) { return true; } <END> try { File file = new File("/system/app/Superuser.apk"); if (file.exists()) { return true; } } catch (Throwable e1) { } return false; }</code><technical_language>consistent, strings in this method static</technical_language>

Target:
public static boolean isDeviceRooted() { String buildTags = android.os.Build.TAGS; if (buildTags != null && buildTags.contains(TEST_KEYS)) { return true; } try { File file = new File(PATH_SUPERUSER_APK); if (file.exists()) { return true; } } catch (Throwable e1) { } return false; }
Source:
<code>public List<IndexEntry> getValidEntry(IndexSegment indexSegment, FileSpan duplicateSearchSpan, boolean checkAlreadyCopied) throws StoreException { List<IndexEntry> copyCandidates = getValidIndexEntries(indexSegment); int validEntriesSize = copyCandidates.size(); copyCandidates.removeIf( copyCandidate -> isDuplicate(copyCandidate, duplicateSearchSpan, indexSegment.getStartOffset(), checkAlreadyCopied)); copyCandidates.removeIf( <START> copyCandidate -> isDeleteRequested(copyCandidate, selectedContainers)); <END> copyCandidates.sort(PersistentIndex.INDEX_ENTRIES_OFFSET_COMPARATOR); logger.debug("Out of entries, are valid and will be copied in this round", validEntriesSize, copyCandidates.size()); logger.trace("For index segment with start offset in - Entries to copy: {}", indexSegment.getStartOffset(), storeId, copyCandidates); return copyCandidates; }</code><technical_language>logic is remove blob belongs containers deleted. I suggest considering edge case obsolete container removed Helix account metadata ZNode, however, blobs container cleaned node (perhaps this node is for a long time)</technical_language>

Target:
public List<IndexEntry> getValidEntry(IndexSegment indexSegment, FileSpan duplicateSearchSpan, boolean checkAlreadyCopied) throws StoreException { List<IndexEntry> copyCandidates = getValidIndexEntries(indexSegment); int validEntriesSize = copyCandidates.size(); copyCandidates.removeIf( copyCandidate -> isDuplicate(copyCandidate, duplicateSearchSpan, indexSegment.getStartOffset(), checkAlreadyCopied) || (config.storeContainerDeletionEnabled && isFromDeprecatedContainer(copyCandidate))); copyCandidates.sort(PersistentIndex.INDEX_ENTRIES_OFFSET_COMPARATOR); logger.debug("Out of entries, are valid and will be copied in this round", validEntriesSize, copyCandidates.size()); logger.trace("For index segment with start offset in - Entries to copy: {}", indexSegment.getStartOffset(), storeId, copyCandidates); return copyCandidates; }
Source:
<code>public List<PartitionStatistics> loadTopicStatistics(final Collection<Timeline> timelines) throws ServiceTemporarilyUnavailableException { try { return Retryer.executeWithRetry(() -> { return loadTopicStatisticsInternal(timelines); }, new RetryForSpecifiedCountStrategy(3) .withWaitBetweenEachTry(5000) .withExceptionsThatForceRetry(org.apache.kafka.common.errors.TimeoutException.class)); <START> } catch (final Exception e) { <END> throw new ServiceTemporarilyUnavailableException("Error occurred when fetching partitions offsets", e); } }</code><technical_language>RuntimeException</technical_language>

Target:
public List<PartitionStatistics> loadTopicStatistics(final Collection<Timeline> timelines) throws ServiceTemporarilyUnavailableException { try { return Retryer.executeWithRetry(() -> { return loadTopicStatisticsInternal(timelines); }, new RetryForSpecifiedCountStrategy(3) .withWaitBetweenEachTry(5000) .withExceptionsThatForceRetry(org.apache.kafka.common.errors.TimeoutException.class)); } catch (final RuntimeException e) { throw new ServiceTemporarilyUnavailableException("Error occurred when fetching partitions offsets", e); } }
Source:
<code>public AbstractBigtableAdmin(CommonConnection connection) throws IOException { LOG.debug("Creating BigtableAdmin"); configuration = connection.getConfiguration(); options = connection.getOptions(); this.connection = connection; bigtableTableAdminClient = connection.getSession().getTableAdminClient(); disabledTables = connection.getDisabledTables(); bigtableInstanceName = options.getInstanceName(); tableAdapter = new TableAdapter(bigtableInstanceName); <START> this.instanceName = InstanceName.of(bigtableInstanceName.getProjectId(), bigtableInstanceName.getInstanceId()); <END> String clusterId = configuration.get(BigtableOptionsFactory.BIGTABLE_SNAPSHOT_CLUSTER_ID_KEY, null); if (clusterId != null) { bigtableSnapshotClusterName = bigtableInstanceName.toClusterName(clusterId); } }</code><technical_language>Please get instance name bigtableInstanceName.toGcbInstanceName(), if exists</technical_language>

Target:
public AbstractBigtableAdmin(CommonConnection connection) throws IOException { LOG.debug("Creating BigtableAdmin"); configuration = connection.getConfiguration(); options = connection.getOptions(); this.connection = connection; bigtableTableAdminClient = connection.getSession().getTableAdminClient(); disabledTables = connection.getDisabledTables(); bigtableInstanceName = options.getInstanceName(); tableAdapter = new TableAdapter(bigtableInstanceName); String clusterId = configuration.get(BigtableOptionsFactory.BIGTABLE_SNAPSHOT_CLUSTER_ID_KEY, null); if (clusterId != null) { bigtableSnapshotClusterName = bigtableInstanceName.toClusterName(clusterId); } }
Source:
<code>private Optional<RowColumn> fillSiblingBatch(TransactionBase tx, Span siblingSpan, Column siblingColumn, Set<VisibilityBindingSet> bsSet, int batchSize) throws Exception { RowScanner rs = tx.scanner().over(siblingSpan).fetch(siblingColumn).byRow().build(); Iterator<ColumnScanner> colScannerIter = rs.iterator(); boolean batchLimitMet = false; Bytes row = siblingSpan.getStart().getRow(); while (colScannerIter.hasNext() && !batchLimitMet) { ColumnScanner colScanner = colScannerIter.next(); row = colScanner.getRow(); Iterator<ColumnValue> iter = colScanner.iterator(); <START> while (iter.hasNext()) { <END> if (bsSet.size() >= batchSize) { batchLimitMet = true; break; } bsSet.add(BS_SERDE.deserialize(iter.next().getValue())); } } if (batchLimitMet) { return Optional.of(new RowColumn(row, siblingColumn)); } else { return Optional.absent(); } }</code><technical_language>this check batchLimitMet? flag set true pass, do size check adding bindingSet, need a break</technical_language>

Target:
private Optional<RowColumn> fillSiblingBatch(TransactionBase tx, Span siblingSpan, Column siblingColumn, Set<VisibilityBindingSet> bsSet, int batchSize) throws Exception { RowScanner rs = tx.scanner().over(siblingSpan).fetch(siblingColumn).byRow().build(); Iterator<ColumnScanner> colScannerIter = rs.iterator(); boolean batchLimitMet = false; Bytes row = siblingSpan.getStart().getRow(); while (colScannerIter.hasNext() && !batchLimitMet) { ColumnScanner colScanner = colScannerIter.next(); row = colScanner.getRow(); Iterator<ColumnValue> iter = colScanner.iterator(); while (iter.hasNext() && !batchLimitMet) { bsSet.add(BS_SERDE.deserialize(iter.next().getValue())); if (bsSet.size() >= batchSize) { batchLimitMet = true; } } } if (batchLimitMet) { return Optional.of(new RowColumn(row, siblingColumn)); } else { return Optional.absent(); } }
Source:
<code>private void zoomInAction(ActionEvent e) { <START> if (strainView != null) { <END> strainView.zoomIn(); } }</code><technical_language>needed of a sudden</technical_language>

Target:
private void zoomInAction(ActionEvent e) { strainView.zoomIn(); }
Source:
<code>private void assertTransactionOpen( KernelTransaction transaction ) { <START> Optional<Status> terminationReason = transaction.getReasonIfTerminated(); <END> if ( terminationReason.isPresent() ) { throw new TransactionTerminatedException( terminationReason.get() ); } }</code><technical_language>transaction.isTerminated optimization here</technical_language>

Target:
private void assertTransactionOpen( KernelTransaction transaction ) { if ( transaction.isTerminated() ) { Status terminationReason = transaction.getReasonIfTerminated().orElse( Status.Transaction.Terminated ); throw new TransactionTerminatedException( terminationReason ); } }
Source:
<code>public void afterPropertiesSet() throws Exception { <START> node = new TestNode(Settings.builder().put(loadConfig()).put("transport.type", "netty4").put("http.type", "netty4") <END> .put("path.home", this.pathHome).put("path.data", this.pathData).put("cluster.name", this.clusterName) .put("node.max_local_storage_nodes", 100).build(), Collections.singletonList(Netty4Plugin.class)); nodeClient = (NodeClient) node.start().client(); }</code><technical_language>Nit: good move settings new lines? suggestion Settings settings = Settings.builder() // .put(loadConfig()) // .put("transport.type", "netty4") // .put("http.type", "netty4") // .put("path.home", this.pathHome) // .put("path.data", this.pathData) // .put("cluster.name", this.clusterName) // .put("node.max_local_storage_nodes", 100) // .build(); node = new TestNode(settings, Collections.singletonList(Netty4Plugin.class))</technical_language>

Target:
public void afterPropertiesSet() throws Exception { Settings settings = Settings.builder() .put(loadConfig()) .put("transport.type", "netty4") .put("http.type", "netty4") .put("path.home", this.pathHome) .put("path.data", this.pathData) .put("cluster.name", this.clusterName) .put("node.max_local_storage_nodes", 100) .build(); node = new TestNode(settings, Collections.singletonList(Netty4Plugin.class)); nodeClient = (NodeClient) node.start().client(); }
Source:
<code>public static String[] resourceToScopes(String resource) { Objects.requireNonNull(resource); <START> return new String[] { resource + "/.default" }; <END> }</code><technical_language>return new String[] { resource + "/.default" }; [](start = 7, length = 48) this DEFAULT_SUFFIX constant above</technical_language>

Target:
public static String[] resourceToScopes(String resource) { Objects.requireNonNull(resource); return new String[] { resource + DEFAULT_SUFFIX }; }