auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>protected Control createDialogArea(Composite parent) { final Composite area = (Composite) super.createDialogArea(parent); final Composite container = new Composite(area, SWT.NONE); area.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); final GridLayout layout = new GridLayout(1, false); container.setLayout(layout); if (errors.isEmpty()) { final Label label = new Label(area, SWT.NONE); label.setText(Messages.ViewMigrationResultDialog_MigrationSuccess); } else { final TreeViewer diagnosticView = ValidationTreeViewerFactory.createValidationViewer(area); <START> diagnosticView.setInput(errors); <END> } return parent; }</code><technical_language>Tested in Ubuntu This dialog in combination this view a lot of problems: * is narrow wide, shows top node a long text. * top node is expanded show dozens of entries a vertical scrollbar. This is usable table is narrow error a time. * resizing dialog, table resize. scrollbar disappears is scroll entire list/table of errors</technical_language>

Target:
protected Control createDialogArea(Composite parent) { final Composite area = (Composite) super.createDialogArea(parent); area.setLayout(new GridLayout(1, true)); final Composite container = new Composite(area, SWT.NONE); container.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); final GridLayout layout = new GridLayout(1, false); container.setLayout(layout); if (errors.isEmpty()) { final Label label = new Label(container, SWT.NONE); label.setText(Messages.ViewMigrationResultDialog_MigrationSuccess); label.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); } else { final TreeViewer diagnosticView = ValidationTreeViewerFactory.createValidationViewer(container); diagnosticView.setInput(errors); diagnosticView.getTree().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); } return parent; }
Source:
<code>private static double computeSphericalExcess(LineString lineString) { if (lineString.getNumPoints() < 3) { throw new RuntimeException("Polygon is not valid: a loop contains less then 3 vertices."); } SphericalExcessCalculator calculator = new SphericalExcessCalculator(lineString.getEndPoint()); <START> int start = lineString.getStartPoint().equals(lineString.getEndPoint()) ? 1 : 0; <END> for (int i = start; i < lineString.getNumPoints(); i++) { calculator.add(lineString.getPointN(i)); } return calculator.computeSphericalExcess(); }</code><technical_language>I start point is end point? more 3 points check stand</technical_language>

Target:
private static double computeSphericalExcess(LineString lineString) { if (lineString.getNumPoints() < 3) { throw new RuntimeException("Polygon is not valid: a loop contains less then 3 vertices."); } SphericalExcessCalculator calculator = new SphericalExcessCalculator(lineString.getEndPoint()); for (int i = 1; i < lineString.getNumPoints(); i++) { calculator.add(lineString.getPointN(i)); } return calculator.computeSphericalExcess(); }
Source:
<code>private void updateGitInformation(Log log) { try { Repository repo = new Git().getRepo(); if (repo != null) { this.repo = repo.getConfig().getString("remote", "origin", "url"); final ObjectId head = repo.resolve("HEAD"); <START> if (head != null && isNullOrEmpty(head.getName())) { <END> this.commit = head.getName(); } } } catch (IOException e) { log.error("Failed to read Git information", e); } }</code><technical_language>This condition is true if head.getName() is null empty. I suspect a logical in front of isNullOrEmpty() :)</technical_language>

Target:
private void updateGitInformation(Log log) { try { Repository repo = new Git().getRepo(); if (repo != null) { this.repo = repo.getConfig().getString("remote", "origin", "url"); final ObjectId head = repo.resolve("HEAD"); if (head != null && !isNullOrEmpty(head.getName())) { this.commit = head.getName(); } } } catch (IOException e) { log.error("Failed to read Git information", e); } }
Source:
<code>protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_request_detail); User user = User.getCurrentUser(); actionBar = new DynamicActionBar(this, getResources().getColor(R.color.black)); actionBar.setXMarkVisibility(View.VISIBLE, new View.OnClickListener() { @Override public void onClick(View v) { finish(); } }); actionBar.setCheckMarkVisibility(View.VISIBLE, new View.OnClickListener() { @Override public void onClick(View v) { Log.d("debug", "Setting Request to Active"); request.setState(Request.State.ACTIVE); request.setVendor(User.getCurrentUser()); request.saveEventually(new SaveCallback() { @Override public void done(ParseException e) { if (e == null) { try { RequestUpdateChannel.publish(RequestDetailActivity.this, request); } catch (JSONException e1) { <START> onError(e); <END> } Intent i = new Intent( RequestDetailActivity.this, RequestActiveVendorActivity.class ); i.setFlags(Intent.FLAG_ACTIVITY_NO_HISTORY); startActivity(i); } else { onError(e); } } }); } }); }</code><technical_language>onError(e1)</technical_language>

Target:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_request_detail); User user = User.getCurrentUser(); actionBar = new DynamicActionBar(this, getResources().getColor(R.color.black)); actionBar.setXMarkVisibility(View.VISIBLE, new View.OnClickListener() { @Override public void onClick(View v) { finish(); } }); actionBar.setCheckMarkVisibility(View.VISIBLE, new View.OnClickListener() { @Override public void onClick(View v) { Log.d("debug", "Setting Request to Active"); request.setState(Request.State.ACTIVE); request.setVendor(User.getCurrentUser()); request.saveEventually(new SaveCallback() { @Override public void done(ParseException e) { if (e == null) { try { RequestUpdateChannel.publish(RequestDetailActivity.this, request); } catch (JSONException e1) { onError(e1); } Intent i = new Intent( RequestDetailActivity.this, RequestActiveVendorActivity.class ); i.setFlags(Intent.FLAG_ACTIVITY_NO_HISTORY); startActivity(i); } else { onError(e); } } }); } }); }
Source:
<code>public static void assertNumInstances(Set<PackingPlan.ContainerPlan> containerPlans, String component, int numInstances) { int instancesFound = 0; for (PackingPlan.ContainerPlan containerPlan : containerPlans) { for (PackingPlan.InstancePlan instancePlan : containerPlan.getInstances()) { if (instancePlan.getComponentName().equals(component)) { instancesFound++; } } } Assert.assertEquals("Components " + component + " found in the container plans: ", <START> instancesFound, numInstances); <END> }</code><technical_language>output of assertion classes failure expect param ordering [expectedValue, foundValue]</technical_language>

Target:
public static void assertNumInstances(Set<PackingPlan.ContainerPlan> containerPlans, String component, int numInstances) { int instancesFound = 0; for (PackingPlan.ContainerPlan containerPlan : containerPlans) { for (PackingPlan.InstancePlan instancePlan : containerPlan.getInstances()) { if (instancePlan.getComponentName().equals(component)) { instancesFound++; } } } Assert.assertEquals(numInstances, instancesFound); }
Source:
<code>public void updateInterestFilter(final boolean on, StructuredViewer viewer) { if (viewer != null) { if (on) { if (showEmptyViewMessage && viewer instanceof TreeViewer) { Tree tree = ((TreeViewer) viewer).getTree(); Listener drawingListener = viewerToDrawerMap.get(viewer); if (drawingListener == null) { EmptyContextDrawer drawer = new EmptyContextDrawer(tree); viewerToDrawerMap.put(viewer, drawer); tree.addListener(SWT.Paint, drawer); } } installInterestFilter(viewer); ContextUiPlugin.getViewerManager().addFilteredViewer(viewer, this); } else { if (showEmptyViewMessage && viewer instanceof TreeViewer) { Tree tree = ((TreeViewer) viewer).getTree(); EmptyContextDrawer drawer = viewerToDrawerMap.remove(viewer); <START> if (drawer != null && !tree.isDisposed()) { <END> tree.removeListener(SWT.Paint, drawer); } } ContextUiPlugin.getViewerManager().removeFilteredViewer(viewer); uninstallInterestFilter(viewer); } } }</code><technical_language>need cover case well. I short secret check null for viewer (L 406) get tree point well</technical_language>

Target:
public void updateInterestFilter(final boolean on, StructuredViewer viewer) { if (viewer != null) { if (on) { if (showEmptyViewMessage && viewer instanceof TreeViewer) { Tree tree = ((TreeViewer) viewer).getTree(); Listener drawingListener = viewerToDrawerMap.get(viewer); if (drawingListener == null && !tree.isDisposed()) { EmptyContextDrawer drawer = new EmptyContextDrawer(tree); viewerToDrawerMap.put(viewer, drawer); tree.addListener(SWT.Paint, drawer); } } installInterestFilter(viewer); ContextUiPlugin.getViewerManager().addFilteredViewer(viewer, this); } else { if (showEmptyViewMessage && viewer instanceof TreeViewer) { Tree tree = ((TreeViewer) viewer).getTree(); EmptyContextDrawer drawer = viewerToDrawerMap.remove(viewer); if (drawer != null && !tree.isDisposed()) { tree.removeListener(SWT.Paint, drawer); } } ContextUiPlugin.getViewerManager().removeFilteredViewer(viewer); uninstallInterestFilter(viewer); } } }
Source:
<code>protected int compareTo(Object c1, Object c2) { Object cc1 = c1; Object cc2 = c2; Class<?> clazz1 = c1 == null ? Null.class : c1.getClass(); Class<?> clazz2 = c2 == null ? Null.class : c2.getClass(); if (!clazz1.equals(clazz2) || !(cc1 instanceof Comparable)) { if (cc1 instanceof Number) { if (cc2 instanceof Number) { <START> cc1 = ((Number) cc1).doubleValue(); <END> cc2 = ((Number) cc2).doubleValue(); } else { return cc2 instanceof MinKey ? 1 : -1; } } else if (cc2 instanceof Number && !(cc1 instanceof MinKey) && !(cc1 instanceof MaxKey)) { return 1; } else { Integer type1 = CLASS_TO_WEIGHT.get(clazz1); Integer type2 = CLASS_TO_WEIGHT.get(clazz2); if (type1 != null && type2 != null) { cc1 = type1; cc2 = type2; } else { } } } return ((Comparable) cc1).compareTo(cc2); }</code><technical_language>this lose information a large Long value</technical_language>

Target:
protected int compareTo(Object c1, Object c2) { Object cc1 = c1; Object cc2 = c2; Class<?> clazz1 = c1 == null ? Null.class : c1.getClass(); Class<?> clazz2 = c2 == null ? Null.class : c2.getClass(); if (!clazz1.equals(clazz2) || !(cc1 instanceof Comparable)) { boolean checkTypes = true; if (cc1 instanceof Number) { if (cc2 instanceof Number) { cc1 = new BigDecimal(cc1.toString()); cc2 = new BigDecimal(cc2.toString()); checkTypes = false; } } if (checkTypes) { Integer type1 = CLASS_TO_WEIGHT.get(clazz1); Integer type2 = CLASS_TO_WEIGHT.get(clazz2); if (type1 != null && type2 != null) { cc1 = type1; cc2 = type2; } else { throw new FongoException("Don't know how to compare " + cc1.getClass() + " and " + cc2.getClass() + " values are : " + c1 + " vs " + c2); } } } return ((Comparable) cc1).compareTo(cc2); }
Source:
<code>public int hashCode() { final int prime = 31; int result = 1; <START> result = prime * result + Arrays.hashCode(children); <END> result = prime * result + ((groupName == null) ? 0 : groupName.hashCode()); return result; }</code><technical_language>Hashcode of groupname sufficient</technical_language>

Target:
public int hashCode() { return Objects.hashCode(groupName); }
Source:
<code>CompositeT commonAncestor(CompositeT object1, CompositeT object2) { if (object1 == object2) { return object1; } else if (isDescendant(object1, object2)) { return object1; } else if (isDescendant(object2, object1)) { return object2; } <START> Stack<CompositeT> stack1 = new Stack<>(); <END> Stack<CompositeT> stack2 = new Stack<>(); for (CompositeT c : ancestorsFrom(object1)) { stack1.push(c); } for (CompositeT c : ancestorsFrom(object2)) { stack2.push(c); } if (stack1.isEmpty() || stack2.isEmpty()) { return null; } else { do { CompositeT pop1 = stack1.pop(); CompositeT pop2 = stack2.pop(); if (pop1 != pop2) { return pop1.getParent(); } } while (!stack1.isEmpty() && !stack2.isEmpty()); return null; } }</code><technical_language>is ArrayDeck</technical_language>

Target:
CompositeT commonAncestor(CompositeT object1, CompositeT object2) { if (object1 == object2) { return object1; } else if (isDescendant(object1, object2)) { return object1; } else if (isDescendant(object2, object1)) { return object2; } ArrayDeque<CompositeT> stack1 = new ArrayDeque<>(); ArrayDeque<CompositeT> stack2 = new ArrayDeque<>(); for (CompositeT c : ancestorsFrom(object1)) { stack1.push(c); } for (CompositeT c : ancestorsFrom(object2)) { stack2.push(c); } if (stack1.isEmpty() || stack2.isEmpty()) { return null; } else { do { CompositeT pop1 = stack1.pop(); CompositeT pop2 = stack2.pop(); if (pop1 != pop2) { return pop1.getParent(); } } while (!stack1.isEmpty() && !stack2.isEmpty()); return null; } }
Source:
<code>protected void process(Tuple tuple) { try { LOG.debug("Processing Tuple: {}", tuple); SolrRequest request = solrMapper.toSolrRequest(tuple); solrClient.request(request, solrMapper.getCollection()); ack(tuple); LOG.debug("Acked Tuple: {}", tuple); } catch (Exception e) { fail(tuple, e); <START> LOG.debug("Failed Tuple: {}", tuple, e); <END> } }</code><technical_language>nit: want push log statement fail method</technical_language>

Target:
protected void process(Tuple tuple) { try { SolrRequest request = solrMapper.toSolrRequest(tuple); solrClient.request(request, solrMapper.getCollection()); ack(tuple); } catch (Exception e) { fail(tuple, e); } }
Source:
<code>protected Optional<PlanNodeStatsEstimate> doCalculate(SpatialJoinNode node, StatsProvider sourceStats, Lookup lookup, Session session, TypeProvider types) { PlanNodeStatsEstimate leftStats = sourceStats.getStats(node.getLeft()); PlanNodeStatsEstimate rightStats = sourceStats.getStats(node.getRight()); PlanNodeStatsEstimate crossJoinStats = crossJoinStats(node, leftStats, rightStats); switch (node.getType()) { case INNER: <START> return Optional.of(filterStatsCalculator.filterStats(crossJoinStats, node.getFilter(), session, types)); <END> case LEFT: return Optional.of(UNKNOWN_STATS); default: throw new IllegalStateException("Unknown spatial join type: " + node.getType()); } }</code><technical_language>Is this return other UNKNOWN_STATS usecom.facebook.presto.cost.FilterStatsCalculator#UNKNOWN_FILTER_COEFFICIENT here? I expect FilterStatsCalculator estimate useful for spatial join. OK this? This basically means CBO generate more-or-less random plan for queries spatial join</technical_language>

Target:
protected Optional<PlanNodeStatsEstimate> doCalculate(SpatialJoinNode node, StatsProvider sourceStats, Lookup lookup, Session session, TypeProvider types) { PlanNodeStatsEstimate leftStats = sourceStats.getStats(node.getLeft()); PlanNodeStatsEstimate rightStats = sourceStats.getStats(node.getRight()); PlanNodeStatsEstimate crossJoinStats = crossJoinStats(node, leftStats, rightStats); switch (node.getType()) { case INNER: return Optional.of(statsCalculator.filterStats(crossJoinStats, node.getFilter(), session, types)); case LEFT: return Optional.of(UNKNOWN_STATS); default: throw new IllegalArgumentException("Unknown spatial join type: " + node.getType()); } }
Source:
<code>public static boolean downloadUpdatedBlob(Map<String, Object> conf, BlobStore blobStore, String key, Set<NimbusInfo> nimbusInfos) throws TTransportException { ClientBlobStore remoteBlobStore; AtomicOutputStream out = null; boolean isSuccess = false; LOG.debug("Download blob NimbusInfos {}", nimbusInfos); for (NimbusInfo nimbusInfo : nimbusInfos) { if (isSuccess) { break; } try (NimbusClient client = new NimbusClient(conf, nimbusInfo.getHost(), nimbusInfo.getPort(), null)) { remoteBlobStore = new NimbusBlobStore(); remoteBlobStore.setClient(conf, client); try (InputStreamWithMeta in = remoteBlobStore.getBlob(key)) { out = blobStore.updateBlob(key, getNimbusSubject()); byte[] buffer = new byte[2048]; int len = 0; while ((len = in.read(buffer)) > 0) { out.write(buffer, 0, len); } } if (out != null) { out.close(); } isSuccess = true; } catch(FileNotFoundException fnf) { LOG.warn("Blobstore file for key '{}' does not exist or got deleted before it could be downloaded.", key, fnf); } catch (IOException | AuthorizationException exception) { throw new RuntimeException(exception); } catch (KeyNotFoundException knf) { LOG.info("KeyNotFoundException", knf); } catch (Exception exp) { LOG.error("Exception", exp); } finally { <START> if (null != out) { <END> try { out.cancel(); } catch (IOException e) { } } } } if (!isSuccess) { LOG.error("Could not update the blob with key: {}", key); } return isSuccess; }</code><technical_language>here, nulled out out close</technical_language>

Target:
public static boolean downloadUpdatedBlob(Map<String, Object> conf, BlobStore blobStore, String key, Set<NimbusInfo> nimbusInfos) throws TTransportException { ClientBlobStore remoteBlobStore; AtomicOutputStream out = null; boolean isSuccess = false; LOG.debug("Download blob NimbusInfos {}", nimbusInfos); for (NimbusInfo nimbusInfo : nimbusInfos) { if (isSuccess) { break; } try (NimbusClient client = new NimbusClient(conf, nimbusInfo.getHost(), nimbusInfo.getPort(), null)) { remoteBlobStore = new NimbusBlobStore(); remoteBlobStore.setClient(conf, client); try (InputStreamWithMeta in = remoteBlobStore.getBlob(key)) { out = blobStore.updateBlob(key, getNimbusSubject()); byte[] buffer = new byte[2048]; int len = 0; while ((len = in.read(buffer)) > 0) { out.write(buffer, 0, len); } out.close(); out = null; } isSuccess = true; } catch(FileNotFoundException fnf) { LOG.warn("Blobstore file for key '{}' does not exist or got deleted before it could be downloaded.", key, fnf); } catch (IOException | AuthorizationException exception) { throw new RuntimeException(exception); } catch (KeyNotFoundException knf) { LOG.info("KeyNotFoundException", knf); } catch (Exception exp) { LOG.error("Exception", exp); } finally { if (out != null) { try { out.cancel(); } catch (IOException e) { } } } } if (!isSuccess) { LOG.error("Could not update the blob with key: {}", key); } return isSuccess; }
Source:
<code>public void start(List<TaskSource> sources) { requireNonNull(sources, "sources is null"); <START> <END> scheduleDriversForTaskLifeCycle(); scheduleDriversForSplitLifeCycle(sources); checkTaskCompletion(); }</code><technical_language>add some guard start called once? :)</technical_language>

Target:
public void start(List<TaskSource> sources) { requireNonNull(sources, "sources is null"); checkState(started.compareAndSet(false, true), "already started"); scheduleDriversForTaskLifeCycle(); scheduleDriversForSplitLifeCycle(sources); checkTaskCompletion(); }
Source:
<code>public void testBug475357_IconChanges() throws Exception { <START> part1.getTransientData().put(SWTPartRenderer.ICON_URI_FOR_PART, PART_DESC_ICON); <END> part1.setIconURI(PART_DESC_ICON); CTabItem item = ((CTabFolder) partStack.getWidget()).getItem(0); assertEquals(PART_DESC_ICON, part1.getTransientData().get(SWTPartRenderer.ICON_URI_FOR_PART)); assertEquals(8, item.getImage().getImageData().width); part1.setIconURI(PART_ICON); assertEquals(PART_ICON, part1.getTransientData().get(SWTPartRenderer.ICON_URI_FOR_PART)); assertEquals(16, item.getImage().getImageData().width); }</code><technical_language>I this line is obsolete</technical_language>

Target:
public void testBug475357_IconChanges() throws Exception { part1.setIconURI(PART_DESC_ICON); CTabItem item = ((CTabFolder) partStack.getWidget()).getItem(0); assertEquals(PART_DESC_ICON, part1.getTransientData().get(SWTPartRenderer.ICON_URI_FOR_PART)); assertEquals(8, item.getImage().getImageData().width); part1.setIconURI(PART_ICON); assertEquals(PART_ICON, part1.getTransientData().get(SWTPartRenderer.ICON_URI_FOR_PART)); assertEquals(16, item.getImage().getImageData().width); }
Source:
<code>protected void addVmTemplateImages(Map<Guid, Guid> srcDeviceIdToTargetDeviceIdMapping) { <START> Guid vmSnapshotId = Guid.newGuid(); <END> for (DiskImage diskImage : mImages) { VdcReturnValueBase retValue = Backend.getInstance().runInternalAction( VdcActionType.CreateImageTemplate, buildChildCommandParameters(diskImage, vmSnapshotId), cloneContextAndDetachFromParent()); if (!retValue.getSucceeded()) { throw new VdcBLLException(retValue.getFault().getError(), retValue.getFault().getMessage()); } getReturnValue().getVdsmTaskIdList().addAll(retValue.getInternalVdsmTaskIdList()); DiskImage newImage = (DiskImage) retValue.getActionReturnValue(); srcDeviceIdToTargetDeviceIdMapping.put(diskImage.getId(), newImage.getId()); } }</code><technical_language>please inline, I usage of this field</technical_language>

Target:
protected void addVmTemplateImages(Map<Guid, Guid> srcDeviceIdToTargetDeviceIdMapping) { for (DiskImage diskImage : mImages) { VdcReturnValueBase retValue = Backend.getInstance().runInternalAction( VdcActionType.CreateImageTemplate, buildChildCommandParameters(diskImage, Guid.newGuid()), ExecutionHandler.createDefaultContextForTasks(getContext())); if (!retValue.getSucceeded()) { throw new VdcBLLException(retValue.getFault().getError(), retValue.getFault().getMessage()); } getReturnValue().getVdsmTaskIdList().addAll(retValue.getInternalVdsmTaskIdList()); DiskImage newImage = (DiskImage) retValue.getActionReturnValue(); srcDeviceIdToTargetDeviceIdMapping.put(diskImage.getId(), newImage.getId()); } }
Source:
<code>public void adminStopAll() throws IOException { String master = getHosts(MASTER_HOSTS_FILE).get(0); <START> String[] cmd = new String[] {SUDO_CMD, "-u", user, accumuloPath, Admin.class.getName(), "stopAll"}; <END> Entry<Integer,String> pair = exec(master, cmd); if (0 != pair.getKey().intValue()) { throw new IOException("stopAll did not finish successfully, retcode=" + pair.getKey() + ", stdout=" + pair.getValue()); } }</code><technical_language>Ah, this is a good example of broken change. requiring a user privileged read Accumulo services' configuration files</technical_language>

Target:
public void adminStopAll() throws IOException { String master = getHosts(MASTER_HOSTS_FILE).get(0); String[] cmd = new String[] {serverCmdPrefix, accumuloPath, Admin.class.getName(), "stopAll"}; Entry<Integer,String> pair = exec(master, cmd); if (0 != pair.getKey().intValue()) { throw new IOException("stopAll did not finish successfully, retcode=" + pair.getKey() + ", stdout=" + pair.getValue()); } }
Source:
<code>public void parsesInvalidFirstNameField() throws IOException { <START> final MemberProfileJson memberprofilejson = <END> Mockito.mock(MemberProfileJson.class); Mockito.when( memberprofilejson.fetch( Mockito.anyString(), Mockito.anyString(), Mockito.any(Href.class) ) ).thenReturn( Json.createReader( new FileInputStream( PsLinkedinTest.class.getResource( "linkedinTestUserInvalidFirstName.json" ).getPath() ) ).readObject() ); MatcherAssert.assertThat( new PsLinkedin(memberprofilejson) .enter(REQUEST).next() .properties().get("first_name"), Matchers.is("?") ); }</code><technical_language>@ikhvostenkov please name json</technical_language>

Target:
public void parsesInvalidFirstNameField() throws IOException { MatcherAssert.assertThat( new PsLinkedin( this.mockRequest( "linkedinTestUserInvalidFirstName.json" ), "app", "key" ).enter(REQUEST).next().properties().get("first_name"), Matchers.is("?") ); }
Source:
<code>public String apply(String dimValue) { <START> if (dimValue == null) return null; <END> Matcher matcher = pattern.matcher(dimValue); return matcher.find() ? dimValue : null; }</code><technical_language>Internally Druid treats nulls empty strings similar values. I workaround is do dimValue == null ? "" : dimValue Druid's handling of nulls empty strings though</technical_language>

Target:
public String apply(String dimValue) { dimValue = (dimValue == null) ? "" : dimValue; Matcher matcher = pattern.matcher(dimValue); return matcher.find() ? dimValue : null; }
Source:
<code>public ASTNode transform(RuleAutomatonDisjunction ruleAutomatonDisjunction) { return new RuleAutomatonDisjunction( ruleAutomatonDisjunction.disjunctions().stream() <START> .map(p -> Pair.of((Term) p.getLeft().accept(this), p.getRight())) <END> .collect(Collectors.toList()), context); }</code><technical_language>ugly getLeft/Right eliminated if a map return map of disjunctions()</technical_language>

Target:
public ASTNode transform(RuleAutomatonDisjunction ruleAutomatonDisjunction) { List<Pair<Term, BitSet>> children = ruleAutomatonDisjunction.disjunctions().stream() .map(p -> Pair.of((Term) p.getLeft().accept(this), p.getRight())) .collect(Collectors.toList()); if (children.equals(ruleAutomatonDisjunction.disjunctions())) { return ruleAutomatonDisjunction; } else { return new RuleAutomatonDisjunction( children, context); } }
Source:
<code>private String getMetadataFromDigitalDocument(MetadataLevel inLevel, String metadata) { if (this.dd != null) { DocStructInterface topstruct = this.dd.getLogicalDocStruct(); DocStructInterface firstchildstruct = null; if (topstruct.getAllChildren() != null && topstruct.getAllChildren().size() > 0) { firstchildstruct = topstruct.getAllChildren().get(0); } MetadataTypeInterface mdt; try { mdt = UghHelper.getMetadataType(this.prefs, metadata); } catch (UghHelperException e) { <START> logger.error(e.getMessage(), e); <END> Helper.setFehlerMeldung(e); return ""; } String result = ""; String resultTop = getMetadataValue(topstruct, mdt); String resultFirst = null; if (firstchildstruct != null) { resultFirst = getMetadataValue(firstchildstruct, mdt); } switch (inLevel) { case FIRSTCHILD: if (resultFirst == null) { logger.info("Can not replace firstChild-variable for METS: {}", metadata); result = ""; } else { result = resultFirst; } break; case TOPSTRUCT: if (resultTop == null) { result = ""; logger.warn("Can not replace topStruct-variable for METS: {}", metadata); } else { result = resultTop; } break; case ALL: if (resultFirst != null) { result = resultFirst; } else if (resultTop != null) { result = resultTop; } else { result = ""; logger.warn("Can not replace variable for METS: {}", metadata); } break; default: break; } return result; } else { return ""; } }</code><technical_language>setErrorMessage</technical_language>

Target:
private String getMetadataFromDigitalDocument(MetadataLevel inLevel, String metadata) { if (this.dd != null) { DocStructInterface topstruct = this.dd.getLogicalDocStruct(); DocStructInterface firstchildstruct = null; if (topstruct.getAllChildren() != null && topstruct.getAllChildren().size() > 0) { firstchildstruct = topstruct.getAllChildren().get(0); } MetadataTypeInterface mdt; try { mdt = UghHelper.getMetadataType(this.prefs, metadata); } catch (UghHelperException e) { Helper.setErrorMessage(e.toString(), logger, e); return ""; } String result = ""; String resultTop = getMetadataValue(topstruct, mdt); String resultFirst = null; if (firstchildstruct != null) { resultFirst = getMetadataValue(firstchildstruct, mdt); } switch (inLevel) { case FIRSTCHILD: if (resultFirst == null) { logger.info("Can not replace firstChild-variable for METS: {}", metadata); result = ""; } else { result = resultFirst; } break; case TOPSTRUCT: if (resultTop == null) { result = ""; logger.warn("Can not replace topStruct-variable for METS: {}", metadata); } else { result = resultTop; } break; case ALL: if (resultFirst != null) { result = resultFirst; } else if (resultTop != null) { result = resultTop; } else { result = ""; logger.warn("Can not replace variable for METS: {}", metadata); } break; default: break; } return result; } else { return ""; } }
Source:
<code>public void testIssue445() throws InterruptedException { ExecutorService executor = Executors.newFixedThreadPool(100); final int maxCallables = 10_000; List<Callable<String>> callableList = new ArrayList<>(maxCallables); for (int i = 0; i < maxCallables; i++) { callableList.add(new Callable<String>() { @Override public String call() throws Exception { MyInfluxDBBean myBean = new MyInfluxDBBean(); return myBean.connectAndDoNothing1(); } }); } <START> System.out.println("Invoking all callableList (size()=" + callableList.size() + ")"); <END> executor.invokeAll(callableList); System.out.println("Shutting down..."); executor.shutdown(); System.out.println("Shutdown requested and waiting for termination..."); if (!executor.awaitTermination(20, TimeUnit.SECONDS)) { executor.shutdownNow(); } Assertions.assertTrue(MyInfluxDBBean.OK); Assertions.assertTrue(MyInfluxDBBean.OKHTTP_BUILDER.interceptors().isEmpty()); }</code><technical_language>I a big fan of sysout in tests, necessary</technical_language>

Target:
public void testIssue445() throws InterruptedException { ExecutorService executor = Executors.newFixedThreadPool(100); final int maxCallables = 10_000; List<Callable<String>> callableList = new ArrayList<>(maxCallables); for (int i = 0; i < maxCallables; i++) { callableList.add(new Callable<String>() { @Override public String call() throws Exception { MyInfluxDBBean myBean = new MyInfluxDBBean(); return myBean.connectAndDoNothing1(); } }); } executor.invokeAll(callableList); executor.shutdown(); if (!executor.awaitTermination(20, TimeUnit.SECONDS)) { executor.shutdownNow(); } Assertions.assertTrue(MyInfluxDBBean.OK); Assertions.assertTrue(MyInfluxDBBean.OKHTTP_BUILDER.interceptors().isEmpty()); }
Source:
<code>public void shouldNotDeleteDomainWithApplications() throws OpenShiftException { <START> IDomain domain; <END> try { domain = DomainTestUtils.ensureHasDomain(user); ApplicationTestUtils.getOrCreateApplication(domain); assertThat(domain.getApplications()).isNotEmpty(); domain.destroy(); fail("OpenShiftEndpointException did not occur"); } catch (OpenShiftEndpointException e) { } }</code><technical_language>please dont remove explicit initialization</technical_language>

Target:
public void shouldNotDeleteDomainWithApplications() throws OpenShiftException { IDomain domain = null; try { domain = DomainTestUtils.ensureHasDomain(user); ApplicationTestUtils.getOrCreateApplication(domain); assertThat(domain.getApplications()).isNotEmpty(); domain.destroy(); fail("OpenShiftEndpointException did not occur"); } catch (OpenShiftEndpointException e) { } }
Source:
<code>private Optional<ComponentModel> findTestConnectionGlobalElementFrom(List<ComponentModel> globalElementsComponentModel, ExtensionModelHelper extensionModelHelper) { <START> final List<ComponentModel> testConnectionComponentModels_new = globalElementsComponentModel <END> .stream() .filter(globalElementComponentModel -> globalElementComponentModel.getModel(ConfigurationModel.class) .map(configurationModel -> configurationModel.getConnectionProviders().stream() .anyMatch(ConnectionProviderModel::supportsConnectivityTesting)) .orElse(false)) .collect(toList()); if (testConnectionComponentModels_new.size() > 1) { throw new MuleRuntimeException(createStaticMessage(format("There are [%d] global elements that can be potentially used for test connection when it should be just one. Mark any of them with the attribute [%s=\"true\"], offended global elements are: [%s]", testConnectionComponentModels_new.size(), MODULE_CONNECTION_MARKER_ATTRIBUTE, testConnectionComponentModels_new.stream() .map(ComponentModel::getNameAttribute) .sorted() .collect(joining(", "))))); } return testConnectionComponentModels_new.stream().findFirst(); }</code><technical_language>drop _new suffix</technical_language>

Target:
private Optional<ComponentModel> findTestConnectionGlobalElementFrom(List<ComponentModel> globalElementsComponentModel, ExtensionModelHelper extensionModelHelper) { final List<ComponentModel> testConnectionComponentModels = globalElementsComponentModel .stream() .filter(globalElementComponentModel -> globalElementComponentModel.getModel(ConfigurationModel.class) .map(configurationModel -> configurationModel.getConnectionProviders().stream() .anyMatch(ConnectionProviderModel::supportsConnectivityTesting)) .orElse(false)) .collect(toList()); if (testConnectionComponentModels.size() > 1) { throw new MuleRuntimeException(createStaticMessage(format("There are [%d] global elements that can be potentially used for test connection when it should be just one. Mark any of them with the attribute [%s=\"true\"], offended global elements are: [%s]", testConnectionComponentModels.size(), MODULE_CONNECTION_MARKER_ATTRIBUTE, testConnectionComponentModels.stream() .map(ComponentModel::getNameAttribute) .sorted() .collect(joining(", "))))); } return testConnectionComponentModels.stream().findFirst(); }
Source:
<code>public static WifiSsid createFromByteArray(byte ssid[]) { WifiSsid wifiSsid = new WifiSsid(); <START> wifiSsid.octets.write(ssid, 0 , ssid.length);; <END> return wifiSsid; }</code><technical_language>add a null check for |ssid|</technical_language>

Target:
public static WifiSsid createFromByteArray(byte ssid[]) { WifiSsid wifiSsid = new WifiSsid(); if (ssid != null) { wifiSsid.octets.write(ssid, 0 , ssid.length);; } return wifiSsid; }
Source:
<code>public String getCreateQuery(String tableName, Collection<SinkRecordField> fields) { String createQuery = super.getCreateQuery(tableName, fields).replace("CREATE TABLE", "CREATE COLUMN TABLE"); <START> log.trace("Create Query : " + createQuery); <END> return createQuery; }</code><technical_language>This is logged INFO caller, remove this log line</technical_language>

Target:
public String getCreateQuery(String tableName, Collection<SinkRecordField> fields) { return super.getCreateQuery(tableName, fields).replace("CREATE TABLE", "CREATE COLUMN TABLE"); }
Source:
<code>public void initialize(final AppStateManager stateManager, final Application app) { super.initialize(stateManager, app); this.app = (Main) app; rootNode = this.app.getRootNode(); assetManager = this.app.getAssetManager(); this.stateManager = this.app.getStateManager(); inputManager = this.app.getInputManager(); viewPort = this.app.getViewPort(); SingleBarLoadingState loader = new SingleBarLoadingState() { @Override public Void onLoad() { try { if (level != null) { kwdFile = new KwdFile(Main.getDkIIFolder(), new File(Main.getDkIIFolder().concat(AssetsConverter.MAPS_FOLDER.concat(level).concat(".kwd")))); } else { kwdFile.load(); } setProgress(0.25f); worldNode = new Node("World"); worldNode.attachChild(new MapLoader() { @Override protected void updateProgress(int progress, int max) { setProgress(0.25f + ((float) progress / max * 0.75f)); } }.load(assetManager, kwdFile)); bulletAppState = new BulletAppState(); this.stateManager.attach(bulletAppState); <START> rootNode.attachChild(new ThingLoader().load(bulletAppState, assetManager, kwdFile)); <END> setProgress(1.0f); } catch (Exception e) { logger.log(Level.SEVERE, "Failed to load the game!", e); } return null; } @Override public void onLoadComplete() { GameState.this.app.setViewProcessors(); rootNode.attachChild(worldNode); stateManager.getState(PlayerState.class).setEnabled(true); } }; stateManager.attach(loader); }</code><technical_language>afraid this crashes system. OnLoad() is called another thread. "worldNode" is loaded separately, attached root node later. scenegraph figured out, for attach ThingLoader stuff "worldNode" work</technical_language>

Target:
public void initialize(final AppStateManager stateManager, final Application app) { super.initialize(stateManager, app); this.app = (Main) app; rootNode = this.app.getRootNode(); assetManager = this.app.getAssetManager(); this.stateManager = this.app.getStateManager(); inputManager = this.app.getInputManager(); viewPort = this.app.getViewPort(); SingleBarLoadingState loader = new SingleBarLoadingState() { @Override public Void onLoad() { try { if (level != null) { kwdFile = new KwdFile(Main.getDkIIFolder(), new File(Main.getDkIIFolder().concat(AssetsConverter.MAPS_FOLDER.concat(level).concat(".kwd")))); } else { kwdFile.load(); } setProgress(0.25f); worldNode = new Node("World"); worldNode.attachChild(new MapLoader() { @Override protected void updateProgress(int progress, int max) { setProgress(0.25f + ((float) progress / max * 0.75f)); } }.load(assetManager, kwdFile)); bulletAppState = new BulletAppState(); this.stateManager.attach(bulletAppState); worldNode.attachChild(new ThingLoader().load(bulletAppState, assetManager, kwdFile)); setProgress(1.0f); } catch (Exception e) { logger.log(Level.SEVERE, "Failed to load the game!", e); } return null; } @Override public void onLoadComplete() { GameState.this.app.setViewProcessors(); rootNode.attachChild(worldNode); stateManager.getState(PlayerState.class).setEnabled(true); } }; stateManager.attach(loader); }
Source:
<code>synchronized Set<String> metadataTopics() { <START> Set<String> topics = new HashSet<>(groupSubscription); <END> topics.addAll(subscription); return topics; }</code><technical_language>borderline overkill, considering if avoid copy logic following: if (!groupSubscription.isEmpty()) return groupSubscription; else return subscription; Basically relying group subscription a superset of local subscription is defined</technical_language>

Target:
synchronized Set<String> metadataTopics() { return groupSubscription.isEmpty() ? subscription : groupSubscription; }
Source:
<code>public Set<Stream> getResultStreams() { <START> Set<Stream> streams = new HashSet<Stream>(); <END> streams.add(this.modelResultStream); streams.add(this.rootResultStream); return streams; }</code><technical_language>here, return ImmutableSet.of(this.modelResultStream, this.rootResultStream);</technical_language>

Target:
public Set<Stream> getResultStreams() { Set<Stream> streams = ImmutableSet.of(this.modelResultStream,this.rootResultStream); return streams; }
Source:
<code>private void enableBreakpoints() { for (BreakpointRequest <START> fBreakpointRequest : <END> fBreakpointRequests) { fBreakpointRequest.enable(); } }</code><technical_language>rename breakpointRequest</technical_language>

Target:
private void enableBreakpoints() { for (BreakpointRequest breakpointRequest : fBreakpointRequests) { breakpointRequest.enable(); } }
Source:
<code>public void addGunner(Person p) { <START> addGunner(Objects.requireNonNull(p), false); <END> }</code><technical_language>this duplicate nonNull check</technical_language>

Target:
public void addGunner(Person p) { addGunner(p, false); }
Source:
<code><START> public BaseWorkerTask<Operation> createBaseWorker() { <END> return new BaseWorkerTask<Operation>() { @Override protected OperationSelector<Operation> createOperationSelector() { return new OperationSelector<Operation>().addOperation(Operation.PUT, putProb) .addOperationRemainingProbability(Operation.GET); } @Override protected void doRun(Operation operation) { int key = randomKey(); switch (operation) { case PUT: int value = randomValue(); putLatency.started(); if (useSet) { map.set(key, value); } else { map.put(key, value); } putLatency.done(); break; case GET: getLatency.started(); map.get(key); getLatency.done(); break; default: throw new UnsupportedOperationException(); } throughput.done(); } private int randomKey() { return keys[nextInt(keys.length)]; } private int randomValue() { return nextInt(Integer.MAX_VALUE); } }; }</code><technical_language>Please of of ordinary class. This is hard read. 'Never' anonymous interclasses of more a lines</technical_language>

Target:
public AbstractWorkerTask<Operation> createBaseWorker() { return new WorkerTask(); }
Source:
<code>private File cropImageFile(File selectedFile){ int targetImageWidth = 100; <START> int targetImageHeight = 100; <END> File imageFile = null; try { BufferedImage avatarImageBuffered = ImageIO.read(selectedFile); BufferedImage croppedImage; int currentImageWidth = avatarImageBuffered.getWidth(null); int currentImageHeight = avatarImageBuffered.getHeight(null); if(currentImageHeight == targetImageHeight && currentImageWidth == targetImageHeight){ croppedImage = avatarImageBuffered; imageFile = selectedFile; }else{ double targetImageRatio = (double)targetImageWidth / (double)targetImageHeight; if (currentImageWidth < targetImageRatio * currentImageHeight) { currentImageHeight = new Double((new Double(currentImageWidth )/ new Double(targetImageRatio))).intValue(); } else { currentImageWidth = new Double(((double)currentImageHeight * targetImageRatio)).intValue(); } imageFile = new File(SparkManager.getUserDirectory(), "personal.png"); croppedImage = Thumbnails.of(avatarImageBuffered).sourceRegion(Positions.CENTER, currentImageWidth, currentImageHeight). size(targetImageWidth,targetImageWidth).asBufferedImage(); ImageIO.write(croppedImage, "PNG", imageFile); } }catch (IOException ex){ ex.printStackTrace(); } return imageFile; }</code><technical_language>this dimension? <LINK_0> lists recommended dimension 64x64px. If a reason for 100x100, consider changing (and/or making configurable)</technical_language>

Target:
private BufferedImage cropImageFile(File selectedFile) { int targetImageWidth = 64; int targetImageHeight = 64; BufferedImage croppedImage = null; try { BufferedImage avatarImageBuffered = ImageIO.read(selectedFile); int currentImageWidth = avatarImageBuffered.getWidth(null); int currentImageHeight = avatarImageBuffered.getHeight(null); if (currentImageHeight == targetImageHeight && currentImageWidth == targetImageHeight) { croppedImage = avatarImageBuffered; } else { double targetImageRatio = (double)targetImageWidth / (double)targetImageHeight; if (currentImageWidth < targetImageRatio * currentImageHeight) { currentImageHeight = new Double((double)currentImageWidth / (double)targetImageRatio).intValue(); } else { currentImageWidth = new Double(((double)currentImageHeight * targetImageRatio)).intValue(); } croppedImage = Thumbnails.of(avatarImageBuffered).sourceRegion(Positions.CENTER, currentImageWidth, currentImageHeight). size(targetImageWidth, targetImageHeight).asBufferedImage(); } } catch (IOException ex) { Log.error(ex); } return croppedImage; }
Source:
<code>protected void run() throws Exception { StoredConfig dbconfig = db.getConfig(); RemoteConfig remoteConfig = new RemoteConfig(dbconfig, remote); PubSubConfig pubsubConfig = SubscribeDaemon.getConfig(); <START> URIish uriish = remoteConfig.getURIs().get(0); <END> String uriRoot = PubSubConfig.getUriRoot(uriish); String dir = db.getDirectory().getAbsolutePath(); if (uriish != null) { Publisher p = pubsubConfig.getPublisher(uriRoot); if (p == null || !p.removeSubscriber(remote, dir)) { out.println(MessageFormat.format( CLIText.get().doesNotExist, remote)); return; } if (p.getSubscribers().size() == 0) pubsubConfig.removePublisher(p); try { SubscribeDaemon.updateConfig(pubsubConfig); } catch (IOException e) { out.println(MessageFormat.format(CLIText.get().cannotWrite, SubscribeDaemon.getConfigFile())); return; } } }</code><technical_language>if is remote this fails: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0 java.util.ArrayList.RangeCheck(ArrayList.java:547) java.util.ArrayList.get(ArrayList.java:322) java.util.Collections$UnmodifiableList.get(Collections.java:1154) org.eclipse.jgit.pgm.Unsubscribe.run(Unsubscribe.java:69) org.eclipse.jgit.pgm.TextBuiltin.execute(TextBuiltin.java:148) org.eclipse.jgit.pgm.Main.execute(Main.java:191) org.eclipse.jgit.pgm.Main.run(Main.java:120) org.eclipse.jgit.pgm.Main.main(Main.java:94) instead command explain handle this situation user do instead</technical_language>

Target:
protected void run() throws Exception { StoredConfig dbconfig = db.getConfig(); RemoteConfig remoteConfig = new RemoteConfig(dbconfig, remote); PubSubConfig pubsubConfig = SubscribeDaemon.getConfig(); List<URIish> uris = remoteConfig.getURIs(); if (uris.isEmpty()) { out.println(MessageFormat.format( CLIText.get().noRemoteUriUnsubscribe, remote)); return; } String uriRoot = PubSubConfig.getUriRoot(uris.get(0)); String dir = db.getDirectory().getAbsolutePath(); Publisher p = pubsubConfig.getPublisher(uriRoot); if (p == null || !p.removeSubscriber(remote, dir)) { out.println(MessageFormat.format( CLIText.get().subscriptionDoesNotExist, remote)); return; } if (p.getSubscribers().size() == 0) pubsubConfig.removePublisher(p); try { SubscribeDaemon.updateConfig(pubsubConfig); } catch (IOException e) { out.println(MessageFormat.format(CLIText.get().cannotWrite, SubscribeDaemon.getConfigFile())); return; } out.println(MessageFormat.format( CLIText.get().didUnsubscribe, remote, uriRoot)); }
Source:
<code>private static void checkDictionary(UnpackingExpression unpackingExpression, Map<String, List<Tree>> passedParameters) { List<String> dictionaryKeys = extractKeysFromDictionary(unpackingExpression); for (String key : dictionaryKeys) { <START> passedParameters.computeIfAbsent(key, k -> new ArrayList<>()).add(unpackingExpression); <END> } }</code><technical_language>This if this collide rules duplicate keys in dictionary literals for cases foo(**{'a': 1, 'a': 1}). If this is case, consider replacing List<String> Set<String> in return types of helper methods collect keys</technical_language>

Target:
private static void checkDictionary(UnpackingExpression unpackingExpression, Map<String, List<Tree>> passedParameters) { Set<String> dictionaryKeys = extractKeysFromDictionary(unpackingExpression); dictionaryKeys.forEach(key -> passedParameters.computeIfAbsent(key, k -> new ArrayList<>()).add(unpackingExpression)); }
Source:
<code>private static void check(@NotNull GoNamedElement element, @NotNull ProblemsHolder holder) { ProgressManager.checkCanceled(); GoFile builtin = GoSdkUtil.findBuiltinFile(element); if (builtin == null) return; String name = element.getName(); <START> if (name == null || "Type".equals(name)) return; <END> for (GoTypeSpec builtinTypeDeclaration : builtin.getTypes()) { if (name.equals(builtinTypeDeclaration.getName())) { registerProblem(holder, element, builtinTypeDeclaration); break; } } }</code><technical_language>Type name from? I test for</technical_language>

Target:
private static void check(@NotNull GoNamedElement element, @NotNull ProblemsHolder holder) { GoFile builtin = GoSdkUtil.findBuiltinFile(element); if (builtin == null) return; String name = element.getName(); if (name == null || GoTypeReference.DOC_ONLY_TYPES.contains(name)) return; for (GoTypeSpec builtinTypeDeclaration : builtin.getTypes()) { if (name.equals(builtinTypeDeclaration.getName())) { registerProblem(holder, element, builtinTypeDeclaration); return; } } ProgressManager.checkCanceled(); for (GoFunctionDeclaration builtinFunctionsDeclaration : builtin.getFunctions()) { if (name.equals(builtinFunctionsDeclaration.getName())) { registerProblem(holder, element, builtinFunctionsDeclaration); return; } } }
Source:
<code>private void deserializeShuffle(final String serializedShuffle) { try { final Injector injector = rootInjector.forkInjector(confSerializer.fromString(serializedShuffle)); <START> injector.getInstance(TupleNetworkSetup.class); <END> final Shuffle shuffle = injector.getInstance(Shuffle.class); shuffleMap.put(shuffle.getShuffleDescription().getShuffleName(), shuffle); } catch (final Exception e) { throw new RuntimeException("An exception occurred while deserializing shuffle : " + serializedShuffle, e); } }</code><technical_language>remove this line, add TupleNetworkSetup parameters of StaticPushShuffle's constructor? this approach, close TupleNetworkSetup instance in close() method of StaticPushShuffle avoid multiple TupleNetworkSetups</technical_language>

Target:
private void deserializeShuffle(final String serializedShuffle) { try { final Injector injector = rootInjector.forkInjector(confSerializer.fromString(serializedShuffle)); final Shuffle shuffle = injector.getInstance(Shuffle.class); shuffleMap.put(shuffle.getShuffleDescription().getShuffleName(), shuffle); } catch (final Exception e) { throw new RuntimeException("An exception occurred while deserializing shuffle : " + serializedShuffle, e); } }
Source:
<code>private static void initializeFiles() throws IOException { <START> TEST_DIR = <END> createTempDir().toString(); DATA_FILE_PATH = Paths.get(TEST_DIR, DATA_FILE); TEST_PATH = Paths.get(TEST_DIR, NON_EXISTENT_FILE); File testInputFile = new File(TEST_DIR, DATA_FILE); if (!testInputFile.exists()) { testInputFile.createNewFile(); } FileWriter fw = new FileWriter(testInputFile.getAbsoluteFile()); BufferedWriter bw = new BufferedWriter(fw); bw.write(TEST_FILE_DATA); bw.close(); }</code><technical_language>CAPITALS reserved for constants, capitalized</technical_language>

Target:
private void initializeFiles() throws IOException { testDir = Files.createTempDirectory("testDir").toString(); dataFilePath = Paths.get(testDir, DATA_FILE); testPath = Paths.get(testDir, NON_EXISTENT_FILE); File testInputFile = new File(testDir, DATA_FILE); if (!testInputFile.exists()) { testInputFile.createNewFile(); } FileWriter fw = new FileWriter(testInputFile.getAbsoluteFile()); BufferedWriter bw = new BufferedWriter(fw); bw.write(TEST_FILE_DATA); bw.close(); }