auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private ProcReturn execCommandInContainer(String containerName, Node node, boolean quiet, String... cmd) throws Exception { if (containerName != null && ! containerName.isEmpty()) { decorator.setContainerName(containerName); } ByteArrayOutputStream out = new ByteArrayOutputStream(); Launcher launcher = decorator .decorate(new DummyLauncher(new StreamTaskListener(new TeeOutputStream(out, System.out))), node); Map<String, String> envs = new HashMap<>(100); for (int i = 0; i < 50; i++) { envs.put("aaaaaaaa" + i, "bbbbbbbb"); } envs.put("workingDir1", "/home/jenkins/agent"); ContainerExecProc proc = (ContainerExecProc) launcher .launch(launcher.new ProcStarter().pwd("/tmp").cmds(cmd).envs(envs).quiet(quiet)); for (int i = 0; proc.isAlive() && i < 200; i++) { Thread.sleep(100); } assertFalse("proc is alive", proc.isAlive()); <START> int exitCode = proc.joinWithTimeout(20, TimeUnit.SECONDS, StreamTaskListener.fromStderr()); <END> return new ProcReturn(proc, exitCode, out.toString()); }</code><technical_language>java @Test(timeout = 10000) * this help? * necessary? Suggest suggestion int exitCode = proc.join(); for test java @Test(timeout = 180_000) matching JenkinsRule.timeout</technical_language>

Target:
private ProcReturn execCommandInContainer(String containerName, Node node, boolean quiet, String... cmd) throws Exception { if (containerName != null && ! containerName.isEmpty()) { decorator.setContainerName(containerName); } ByteArrayOutputStream out = new ByteArrayOutputStream(); Launcher launcher = decorator .decorate(new DummyLauncher(new StreamTaskListener(new TeeOutputStream(out, System.out))), node); Map<String, String> envs = new HashMap<>(100); for (int i = 0; i < 50; i++) { envs.put("aaaaaaaa" + i, "bbbbbbbb"); } envs.put("workingDir1", "/home/jenkins/agent"); ContainerExecProc proc = (ContainerExecProc) launcher .launch(launcher.new ProcStarter().pwd("/tmp").cmds(cmd).envs(envs).quiet(quiet)); for (int i = 0; proc.isAlive() && i < 200; i++) { Thread.sleep(100); } assertFalse("proc is alive", proc.isAlive()); int exitCode = proc.join(); return new ProcReturn(proc, exitCode, out.toString()); }
Source:
<code>public void readsEnumsUsingToString() throws Exception { <START> mapper.configure(DeserializationFeature.READ_ENUMS_USING_TO_STRING, true); <END> assertThat(mapper.readValue("\"Pound sterling\"", CurrencyCode.class)).isEqualTo(CurrencyCode.GBP); }</code><technical_language>configuration changed a copy of object mapper. test methods in this class fail (order guaranteed): [ObjectMapper#copy()](<LINK_0></technical_language>

Target:
public void readsEnumsUsingToString() throws Exception { final ObjectMapper toStringEnumsMapper = mapper.copy() .configure(DeserializationFeature.READ_ENUMS_USING_TO_STRING, true); assertThat(toStringEnumsMapper.readValue("\"Pound sterling\"", CurrencyCode.class)).isEqualTo(CurrencyCode.GBP); }
Source:
<code>public Optional<BlockState> bridge$getStateWithData(final IBlockState blockState, final ImmutableDataManipulator<?, ?> manipulator) { if (manipulator instanceof ImmutableConnectedDirectionData) { ImmutableConnectedDirectionData connectedDirectionData = (ImmutableConnectedDirectionData) manipulator; return Optional.of((BlockState) DirectionalBlockUtils.applyConnectedDirections(blockState, <START> DIRECTION_TO_PROPERTY_MAPPING, <END> (sourceBlockState, property) -> true, (sourceBlockState, property) -> false, connectedDirectionData.connectedDirections().get())); } return super.bridge$getStateWithData(blockState, manipulator); }</code><technical_language>align multi-line this, indent continuation</technical_language>

Target:
public Optional<BlockState> bridge$getStateWithData(final IBlockState blockState, final ImmutableDataManipulator<?, ?> manipulator) { if (manipulator instanceof ImmutableConnectedDirectionData) { final ImmutableConnectedDirectionData connectedDirectionData = (ImmutableConnectedDirectionData) manipulator; return Optional.of((BlockState) impl$applyConnectedDirections(blockState, connectedDirectionData.connectedDirections().get())); } return super.bridge$getStateWithData(blockState, manipulator); }
Source:
<code>private String identifier(Class<?> caller) { return Optional.ofNullable(FrameworkUtil.getBundle(caller)) .map(b -> b.getSymbolicName()) .orElse(Optional.ofNullable(caller) .map(c -> c.getName()) <START> .orElse(Status.class.getName())); <END> }</code><technical_language>more sense caller class identifier instead of Status class? caller class package name</technical_language>

Target:
private String identifier(Class<?> caller) { return Optional.ofNullable(caller) .flatMap(c -> Optional.ofNullable(FrameworkUtil.getBundle(c))) .map(b -> b.getSymbolicName()) .orElseGet(() -> Optional.ofNullable(caller) .map(c -> c.getName()) .orElse(getClass().getName())); }
Source:
<code>static com.basho.riak.pbc.RiakObject convert(IRiakObject riakObject) { final VClock vc = riakObject.getVClock(); ByteString bucketName = nullSafeToByteString(riakObject.getBucket()); ByteString key = nullSafeToByteString(riakObject.getKey()); ByteString content = ByteString.copyFrom(riakObject.getValue()); ByteString vclock = null; if (vc != null) { vclock = nullSafeFromBytes(vc.getBytes()); } com.basho.riak.pbc.RiakObject result = new com.basho.riak.pbc.RiakObject(vclock, bucketName, key, content); for (com.basho.riak.client.RiakLink link : riakObject) { result.addLink(link.getTag(), link.getBucket(), link.getKey()); } for (Entry<String, String> metaDataItem : riakObject.userMetaEntries()) { result.addUsermetaItem(metaDataItem.getKey(), metaDataItem.getValue()); } for (Map.Entry<com.basho.riak.client.query.indexes.IntIndex, Set<Integer>> i : riakObject.allIntIndexes().entrySet()) { String name = i.getKey().getFullname(); for (Integer v : i.getValue()) { result.addIndex(name, v); } } <START> for (Map.Entry<BinIndex, Set<String>> i : riakObject.allBinIndexes().entrySet()) { <END> String name = i.getKey().getFullname(); for (String v : i.getValue()) { result.addIndex(name, v); } } result.setContentType(riakObject.getContentType()); return result; }</code><technical_language>import for com.basho.riak.client.query.indexes for loops easier read</technical_language>

Target:
static com.basho.riak.pbc.RiakObject convert(IRiakObject riakObject) { final VClock vc = riakObject.getVClock(); ByteString bucketName = nullSafeToByteString(riakObject.getBucket()); ByteString key = nullSafeToByteString(riakObject.getKey()); ByteString content = ByteString.copyFrom(riakObject.getValue()); ByteString vclock = null; if (vc != null) { vclock = nullSafeFromBytes(vc.getBytes()); } com.basho.riak.pbc.RiakObject result = new com.basho.riak.pbc.RiakObject(vclock, bucketName, key, content); for (com.basho.riak.client.RiakLink link : riakObject) { result.addLink(link.getTag(), link.getBucket(), link.getKey()); } for (Entry<String, String> metaDataItem : riakObject.userMetaEntries()) { result.addUsermetaItem(metaDataItem.getKey(), metaDataItem.getValue()); } for (Map.Entry<IntIndex, Set<Integer>> i : riakObject.allIntIndexes().entrySet()) { String name = i.getKey().getFullname(); for (Integer v : i.getValue()) { result.addIndex(name, v); } } for (Map.Entry<BinIndex, Set<String>> i : riakObject.allBinIndexes().entrySet()) { String name = i.getKey().getFullname(); for (String v : i.getValue()) { result.addIndex(name, v); } } result.setContentType(riakObject.getContentType()); return result; }
Source:
<code>protected void executeCommand() { if (getDiskImages().isEmpty()) { setSucceeded(true); return; } SealDisksVDSCommandParameters parameters = new SealDisksVDSCommandParameters(); parameters.setVmId(getParameters().getVmTemplateId()); parameters.setJobId(getParameters().getHostJobId()); getDiskImages().forEach(diskImage -> parameters.addVolume( diskImage.getStorageIds().get(0), diskImage.getId(), diskImage.getImageId())); lockTemplateInDb(); lockDiskImagesInDb(); VDSReturnValue vdsReturnValue = VdsCommandsHelper.runVdsCommandWithFailover( VDSCommandType.SealDisks, parameters, getDiskImages().get(0).getStoragePoolId(), this); if (!vdsReturnValue.getSucceeded()) { setCommandStatus(CommandStatus.FAILED); unlockDiskImagesInDb(); <START> unlockTemplateInDb(); <END> } setSucceeded(vdsReturnValue.getSucceeded()); }</code><technical_language>indication for able seal template</technical_language>

Target:
protected void executeCommand() { if (getDiskImages().isEmpty()) { setSucceeded(true); return; } SealDisksVDSCommandParameters parameters = new SealDisksVDSCommandParameters(); parameters.setVmId(getParameters().getVmTemplateId()); parameters.setJobId(getParameters().getHostJobId()); getDiskImages().forEach(diskImage -> parameters.addVolume( diskImage.getStorageIds().get(0), diskImage.getId(), diskImage.getImageId())); VDSReturnValue vdsReturnValue = VdsCommandsHelper.runVdsCommandWithFailover( VDSCommandType.SealDisks, parameters, getDiskImages().get(0).getStoragePoolId(), this); if (!vdsReturnValue.getSucceeded()) { setCommandStatus(CommandStatus.FAILED); unlockTemplateInDb(); } setSucceeded(vdsReturnValue.getSucceeded()); }
Source:
<code>public Enumeration<URL> getResources(String name) throws IOException { @SuppressWarnings("unchecked") <START> Enumeration<URL>[] enums = (Enumeration<URL>[]) new Enumeration<?>[2]; <END> enums[0] = findResources(name); enums[1] = getParent() == null ? null : getParent().getResources(name); return new Enumeration<URL>() { int index = 0; @Override public boolean hasMoreElements() { while (index < enums.length) { if (enums[index] != null && enums[index].hasMoreElements()) { return true; } index++; } return false; } @Override public URL nextElement() { if (!hasMoreElements()) { throw new NoSuchElementException(); } return enums[index].nextElement(); } }; }</code><technical_language>simpler put in ArrayList return Collections.enumeration(list)</technical_language>

Target:
public Enumeration<URL> getResources(String name) throws IOException { List<URL> resources = Collections.list(findResources(name)); if (getParent() != null) { Enumeration<URL> parentResources = getParent().getResources(name); if (parentResources.hasMoreElements()) { resources.addAll(Collections.list(parentResources)); } } return Collections.enumeration(resources); }
Source:
<code>@Override public Double predict(Vector input) { Vector likelihood = likelihood(input); double maxLikelihood = -1.; int idxOfMax = -1; for (int i = 0; i < likelihood.size(); i++) { double prob = likelihood.get(i); if (prob > maxLikelihood) { maxLikelihood = prob; idxOfMax = i; } } <START> return (double)idxOfMax; <END> }</code><technical_language>likelihood.maxElement().index() here</technical_language>

Target:
@Override public Double predict(Vector input) { return (double)likelihood(input).maxElement().index(); }
Source:
<code>public void removeJob(T job) throws InternalErrorException { if (job == null) throw new InternalErrorException("Can't remove null job from set of running jobs."); jobsAccessLock.lock(); boolean removedSuccesfully = runningJobs.remove(job); jobsAccessLock.unlock(); <START> if (!removedSuccesfully) throw new InternalErrorException("We can't remove job defined by PerunBean " + job.toString() + " because it is not defined as running!"); <END> }</code><technical_language>return false another layer deal this situation</technical_language>

Target:
public boolean removeJob(T job) { if (job == null) return false; boolean removedSuccessfully; try { jobsAccessLock.lock(); removedSuccessfully = runningJobs.remove(job); } finally { jobsAccessLock.unlock(); } return removedSuccessfully; }
Source:
<code>protected void handleReceive(final Context context, Intent data){ try { if (data != null && data.hasExtra(DownloadManager.EXTRA_DOWNLOAD_ID)) { long id = data.getLongExtra(DownloadManager.EXTRA_DOWNLOAD_ID, -1); if (id != -1) { logger.debug("Received download notification for id: " + id); NativeDownloadModel nm = environment.getDownloadManager().getDownload(id); if (nm == null || nm.status != DownloadManager.STATUS_SUCCESSFUL) { logger.debug("Download seems failed or cancelled for id : " + id); return; } else { logger.debug("Download successful for id : " + id); } environment.getStorage().markDownloadAsComplete(id, new DataCallback<VideoModel>() { @Override public void onResult(VideoModel result) { if(result!=null){ DownloadEntry download = (DownloadEntry) result; ISegment segIO = environment.getSegment(); segIO.trackDownloadComplete(download.videoId, download.eid, download.lmsUrl); PrefManager p = new PrefManager(context, download.username); long count = p.getLong(PrefManager.Key.COUNT_OF_VIDEOS_DOWNLOADED); if (count < 0) { count = 0; } count ++; <START> p.put(PrefManager.Key.COUNT_OF_VIDEOS_DOWNLOADED, count); <END> } } @Override public void onFail(Exception ex) { logger.error(ex); } }); } } } catch(Exception ex) { logger.error(ex); } }</code><technical_language>Hmm, this count anywhere, remove this key I guess</technical_language>

Target:
protected void handleReceive(final Context context, Intent data){ try { if (data != null && data.hasExtra(DownloadManager.EXTRA_DOWNLOAD_ID)) { long id = data.getLongExtra(DownloadManager.EXTRA_DOWNLOAD_ID, -1); if (id != -1) { logger.debug("Received download notification for id: " + id); NativeDownloadModel nm = environment.getDownloadManager().getDownload(id); if (nm == null || nm.status != DownloadManager.STATUS_SUCCESSFUL) { logger.debug("Download seems failed or cancelled for id : " + id); return; } else { logger.debug("Download successful for id : " + id); } environment.getStorage().markDownloadAsComplete(id, new DataCallback<VideoModel>() { @Override public void onResult(VideoModel result) { if(result!=null){ DownloadEntry download = (DownloadEntry) result; ISegment segIO = environment.getSegment(); segIO.trackDownloadComplete(download.videoId, download.eid, download.lmsUrl); } } @Override public void onFail(Exception ex) { logger.error(ex); } }); } } } catch(Exception ex) { logger.error(ex); } }
Source:
<code>public void shouldSeeSingleRelationshipInTransaction() throws Exception { int label; long n1, n2; try ( Transaction tx = session.beginTransaction() ) { n1 = tx.dataWrite().nodeCreate(); n2 = tx.dataWrite().nodeCreate(); long decoyNode = tx.dataWrite().nodeCreate(); label = tx.tokenWrite().relationshipTypeGetOrCreateForName( "R" ); tx.dataWrite().relationshipCreate( n2, label, decoyNode ); tx.success(); } try ( Transaction tx = session.beginTransaction() ) { <START> label = tx.tokenWrite().relationshipTypeGetOrCreateForName( "R" ); <END> long r = tx.dataWrite().relationshipCreate( n1, label, n2 ); try ( RelationshipScanCursor relationship = cursors.allocateRelationshipScanCursor() ) { tx.dataRead().singleRelationship( r, relationship ); assertTrue( "should find relationship", relationship.next() ); assertEquals( label, relationship.label() ); assertEquals( n1, relationship.sourceNodeReference() ); assertEquals( n2, relationship.targetNodeReference() ); assertEquals( r, relationship.relationshipReference() ); assertFalse( "should only find one relationship", relationship.next() ); } tx.success(); } }</code><technical_language>need do this again, right</technical_language>

Target:
public void shouldSeeSingleRelationshipInTransaction() throws Exception { int label; long n1, n2; try ( Transaction tx = session.beginTransaction() ) { n1 = tx.dataWrite().nodeCreate(); n2 = tx.dataWrite().nodeCreate(); long decoyNode = tx.dataWrite().nodeCreate(); label = tx.tokenWrite().relationshipTypeGetOrCreateForName( "R" ); tx.dataWrite().relationshipCreate( n2, label, decoyNode ); tx.success(); } try ( Transaction tx = session.beginTransaction() ) { long r = tx.dataWrite().relationshipCreate( n1, label, n2 ); try ( RelationshipScanCursor relationship = cursors.allocateRelationshipScanCursor() ) { tx.dataRead().singleRelationship( r, relationship ); assertTrue( "should find relationship", relationship.next() ); assertEquals( label, relationship.label() ); assertEquals( n1, relationship.sourceNodeReference() ); assertEquals( n2, relationship.targetNodeReference() ); assertEquals( r, relationship.relationshipReference() ); assertFalse( "should only find one relationship", relationship.next() ); } tx.success(); } }
Source:
<code><START> public TermsOfUse getTermsOfUse() { <END> return termsOfUse; }</code><technical_language>this a string, object</technical_language>

Target:
public String getTermsOfUse() { return termsOfUse; }
Source:
<code>public ItemStack slotClick(int par1, int par2, int par3, EntityPlayer par4EntityPlayer) { ItemStack st = par4EntityPlayer.inventory.getItemStack(); <START> if(st != null && st.getItem() == EnderIO.itemExtractSpeedUpgrade && st.getItemDamage() != 0) { <END> speedUpgradeSlotLimit = 1; } if(par4EntityPlayer.worldObj != null) { if(par1 >= startFilterSlot && itemConduit != null) { itemConduit.setInputFilter(dir, inputFilter); itemConduit.setOutputFilter(dir, outputFilter); } } try { return super.slotClick(par1, par2, par3, par4EntityPlayer); } catch (Exception e) { return null; } finally { speedUpgradeSlotLimit = 15; } }</code><technical_language>!= 0 checks conducive more types in future. prefer enum of sort created</technical_language>

Target:
public ItemStack slotClick(int par1, int par2, int par3, EntityPlayer par4EntityPlayer) { ItemStack st = par4EntityPlayer.inventory.getItemStack(); if(st != null && st.getItem() == EnderIO.itemExtractSpeedUpgrade) { SpeedUpgrade speedUpgrade = EnderIO.itemExtractSpeedUpgrade.getSpeedUpgrade(st); speedUpgradeSlotLimit = speedUpgrade.maxStackSize; } if(par4EntityPlayer.worldObj != null) { if(par1 >= startFilterSlot && itemConduit != null) { itemConduit.setInputFilter(dir, inputFilter); itemConduit.setOutputFilter(dir, outputFilter); } } try { return super.slotClick(par1, par2, par3, par4EntityPlayer); } catch (Exception e) { return null; } }
Source:
<code>protected DeploymentUnitStatus.State getJobState(String jobName) { PagedResources<JobDefinitionResource> list = distributedTestSupport.ensureTemplate() .jobOperations().list(); <START> for (JobDefinitionResource job : list) { <END> if (job.getName().equals(jobName)) { return DeploymentUnitStatus.State.valueOf(job.getStatus()); } } throw new IllegalStateException(String.format("Job %s not deployed", jobName)); }</code><technical_language>Noticed search for job in a list returned jobOperations. this extracted a private method is repeated</technical_language>

Target:
protected DeploymentUnitStatus.State getJobState(String jobName) { JobDefinitionResource job = getJob(jobName); if (job == null) { throw new IllegalStateException(String.format("Job %s not deployed", jobName)); } return DeploymentUnitStatus.State.valueOf(job.getStatus()); }
Source:
<code>public VcfReader(VariantSource source, File file) { this.source = source; this.file = file; <START> Resource resource = new GzipLazyResource(file); <END> setResource(resource); setLineMapper(new VcfLineMapper(source)); }</code><technical_language>system detect file is compressed create a resource accordingly</technical_language>

Target:
public VcfReader(VariantSource source, File file) throws IOException { Resource resource; resource = FileUtils.getResource(file); setResource(resource); setLineMapper(new VcfLineMapper(source)); }
Source:
<code>public List<MetricFamilySamples> collect() { List<MetricFamilySamples.Sample> samples = new ArrayList<MetricFamilySamples.Sample>(); for (Map.Entry<List<String>, Child> c : children.entrySet()) { Child.Value v = c.getValue().get(); samples.add(new MetricFamilySamples.Sample(fullname + "_count", labelNames, c.getKey(), v.count)); samples.add(new MetricFamilySamples.Sample(fullname + "_sum", labelNames, c.getKey(), v.sum)); if (this.shouldCalculateQuantiles()) { double[] data = c.getValue().reservoir.getSnapshot(); Arrays.sort(data); List<String> labelNamesWithQuantile = new ArrayList<String>(labelNames); <START> labelNamesWithQuantile.add("quantile"); <END> for (int i = 0; i < quantiles.length; i++) { List<String> labelValuesWithQuantile = new ArrayList<String>(c.getKey()); labelValuesWithQuantile.add(Double.toString(quantiles[i])); samples.add(new MetricFamilySamples.Sample(fullname, labelNamesWithQuantile, labelValuesWithQuantile, c.getValue().reservoir.getQuantile(quantiles[i], data))); } } } MetricFamilySamples mfs = new MetricFamilySamples(fullname, Type.SUMMARY, help, samples); List<MetricFamilySamples> mfsList = new ArrayList<MetricFamilySamples>(); mfsList.add(mfs); return mfsList; }</code><technical_language>quantile label needs banned in Builder, done in Histogram</technical_language>

Target:
public List<MetricFamilySamples> collect() { List<MetricFamilySamples.Sample> samples = new ArrayList<MetricFamilySamples.Sample>(); for (Map.Entry<List<String>, Child> c : children.entrySet()) { Child.Value v = c.getValue().get(); samples.add(new MetricFamilySamples.Sample(fullname + "_count", labelNames, c.getKey(), v.count)); samples.add(new MetricFamilySamples.Sample(fullname + "_sum", labelNames, c.getKey(), v.sum)); if (this.shouldCalculateQuantiles()) { Map<Quantile, Double> snapshot; synchronized (stream) { snapshot = c.getValue().stream.getSnapshot(this.quantiles); } List<String> labelNamesWithQuantile = new ArrayList<String>(labelNames); labelNamesWithQuantile.add("quantile"); for (Map.Entry<Quantile, Double> qe : snapshot.entrySet()) { List<String> labelValuesWithQuantile = new ArrayList<String>(c.getKey()); labelValuesWithQuantile.add(Double.toString(qe.getKey().getQuantile())); samples.add(new MetricFamilySamples.Sample(fullname, labelNamesWithQuantile, labelValuesWithQuantile, qe.getValue())); } } } MetricFamilySamples mfs = new MetricFamilySamples(fullname, Type.SUMMARY, help, samples); List<MetricFamilySamples> mfsList = new ArrayList<MetricFamilySamples>(); mfsList.add(mfs); return mfsList; }
Source:
<code>public static void proceedToNextStateFrom(InstallState prior) { InstallState current = Jenkins.getInstance().getInstallState(); if (!current.equals(prior)) { LOGGER.warning("Transitioning state from: " + prior + ", but current is: " + current); } <START> InstallState next = getNextInstallState(prior); <END> LOGGER.info("Install state tranisitioning from: " + prior + " to: " + next); if (next != null) { Jenkins.getInstance().setInstallState(next); } }</code><technical_language>overwrite 'current'? do need define 'prior'</technical_language>

Target:
public static void proceedToNextStateFrom(InstallState prior) { InstallState current = Jenkins.getInstance().getInstallState(); if (!current.equals(prior)) { if (Main.isDevelopmentMode) LOGGER.warning("Transitioning state from: " + prior + ", but current is: " + current); } InstallState next = getNextInstallState(prior); if (Main.isDevelopmentMode) LOGGER.info("Install state tranisitioning from: " + prior + " to: " + next); if (next != null) { Jenkins.getInstance().setInstallState(next); } }
Source:
<code>private void doAddReviewer() { final String nameEmail = addMemberBox.getText(); if (nameEmail == null || nameEmail.length() == 0 <START> || com.google.gerrit.client.admin.Util.C.defaultAccountName().equals( <END> nameEmail)) { return; } addMemberBox.setEnabled(false); final List<String> reviewers = Arrays.asList(nameEmail.split(";")); Util.DETAIL_SVC.addReviewers(reviewers, changeId, new GerritCallback<VoidResult>() { public void onSuccess(final VoidResult result) { addMemberBox.setEnabled(true); addMemberBox.setText(""); } @Override public void onFailure(final Throwable caught) { addMemberBox.setEnabled(true); super.onFailure(caught); } }); }</code><technical_language>Ick. tells I failed AddMemberBox review. move this detail defaultAccountName() AddMemberBox getText() method return "" defaultAccountName(). simplify a number of callers. work patch myself</technical_language>

Target:
private void doAddReviewer() { final String nameEmail = addMemberBox.getText(); if (nameEmail.length() == 0) { return; } addMemberBox.setEnabled(false); final List<String> reviewers = Arrays.asList(nameEmail.split(";")); PatchUtil.DETAIL_SVC.addReviewers(changeId, reviewers, new GerritCallback<VoidResult>() { public void onSuccess(final VoidResult result) { addMemberBox.setEnabled(true); addMemberBox.setText(""); } @Override public void onFailure(final Throwable caught) { addMemberBox.setEnabled(true); super.onFailure(caught); } }); }
Source:
<code>private void cacheNullForGroup(GroupColumnIO group, int r) { <START> if (!groupNullCache.containsKey(group)) { <END> groupNullCache.put(group, new IntArrayList()); } groupNullCache.get(group).add(r); }</code><technical_language>this is in hot path, this efficient possible, so: IntArrayList key = groupNullCache.get(group) if (groupNullCache == null) { key = new IntArrayList() groupNullCache.put(group, key); } key.add(r); This 1 map lookup key is present, 1 lookup, 1 put (which happen anyway)</technical_language>

Target:
private void cacheNullForGroup(GroupColumnIO group, int r) { IntArrayList nulls = groupNullCache.get(group); if (nulls == null) { nulls = new IntArrayList(); groupNullCache.put(group, nulls); } nulls.add(r); }
Source:
<code>public String solveProblemForSingle() { this.solution.setId(getIdForCorrection(this.solutionTask)); serviceManager.getWorkflowService().setSolution(getSolution()); try { setCurrentStep(serviceManager.getWorkflowService().solveProblem(this.currentStep)); saveStep(); } catch (DAOException | DataException e) { Helper.setFehlerMeldung("correctionSolveProblem"); <START> logger.error(e.getMessage(), e); <END> } setSolution(serviceManager.getWorkflowService().getSolution()); this.solutionTask = ""; AktuelleSchritteForm asf = (AktuelleSchritteForm) Helper.getManagedBeanValue("#{AktuelleSchritteForm}"); return asf.filterAll(); }</code><technical_language>setErrorMessage</technical_language>

Target:
public String solveProblemForSingle() { this.solution.setId(getIdForCorrection(this.solutionTask)); serviceManager.getWorkflowControllerService().setSolution(getSolution()); try { setCurrentStep(serviceManager.getWorkflowControllerService().solveProblem(this.currentStep)); saveStep(); } catch (DAOException | DataException e) { Helper.setErrorMessage("correctionSolveProblem", logger, e); } setSolution(serviceManager.getWorkflowControllerService().getSolution()); this.solutionTask = ""; AktuelleSchritteForm asf = (AktuelleSchritteForm) Helper.getManagedBeanValue("#{AktuelleSchritteForm}"); return asf.filterAll(); }
Source:
<code>CommonsRequestLoggingFilter commonsRequestLoggingFilter() { CommonsRequestLoggingFilter result = new CommonsRequestLoggingFilter() { @Override protected String createMessage(HttpServletRequest request, String prefix, String suffix) { return super.createMessage(request, String.format("%smethod=%s;", prefix, request.getMethod()), suffix); } }; result.setIncludeQueryString(true); <START> result.setIncludeHeaders(false); <END> result.setIncludeClientInfo(true); return result; }</code><technical_language>if this is a good idea this remove headers. add beforeRequest afterRequest redact commonly sensitive headers (i.e. Authentication: Bearer TOKEN => Authentication: Bearer [credentials redacted]). @sbespalov thoughts</technical_language>

Target:
CommonsRequestLoggingFilter commonsRequestLoggingFilter() { CommonsRequestLoggingFilter result = new CommonsRequestLoggingFilter() { @Override protected String createMessage(HttpServletRequest request, String prefix, String suffix) { return super.createMessage(request, String.format("%smethod=%s;", prefix, request.getMethod()), suffix); } }; result.setIncludeQueryString(true); result.setIncludeHeaders(true); result.setHeaderPredicate(s -> !(s.equals("Authorization") || s.equals("Cookie"))); result.setIncludeClientInfo(true); return result; }
Source:
<code>public void put(long entryLogId, EntryLogMetadata entryLogMeta) throws EntryLogMetadataMapException { LongWrapper key = LongWrapper.get(entryLogId); try { baos.get().reset(); try { entryLogMeta.serialize(dataos.get()); <START> dataos.get().flush(); <END> metadataMapDB.put(key.array, baos.get().toByteArray()); } catch (IllegalStateException | IOException e) { LOG.error("Failed to deserialize entrylog-metadata, entryLogId {}", entryLogId); throw new EntryLogMetadataMapException(e); } } finally { key.recycle(); } }</code><technical_language>output of serialize is expected flushed. move this flush call serialize method</technical_language>

Target:
public void put(long entryLogId, EntryLogMetadata entryLogMeta) throws EntryLogMetadataMapException { LongWrapper key = LongWrapper.get(entryLogId); try { baos.get().reset(); try { entryLogMeta.serialize(dataos.get()); metadataMapDB.put(key.array, baos.get().toByteArray()); } catch (IllegalStateException | IOException e) { LOG.error("Failed to serialize entrylog-metadata, entryLogId {}", entryLogId); throw new EntryLogMetadataMapException(e); } } finally { key.recycle(); } }
Source:
<code><START> public List<MaplayerGroup> findByParentId(final int groupId) { <END> final List<MaplayerGroup> allGroups = findAll(); List<MaplayerGroup> retGroups = new ArrayList<>(); for(MaplayerGroup group : allGroups) { if(group.getParentId() == groupId) { retGroups.add(group); } } retGroups.stream() .filter(g -> g.getParentId() == -1) .sorted(Comparator.comparing(MaplayerGroup::getOrderNumber, Comparator.nullsLast(Comparator.naturalOrder()))) .collect(Collectors.toList()); return retGroups; }</code><technical_language>of this logic written SQL statement</technical_language>

Target:
public List<MaplayerGroup> findByParentId(final int groupId) { final List<MaplayerGroup> groups = queryForList(getNameSpace() + ".findByParentId", groupId); return groups; }
Source:
<code>static <T> Future<T> future(Handler<Promise<T>> handler) { Promise<T> promise = Promise.promise(); try{ handler.handle(promise); <START> }catch (Exception e){ <END> promise.fail(e); } return promise.future(); }</code><technical_language>missing whitespace</technical_language>

Target:
static <T> Future<T> future(Handler<Promise<T>> handler) { Promise<T> promise = Promise.promise(); try { handler.handle(promise); } catch (Exception e){ promise.tryFail(e); } return promise.future(); }
Source:
<code>private ConfigurationBuilder getScriptCacheConfiguration() { GlobalConfiguration globalConfiguration = cacheManager.getGlobalComponentRegistry().getGlobalConfiguration(); CacheMode cacheMode = globalConfiguration.isClustered() ? CacheMode.REPL_SYNC : CacheMode.LOCAL; ConfigurationBuilder cfg = new ConfigurationBuilder(); cfg.transaction() .transactionMode(TransactionMode.TRANSACTIONAL).invocationBatching().enable() .transaction().lockingMode(LockingMode.PESSIMISTIC).syncCommitPhase(true).syncRollbackPhase(true) .locking().isolationLevel(IsolationLevel.READ_COMMITTED).useLockStriping(false) .clustering().cacheMode(cacheMode).sync() <START> .stateTransfer().fetchInMemoryState(true).awaitInitialTransfer(false) <END> .compatibility().enable().marshaller(new GenericJBossMarshaller()) .customInterceptors().addInterceptor() .interceptor(new ScriptingManagerInterceptor()).after(PessimisticLockingInterceptor.class); return cfg; }</code><technical_language>await</technical_language>

Target:
private ConfigurationBuilder getScriptCacheConfiguration() { GlobalConfiguration globalConfiguration = cacheManager.getGlobalComponentRegistry().getGlobalConfiguration(); CacheMode cacheMode = globalConfiguration.isClustered() ? CacheMode.REPL_SYNC : CacheMode.LOCAL; ConfigurationBuilder cfg = new ConfigurationBuilder(); cfg.clustering().cacheMode(cacheMode).sync().stateTransfer().fetchInMemoryState(true).awaitInitialTransfer(false).compatibility().enable() .marshaller(new GenericJBossMarshaller()).customInterceptors().addInterceptor().interceptor(new ScriptingInterceptor()).before(CacheMgmtInterceptor.class); if (globalConfiguration.security().authorization().enabled()) { globalConfiguration.security().authorization().roles().put(SCRIPT_MANAGER_ROLE, new CacheRoleImpl(SCRIPT_MANAGER_ROLE, AuthorizationPermission.ALL)); cfg.security().authorization().enable().role(SCRIPT_MANAGER_ROLE); } return cfg; }
Source:
<code>private String getPassword(Properties properties) throws IOException { if (isNotEmpty(properties.getProperty(PASSWORD_KEY))) { return properties.getProperty(PASSWORD_KEY); } else if (isNotEmpty(properties.getProperty(JDBC_JCEKS_FILE)) && isNotEmpty(properties.getProperty(JDBC_JCEKS_CREDENTIAL_KEY))) { try { Configuration configuration = new Configuration(); configuration.set(CredentialProviderFactory.CREDENTIAL_PROVIDER_PATH, properties.getProperty(JDBC_JCEKS_FILE)); CredentialProvider provider = CredentialProviderFactory.getProviders(configuration).get(0); CredentialProvider.CredentialEntry credEntry = provider.getCredentialEntry(properties.getProperty(JDBC_JCEKS_CREDENTIAL_KEY)); if (credEntry != null) { return new String(credEntry.getCredential()); } else { throw new InterpreterException("Failed to retrieve password from JCEKS from key: " + properties.getProperty(JDBC_JCEKS_CREDENTIAL_KEY)); } } catch (Exception e) { logger.error("Failed to retrieve password from JCEKS", e); <START> logger.error("For file: " + properties.getProperty(JDBC_JCEKS_FILE)); <END> logger.error("For key: " + properties.getProperty(JDBC_JCEKS_CREDENTIAL_KEY)); throw e; } } return null; }</code><technical_language>do logger.error</technical_language>

Target:
private String getPassword(Properties properties) throws IOException { if (isNotEmpty(properties.getProperty(PASSWORD_KEY))) { return properties.getProperty(PASSWORD_KEY); } else if (isNotEmpty(properties.getProperty(JDBC_JCEKS_FILE)) && isNotEmpty(properties.getProperty(JDBC_JCEKS_CREDENTIAL_KEY))) { try { Configuration configuration = new Configuration(); configuration.set(CredentialProviderFactory.CREDENTIAL_PROVIDER_PATH, properties.getProperty(JDBC_JCEKS_FILE)); CredentialProvider provider = CredentialProviderFactory.getProviders(configuration).get(0); CredentialProvider.CredentialEntry credEntry = provider.getCredentialEntry(properties.getProperty(JDBC_JCEKS_CREDENTIAL_KEY)); if (credEntry != null) { return new String(credEntry.getCredential()); } else { throw new InterpreterException("Failed to retrieve password from JCEKS from key: " + properties.getProperty(JDBC_JCEKS_CREDENTIAL_KEY)); } } catch (Exception e) { logger.error("Failed to retrieve password from JCEKS \n" + "For file: " + properties.getProperty(JDBC_JCEKS_FILE) + "\nFor key: " + properties.getProperty(JDBC_JCEKS_CREDENTIAL_KEY), e); throw e; } } return null; }
Source:
<code>public CommandResult exec(ContextAwareCommandInvocation invocation) { if (paths.size() < 3) { throw Messages.MSG.patchCreateArgumentsRequired(); } PatchTool patchTool = new PatchTool(invocation.getShellOutput(), invocation.getShellError()); try { Path patch = Paths.get(paths.get(0).getAbsolutePath()); Path target = Paths.get(paths.get(1).getAbsolutePath()); Path sources[] = new Path[paths.size() - 2]; for (int i = 2; i < paths.size(); i++) { sources[i - 2] = Paths.get(paths.get(i).getAbsolutePath()); } patchTool.createPatch(qualifier, patch, target, sources); return CommandResult.SUCCESS; } catch (IOException e) { <START> throw new RuntimeException(e); <END> } }</code><technical_language>exception handling is missing in subcommands</technical_language>

Target:
public CommandResult exec(ContextAwareCommandInvocation invocation) throws CommandException { if (paths == null || paths.size() < 3) { throw Messages.MSG.patchCreateArgumentsRequired(); } PatchTool patchTool = new PatchTool(invocation.getShellOutput(), invocation.getShellError()); try { Path patch = Paths.get(paths.get(0).getAbsolutePath()); Path target = Paths.get(paths.get(1).getAbsolutePath()); Path sources[] = new Path[paths.size() - 2]; for (int i = 2; i < paths.size(); i++) { sources[i - 2] = Paths.get(paths.get(i).getAbsolutePath()); } patchTool.createPatch(qualifier, patch, target, sources); return CommandResult.SUCCESS; } catch (IOException e) { throw new CommandException(e); } }
Source:
<code>public int hashCode() { <START> return Objects.hash(name); <END> }</code><technical_language>argument do Objects.hashCode(name) is more efficient</technical_language>

Target:
public int hashCode() { return Objects.hashCode(name); }
Source:
<code>public void setVSync(boolean vsync) { this.vsync = vsync; try{ Display.setVSyncEnabled(vsync); } catch (Exception e) { <START> Log.error("GL error", e); <END> } }</code><technical_language>suppressing errors</technical_language>

Target:
public void setVSync(boolean vsync) { this.vsync = vsync; Display.setVSyncEnabled(vsync); }
Source:
<code>protected void updateVersion(Version newVersion) { checkNotNull(newVersion); <START> if (this.version.equals(newVersion)) { <END> return; } final int currentVersionNumber = versionNumber(); final int newVersionNumber = newVersion.getNumber(); if (currentVersionNumber > newVersionNumber) { final String errMsg = format( "A version with the lower number (%d) passed to `updateVersion()` " + "of the entity with the version number %d.", newVersionNumber, currentVersionNumber ); throw new IllegalArgumentException(errMsg); } this.version = newVersion; }</code><technical_language>calling this times in this class</technical_language>

Target:
private void updateVersion(Version newVersion) { checkNotNull(newVersion); if (version.equals(newVersion)) { return; } final int currentVersionNumber = versionNumber(); final int newVersionNumber = newVersion.getNumber(); if (currentVersionNumber > newVersionNumber) { final String errMsg = format( "A version with the lower number (%d) passed to `updateVersion()` " + "of the entity with the version number %d.", newVersionNumber, currentVersionNumber ); throw new IllegalArgumentException(errMsg); } setVersion(newVersion); }
Source:
<code>public boolean onCreateOptionsMenu(Menu menu) { MenuItem buttonSettings = menu.add(R.string.title_settings); buttonSettings.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER); buttonSettings.setOnMenuItemClickListener(new MenuItem. OnMenuItemClickListener() { @Override public boolean onMenuItemClick(MenuItem item) { Intent settingsIntent = new Intent(AddBudgetActivity.this, SettingsActivity.class); settingsIntent.putExtra(PreferenceActivity.EXTRA_SHOW_FRAGMENT, SettingsFragment.class.getName()); settingsIntent.putExtra(PreferenceActivity.EXTRA_NO_HEADERS, true); AddBudgetActivity.this.startActivity(settingsIntent); return false; } }); MenuItem buttonSignout = menu.add(R.string.title_signout); buttonSignout.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER); buttonSignout.setOnMenuItemClickListener(new MenuItem. OnMenuItemClickListener() { @Override public boolean onMenuItemClick(MenuItem item) { <START> ApiInterface.getInstance().logOut(); <END> Intent logOut = new Intent(AddBudgetActivity.this, LoginActivity.class); logOut.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK); startActivity(logOut); return false; } }); return true; }</code><technical_language>Remove trailing spaces here</technical_language>

Target:
public boolean onCreateOptionsMenu(Menu menu) { MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.items, menu); return super.onCreateOptionsMenu(menu); }
Source:
<code>public synchronized void onClusterStateChange(VersionedOperationMode mode) { <START> m_clusterMode = mode.getMode(); <END> switch (m_clusterMode) { case PAUSED: importLog.info("Cluster is paused shutting down all importers."); close(); importLog.info("Cluster is paused all importers shutdown."); break; case RUNNING: importLog.info("Cluster is resumed STARTING all importers."); resume(); importLog.info("Cluster is resumed STARTED all importers."); break; default: break; } }</code><technical_language>dont need this keeping copy of cluster mode is good</technical_language>

Target:
public synchronized void onClusterStateChange(VersionedOperationMode mode) { switch (mode.getMode()) { case PAUSED: importLog.info("Cluster is paused shutting down all importers."); close(); importLog.info("Cluster is paused all importers shutdown."); break; case RUNNING: importLog.info("Cluster is resumed STARTING all importers."); resume(); importLog.info("Cluster is resumed STARTED all importers."); break; default: break; } }
Source:
<code>public void close() { try { heliosClient.close(); } catch (IOException e) { <START> log.warn("HeliosClient did not close cleanly: {}", e); <END> } }</code><technical_language>if pass a throwable argument a log method, logback (or slf4j, which) interprets wanting log stacktrace, this WARN HeliosClient close cleanly: java.util.IOException: blah foo.bar.blah():123 ... if want log message stacktrace do log.warn("HeliosClient close cleanly: {}", e.toString())</technical_language>

Target:
public void close() { if (!existingHeliosClient) { try { heliosClient.close(); } catch (IOException e) { log.warn("HeliosClient did not close cleanly: {}", e.toString()); } } jobPrefixFile.delete(); }
Source:
<code>private void validateAppConfig(String fileName) throws Exception { String appsDir = getAppsDirectory(); if (appsDir.equalsIgnoreCase("apps") && !isFoundAppNameConfigInSourceServerXml(fileName)) { applicationXml.createWebApplicationElement(fileName); } <START> else if (appsDir.equalsIgnoreCase("dropins") && isFoundAppConfigInSourceServerXml()) <END> throw new MojoExecutionException(messages.getString("error.install.app.dropins.directory")); }</code><technical_language>throw exception if appsDirectory is dropins application fileName is configured</technical_language>

Target:
private void validateAppConfig(String fileName) throws Exception { String appsDir = getAppsDirectory(); if (appsDir.equalsIgnoreCase("apps") && !isAppConfiguredInSourceServerXml(fileName)) { applicationXml.createWebApplicationElement(fileName); } else if (appsDir.equalsIgnoreCase("dropins") && isAppConfiguredInSourceServerXml(fileName)) throw new MojoExecutionException(messages.getString("error.install.app.dropins.directory")); }
Source:
<code><START> private Object createInstance(String className) throws ExecutorException { <END> try { Class<?> clazz = Class.forName(className); Constructor<?> ctor = clazz.getConstructor(); return ctor.newInstance(); } catch (ClassNotFoundException | NoSuchMethodException | IllegalAccessException | InstantiationException | InvocationTargetException e) { throw new ExecutorException(e); } }</code><technical_language>fine throw a ExecutorException for a method of createShellExecutor, misleading for a method named createInstance creates commandhandlers well</technical_language>

Target:
private Object createInstance(String className) throws Exception { try { Class<?> clazz = Class.forName(className); Constructor<?> ctor = clazz.getConstructor(); return ctor.newInstance(); } catch (ClassNotFoundException | NoSuchMethodException | IllegalAccessException | InstantiationException | InvocationTargetException e) { throw new ExecutorException(e); } }
Source:
<code>protected void executeCommand() { GlusterGeoRepSession session = getGeoRepSession(); <START> VDSReturnValue returnValue = runVdsCommand(VDSCommandType.SetGlusterVolumeGeoRepConfig, new GlusterVolumeGeoRepConfigVdsParameters(upServer.getId(), session.getMasterVolumeName(), session.getSlaveHostName(), session.getSlaveVolumeName(), getParameters().getConfigKey(), getParameters().getConfigValue())); <END> setSucceeded(returnValue.getSucceeded()); if(!getSucceeded()) { handleVdsError(AuditLogType.GLUSTER_GEOREP_CONFIG_SET_FAILED, returnValue.getVdsError().getMessage()); return; } }</code><technical_language>format</technical_language>

Target:
protected void executeCommand() { GlusterGeoRepSession session = getGeoRepSession(); String configKey = getParameters().getConfigKey(); String configValue = getParameters().getConfigValue(); VDSReturnValue returnValue = runVdsCommand(VDSCommandType.SetGlusterVolumeGeoRepConfig, new GlusterVolumeGeoRepConfigVdsParameters(upServer.getId(), session.getMasterVolumeName(), session.getSlaveHostName(), session.getSlaveVolumeName(), configKey, configValue)); setSucceeded(returnValue.getSucceeded()); if (getSucceeded()) { GlusterGeoRepSessionConfiguration geoRepSessionConfig = new GlusterGeoRepSessionConfiguration(); geoRepSessionConfig.setValue(configValue); geoRepSessionConfig.setKey(configKey); geoRepSessionConfig.setId(session.getId()); getGlusterGeoRepDao().updateConfig(geoRepSessionConfig); } else { handleVdsError(AuditLogType.GLUSTER_GEOREP_CONFIG_SET_FAILED, returnValue.getVdsError().getMessage()); return; } }
Source:
<code>private static long getStatsAsLong(Properties stats, String key) { <START> return (Long) firstNonNull(stats.get(key), 0); <END> }</code><technical_language>0 passed Integer? cast Integer Long? change</technical_language>

Target:
private static long getStatsAsLong(Properties stats, String key) { Object value = stats.get(key); if (value instanceof Number) return ((Number) value).longValue(); return 0L; }
Source:
<code>public void testAggregation() { <START> assertQuery("SELECT ST_AsText(point), count(*) " + <END> "FROM (VALUES (ST_Point(1, 2)), (ST_Point(3, 4)), (ST_Point(3, 4)), (ST_Point(5, 6))) as t(point) " + "GROUP BY 1", "SELECT * FROM (VALUES ('POINT (1 2)', 1), ('POINT (3 4)', 2), ('POINT (5 6)', 1))"); }</code><technical_language>nit: COUNT(*)</technical_language>

Target:
public void testAggregation() { assertQuery("SELECT ST_AsText(point), COUNT(*) " + "FROM (VALUES (ST_Point(1, 2)), (ST_Point(3, 4)), (ST_Point(3, 4)), (ST_Point(5, 6))) as t(point) " + "GROUP BY 1", "SELECT * FROM (VALUES ('POINT (1 2)', 1), ('POINT (3 4)', 2), ('POINT (5 6)', 1))"); }
Source:
<code>private synchronized SecretKey getUnwrappedSecretKey() throws GeneralSecurityException, IOException { Logger.v(TAG, "Reading SecretKey"); <START> SecretKey unwrappedSecretKey; <END> try { final byte[] wrappedSecretKey = readKeyData(); unwrappedSecretKey = unwrap(wrappedSecretKey); Logger.v(TAG, "Finished reading SecretKey"); } catch (final GeneralSecurityException | IOException ex) { Logger.e(TAG, "Unwrap failed for AndroidKeyStore", "", ADALError.ANDROIDKEYSTORE_FAILED, ex); mKeyPair = null; deleteKeyFile(); resetKeyPairFromAndroidKeyStore(); Logger.v(TAG, "Removed previous key pair info."); throw ex; } return unwrappedSecretKey; }</code><technical_language>final</technical_language>

Target:
private synchronized SecretKey getUnwrappedSecretKey() throws GeneralSecurityException, IOException { Logger.v(TAG, "Reading SecretKey"); final SecretKey unwrappedSecretKey; try { final byte[] wrappedSecretKey = readKeyData(); unwrappedSecretKey = unwrap(wrappedSecretKey); Logger.v(TAG, "Finished reading SecretKey"); } catch (final GeneralSecurityException | IOException ex) { Logger.e(TAG, "Unwrap failed for AndroidKeyStore", "", ADALError.ANDROIDKEYSTORE_FAILED, ex); mKeyPair = null; deleteKeyFile(); resetKeyPairFromAndroidKeyStore(); Logger.v(TAG, "Removed previous key pair info."); throw ex; } return unwrappedSecretKey; }
Source:
<code>public UnixConnectionSocketFactory(final URI socketUri) { super(); <START> String filename = socketUri.toString() <END> .replaceAll("^unix:/ .replaceAll("^unix://localhost", ""); this.socketFile = new File(filename); }</code><technical_language>final</technical_language>

Target:
public UnixConnectionSocketFactory(final URI socketUri) { super(); final String filename = socketUri.toString() .replaceAll("^unix:/ .replaceAll("^unix://localhost", ""); this.socketFile = new File(filename); }
Source:
<code>public void updateDimensions(int width, int height) { <START> if (height > width) { <END> setMinimumSize(getMinimumSize()); setPreferredSize(new Dimension(width, width)); setMaximumSize(new Dimension(width, width)); } else { setMinimumSize(getMinimumSize()); setPreferredSize(new Dimension(height, height)); setMaximumSize(new Dimension(height, height)); } }</code><technical_language>do size trick here</technical_language>

Target:
public void updateDimensions(int width, int height) { int size = Math.min(width, height); setMinimumSize(new Dimension(size, size)); setPreferredSize(new Dimension(size, size)); setMaximumSize(new Dimension(size, size)); revalidate(); repaint(); }