auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code><START> private void collectOverTimeStatistics() { <END> final List<GamePlayer> players = game.getPlayerList().getPlayers(); final List<String> alliances = new ArrayList<>(game.getAllianceTracker().getAlliances()); final Map<OverTimeStatisticType, IStat> overTimeStatisticToSource = createOverTimeStatisticsMapping(game.getResourceList().getResources()); { for (OverTimeStatisticType type : overTimeStatisticToSource.keySet()) { underConstruction.getOverTimeStatistics().put(type, HashBasedTable.create()); } } for (final Round round : getRounds()) { game.getHistory().gotoNode(round); for (final GamePlayer player : players) { overTimeStatisticToSource.forEach( (type, source) -> underConstruction .getOverTimeStatistics() .get(type) .put(player.getName(), round, source.getValue(player, game))); } for (final String alliance : alliances) { overTimeStatisticToSource.forEach( (type, source) -> underConstruction .getOverTimeStatistics() .get(type) .put(alliance, round, source.getValue(alliance, game))); } } }</code><technical_language>Method collectOverTimeStatistics a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring</technical_language>

Target:
private void collectOverTimeStatistics() { final Map<OverTimeStatisticType, IStat> overTimeStatisticSources = createOverTimeStatisticsMapping(game.getResourceList().getResources()); { for (final OverTimeStatisticType type : overTimeStatisticSources.keySet()) { underConstruction.getOverTimeStatistics().put(type, HashBasedTable.create()); } } final List<GamePlayer> players = game.getPlayerList().getPlayers(); final List<String> alliances = new ArrayList<>(game.getAllianceTracker().getAlliances()); for (final Round round : getRounds()) { game.getHistory().gotoNode(round); collectOverTimeStatisticsForRound(overTimeStatisticSources, players, alliances, round); } }
Source:
<code>public Map<String,Serializable> createConnectionParameters(ImportData data, Catalog catalog) throws IOException { if (dataStoreFactory instanceof FileDataStoreFactorySpi) { File f = null; if (data instanceof SpatialFile) { f = ((SpatialFile) data).getFile(); } if (data instanceof Directory) { f = ((Directory) data).getFile(); } if (f != null) { Map<String,Serializable> map = new HashMap<String, Serializable>(); <START> map.put("url", relativeDataFileURL(f.toURI().toURL().toString(), catalog)); <END> if (data.getCharsetEncoding() != null) { map.put("charset",data.getCharsetEncoding()); } return map; } } if (dataStoreFactory instanceof JDBCDataStoreFactory) { Database db = null; if (data instanceof Database) { db = (Database) data; } if (data instanceof Table) { db = ((Table) data).getDatabase(); } if (db != null) { return db.getParameters(); } } Database db = null; if (data instanceof Database) { db = (Database) data; } if (data instanceof Table) { db = ((Table) data).getDatabase(); } if (db != null) { return db.getParameters(); } return null; }</code><technical_language>DataUtilities method is slightly more stable toURI().toURL() platforms windows</technical_language>

Target:
public Map<String,Serializable> createConnectionParameters(ImportData data, Catalog catalog) throws IOException { if (dataStoreFactory instanceof FileDataStoreFactorySpi) { File f = null; if (data instanceof SpatialFile) { f = ((SpatialFile) data).getFile(); } if (data instanceof Directory) { f = ((Directory) data).getFile(); } if (f != null) { Map<String,Serializable> map = new HashMap<String, Serializable>(); map.put("url", relativeDataFileURL(DataUtilities.fileToURL(f).toString(), catalog)); if (data.getCharsetEncoding() != null) { map.put("charset",data.getCharsetEncoding()); } return map; } } if (dataStoreFactory instanceof JDBCDataStoreFactory) { Database db = null; if (data instanceof Database) { db = (Database) data; } if (data instanceof Table) { db = ((Table) data).getDatabase(); } if (db != null) { return db.getParameters(); } } Database db = null; if (data instanceof Database) { db = (Database) data; } if (data instanceof Table) { db = ((Table) data).getDatabase(); } if (db != null) { return db.getParameters(); } return null; }
Source:
<code>public void testLineBreakImplicitParagraph() { builder.beginDocument(); builder.characters("line"); builder.lineBreak(); builder.characters("break"); builder.endDocument(); String markup = out.toString(); TestUtil.println(markup); <START> assertEquals("line \nbreak\n\n", markup); <END> }</code><technical_language>spaces "line" line break</technical_language>

Target:
public void testLineBreakImplicitParagraph() { builder.beginDocument(); builder.characters("line"); builder.lineBreak(); builder.characters("break"); builder.endDocument(); assertMarkup("line \nbreak\n\n"); }
Source:
<code>public void testFindPrimaryReferenceMultipleChildOfSpanContext() { Tracer tracer = new APMTracer(); Map<String, String> headers1 = new HashMap<>(); headers1.put(Constants.HAWKULAR_APM_TRACEID, TEST_APM_TRACEID); headers1.put(Constants.HAWKULAR_APM_ID, TEST_APM_ID1); headers1.put(Constants.HAWKULAR_APM_TXN, TEST_TXN); <START> SpanContext spanCtx1 = tracer.extract(Format.Builtin.TEXT_MAP, <END> new TextMapExtractAdapter(headers1)); Map<String, String> headers2 = new HashMap<>(); headers2.put(Constants.HAWKULAR_APM_TRACEID, TEST_APM_TRACEID); headers2.put(Constants.HAWKULAR_APM_ID, TEST_APM_ID2); headers2.put(Constants.HAWKULAR_APM_TXN, TEST_TXN); SpanContext spanCtx2 = tracer.extract(Format.Builtin.TEXT_MAP, new TextMapExtractAdapter(headers2)); Reference ref1 = new Reference(References.CHILD_OF, spanCtx1); Reference ref2 = new Reference(References.CHILD_OF, spanCtx2); assertNull(APMSpan.findPrimaryReference(Arrays.asList(ref1, ref2))); }</code><technical_language>please span.context() instead of calling extract method tracer</technical_language>

Target:
public void testFindPrimaryReferenceMultipleChildOfSpanContext() { Tracer tracer = new APMTracer(); SpanContext spanCtx1 = extractSpanContext(tracer, TEST_APM_ID1); SpanContext spanCtx2 = extractSpanContext(tracer, TEST_APM_ID2); Reference ref1 = new Reference(References.CHILD_OF, spanCtx1); Reference ref2 = new Reference(References.CHILD_OF, spanCtx2); assertNull(APMSpan.findPrimaryReference(Arrays.asList(ref1, ref2))); }
Source:
<code>private File createUnixGitSSH(File key, String user) throws IOException { File ssh = createTempFile("ssh", ".sh"); File ssh_copy = new File(ssh.toString() + "-copy"); boolean isCopied = false; try (PrintWriter w = new PrintWriter(ssh, this.encoding)) { w.println("#!/bin/sh"); w.println("if [ -z \"${DISPLAY}\" ]; then"); w.println(" DISPLAY=:123.456"); w.println(" export DISPLAY"); w.println("fi"); w.println("ssh -i \"" + key.getAbsolutePath() + "\" -l \"" + user + "\" -o StrictHostKeyChecking=no \"$@\""); } ssh.setExecutable(true, true); String fromLocation = ssh.toString(); String toLocation = ssh_copy.toString(); try { new ProcessBuilder("cp", fromLocation, toLocation).start().waitFor(); isCopied = true; ssh_copy.setExecutable(true,true); deleteTempFile(ssh); } catch(InterruptedException ie) { if(isCopied) { deleteTempFile(ssh_copy); } <START> return ssh; <END> } return ssh_copy; }</code><technical_language>Remove this whitespace change please</technical_language>

Target:
private File createUnixGitSSH(File key, String user) throws IOException { File ssh = createTempFile("ssh", ".sh"); File ssh_copy = new File(ssh.toString() + "-copy"); boolean isCopied = false; try (PrintWriter w = new PrintWriter(ssh, encoding)) { w.println("#!/bin/sh"); w.println("if [ -z \"${DISPLAY}\" ]; then"); w.println(" DISPLAY=:123.456"); w.println(" export DISPLAY"); w.println("fi"); w.println("ssh -i \"" + key.getAbsolutePath() + "\" -l \"" + user + "\" -o StrictHostKeyChecking=no \"$@\""); } ssh.setExecutable(true, true); String fromLocation = ssh.toString(); String toLocation = ssh_copy.toString(); try { new ProcessBuilder("cp", fromLocation, toLocation).start().waitFor(); isCopied = true; ssh_copy.setExecutable(true,true); deleteTempFile(ssh); } catch(InterruptedException ie) { if(isCopied) { deleteTempFile(ssh_copy); } return ssh; } return ssh_copy; }
Source:
<code>public static IElectriCityBus getElectriCityBus(String dgw) { IElectricityAdapter ecAdapter = ApiAdapterFactory.createElectricityAdapter(); IJourney journey = ecAdapter.getCurrentJourney(dgw); String destination = journey.getDestination(); String journeyId = journey.getJourneyId(); <START> IWaftAdapter waftAdapter = ApiAdapterFactory.createWaftAdapter(); <END> List<IFlag> flags = waftAdapter.getFlagsForVehicle(journeyId); return new ElectriCityBus(destination, journeyId, dgw, flags); }</code><technical_language>this a private final variable instead class wanna create this once</technical_language>

Target:
public static IElectriCityBus getElectriCityBus(String dgw) { IJourney journey = electriCityAdapter.getCurrentJourney(dgw); String destination = journey.getDestination(); String journeyId = journey.getJourneyId(); List<IFlag> flags = waftAdapter.getFlagsForVehicle(journeyId); return new ElectriCityBus(destination, journeyId, dgw, flags); }
Source:
<code>public void testValidmzMLfile() throws IOException, MSDKException, XMLStreamException { final String inputFileName = TEST_DATA_PATH + "mzML_with_UV.mzML"; final File inputFile = new File(inputFileName); <START> Assert.assertNotNull(inputFile); <END> MzMLFileParser mzParser = new MzMLFileParser(inputFile); mzParser.execute(); Assert.assertNotNull(new File(inputFileName)); MzMLFileParser mzParser2 = new MzMLFileParser(inputFileName); mzParser2.execute(); }</code><technical_language>is reason check if inputFile == null? Is happen</technical_language>

Target:
public void testValidmzMLfile() throws IOException, MSDKException, XMLStreamException { final String inputFileName = TEST_DATA_PATH + "mzML_with_UV.mzML"; final File inputFile = new File(inputFileName); MzMLFileParser mzParser = new MzMLFileParser(inputFile); mzParser.execute(); MzMLSpectrum spectrum = mzParser.getSpectrumList().get(14); Assert.assertNotNull(spectrum); Assert.assertNotNull(spectrum.getMzValues()); Assert.assertEquals(spectrum.getMzBinaryDataInfo().getArrayLength(), spectrum.getMzValues().length); Assert.assertNotNull(new File(inputFileName)); MzMLFileParser mzParser2 = new MzMLFileParser(inputFileName); mzParser2.execute(); MzMLSpectrum spectrum2 = mzParser2.getSpectrumList().get(17); Assert.assertNotNull(spectrum2); Assert.assertNotNull(spectrum2.getMzValues()); Assert.assertEquals(spectrum2.getMzBinaryDataInfo().getArrayLength(), spectrum2.getMzValues().length); }
Source:
<code>public List<JobInfo> getJobsInfoList(List<String> jobsId) <START> throws PermissionException, NotConnectedException, UnknownJobException { <END> frontendState.checkPermission("getJobsInfoList", "You don't have permissions to load jobs"); List<JobInfo> jobsInfoList = new ArrayList<>(); for (String jobId : jobsId) { try { jobsInfoList.add(this.getJobInfo(jobId)); } catch (UnknownJobException e) { throw new UnknownJobException(e); } } return jobsInfoList; }</code><technical_language>![MINOR](<LINK_2> 'Severity: MINOR') Remove redundant '!unknownSymbol!' thrown exception declaration(s). [![rule](<LINK_1>](<LINK_0></technical_language>

Target:
public List<JobInfo> getJobsInfoList(List<String> jobsId) throws PermissionException, NotConnectedException, UnknownJobException { List<JobInfo> jobsInfoList = new ArrayList<>(); for (String jobId : jobsId) { try { jobsInfoList.add(this.getJobInfo(jobId)); } catch (UnknownJobException e) { throw new UnknownJobException(e); } } return jobsInfoList; }
Source:
<code>public void mouseMove(NatTable natTable, MouseEvent event) { Rectangle clientArea = natTable.getClientAreaProvider().getClientArea(); int x = event.x; int y = event.y; MoveDirectionEnum horizontal = MoveDirectionEnum.NONE; if (event.x < 0) { horizontal = MoveDirectionEnum.LEFT; x = 0; } else if (event.x > clientArea.width) { horizontal = MoveDirectionEnum.RIGHT; <START> x = clientArea.width; <END> } MoveDirectionEnum vertical = MoveDirectionEnum.NONE; if (event.y < 0) { vertical = MoveDirectionEnum.UP; y = 0; } else if (event.y > clientArea.height) { vertical = MoveDirectionEnum.DOWN; y = clientArea.height - 1; } if (!MoveDirectionEnum.NONE.equals(horizontal) || !MoveDirectionEnum.NONE.equals(vertical)) { this.lastDragInCellPosition = null; } if (natTable.doCommand(new ViewportDragCommand(horizontal, vertical))) { int selectedColumnPosition = natTable.getColumnPositionByX(x); int selectedRowPosition = natTable.getRowPositionByY(y); if (selectedColumnPosition > -1 && selectedRowPosition > -1) { Point dragInCellPosition = new Point(selectedColumnPosition, selectedRowPosition); if (this.lastDragInCellPosition == null || !dragInCellPosition.equals(this.lastDragInCellPosition)) { this.lastDragInCellPosition = dragInCellPosition; fireSelectionCommand(natTable, selectedColumnPosition, selectedRowPosition, true, false); } } } }</code><technical_language>x = clientArea.width; y = clientArea.height -1;</technical_language>

Target:
public void mouseMove(NatTable natTable, MouseEvent event) { Rectangle clientArea = natTable.getClientAreaProvider().getClientArea(); int x = event.x; int y = event.y; MoveDirectionEnum horizontal = MoveDirectionEnum.NONE; if (event.x < 0) { horizontal = MoveDirectionEnum.LEFT; x = 0; } else if (event.x > clientArea.width) { horizontal = MoveDirectionEnum.RIGHT; x = clientArea.width; } MoveDirectionEnum vertical = MoveDirectionEnum.NONE; if (event.y < 0) { vertical = MoveDirectionEnum.UP; y = 0; } else if (event.y > clientArea.height) { vertical = MoveDirectionEnum.DOWN; y = clientArea.height; } if (!MoveDirectionEnum.NONE.equals(horizontal) || !MoveDirectionEnum.NONE.equals(vertical)) { this.lastDragInCellPosition = null; } if (natTable.doCommand(new ViewportDragCommand(horizontal, vertical))) { int selectedColumnPosition = natTable.getColumnPositionByX(x); int selectedRowPosition = natTable.getRowPositionByY(y); if (selectedColumnPosition > -1 && selectedRowPosition > -1) { Point dragInCellPosition = new Point(selectedColumnPosition, selectedRowPosition); if (this.lastDragInCellPosition == null || !dragInCellPosition.equals(this.lastDragInCellPosition)) { this.lastDragInCellPosition = dragInCellPosition; fireSelectionCommand(natTable, selectedColumnPosition, selectedRowPosition, true, false); } } } }
Source:
<code>public Class<? extends NNode> getNNodeClass() { <START> return null; <END> }</code><technical_language>question: throwing InvalidTokenException</technical_language>

Target:
public Class<? extends NNode> getNNodeClass() throws InvalidTokenException { throw new InvalidTokenException("No node coresponding to token " + this.toString()); }
Source:
<code>public void truncate(long toDeleteInclusive) { <START> currentLog.truncate(toDeleteInclusive); <END> }</code><technical_language>truncate both? throw UnsupportedOperationException deploying this</technical_language>

Target:
public void truncate(long toDeleteInclusive) { log.warn("Tried to truncate paxos state log with an implementation that does not support truncations."); }
Source:
<code><START> private static Iterator<CliCommand> getAllCommands() { <END> final ServiceLoader<CliCommand> loader = ServiceLoader.load(CliCommand.class); return loader.iterator(); }</code><technical_language>This updated return Iterable return loader, returning iterator</technical_language>

Target:
private static Iterable<CliCommand> getAllCommands() { return ServiceLoader.load(CliCommand.class); }
Source:
<code>public boolean performFinish() { final ConnectProviderOperation op = new ConnectProviderOperation( existingPage.getProjects(true)); try { getContainer().run(true, false, new IRunnableWithProgress() { public void run(final IProgressMonitor monitor) throws InvocationTargetException { try { op.execute(monitor); PlatformUI.getWorkbench().getDisplay().syncExec( new Runnable() { public void run() { Set<File> filesToAdd = new HashSet<File>(); for (Entry<IProject, File> entry : existingPage <START> .getProjects(true).entrySet()) { <END> filesToAdd.add(entry.getValue()); } for (File file : filesToAdd) Activator.getDefault() .getRepositoryUtil() .addConfiguredRepository( file); } }); } catch (CoreException ce) { throw new InvocationTargetException(ce); } } }); return true; } catch (Throwable e) { if (e instanceof InvocationTargetException) { e = e.getCause(); } if (e instanceof CoreException) { IStatus status = ((CoreException) e).getStatus(); e = status.getException(); } Activator.handleError(UIText.SharingWizard_failed, e, true); return false; } }</code><technical_language>style nit: braces</technical_language>

Target:
public boolean performFinish() { final ConnectProviderOperation op = new ConnectProviderOperation( existingPage.getProjects(true)); try { getContainer().run(true, false, new IRunnableWithProgress() { public void run(final IProgressMonitor monitor) throws InvocationTargetException { try { op.execute(monitor); PlatformUI.getWorkbench().getDisplay() .syncExec(new Runnable() { public void run() { Set<File> filesToAdd = new HashSet<File>(); for (Entry<IProject, File> entry : existingPage .getProjects(true).entrySet()) filesToAdd.add(entry.getValue()); for (File file : filesToAdd) Activator .getDefault() .getRepositoryUtil() .addConfiguredRepository( file); } }); } catch (CoreException ce) { throw new InvocationTargetException(ce); } } }); return true; } catch (Throwable e) { if (e instanceof InvocationTargetException) { e = e.getCause(); } if (e instanceof CoreException) { IStatus status = ((CoreException) e).getStatus(); e = status.getException(); } Activator.handleError(UIText.SharingWizard_failed, e, true); return false; } }
Source:
<code>public void init() { try { <START> LogSerialiser serialiser = new JacksonLogSerialiser(true); <END> LogStore logStore = new MDCLogStore(serialiser); Logger logger = new LoggerImpl("com.zebedee.app"); LogConfig config = new Builder() .logger(logger) .dataNamespace("app.data") .logStore(logStore) .serialiser(serialiser) .create(); DPLogger.init(config); } catch (LoggingException ex) { System.err.println("failed to init DP Logger"); System.exit(1); } logInfo("inside CMS INIT").log(); logInfo("loading CMS feature flags").log(); CMSFeatureFlags.cmsFeatureFlags(); logInfo("Root.init()").log(); Root.init(); logInfo("ZebedeeReader.setCollectionReaderFactory").log(); ZebedeeReader.setCollectionReaderFactory(new ZebedeeCollectionReaderFactory(Root.zebedee)); logInfo("CollectionHistoryDaoFactory.initialise();").log(); CollectionHistoryDaoFactory.initialise(); logDebug("Zebedee Start up").log(); }</code><technical_language>Remove true constructor - for prod want formatted</technical_language>

Target:
public void init() { try { LogSerialiser serialiser = new JacksonLogSerialiser(); LogStore logStore = new MDCLogStore(serialiser); Logger logger = new LoggerImpl("com.github.onsdigital.zebedee.cms"); LogConfig config = new Builder() .logger(logger) .dataNamespace("app.data") .logStore(logStore) .serialiser(serialiser) .create(); DPLogger.init(config); } catch (LoggingException ex) { System.err.println("failed to init DP Logger"); System.exit(1); } logInfo("inside CMS INIT").log(); logInfo("loading CMS feature flags").log(); CMSFeatureFlags.cmsFeatureFlags(); logInfo("Root.init()").log(); Root.init(); logInfo("ZebedeeReader.setCollectionReaderFactory").log(); ZebedeeReader.setCollectionReaderFactory(new ZebedeeCollectionReaderFactory(Root.zebedee)); logInfo("CollectionHistoryDaoFactory.initialise();").log(); CollectionHistoryDaoFactory.initialise(); logDebug("Zebedee Start up").log(); }
Source:
<code>private CryptByteBufferType(int bitmask, KeyType keyType, int blockSize){ this.bitmask = bitmask; <START> this.ivSize = -1; <END> this.keyType = keyType; this.cipherName = keyType.alg; this.blockSize = blockSize; algName = name(); }</code><technical_language>this set null now</technical_language>

Target:
private CryptByteBufferType(int bitmask, KeyType keyType, int blockSize){ this.bitmask = bitmask; this.ivSize = null; this.keyType = keyType; this.cipherName = keyType.alg; this.blockSize = blockSize; algName = name(); }
Source:
<code>private static SimpleFeatureCollection parseGeoJSON(InputStream in, CoordinateReferenceSystem crs) throws IOException { Map<String, Object> geojson = OM.readValue(in, TYPE_REF); <START> in.close(); <END> SimpleFeatureType schema = GeoJSONSchemaDetector.getSchema(geojson, crs); return GeoJSONReader2.toFeatureCollection(geojson, schema); }</code><technical_language>Move close() a finally-block</technical_language>

Target:
private static SimpleFeatureCollection parseGeoJSON(InputStream in, CoordinateReferenceSystem crs) throws IOException { Map<String, Object> geojson = OM.readValue(in, TYPE_REF); SimpleFeatureType schema = GeoJSONSchemaDetector.getSchema(geojson, crs); return GeoJSONReader2.toFeatureCollection(geojson, schema); }
Source:
<code>public boolean apply(Game game, Ability source) { <START> UUID defenderId = game.getCombat().getDefenderId(source.getSourceId()); <END> if (defenderId != null) { FilterCreaturePermanent filter = new FilterCreaturePermanent(); filter.add(new ControllerIdPredicate(defenderId)); for (Permanent permanent : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) { permanent.untap(game); } return true; } return false; }</code><technical_language>need getDefendingPlayerId get a planeswalker id instead of a player</technical_language>

Target:
public boolean apply(Game game, Ability source) { UUID defenderId = game.getCombat().getDefendingPlayerId(source.getSourceId(), game); if (defenderId != null) { FilterCreaturePermanent filter = new FilterCreaturePermanent(); filter.add(new ControllerIdPredicate(defenderId)); for (Permanent permanent : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) { permanent.untap(game); } return true; } return false; }
Source:
<code>public OutputStream getOutputStream() throws Exception { String tempOutputFilePath = outputFilePath; String extension = RepositoryFilenameUtils.getExtension( tempOutputFilePath ); if ( "*".equals( extension ) ) { tempOutputFilePath = tempOutputFilePath.substring( 0, tempOutputFilePath.lastIndexOf( '.' ) ); if ( appendDateFormat != null ) { try { <START> Date date = new Date(); <END> SimpleDateFormat sdf = new SimpleDateFormat( appendDateFormat ); String formattedDate = sdf.format( date ).toString(); tempOutputFilePath += formattedDate; } catch ( Exception e ) { } } if ( streamingAction != null ) { String mimeType = streamingAction.getMimeType( null ); if ( mimeType != null && MimeHelper.getExtension( mimeType ) != null ) { tempOutputFilePath += MimeHelper.getExtension( mimeType ); } } } RepositoryFileOutputStream outputStream = new RepositoryFileOutputStream( tempOutputFilePath, autoCreateUniqueFilename, true ); outputStream.addListener( this ); return outputStream; }</code><technical_language>new api for date/time. a general example: LocalDate = LocalDate.now(); DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); String formattedDate = now.format(formatter); LocalDate parsedDate = LocalDate.parse(formattedDate, formatter); --</technical_language>

Target:
public OutputStream getOutputStream() throws Exception { String tempOutputFilePath = outputFilePath; String extension = RepositoryFilenameUtils.getExtension( tempOutputFilePath ); if ( "*".equals( extension ) ) { tempOutputFilePath = tempOutputFilePath.substring( 0, tempOutputFilePath.lastIndexOf( '.' ) ); if ( appendDateFormat != null ) { try { LocalDateTime now = LocalDateTime.now(); DateTimeFormatter formatter = DateTimeFormatter.ofPattern( appendDateFormat ); String formattedDate = now.format( formatter ); tempOutputFilePath += formattedDate; } catch ( Exception e ) { logger.warn( "Unable to calculate current date: " + e.getMessage() ); } } if ( streamingAction != null ) { String mimeType = streamingAction.getMimeType( null ); if ( mimeType != null && MimeHelper.getExtension( mimeType ) != null ) { tempOutputFilePath += MimeHelper.getExtension( mimeType ); } } } RepositoryFileOutputStream outputStream = new RepositoryFileOutputStream( tempOutputFilePath, autoCreateUniqueFilename, true ); outputStream.addListener( this ); return outputStream; }
Source:
<code>public void testConvertTextToHtml() throws IOException { Blob blob = new StringBlob("thisismytest", "text/plain"); <START> DocumentModel doc = session.createDocumentModel("File"); <END> doc.setPropertyValue("file:content", (Serializable) blob); BlobHolder blobHolder = new SimpleBlobHolder(blob); BlobHolder res = conversionService.convertToMimeType("text/html", blobHolder , null); List<Blob> blobs = res.getBlobs(); assertEquals(1, blobs.size()); String preview = blobs.get(0).getString(); assertTrue(preview, preview.contains("thisismytest")); }</code><technical_language>constructor single parameter (which text/plain mime type internally): Blob blob = new StringBlob("thisismytest", "text/plain"); -> Blob blob = new StringBlob("thisismytest");</technical_language>

Target:
public void testConvertTextToHtml() throws IOException { Blob blob = new StringBlob("thisismytest", "text/plain"); BlobHolder blobHolder = new SimpleBlobHolder(blob); BlobHolder res = conversionService.convertToMimeType("text/html", blobHolder , null); List<Blob> blobs = res.getBlobs(); assertEquals(1, blobs.size()); String preview = blobs.get(0).getString(); assertTrue(preview, preview.contains("thisismytest")); }
Source:
<code>public Object valueFromString(PermanentProperty prop, String sValue, Flag flag) { synchronized (coreLock) { @SuppressWarnings("rawtypes") Class type = prop.getType(); <START> if (type == TimeoutOwner.class) { return scoreBoard.getTimeoutOwner(sValue); } <END> if (sValue == null) { return prop.getDefaultValue(); } if (type == Role.class) { return Role.fromString(sValue); } if (type == FloorPosition.class) { return FloorPosition.fromString(sValue); } if (type == Boolean.class) { return Boolean.valueOf(sValue); } if (type == Integer.class) { return Integer.valueOf(sValue); } if (type == Long.class) { return Long.valueOf(sValue); } if (prop == IValue.PREVIOUS || prop == IValue.NEXT) { return getElement(providerClass, sValue); } if (ScoreBoardEventProvider.class.isAssignableFrom(type)) { return getElement(type, sValue); } if ("".equals(sValue) && !(type == String.class)) { return prop.getDefaultValue(); } return sValue; } }</code><technical_language>Specifically for TimeoutOwner this work. Object yet, fromString() method needs static. list of TimeoutOwners includes Teams, created runtime in a specific ScoreBoardImpl object. need a) inject current ScoreBoard instance a static variable in TimeoutOwner fromString() reference it. b) reflection call static fromString() method (this required for other classes) I is improvement now</technical_language>

Target:
public Object valueFromString(PermanentProperty prop, String sValue, Flag flag) { synchronized (coreLock) { @SuppressWarnings("rawtypes") Class type = prop.getType(); if (type == TimeoutOwner.class) { return scoreBoard.getTimeoutOwner(sValue); } if (sValue == null) { return prop.getDefaultValue(); } if ("".equals(sValue) && !(type == String.class)) { return prop.getDefaultValue(); } if (type == RuleDefinition.Type.class) { return prop.getDefaultValue(); } if (type == Role.class) { return Role.fromString(sValue); } if (type == FloorPosition.class) { return FloorPosition.fromString(sValue); } if (type == Boolean.class) { return Boolean.valueOf(sValue); } if (type == Integer.class) { return Integer.valueOf(sValue); } if (type == Long.class) { return Long.valueOf(sValue); } if (prop == IValue.PREVIOUS || prop == IValue.NEXT) { return getElement(providerClass, sValue); } if (ScoreBoardEventProvider.class.isAssignableFrom(type)) { return getElement(type, sValue); } if (type != String.class) { ScoreBoardManager.printMessage("Conversion to " + type.getSimpleName() + " used by " + PropertyConversion.toFrontend(prop) + " missing in ScoreBoardEventProvider.valueFromString()"); return prop.getDefaultValue(); } return sValue; } }
Source:
<code>private static Properties createSchema(HiveStorageFormat format, List<String> columnNames, List<Type> columnTypes) { Properties schema = new Properties(); TypeTranslator typeTranslator = new HiveTypeTranslator(); schema.setProperty(SERIALIZATION_LIB, format.getSerDe()); schema.setProperty(FILE_INPUT_FORMAT, format.getInputFormat()); schema.setProperty(META_TABLE_COLUMNS, columnNames.stream() .collect(joining(","))); schema.setProperty(META_TABLE_COLUMN_TYPES, columnTypes.stream() .map(type -> toHiveType(typeTranslator, type)) <START> .map(hiveType -> hiveType.getHiveTypeName().toString()) <END> .collect(joining(":"))); return schema; }</code><technical_language>java .map(Object::toString)</technical_language>

Target:
private static Properties createSchema(HiveStorageFormat format, List<String> columnNames, List<Type> columnTypes) { Properties schema = new Properties(); TypeTranslator typeTranslator = new HiveTypeTranslator(); schema.setProperty(SERIALIZATION_LIB, format.getSerDe()); schema.setProperty(FILE_INPUT_FORMAT, format.getInputFormat()); schema.setProperty(META_TABLE_COLUMNS, columnNames.stream() .collect(joining(","))); schema.setProperty(META_TABLE_COLUMN_TYPES, columnTypes.stream() .map(type -> toHiveType(typeTranslator, type)) .map(HiveType::getHiveTypeName) .map(HiveTypeName::toString) .collect(joining(":"))); return schema; }
Source:
<code>public Slice serialize() { try (SliceOutput output = new DynamicSliceOutput(estimatedSerializedSize())) { <START> output.appendByte(UNCOMPRESSED_FORMAT); <END> output.appendInt(maxSize); output.appendInt(hllBuckets); output.appendInt(minhash.size()); for (long key : minhash.keySet()) { output.appendLong(key); } Slice serializedHll; for (HyperLogLog hll : minhash.values()) { serializedHll = hll.serialize(); output.appendInt(serializedHll.length()); output.appendBytes(serializedHll); } return output.slice(); } catch (IOException e) { throw new UncheckedIOException(e); } }</code><technical_language>add a version byte in case change mind serialization format</technical_language>

Target:
public Slice serialize() { try (SliceOutput output = new DynamicSliceOutput(estimatedSerializedSize())) { List<Slice> hllSlices = new ArrayList<>(); IntList hllSizes = new IntArrayList(); int totalHllSize = 0; for (HyperLogLog hll : minhash.values()) { Slice serializedHll = hll.serialize(); hllSlices.add(serializedHll); totalHllSize += serializedHll.length(); hllSizes.add(serializedHll.length()); } Slice hashesSlice = wrappedLongArray(minhash.keySet().toLongArray()); Slice hllSizesSlice = wrappedIntArray(hllSizes.toIntArray()); output.appendByte(VERSION_BYTE); output.appendInt(maxSize); output.appendInt(hllBuckets); output.appendInt(minhash.size()); output.appendInt(totalHllSize); output.appendBytes(hllSizesSlice); output.appendBytes(hashesSlice); for (Slice hllSlice : hllSlices) { output.appendBytes(hllSlice); } return output.slice(); } catch (IOException e) { throw new UncheckedIOException(e); } }
Source:
<code>public static synchronized String getServiceToken(String url, String service) { String token; try (CloseableHttpClient httpClient = new CommonHttpClientBuilder().allowAnyCertificate(true).build()) { HttpPost httpPost = new HttpPost(url); List<NameValuePair> params = new ArrayList<>(); params.add(new BasicNameValuePair("service", service)); httpPost.setEntity(new UrlEncodedFormEntity(params)); HttpResponse httpResponse = httpClient.execute(httpPost); if ((httpResponse.getStatusLine().getStatusCode() != HttpStatus.SC_OK) || (null == httpResponse.getEntity())) throw new IAMException("Authentication failed"); token = EntityUtils.toString(httpResponse.getEntity()); LOG.debug("Token successfully generated for service " + service + "\n Token: " + token); } catch (Exception e) { <START> throw new IAMException(e.getMessage()); <END> } return token; }</code><technical_language>add IAMException constructor takes (String message, Exception cause). trace root exception</technical_language>

Target:
public String getServiceToken(String url, String service) { String token; try (CloseableHttpClient httpClient = new CommonHttpClientBuilder().allowAnyCertificate(true).build()) { HttpPost httpPost = new HttpPost(url); List<NameValuePair> params = new ArrayList<>(); params.add(new BasicNameValuePair("service", service)); httpPost.setEntity(new UrlEncodedFormEntity(params)); HttpResponse httpResponse = httpClient.execute(httpPost); if ((httpResponse.getStatusLine().getStatusCode() != HttpStatus.SC_OK) || (null == httpResponse.getEntity())) throw new IAMException("Failed to acquire authentication token for the service" + service); token = EntityUtils.toString(httpResponse.getEntity()); LOG.debug("Service token successfully generated for service " + service + "\n Token: " + token); } catch (Exception e) { throw new IAMException("Authentication failed: Error occurred while acquiring authentication token for the service" + service, e); } return token; }
Source:
<code>public void customJavadocTags() throws IOException { final String inputFilename = getDocPath("InputCustomJavadocTags.txt"); final String outputFilename = getOutputDocPath("OutputCustomJavadocTags.txt"); final String expectedTree = getFileContent(new File(outputFilename)) .replaceAll("\\\\r\\\\n", "\\\\n"); final String generatedTree = printFileAst(new File(inputFilename)) <START> .replaceAll("\\\\r\\\\n", "\\\\n"); <END> assertEquals(expectedTree, generatedTree); }</code><technical_language>printFileAst().replaceAll() getFileContent().replaceAll() pieces of code extracted private methods, "\\\\r\\\\n" "\\\\n" constants</technical_language>

Target:
public void customJavadocTags() throws Exception { verifyJavadocTree(getDocPath("expectedCustomJavadocTagsAst.txt"), getDocPath("InputCustomJavadocTags.javadoc")); }
Source:
<code>public void getTitleWithThis() { String thisObject = "something"; String title = getTitle(NAME_PATTERN_WITH_THIS, METHOD_NAME, thisObject, new Object[]{}); Object[] args = {METHOD_NAME, thisObject}; <START> assertThat("Название метода с массивом массивов, в котором есть {this}", title, <END> equalTo(MessageFormat.format(TITLE_STRING_WITH_THIS, args))); }</code><technical_language>translate please</technical_language>

Target:
public void getTitleWithThis() { String thisObject = "something"; String title = getTitle(NAME_PATTERN_WITH_THIS, METHOD_NAME, thisObject, new Object[]{}); Object[] args = {METHOD_NAME, thisObject}; assertThat("Method with {this} is processed incorrectly", title, equalTo(MessageFormat.format(TITLE_STRING_WITH_THIS, args))); }
Source:
<code>protected CompletableFuture<Void> doResolve(ITextViewer viewer, IProgressMonitor monitor) { <START> return null; <END> }</code><technical_language>If for making this class method non-abstract assume default implementation need additional resolution, default implementation returning null CodeMining resolved, is erroneous state. default implementation, if abstract, "return CompletableFuture.completedFuture(Void.Type);"</technical_language>

Target:
protected CompletableFuture<Void> doResolve(ITextViewer viewer, IProgressMonitor monitor) { return CompletableFuture.completedFuture(null); }
Source:
<code>public boolean equals(Object object) { if (object instanceof AbstractRemoteEmfFactory.UniqueLocalReference) { <START> UniqueLocalReference reference = (UniqueLocalReference) object; <END> return parent.equals(reference.parent) && localKey.equals(reference.localKey); } return false; }</code><technical_language>UniqueLocalReference is parametrized</technical_language>

Target:
public boolean equals(Object object) { if (object instanceof AbstractRemoteEmfFactory.UniqueLocalReference) { @SuppressWarnings("rawtypes") UniqueLocalReference reference = (UniqueLocalReference) object; return parent.equals(reference.parent) && localKey.equals(reference.localKey); } return false; }
Source:
<code>public void verifyRubricQuestion(int qnNumber, int[] colIndexes, String[]... columns) { int i = 0; <START> for (int colIndex : colIndexes) { <END> String[] colValues = columns[i++]; int rubDescIndex = 1; assertTrue(getRubricChoice(qnNumber, colIndex).equals(colValues[0])); if (isRubricWeightsEnabled(qnNumber)) { assertTrue(getRubricWeight(qnNumber, colIndex).equals(colValues[1])); rubDescIndex = 2; } int subQnIndex = 0; while (rubDescIndex < colValues.length) { assertTrue(getRubricDescription(qnNumber, subQnIndex, colIndex).equals(colValues[rubDescIndex])); rubDescIndex++; subQnIndex++; } } verifyRubricColumnsMovability(qnNumber, colIndexes); }</code><technical_language>more intuitive a counter in for loop in this case, is easy accessing index for arrays</technical_language>

Target:
public void verifyRubricQuestion(int qnNumber, int[] colIndexes, String[]... columns) { for (int i = 0; i < colIndexes.length; i++) { int colIndex = colIndexes[i]; String[] colValues = columns[i]; int rubDescriptionIndex = 1; assertTrue(getRubricChoice(qnNumber, colIndex).equals(colValues[0])); if (isRubricWeightsEnabled(qnNumber)) { assertTrue(getRubricWeight(qnNumber, colIndex).equals(colValues[1])); rubDescriptionIndex = 2; } int subQnIndex = 0; while (rubDescriptionIndex < colValues.length) { assertTrue(getRubricDescription(qnNumber, subQnIndex, colIndex).equals(colValues[rubDescriptionIndex])); rubDescriptionIndex++; subQnIndex++; } } verifyRubricColumnsMovability(qnNumber, colIndexes); }
Source:
<code>@Override public RequestBody toBody(Object source, Type type) { byte[] bytes; try { <START> ByteArrayOutputStream bos = new ByteArrayOutputStream(); <END> OutputStreamWriter osw = new OutputStreamWriter(bos, CHARSET); serializer.write(source, osw); osw.flush(); bytes = bos.toByteArray(); } catch (Exception e) { throw new AssertionError(e); } return RequestBody.create(MEDIA_TYPE, bytes); }</code><technical_language>a Buffer instead</technical_language>

Target:
@Override public RequestBody toBody(Object source, Type type) { byte[] bytes; try { Buffer buffer = new Buffer(); OutputStreamWriter osw = new OutputStreamWriter(buffer.outputStream(), CHARSET); serializer.write(source, osw); osw.flush(); bytes = buffer.readByteArray(); } catch (Exception e) { throw new AssertionError(e); } return RequestBody.create(MEDIA_TYPE, bytes); }
Source:
<code>public List<Map<String, String>> taskConfigs(int maxTasks) { if (!config.enabled() || knownTopicPartitions.isEmpty()) { return Collections.emptyList(); } int numTasks = Math.min(maxTasks, knownTopicPartitions.size()); List<List<TopicPartition>> roundRobinAssignment = new ArrayList<>(numTasks); for (int i = 0; i < numTasks; i++) { roundRobinAssignment.add(new ArrayList<>()); } int count = 0; for (TopicPartition partition : knownTopicPartitions) { int index = count % numTasks; roundRobinAssignment.get(index).add(partition); count++; } <START> List<TopicPartition> roundRobinFlatten = new ArrayList<>(); <END> for (List<TopicPartition> assignment : roundRobinAssignment) { roundRobinFlatten.addAll(assignment); } return ConnectorUtils.groupPartitions(roundRobinFlatten, numTasks).stream() .map(config::taskConfigForTopicPartitions) .collect(Collectors.toList()); }</code><technical_language>this a flatMap</technical_language>

Target:
public List<Map<String, String>> taskConfigs(int maxTasks) { if (!config.enabled() || knownTopicPartitions.isEmpty()) { return Collections.emptyList(); } int numTasks = Math.min(maxTasks, knownTopicPartitions.size()); List<List<TopicPartition>> roundRobinByTask = new ArrayList<>(numTasks); for (int i = 0; i < numTasks; i++) { roundRobinByTask.add(new ArrayList<>()); } int count = 0; for (TopicPartition partition : knownTopicPartitions) { int index = count % numTasks; roundRobinByTask.get(index).add(partition); count++; } return roundRobinByTask.stream().map(config::taskConfigForTopicPartitions) .collect(Collectors.toList()); }
Source:
<code>public CacheKey getCacheKey(HttpServletRequest request, HttpServletResponse response) { if (this.wrappedComponent != null) { return this.wrappedComponent.getCacheKey(request, response); <START> } else return null; <END> }</code><technical_language>art: else is needed if ends a return</technical_language>

Target:
public CacheKey getCacheKey(HttpServletRequest request, HttpServletResponse response) throws IllegalStateException { if (this.wrappedComponent != null) { return this.wrappedComponent.getCacheKey(request, response); } else { logger.debug("PipelineComponentWrapper.wrapperComponent is null"); throw new IllegalStateException("PipelineComponentWrapper.wrapperComponent is null"); } }
Source:
<code><START> private List<String> checkInvalidIndexes() throws StandardException { <END> invalidIndexCount = 0; ArrayListMultimap<String, byte[]> result = ArrayListMultimap.create(); for (String baseRowId : indexData.keySet()) { if (!tableData.containsKey(baseRowId)) { List<byte[]> rows = indexData.get(baseRowId); result.putAll(baseRowId, rows); invalidIndexCount += rows.size(); } } if (invalidIndexCount > 0) { if (fix) { return fixInvalidIndexes(result); } else { return reportInvalidIndexes(result); } } return new LinkedList<>(); }</code><technical_language>For checkDuplicateIndexes(), handle fix=true path, remove duplicate indexes</technical_language>

Target:
private List<String> checkInvalidIndexes() throws StandardException { invalidIndexCount = 0; ArrayListMultimap<String, byte[]> result = ArrayListMultimap.create(); for (String baseRowId : indexData.keySet()) { if (!tableData.containsKey(baseRowId)) { List<byte[]> rows = indexData.get(baseRowId); result.putAll(baseRowId, rows); invalidIndexCount += rows.size(); } } if (invalidIndexCount > 0) { if (fix) { fixInvalidIndexes(result); } return reportInvalidIndexes(result); } return new LinkedList<>(); }
Source:
<code>public void saveDrug_shouldUpdateDrugAlreadyExistingInDatabase() { executeDataSet("org/openmrs/api/include/ConceptServiceTest-initialConcepts.xml"); Drug drug = new Drug(); drug.setConcept(conceptService.getConcept(1)); <START> Drug saved = conceptService.saveDrug(drug); <END> saved.setCombination(true); conceptService.saveDrug(saved); assertTrue(conceptService.getDrug(saved.getDrugId()).getCombination()); }</code><technical_language>suggestion Drug savedDrug = conceptService.saveDrug(drug);</technical_language>

Target:
public void saveDrug_shouldUpdateDrugAlreadyExistingInDatabase() { Drug drug = new Drug(); Concept concept = new Concept(); concept.addName(new ConceptName("Concept", new Locale("en", "US"))); concept.addDescription(new ConceptDescription("Description", new Locale("en", "US"))); concept.setConceptClass(new ConceptClass(1)); concept.setDatatype(new ConceptDatatype(1)); Concept savedConcept = conceptService.saveConcept(concept); drug.setConcept(savedConcept); drug.setCombination(false); Drug savedDrug = conceptService.saveDrug(drug); assertFalse(savedDrug.getCombination()); savedDrug.setCombination(true); conceptService.saveDrug(savedDrug); assertTrue(conceptService.getDrug(savedDrug.getDrugId()).getCombination()); }
Source:
<code>public void validateSubscriptionChange(final Subscription old, final SubscriptionBase newValue) { if (!Objects.equals(newValue.getConsumerGroup(), old.getConsumerGroup())) { throw new IllegalArgumentException("Not allowed to change subscription consumer group"); } if (!Objects.equals(newValue.getEventTypes(), old.getEventTypes())) { throw new IllegalArgumentException("Not allowed to change subscription event types"); } if (!Objects.equals(newValue.getOwningApplication(), old.getOwningApplication())) { throw new IllegalArgumentException("Not allowed to change owning application"); } if (!Objects.equals(newValue.getReadFrom(), old.getReadFrom())) { <START> throw new IllegalArgumentException("Not allowed to change owning application"); <END> } if (!Objects.equals(newValue.getInitialCursors(), old.getInitialCursors())) { throw new IllegalArgumentException("Not allowed to change owning application"); } authorizationValidator.validateAuthorization(old.getAuthorization(), newValue.getAuthorization()); }</code><technical_language>Bad copy & paste =)</technical_language>

Target:
public void validateSubscriptionChange(final Subscription old, final SubscriptionBase newValue) throws SubscriptionUpdateConflictException { if (!Objects.equals(newValue.getConsumerGroup(), old.getConsumerGroup())) { throw new SubscriptionUpdateConflictException("Not allowed to change subscription consumer group"); } if (!Objects.equals(newValue.getEventTypes(), old.getEventTypes())) { throw new SubscriptionUpdateConflictException("Not allowed to change subscription event types"); } if (!Objects.equals(newValue.getOwningApplication(), old.getOwningApplication())) { throw new SubscriptionUpdateConflictException("Not allowed to change owning application"); } if (!Objects.equals(newValue.getReadFrom(), old.getReadFrom())) { throw new SubscriptionUpdateConflictException("Not allowed to change read from"); } if (!Objects.equals(newValue.getInitialCursors(), old.getInitialCursors())) { throw new SubscriptionUpdateConflictException("Not allowed to change initial cursors"); } authorizationValidator.validateAuthorization(old.getAuthorization(), newValue.getAuthorization()); }
Source:
<code>public void setup() { MetadataManager metadata = MetadataManager.createTestMetadataManager(); ExpressionCompiler compiler = new ExpressionCompiler(metadata, new PageFunctionCompiler(metadata, 0)); ImmutableList.Builder<RowExpression> projectionsBuilder = ImmutableList.builder(); Block[] blocks = new Block[2]; Type elementType; switch (type) { case "BIGINT": elementType = BIGINT; break; case "VARCHAR": elementType = VARCHAR; break; case "DOUBLE": elementType = DOUBLE; break; case "BOOLEAN": elementType = BOOLEAN; break; default: throw new UnsupportedOperationException(); } ArrayType arrayType = new ArrayType(elementType); Signature signature = new Signature(name, FunctionKind.SCALAR, arrayType.getTypeSignature(), arrayType.getTypeSignature(), arrayType.getTypeSignature()); projectionsBuilder.add(new CallExpression(signature, arrayType, ImmutableList.of(field(0, arrayType), field(1, arrayType)))); blocks[0] = createChannel(POSITIONS, Integer.parseInt(arraySizeString), elementType); blocks[1] = createChannel(POSITIONS, Integer.parseInt(arraySizeString), elementType); ImmutableList<RowExpression> projections = projectionsBuilder.build(); pageProcessor = compiler.compilePageProcessor(Optional.empty(), projections).get(); page = new Page(blocks); <START> System.out.println("created blocks"); <END> }</code><technical_language>Do want remove this</technical_language>

Target:
public void setup() { Type elementType; switch (type) { case "BIGINT": elementType = BIGINT; break; case "VARCHAR": elementType = VARCHAR; break; case "DOUBLE": elementType = DOUBLE; break; case "BOOLEAN": elementType = BOOLEAN; break; default: throw new UnsupportedOperationException(); } ArrayType arrayType = new ArrayType(elementType); Signature signature = new Signature(name, FunctionKind.SCALAR, arrayType.getTypeSignature(), arrayType.getTypeSignature(), arrayType.getTypeSignature()); ImmutableList<RowExpression> projections = ImmutableList.of( new CallExpression(signature, arrayType, ImmutableList.of(field(0, arrayType), field(1, arrayType)))); MetadataManager metadata = MetadataManager.createTestMetadataManager(); ExpressionCompiler compiler = new ExpressionCompiler(metadata, new PageFunctionCompiler(metadata, 0)); pageProcessor = compiler.compilePageProcessor(Optional.empty(), projections).get(); page = new Page(createChannel(POSITIONS, arraySize, elementType), createChannel(POSITIONS, arraySize, elementType)); }
Source:
<code>public void dispose() throws SaslException { <START> try { <END> super.dispose(); } finally { cancelTimeoutTask(); } }</code><technical_language>While technically this matter a correctness perspective if is a synchronized block protecting access delegate timeout task, timeout task _should_ cancelled in case dispose() is unusually expensive avoid spurious task execution block task thread pointlessly for some amount of time</technical_language>

Target:
public synchronized void dispose() throws SaslException { cancelTimeoutTask(); super.dispose(); }