auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public Redirect getRedirect(String siteId) { if (StringUtils.isNotBlank(siteId)) { Redirect redirect = new Redirect(); PortalNode node; String trimmedPath = ""; do{ node = portalHierarchyService.getNodeByUrl(siteId); if(node == null){ int index = siteId.lastIndexOf(PortalHierarchyService.SEPARATOR); if(index > 0){ String firstPart = siteId.substring(0, index); String tempString = PortalHierarchyService.SEPARATOR + siteId.substring(index + 1); trimmedPath = (StringUtils.isBlank(trimmedPath)) ? tempString : (tempString + trimmedPath) ; siteId = firstPart; } } else{ break; } <START> }while(StringUtils.countMatches(siteId, PortalHierarchyService.SEPARATOR) > 1); <END> if (node instanceof PortalNodeRedirect) { String redirectUrl = ((PortalNodeRedirect)node).getUrl(); boolean appendPath = ((PortalNodeRedirect)node).isAppendPath(); redirect.setAppendPath(appendPath); if(appendPath && StringUtils.isNotBlank(trimmedPath)){ redirect.setUrl(redirectUrl + trimmedPath); } else{ redirect.setUrl(redirectUrl); } return redirect; } Matcher matcher = trimTailingSeparators.matcher(siteId); if (matcher.matches()) { redirect.setUrl(serverConfigurationService.getString("portalPath")+ "/"+ "site"+ "/"+ matcher.group(1)); return redirect; } } return null; }</code><technical_language>This is a risky pattern if is a problem in code get runaway threads, safer a loop</technical_language>

Target:
public Redirect getRedirect(String siteId) { if (StringUtils.isNotBlank(siteId)) { Redirect redirect = new Redirect(); Matcher matcher = trimTailingSeparators.matcher(siteId); if (matcher.matches()) { redirect.setUrl(serverConfigurationService.getString("portalPath")+ "/"+ "site"+ "/"+ matcher.group(1)); return redirect; } PortalNode node = null; String trimmedPath = ""; int length = StringUtils.countMatches(siteId, PortalHierarchyService.SEPARATOR); for(int i = length; i >= 1 ; i--){ node = portalHierarchyService.getNodeByUrl(siteId); if(node == null){ int index = siteId.lastIndexOf(PortalHierarchyService.SEPARATOR); if(index > 0){ String firstPart = siteId.substring(0, index); String tempString = PortalHierarchyService.SEPARATOR + siteId.substring(index + 1); trimmedPath = (StringUtils.isBlank(trimmedPath)) ? tempString : (tempString + trimmedPath) ; siteId = firstPart; } } else{ break; } } if (node instanceof PortalNodeRedirect) { String redirectUrl = ((PortalNodeRedirect)node).getUrl(); boolean appendPath = ((PortalNodeRedirect)node).isAppendPath(); redirect.setAppendPath(appendPath); if(appendPath && StringUtils.isNotBlank(trimmedPath)){ redirect.setUrl(redirectUrl + trimmedPath); } else{ redirect.setUrl(redirectUrl); } return redirect; } } return null; }
Source:
<code>public static void verifyJvmRequirements() { String vendor = StandardSystemProperty.JAVA_VENDOR.value(); <START> if (!JVM_VENDORS.contains(vendor)) { <END> failRequirement("Presto requires an Oracle or OpenJDK JVM (found %s)", vendor); } verifyJavaVersion(); String dataModel = System.getProperty("sun.arch.data.model"); if (!"64".equals(dataModel)) { failRequirement("Presto requires a 64-bit JVM (found %s)", dataModel); } String osName = StandardSystemProperty.OS_NAME.value(); String osArch = StandardSystemProperty.OS_ARCH.value(); if ("Linux".equals(osName)) { if (!"amd64".equals(osArch)) { failRequirement("Presto requires x86-64 or amd64 on Linux (found %s)", osArch); } } else if ("Mac OS X".equals(osName)) { if (!"x86_64".equals(osArch)) { failRequirement("Presto requires x86_64 on Mac OS X (found %s)", osArch); } } else { failRequirement("Presto requires Linux or Mac OS X (found %s)", osName); } if (!ByteOrder.nativeOrder().equals(ByteOrder.LITTLE_ENDIAN)) { failRequirement("Presto requires a little endian platform (found %s)", ByteOrder.nativeOrder()); } verifyUsingG1Gc(); verifyFileDescriptor(); verifySlice(); }</code><technical_language>instead of making supported failing, raise a warning Azul Systems, ok is tested, this risk. I do expect start run tests JVMs in order check ok of them. I do expect users migrate Azul ;) warning good enough</technical_language>

Target:
public static void verifyJvmRequirements() { String runtimeName = System.getProperty("java.runtime.name"); String vendor = StandardSystemProperty.JAVA_VENDOR.value(); if (!"Java(TM) SE Runtime Environment".equals(runtimeName)) { warnRequirement("Presto is running on an unsupported JVM runtime " + "(found %s) - only the Oracle(TM) runtime is supported", runtimeName); } else if (!"Oracle Corporation".equals(vendor)) { warnRequirement("Presto is running on a JVM from an unsupported " + "vendor (found %s) - the only supported vendor is " + "Oracle(TM)", vendor); } verifyJavaVersion(); String dataModel = System.getProperty("sun.arch.data.model"); if (!"64".equals(dataModel)) { failRequirement("Presto requires a 64-bit JVM (found %s)", dataModel); } String osName = StandardSystemProperty.OS_NAME.value(); String osArch = StandardSystemProperty.OS_ARCH.value(); if ("Linux".equals(osName)) { if (!"amd64".equals(osArch)) { failRequirement("Presto requires x86-64 or amd64 on Linux (found %s)", osArch); } } else if ("Mac OS X".equals(osName)) { if (!"x86_64".equals(osArch)) { failRequirement("Presto requires x86_64 on Mac OS X (found %s)", osArch); } } else { failRequirement("Presto requires Linux or Mac OS X (found %s)", osName); } if (!ByteOrder.nativeOrder().equals(ByteOrder.LITTLE_ENDIAN)) { failRequirement("Presto requires a little endian platform (found %s)", ByteOrder.nativeOrder()); } verifyUsingG1Gc(); verifyFileDescriptor(); verifySlice(); }
Source:
<code>private List<Thread> getThreadsWithLatchForFile(final CountDownLatch countDownLatch, int threadsCount) { List<Thread> result = new ArrayList<>(); String ballast = "" + System.currentTimeMillis(); for (int i = 0; i < threadsCount; i++) { final int curThreadNo = i; final File tmp = (i % 3 == 0 || i % 3 == 2) ? new File(tempDir.toAbsolutePath().toString() + "/cuce" + ballast + i + "/tmpFile.tmp") : new File(tempDir.toAbsolutePath().toString() + "/cuce" + ballast + (i - 1) + "/tmpFile.tmp"); tmpFiles.add(tmp); result.add(new Thread(() -> { try { countDownLatch.await(); URLOutputStream urlOutputStream = new URLOutputStream(tmp.toURI().toURL()); <START> urlOutputStream.close(); <END> } catch (IOException e) { threadErrors.add("Thread" + curThreadNo + ": parent dir not created. " + e.getMessage()); } catch (InterruptedException e) { threadErrors.add("Thread" + curThreadNo + ": not started on time. " + e.getMessage()); } })); } return result; }</code><technical_language>Nice catch. try-with-resources here</technical_language>

Target:
private List<Thread> getThreadsWithLatchForFile(final CountDownLatch countDownLatch, int threadsCount) { List<Thread> result = new ArrayList<>(); String ballast = "" + System.currentTimeMillis(); for (int i = 0; i < threadsCount; i++) { final int curThreadNo = i; final File tmp = (i % 3 == 0 || i % 3 == 2) ? new File(tempDir.toAbsolutePath().toString() + "/cuce" + ballast + i + "/tmpFile.tmp") : new File(tempDir.toAbsolutePath().toString() + "/cuce" + ballast + (i - 1) + "/tmpFile.tmp"); tmpFiles.add(tmp); result.add(new Thread(() -> { try { countDownLatch.await(); try (URLOutputStream urlOutputStream = new URLOutputStream(tmp.toURI().toURL())) { } } catch (IOException e) { threadErrors.add("Thread" + curThreadNo + ": parent dir not created. " + e.getMessage()); } catch (InterruptedException e) { threadErrors.add("Thread" + curThreadNo + ": not started on time. " + e.getMessage()); } })); } return result; }
Source:
<code>public Future<Optional<String>> sendPaymentConfirmedEmail(ChargeEntity chargeEntity, GatewayAccountEntity gatewayAccountEntity) { <START> return sendEmail(EmailNotificationType.PAYMENT_CONFIRMED, chargeEntity, gatewayAccountEntity, <END> buildConfirmationEmailPersonalisationFrom(chargeEntity)); }</code><technical_language>Do need update this method ? this is for inflight payments, gatewayAccount chargeEntity</technical_language>

Target:
public Future<Optional<String>> sendPaymentConfirmedEmail(ChargeEntity chargeEntity, GatewayAccountEntity gatewayAccountEntity) { return sendEmail(EmailNotificationType.PAYMENT_CONFIRMED, Charge.from(chargeEntity), gatewayAccountEntity, buildConfirmationEmailPersonalisationFrom(chargeEntity)); }
Source:
<code>public void close() { for (StreamReader structField : structFields) { <START> structField.close(); <END> } }</code><technical_language>Please guava Closer here</technical_language>

Target:
public void close() { try (Closer closer = Closer.create()) { for (StreamReader structField : structFields) { closer.register(() -> structField.close()); } } catch (IOException e) { throw new UncheckedIOException(e); } }
Source:
<code>public PropertyCursor( Read read ) { <START> super( -1 ); <END> this.read = read; }</code><technical_language>NO_ID</technical_language>

Target:
public PropertyCursor( Read read ) { super( NO_ID ); this.read = read; }
Source:
<code>private void handleDeleteFile(final DeleteFile deleteFile) { final String messageId = deleteFile.getId(); log.debug("Received file delete message in job {}", messageId, this.jobId); <START> <END> if (this.waitingForBeginMessage) { log.debug( "Haven't received a message. Ignoring file delete message {}.", BeginSync.class.getCanonicalName(), messageId ); this.sendResetMessageIfNecessary(); } else { try { this.jobFileService.deleteJobFile(this.jobId, deleteFile.getPath()); synchronized (this.messagesLock) { this.successfulSyncIds.add(messageId); } } catch (final Exception e) { log.error( "Deleting for job failed due to {}", deleteFile.getPath(), this.jobId, e.getMessage(), e ); synchronized (this.messagesLock) { this.failedSyncIds.add(messageId); } } } this.checkIfShouldSendAck(); }</code><technical_language>This block appears in 3 methods, pulled out for duplication methods simpler</technical_language>

Target:
private void handleDeleteFile(final DeleteFile deleteFile) { final String messageId = deleteFile.getId(); log.debug("Received file delete message in job {}", messageId, this.jobId); if (this.waitingForBeginMessage) { log.debug( "Haven't received a message. Ignoring file delete message {}.", BeginSync.class.getCanonicalName(), messageId ); this.sendResetMessageIfNecessary(); } else { try { this.jobFileService.deleteJobFile(this.jobId, deleteFile.getPath()); synchronized (this.messagesLock) { this.requestResults.add(this.createRequestResult(messageId, true)); } } catch (final Exception e) { log.error( "Deleting for job failed due to {}", deleteFile.getPath(), this.jobId, e.getMessage(), e ); synchronized (this.messagesLock) { this.requestResults.add(this.createRequestResult(messageId, false)); } } } this.checkIfShouldSendAck(); }
Source:
<code>private static CamelReactiveStreamsService resolveReactiveStreamsService(CamelContext context, String serviceName) { CamelReactiveStreamsService service = null; if (serviceName != null) { service = context.getRegistry().lookupByNameAndType(serviceName, CamelReactiveStreamsService.class); } if (service == null) { LOG.info("Using default reactive stream service"); service = new CamelReactiveStreamsServiceImpl(); } return service; <START> } <END></code><technical_language>nice service factory in spring boot pre-load registry osgi/spring/xml custom stuffs want put a jar camel resolve for other stuffs</technical_language>

Target:
private static CamelReactiveStreamsService resolveReactiveStreamsService(CamelContext context, String serviceName) { CamelReactiveStreamsService service = null; if (serviceName != null) { service = context.getRegistry().lookupByNameAndType(serviceName, CamelReactiveStreamsService.class); if (service == null) { service = resolveServiceUsingFactory(context, serviceName); } } else { Set<CamelReactiveStreamsService> set = context.getRegistry().findByType(CamelReactiveStreamsService.class); if (set.size() == 1) { service = set.iterator().next(); } if (service == null) { LOG.info("Using default reactive stream service"); service = resolveServiceUsingFactory(context, null); } } return service; }
Source:
<code>public void dialogOnAddButtonPressed(String time, String date, String reading, String type, String notes) { if (validateDate(date) && validateTime(time) && validateGlucose(reading) && validateType(type)) { Date finalDateTime = getReadingTime(); Number number = parseReading(reading); if (number == null) { activity.showErrorMessage(); return; } <START> boolean isReadingAdded; <END> if ("mg/dL".equals(getUnitMeasuerement())) { int finalReading = number.intValue(); GlucoseReading gReading = new GlucoseReading(finalReading, type, finalDateTime, notes); isReadingAdded = dB.addGlucoseReading(gReading); } else { converter = new GlucosioConverter(); int convertedReading = converter.glucoseToMgDl(number.doubleValue()); GlucoseReading gReading = new GlucoseReading(convertedReading, type, finalDateTime, notes); isReadingAdded = dB.addGlucoseReading(gReading); } if (!isReadingAdded) { activity.showDuplicateErrorMessage(); } else { activity.finishActivity(); } } else { activity.showErrorMessage(); } }</code><technical_language>extract part (the non-null parsing) method for readability put else case</technical_language>

Target:
public void dialogOnAddButtonPressed(String time, String date, String reading, String type, String notes) { dialogOnAddButtonPressed(time, date, reading, type, notes, UNKNOWN_ID); }
Source:
<code>private void isAreaLoadedInject(int xStart, int yStart, int zStart, int xEnd, int yEnd, int zEnd, boolean allowEmpty, @Nonnull CallbackInfoReturnable<Boolean> cbi) { if (!this.isCubicWorld()) { return; } boolean ret = (this.isRemote() && allowEmpty) || this.testForCubes( xStart, yStart, zStart, xEnd, yEnd, zEnd, Objects::nonNull, <START> Requirement.GET_WATCHED); <END> cbi.cancel(); cbi.setReturnValue(ret); }</code><technical_language>This break a lot of for good reason, vanilla logic. Mods vanilla check if area is LOADED, if player needs it</technical_language>

Target:
private void isAreaLoadedInject(int xStart, int yStart, int zStart, int xEnd, int yEnd, int zEnd, boolean allowEmpty, @Nonnull CallbackInfoReturnable<Boolean> cbi) { if (!this.isCubicWorld()) { return; } boolean ret = (this.isRemote() && allowEmpty) || this.testForCubes( xStart, yStart, zStart, xEnd, yEnd, zEnd, Objects::nonNull); cbi.cancel(); cbi.setReturnValue(ret); }
Source:
<code>public void testFindTaskEventsForNotExistingTask() { try { taskClient.findTaskEvents(-9999l, 0, 10); fail("KieServicesException should be thrown complaining about task not found."); } catch (KieServicesException e) { KieServerAssert.assertResultContainsString(e.getMessage(), "No task found with id"); <START> } <END> }</code><technical_language>good check HTTP status code</technical_language>

Target:
public void testFindTaskEventsForNotExistingTask() { try { taskClient.findTaskEvents(-9999l, 0, 10); fail("KieServicesException should be thrown complaining about task not found."); } catch (KieServicesException e) { KieServerAssert.assertResultContainsString(e.getMessage(), "No task found with id"); if(configuration.isRest()) { KieServicesHttpException httpEx = (KieServicesHttpException) e; assertEquals("Exception has wrong HTTP Response code.", Integer.valueOf(404), httpEx.getHttpCode()); } } }
Source:
<code>public File getDatabasePath(String name) { File dir; <START> if (name.charAt(0) == File.separatorChar) { <END> String dirPath = name.substring(0, name.lastIndexOf(File.separatorChar)); dir = new File(dirPath); name = name.substring(name.lastIndexOf(File.separatorChar)); } else { DATABASE_DIR.mkdirs(); dir = DATABASE_DIR; } return new File(dir, name); }</code><technical_language>File#isAbsolute</technical_language>

Target:
public File getDatabasePath(String name) { File file = new File(name); if (file.isAbsolute()) { return file; } else { DATABASE_DIR.mkdirs(); return new File(DATABASE_DIR, name); } }
Source:
<code>private Function<Cursor, Result<TopNResultValue>> getMapFn(TopNQuery query, final StorageAdapter adapter) { final Capabilities capabilities = adapter.getCapabilities(); final String dimension = query.getDimensionSpec().getDimension(); <START> final ColumnCapabilities columnCapabilities = adapter.getColumnCapabilities(dimension); <END> final int cardinality = adapter.getDimensionCardinality(dimension); int numBytesPerRecord = 0; for (AggregatorFactory aggregatorFactory : query.getAggregatorSpecs()) { numBytesPerRecord += aggregatorFactory.getMaxIntermediateSize(); } final TopNAlgorithmSelector selector = new TopNAlgorithmSelector(cardinality, numBytesPerRecord); query.initTopNAlgorithmSelector(selector); final TopNAlgorithm topNAlgorithm; if ( selector.isHasExtractionFn() && dimension.equals(Column.TIME_COLUMN_NAME) ) { topNAlgorithm = new TimeExtractionTopNAlgorithm(capabilities, query); } else if (selector.isHasExtractionFn()) { topNAlgorithm = new DimExtractionTopNAlgorithm(capabilities, query); } else if (selector.isAggregateAllMetrics()) { topNAlgorithm = new PooledTopNAlgorithm(capabilities, query, bufferPool); } else if (selector.isAggregateTopNMetricFirst() || query.getContextBoolean("doAggregateTopNMetricFirst", false)) { topNAlgorithm = new AggregateTopNMetricFirstAlgorithm(capabilities, query, bufferPool); } else { topNAlgorithm = new PooledTopNAlgorithm(capabilities, query, bufferPool); } return new TopNMapFn(query, topNAlgorithm); }</code><technical_language>unused</technical_language>

Target:
private Function<Cursor, Result<TopNResultValue>> getMapFn(TopNQuery query, final StorageAdapter adapter) { final Capabilities capabilities = adapter.getCapabilities(); final String dimension = query.getDimensionSpec().getDimension(); final int cardinality = adapter.getDimensionCardinality(dimension); int numBytesPerRecord = 0; for (AggregatorFactory aggregatorFactory : query.getAggregatorSpecs()) { numBytesPerRecord += aggregatorFactory.getMaxIntermediateSize(); } final TopNAlgorithmSelector selector = new TopNAlgorithmSelector(cardinality, numBytesPerRecord); query.initTopNAlgorithmSelector(selector); final TopNAlgorithm topNAlgorithm; if ( selector.isHasExtractionFn() && dimension.equals(Column.TIME_COLUMN_NAME) ) { topNAlgorithm = new TimeExtractionTopNAlgorithm(capabilities, query); } else if (selector.isHasExtractionFn()) { topNAlgorithm = new DimExtractionTopNAlgorithm(capabilities, query); } else if (selector.isAggregateAllMetrics()) { topNAlgorithm = new PooledTopNAlgorithm(capabilities, query, bufferPool); } else if (selector.isAggregateTopNMetricFirst() || query.getContextBoolean("doAggregateTopNMetricFirst", false)) { topNAlgorithm = new AggregateTopNMetricFirstAlgorithm(capabilities, query, bufferPool); } else { topNAlgorithm = new PooledTopNAlgorithm(capabilities, query, bufferPool); } return new TopNMapFn(query, topNAlgorithm); }
Source:
<code>public void update(Observable o, Object arg) { final String arg1 = OoyalaNotification.getNameOrUnknown(arg); if (arg1.equals(OoyalaPlayer.TIME_CHANGED_NOTIFICATION_NAME)) { <START> if(TAG.toString().equalsIgnoreCase("class com.ooyala.sample.players.ProgrammaticVolumePlayerActivity")) <END> { player.setVolume(player.getVolume() + .025f); return; } return; } String text = "Notification Received: " + arg1 + " - state: " + player.getState(); Log.d(TAG, text); if (writePermission) { Log.d(TAG, "Writing log to SD card"); log.writeToSdcardLog(text); } }</code><technical_language>Remove .toString()</technical_language>

Target:
public void update(Observable o, Object arg) { final String arg1 = OoyalaNotification.getNameOrUnknown(arg); if (arg1.equals(OoyalaPlayer.TIME_CHANGED_NOTIFICATION_NAME)) { if(TAG.equalsIgnoreCase("class com.ooyala.sample.players.ProgrammaticVolumePlayerActivity")) { player.setVolume(player.getVolume() + .025f); return; } return; } String text = "Notification Received: " + arg1 + " - state: " + player.getState(); Log.d(TAG, text); if (writePermission) { Log.d(TAG, "Writing log to SD card"); log.writeToSdcardLog(text); } }
Source:
<code>private static File getConfigDirectory() throws Exception { File dir = Paths.get(LOADER_RESOURCES_DIR.toURI()).toFile(); if (!dir.exists()) { <START> fail("Invalid setup parameter 'target', the directory does not exist"); <END> } return dir; }</code><technical_language>Include path in failure message</technical_language>

Target:
private static File getConfigDirectory() throws Exception { File dir = Paths.get(LOADER_RESOURCES_DIR.toURI()).toFile(); if (!dir.exists()) { fail( format( "Invalid setup parameter 'target', the directory [%s] does not exist", dir.getAbsolutePath())); } return dir; }
Source:
<code>public void run() { try { while (_running) { Frame frame = _frameHandler.readFrame(); if (frame != null) { _missedHeartbeats = 0; if (frame.type == AMQP.FRAME_HEARTBEAT) { } else { if (frame.channel == 0) { _channel0.handleFrame(frame); } else { if (isOpen()) { ChannelManager cm = _channelManager; if (cm != null) { ChannelN channel; try { channel = cm.getChannel(frame.channel); } catch(UnknownChannelException e) { <START> LOGGER.info("Channel is unknown, ignoring frame", frame.channel); <END> continue; } channel.handleFrame(frame); } } } } } else { handleSocketTimeout(); } } } catch (EOFException ex) { if (!_brokerInitiatedShutdown) shutdown(null, false, ex, true); } catch (Throwable ex) { _exceptionHandler.handleUnexpectedConnectionDriverException(AMQConnection.this, ex); shutdown(null, false, ex, true); } finally { _frameHandler.close(); _appContinuation.set(null); notifyListeners(); notifyRecoveryCanBeginListeners(); } }</code><technical_language>change wording "Received a frame unknown channel, ignoring it"</technical_language>

Target:
public void run() { try { while (_running) { Frame frame = _frameHandler.readFrame(); if (frame != null) { _missedHeartbeats = 0; if (frame.type == AMQP.FRAME_HEARTBEAT) { } else { if (frame.channel == 0) { _channel0.handleFrame(frame); } else { if (isOpen()) { ChannelManager cm = _channelManager; if (cm != null) { ChannelN channel; try { channel = cm.getChannel(frame.channel); } catch(UnknownChannelException e) { LOGGER.info("Received a frame on an unknown channel, ignoring it"); continue; } channel.handleFrame(frame); } } } } } else { handleSocketTimeout(); } } } catch (EOFException ex) { if (!_brokerInitiatedShutdown) shutdown(null, false, ex, true); } catch (Throwable ex) { _exceptionHandler.handleUnexpectedConnectionDriverException(AMQConnection.this, ex); shutdown(null, false, ex, true); } finally { _frameHandler.close(); _appContinuation.set(null); notifyListeners(); notifyRecoveryCanBeginListeners(); } }
Source:
<code>public java.io.File cache(IFileStore source, IProgressMonitor monitor) throws CoreException { try { SubMonitor <START> subMonitor = <END> SubMonitor.convert(monitor, NLS.bind(Messages.copying, toString()), 100); IFileInfo myInfo = source.fetchInfo(EFS.NONE, subMonitor.newChild(25)); if (!myInfo.exists()) return new File(cacheDir, "Non-Existent-" + System.currentTimeMillis()); File result; if (myInfo.isDirectory()) { result = getUniqueDirectory(cacheDir, false); } else { result = File.createTempFile(source.getFileSystem().getScheme(), "efs", cacheDir); } subMonitor.worked(25); IFileStore resultStore = new LocalFile(result); source.copy(resultStore, EFS.OVERWRITE, subMonitor.newChild(25)); result.deleteOnExit(); return result; } catch (IOException e) { Policy.error(EFS.ERROR_WRITE, NLS.bind(Messages.couldNotWrite, toString())); return null; } }</code><technical_language>Ticks line up. method body consumes 75 ticks</technical_language>

Target:
public java.io.File cache(IFileStore source, IProgressMonitor monitor) throws CoreException { try { SubMonitor subMonitor = SubMonitor.convert(monitor, NLS.bind(Messages.copying, toString()), 3); IFileInfo myInfo = source.fetchInfo(EFS.NONE, subMonitor.newChild(1)); if (!myInfo.exists()) return new File(cacheDir, "Non-Existent-" + System.currentTimeMillis()); File result; if (myInfo.isDirectory()) { result = getUniqueDirectory(cacheDir, false); } else { result = File.createTempFile(source.getFileSystem().getScheme(), "efs", cacheDir); } subMonitor.worked(1); IFileStore resultStore = new LocalFile(result); source.copy(resultStore, EFS.OVERWRITE, subMonitor.newChild(1)); result.deleteOnExit(); return result; } catch (IOException e) { Policy.error(EFS.ERROR_WRITE, NLS.bind(Messages.couldNotWrite, toString())); return null; } }
Source:
<code>public void testGenerate() throws IOException, ClassNotFoundException, NoSuchMethodException, InvocationTargetException, InstantiationException, IllegalAccessException, URISyntaxException, JSONException { Assert.assertNotNull("CrudResource was not injected by the container", cutCrudResource); String metadata = readFile("generator-md.json"); EntityMetadata em = RestConfiguration.getFactory().getJSONParser().parseEntityMetadata(JsonUtils.json(metadata)); RestConfiguration.getFactory().getMetadata().createNewMetadata(em); String result=cutCrudResource.generate("generate","1.0.0","number",1).getEntity().toString(); System.out.println("Generated:"+result); JSONAssert.assertEquals("{\"processed\":[\"50000000\"]}",result,false); result=cutCrudResource.generate("generate","1.0.0","number",3).getEntity().toString(); System.out.println("Generated:"+result); JSONAssert.assertEquals("{\"processed\":[\"50000001\",\"50000002\",\"50000003\"]}",result,false); <START> } <END></code><technical_language>Test version is supplied</technical_language>

Target:
public void testGenerate() throws IOException, ClassNotFoundException, NoSuchMethodException, InvocationTargetException, InstantiationException, IllegalAccessException, URISyntaxException, JSONException { Assert.assertNotNull("CrudResource was not injected by the container", cutCrudResource); String metadata = readFile("generator-md.json"); EntityMetadata em = RestConfiguration.getFactory().getJSONParser().parseEntityMetadata(JsonUtils.json(metadata)); RestConfiguration.getFactory().getMetadata().createNewMetadata(em); String result=cutCrudResource.generate("generate","1.0.0","number",1).getEntity().toString(); System.out.println("Generated:"+result); JSONAssert.assertEquals("{\"processed\":[\"50000000\"]}",result,false); result=cutCrudResource.generate("generate","number",3).getEntity().toString(); System.out.println("Generated:"+result); JSONAssert.assertEquals("{\"processed\":[\"50000001\",\"50000002\",\"50000003\"]}",result,false); }
Source:
<code><START> public ITmfTimestamp readEnd() { <END> try { Long pos = fFile.length() - 1; while (pos > 0) { while (pos > 0) { fFile.seek(pos - 1); if (fFile.read() == '\n') { break; } pos--; } ITmfLocation location = new TmfLongLocation(pos); TmfContext context = new TmfContext(location, ITmfContext.UNKNOWN_RANK); CustomTxtEvent event = parseEvent(context); if (event != null) { return event.getTimestamp(); } pos--; } } catch (IOException e) { return null; } return null; }</code><technical_language>synchronized</technical_language>

Target:
public synchronized ITmfTimestamp readEnd() { try { Long pos = fFile.length() - 1; while (pos > 0) { while (pos > 0) { fFile.seek(pos - 1); if (fFile.read() == '\n') { break; } pos--; } ITmfLocation location = new TmfLongLocation(pos); ITmfContext context = seekEvent(location); ITmfEvent event = parseEvent(context); context.dispose(); if (event != null) { return event.getTimestamp(); } pos--; } } catch (IOException e) { return null; } return null; }
Source:
<code>public static Thread pipe(InputStream in, OutputStream out) { Runnable run = () -> { try (in; out) { IOUtils.copy(in, out); out.flush(); } catch (IOException e) { <START> throw new RuntimeException(e); <END> } }; Thread thread = new Thread(run, "Nuxeo-pipe-" + PIPE_COUNT.incrementAndGet()); thread.setDaemon(true); thread.start(); return thread; }</code><technical_language>remove finally block, InputStream OutputStream AutoCloseable</technical_language>

Target:
public static Thread pipe(InputStream in, OutputStream out) { Runnable run = () -> { try (in; out) { IOUtils.copy(in, out); out.flush(); } catch (IOException e) { throw new RuntimeServiceException(e); } }; Thread thread = new Thread(run, "Nuxeo-pipe-" + PIPE_COUNT.incrementAndGet()); thread.setDaemon(true); thread.start(); return thread; }
Source:
<code>public Boolean isSHREnabled(){ <START> boolean enableSHR = true; <END> try { MuzimaSetting muzimaSHRStatus = getSettingByProperty(SHR_STATUS_SETTING); enableSHR = muzimaSHRStatus.getValueBoolean(); } catch (MuzimaSettingFetchException e){ Log.e(getClass().getSimpleName(), "Could not fetch requireMedicalRecordNumber setting. ", e); } return enableSHR; }</code><technical_language>enableSHR default false</technical_language>

Target:
public Boolean isSHREnabled(){ boolean enableSHR = false; try { MuzimaSetting muzimaSHRStatus = getSettingByProperty(SHR_STATUS_SETTING); enableSHR = muzimaSHRStatus.getValueBoolean(); } catch (MuzimaSettingFetchException e){ Log.e(getClass().getSimpleName(), "Could not fetch requireMedicalRecordNumber setting. ", e); } return enableSHR; }
Source:
<code>public static Iterable<Object[]> data() { Field[] fields = Look.class.getDeclaredFields(); ArrayList<Object[]> parameterList = new ArrayList<>(); for (Field field : fields) { <START> if (!field.getName().equals("scheduler")) { <END> parameterList.add(new Object[] {field.getName(), field}); } } return parameterList; }</code><technical_language>Please exclude fields starting "$"</technical_language>

Target:
public static Iterable<Object[]> data() { Field[] fields = Look.class.getDeclaredFields(); ArrayList<Object[]> parameterList = new ArrayList<>(); for (Field field : fields) { if (!field.getName().equals("scheduler") && !field.getName().startsWith("$")) { parameterList.add(new Object[] {field.getName(), field}); } } return parameterList; }
Source:
<code>public void bakeNewCake(CakeInfo cakeInfo) throws CakeBakingException { List<CakeTopping> allToppings = getAvailableToppingEntities(); List<CakeTopping> matchingToppings = allToppings.stream().filter(t -> t.getName().equals(cakeInfo.cakeToppingInfo.name)) .collect(Collectors.toList()); if (matchingToppings.isEmpty()) { throw new CakeBakingException(String.format("Topping %s is not available", cakeInfo.cakeToppingInfo.name)); } List<CakeLayer> allLayers = getAvailableLayerEntities(); Set<CakeLayer> foundLayers = new HashSet<>(); for (CakeLayerInfo info : cakeInfo.cakeLayerInfos) { Optional<CakeLayer> found = allLayers.stream().filter(layer -> layer.getName().equals(info.name)).findFirst(); if (!found.isPresent()) { throw new CakeBakingException(String.format("Layer %s is not available", info.name)); } else { foundLayers.add(found.get()); } } CakeToppingDao toppingBean = context.getBean(CakeToppingDao.class); Optional<CakeTopping> topping = toppingBean.findById(matchingToppings.iterator().next().getId()); CakeDao cakeBean = context.getBean(CakeDao.class); if (topping.isPresent()) { Cake cake = new Cake(); cake.setTopping(topping.get()); cake.setLayers(foundLayers); cakeBean.save(cake); topping.get().setCake(cake); toppingBean.save(topping.get()); CakeLayerDao layerBean = context.getBean(CakeLayerDao.class); for (CakeLayer layer : foundLayers) { layer.setCake(cake); layerBean.save(layer); <START> } <END> } }</code><technical_language>if topping is present? handle error case. throw CakeBakingException</technical_language>

Target:
public void bakeNewCake(CakeInfo cakeInfo) throws CakeBakingException { List<CakeTopping> allToppings = getAvailableToppingEntities(); List<CakeTopping> matchingToppings = allToppings.stream().filter(t -> t.getName().equals(cakeInfo.cakeToppingInfo.name)) .collect(Collectors.toList()); if (matchingToppings.isEmpty()) { throw new CakeBakingException(String.format("Topping %s is not available", cakeInfo.cakeToppingInfo.name)); } List<CakeLayer> allLayers = getAvailableLayerEntities(); Set<CakeLayer> foundLayers = new HashSet<>(); for (CakeLayerInfo info : cakeInfo.cakeLayerInfos) { Optional<CakeLayer> found = allLayers.stream().filter(layer -> layer.getName().equals(info.name)).findFirst(); if (!found.isPresent()) { throw new CakeBakingException(String.format("Layer %s is not available", info.name)); } else { foundLayers.add(found.get()); } } CakeToppingDao toppingBean = context.getBean(CakeToppingDao.class); Optional<CakeTopping> topping = toppingBean.findById(matchingToppings.iterator().next().getId()); CakeDao cakeBean = context.getBean(CakeDao.class); if (topping.isPresent()) { Cake cake = new Cake(); cake.setTopping(topping.get()); cake.setLayers(foundLayers); cakeBean.save(cake); topping.get().setCake(cake); toppingBean.save(topping.get()); CakeLayerDao layerBean = context.getBean(CakeLayerDao.class); for (CakeLayer layer : foundLayers) { layer.setCake(cake); layerBean.save(layer); } } else { throw new CakeBakingException(String.format("Topping %s is not available", cakeInfo.cakeToppingInfo.name)); } }
Source:
<code>public Path(String fullPath, <START> boolean windows) { <END> String devicePart = null; if (windows) { fullPath = fullPath.indexOf('\\') == -1 ? fullPath : fullPath.replace('\\', SEPARATOR); int i = fullPath.indexOf(DEVICE_SEPARATOR); if (i != -1) { int start = fullPath.charAt(0) == SEPARATOR ? 1 : 0; devicePart = fullPath.substring(start, i + 1); fullPath = fullPath.substring(i + 1, fullPath.length()); } } initialize(devicePart, fullPath, windows); }</code><technical_language>cleaner this constructor private instead expose static methods, fromWindowsString(String fullPath) fromPosixString(String fullPath)</technical_language>

Target:
private Path(String fullPath, boolean windows) { String devicePart = null; if (windows) { fullPath = fullPath.indexOf('\\') == -1 ? fullPath : fullPath.replace('\\', SEPARATOR); int i = fullPath.indexOf(DEVICE_SEPARATOR); if (i != -1) { int start = fullPath.charAt(0) == SEPARATOR ? 1 : 0; devicePart = fullPath.substring(start, i + 1); fullPath = fullPath.substring(i + 1, fullPath.length()); } } initialize(devicePart, fullPath, windows); }
Source:
<code>public String getGitServerHost() { if (isNullOrEmpty(host)) { <START> return nullToEmpty(host); <END> } StringBuilder gitServerHosts = new StringBuilder(" \""); if (!host.startsWith(HTTPS)) { gitServerHosts.append(HTTPS); } gitServerHosts.append(host); gitServerHosts.append("\""); return gitServerHosts.toString(); }</code><technical_language>elaborate more happen if host is empty? Is a valid case? git a certificate for everything</technical_language>

Target:
public String getGitServerHost() { return host; }
Source:
<code>@Override public void onCreate(Bundle savedInstanceState) { assertNotDead(); latestSavedInstanceState = savedInstanceState; toloadThisTime.addAll(bundlers); duringOnCreate = true; doLoading(); <START> duringOnCreate = false; <END> for (RealMortarScope child : children.values()) { if (!(child instanceof RealActivityScope)) continue; ((RealActivityScope) child).onCreate(getChildBundle(child, savedInstanceState, false)); } }</code><technical_language>Kind of a weird name set false halfway onCreate</technical_language>

Target:
@Override public void onCreate(Bundle savedInstanceState) { assertNotDead(); latestSavedInstanceState = savedInstanceState; toloadThisTime.addAll(bundlers); loadingFromOnCreate = true; doLoading(); loadingFromOnCreate = false; for (RealMortarScope child : children.values()) { if (!(child instanceof RealActivityScope)) continue; ((RealActivityScope) child).onCreate(getChildBundle(child, savedInstanceState, false)); } }
Source:
<code>private static byte[] toByteArray(final SAMFileHeader samFileHeader) { final ByteArrayOutputStream headerBodyOS = new ByteArrayOutputStream(); final OutputStreamWriter outStreamWriter = new OutputStreamWriter(headerBodyOS); new SAMTextHeaderCodec().encode(outStreamWriter, samFileHeader); try { outStreamWriter.close(); } catch (final IOException e) { throw new RuntimeException(e); } final ByteBuffer buf = ByteBuffer.allocate(4); buf.order(ByteOrder.LITTLE_ENDIAN); buf.putInt(headerBodyOS.size()); buf.flip(); final byte[] bytes = new byte[buf.limit()]; buf.get(bytes); final ByteArrayOutputStream headerOS = new ByteArrayOutputStream(); try { headerOS.write(bytes); <START> headerOS.write(headerBodyOS.toByteArray(), 0, headerBodyOS.size()); <END> } catch (final IOException e) { throw new RuntimeException(e); } return headerOS.toByteArray(); }</code><technical_language>This introduces additional redundant array copy, header a bottleneck all. If is a bottleneck headerOs exposed well..</technical_language>

Target:
private static byte[] toByteArray(final SAMFileHeader samFileHeader) { final ByteArrayOutputStream headerBodyOS = new ByteArrayOutputStream(); final OutputStreamWriter outStreamWriter = new OutputStreamWriter(headerBodyOS); new SAMTextHeaderCodec().encode(outStreamWriter, samFileHeader); try { outStreamWriter.close(); } catch (final IOException e) { throw new RuntimeIOException(e); } final ByteBuffer buf = ByteBuffer.allocate(4); buf.order(ByteOrder.LITTLE_ENDIAN); buf.putInt(headerBodyOS.size()); buf.flip(); final byte[] bytes = new byte[buf.limit()]; buf.get(bytes); final ByteArrayOutputStream headerOS = new ByteArrayOutputStream(); try { headerOS.write(bytes); headerOS.write(headerBodyOS.toByteArray(), 0, headerBodyOS.size()); } catch (final IOException e) { throw new RuntimeIOException(e); } return headerOS.toByteArray(); }
Source:
<code>protected boolean canDoAction() { <START> boolean result = validateVM(); <END> List<DiskImage> disksList = getDisksList(); if (result && disksList.size() > 0) { VmValidator vmValidator = new VmValidator(getVm()); SnapshotsValidator snapshotValidator = new SnapshotsValidator(); result = validate(snapshotValidator.vmNotDuringSnapshot(getVmId())) && validate(snapshotValidator.vmNotInPreview(getVmId())) && validate(vmValidator.vmNotDuringMigration()) && validate(vmValidator.vmNotRunningStateless()) && validate(vmValidator.vmNotIlegal()) && ImagesHandler.PerformImagesChecks( getReturnValue().getCanDoActionMessages(), getVm().getStoragePoolId(), Guid.Empty, true, true, true, true, true, true, disksList) && validate(vmValidator.vmNotLocked()); } return result; }</code><technical_language>please create validator if needed this line in case of disks, need create validator if (canDoSnapshot fails) create validators (here in validateVM())</technical_language>

Target:
protected boolean canDoAction() { VmValidator vmValidator = new VmValidator(getVm()); boolean result = validateVM(vmValidator); List<DiskImage> disksList = getDisksList(); if (result && disksList.size() > 0) { SnapshotsValidator snapshotValidator = new SnapshotsValidator(); result = validate(snapshotValidator.vmNotDuringSnapshot(getVmId())) && validate(snapshotValidator.vmNotInPreview(getVmId())) && validate(vmValidator.vmNotDuringMigration()) && validate(vmValidator.vmNotRunningStateless()) && validate(vmValidator.vmNotIlegal()) && ImagesHandler.PerformImagesChecks( getReturnValue().getCanDoActionMessages(), getVm().getStoragePoolId(), Guid.Empty, true, true, true, true, true, true, disksList) && validate(vmValidator.vmNotLocked()); } return result; }
Source:
<code>public Iterator<T> iterator() { return new Iterator<T>() { @Override public boolean hasNext() { return true; } @Override public synchronized T next() { return items.get(random.nextInt(numItems)); } @Override public void remove() { <START> throw new IllegalArgumentException("Cannot remove from " + RandomIterator.class); <END> } }; }</code><technical_language>IllegalArgumentException refers a wrong parameter. I UnsupportedOperationException is a choice here</technical_language>

Target:
public Iterator<T> iterator() { return new Iterator<T>() { @Override public boolean hasNext() { return true; } @Override public synchronized T next() { return items.get(random.nextInt(items.size())); } @Override public void remove() { throw new UnsupportedOperationException("Cannot remove from " + RandomIterator.class); } }; }
Source:
<code>protected CoordinateReferenceSystem getCrsForCoverage( String coverageName ) { CoordinateReferenceSystem crs = crsCache.get(coverageName); if (crs != null) { return crs; } AdapterToIndexMapping adapterMapping = geowaveAdapterIndexMappingStore.getIndicesForAdapter(new ByteArrayId( coverageName)); PrimaryIndex[] indices = adapterMapping.getIndices(geowaveIndexStore); if (indices != null && indices.length > 0) { <START> if (indices[0].getIndexModel() instanceof CustomCrsIndexModel) { <END> crs = ((CustomCrsIndexModel) indices[0].getIndexModel()).getCrs(); } else { crs = GeometryUtils.DEFAULT_CRS; } crsCache.put( coverageName, crs); } return crs; }</code><technical_language>this section GeometryUtils.getCRS(index) reuse some code</technical_language>

Target:
protected CoordinateReferenceSystem getCrsForCoverage( String coverageName ) { CoordinateReferenceSystem crs = crsCache.get(coverageName); if (crs != null) { return crs; } AdapterToIndexMapping adapterMapping = geowaveAdapterIndexMappingStore.getIndicesForAdapter(new ByteArrayId( coverageName)); PrimaryIndex[] indices = adapterMapping.getIndices(geowaveIndexStore); if (indices != null && indices.length > 0) { crs = GeometryUtils.getIndexCrs(indices[0]); crsCache.put( coverageName, crs); } return crs; }
Source:
<code>public void saveCondition_shouldSaveNewCondition(){ Integer patientId = 2; String uuid = "08002000-4469-12q3-551f-0339000c9a76"; CodedOrFreeText codedOrFreeText = new CodedOrFreeText(); Condition condition = new Condition(); condition.setCondition(codedOrFreeText); condition.setClinicalStatus(ConditionClinicalStatus.ACTIVE); condition.setUuid(uuid); condition.setPatient(new Patient(patientId)); <START> condition.setEncounter(new Encounter(2039)); <END> conditionService.saveCondition(condition); Condition savedCondition = conditionService.getConditionByUuid(uuid); Assert.assertEquals(patientId, savedCondition.getPatient().getPatientId()); Assert.assertEquals(uuid, savedCondition.getUuid()); Assert.assertEquals(codedOrFreeText, savedCondition.getCondition()); Assert.assertEquals(ConditionClinicalStatus.ACTIVE, savedCondition.getClinicalStatus()); Assert.assertNotNull(savedCondition.getConditionId()); Assert.assertEquals(Integer.valueOf(2039), savedCondition.getEncounter().getId()); }</code><technical_language>change existing test? Is this change fail</technical_language>

Target:
public void saveCondition_shouldSaveNewCondition(){ Integer patientId = 2; String uuid = "08002000-4469-12q3-551f-0339000c9a76"; CodedOrFreeText codedOrFreeText = new CodedOrFreeText(); Condition condition = new Condition(); condition.setCondition(codedOrFreeText); condition.setClinicalStatus(ConditionClinicalStatus.ACTIVE); condition.setUuid(uuid); condition.setPatient(new Patient(patientId)); conditionService.saveCondition(condition); Condition savedCondition = conditionService.getConditionByUuid(uuid); Assert.assertEquals(patientId, savedCondition.getPatient().getPatientId()); Assert.assertEquals(uuid, savedCondition.getUuid()); Assert.assertEquals(codedOrFreeText, savedCondition.getCondition()); Assert.assertEquals(ConditionClinicalStatus.ACTIVE, savedCondition.getClinicalStatus()); Assert.assertNotNull(savedCondition.getConditionId()); }
Source:
<code>private static Map<DereferenceExpression, VariableReferenceExpression> getDereferenceSymbolMap(Collection<RowExpression> expressions, Context context, Metadata metadata, SqlParser sqlParser) { Set<DereferenceExpression> dereferences = expressions.stream() .filter(OriginalExpressionUtils::isExpression) .map(OriginalExpressionUtils::castToExpression) .flatMap(expression -> extractDereferenceExpressions(expression).stream()) <START> .filter(PushDownDereferences::validPushDown) <END> .collect(toImmutableSet()); if (dereferences.stream().anyMatch(exp -> baseExists(exp, dereferences))) { return ImmutableMap.of(); } return dereferences.stream() .collect(toImmutableMap(Function.identity(), expression -> newSymbol(expression, context, metadata, sqlParser))); }</code><technical_language>validPushDown logic folded extractDereferenceExpressions, e.g. extractDereferenceExpressions modified extract "valid" dereferences</technical_language>

Target:
private static Map<DereferenceExpression, VariableReferenceExpression> getDereferenceSymbolMap(Collection<RowExpression> expressions, Context context, Metadata metadata, SqlParser sqlParser) { Set<DereferenceExpression> dereferences = expressions.stream() .filter(OriginalExpressionUtils::isExpression) .map(OriginalExpressionUtils::castToExpression) .flatMap(expression -> extractDereferenceExpressions(expression).stream()) .collect(toImmutableSet()); if (dereferences.stream().anyMatch(expression -> baseExists(expression, dereferences))) { return ImmutableMap.of(); } return dereferences.stream() .collect(toImmutableMap(Function.identity(), expression -> newSymbol(expression, context, metadata, sqlParser))); }
Source:
<code>public void testSTTouches() throws Exception { <START> assertQuery("select ST_Touches(ST_GeometryFromText('Point(1 2)'), ST_GeometryFromText('Polygon ((1 1, 1 4, 4 4, 4 1))'))", "select true"); <END> }</code><technical_language>this method some duplicate tests; easier read, consider creating a map a pair of WKT shapes a boolean indicating shape 1 contains shape 2, loop map test ST_Contains returns expected results; this easier portion of test matrix is covered is duplicate tests</technical_language>

Target:
public void testSTTouches() throws Exception { assertFunction("ST_Touches(ST_GeometryFromText('POINT (50 100)'), ST_GeometryFromText('POINT (150 150)'))", BOOLEAN, false); assertFunction("ST_Touches(ST_GeometryFromText('MULTIPOINT (50 100, 50 200)'), ST_GeometryFromText('POINT (50 100)'))", BOOLEAN, false); assertFunction("ST_Touches(ST_GeometryFromText('LINESTRING (50 100, 50 200)'), ST_GeometryFromText('LINESTRING (20 150, 100 150)'))", BOOLEAN, false); assertFunction("ST_Touches(ST_GeometryFromText('MULTILINESTRING ((1 1, 5 1), (2 4, 4 4))'), ST_GeometryFromText('MULTILINESTRING ((3 4, 6 4), (5 0, 5 4))'))", BOOLEAN, false); assertFunction("ST_Touches(ST_GeometryFromText('POINT (1 2)'), ST_GeometryFromText('POLYGON ((1 1, 1 4, 4 4, 4 1))'))", BOOLEAN, true); assertFunction("ST_Touches(ST_GeometryFromText('POLYGON ((1 1, 1 3, 3 3, 3 1))'), ST_GeometryFromText('POLYGON ((4 4, 4 5, 5 5, 5 4))'))", BOOLEAN, false); assertFunction("ST_Touches(ST_GeometryFromText('POLYGON ((1 1, 1 3, 3 3, 3 1))'), ST_GeometryFromText('LINESTRING (0 0, 1 1)'))", BOOLEAN, true); assertFunction("ST_Touches(ST_GeometryFromText('POLYGON ((1 1, 1 3, 3 3, 3 1))'), ST_GeometryFromText('POLYGON ((3 3, 3 5, 5 5, 5 3))'))", BOOLEAN, true); assertFunction("ST_Touches(ST_GeometryFromText('MULTIPOLYGON (((1 1, 1 3, 3 3, 3 1)), ((0 0, 0 2, 2 2, 2 0)))'), ST_GeometryFromText('POLYGON ((0 1, 3 1, 3 3, 0 3))'))", BOOLEAN, false); }
Source:
<code>public DoubleDictionary(DictionaryPage dictionaryPage) throws IOException { super(dictionaryPage.getEncoding()); content = new double[dictionaryPage.getDictionarySize()]; DoublePlainValuesReader doubleReader = new DoublePlainValuesReader(); <START> final ByteBufferInputStream in = ByteBufferInputStream.wrap(ByteBuffer.wrap(dictionaryPage.getSlice().getBytes())); <END> doubleReader.initFromPage(dictionaryPage.getDictionarySize(), in); for (int i = 0; i < content.length; i++) { content[i] = doubleReader.readDouble(); } }</code><technical_language>in -> inputStream - final local variables, please remove final modifier</technical_language>

Target:
public DoubleDictionary(DictionaryPage dictionaryPage) throws IOException { super(dictionaryPage.getEncoding()); content = new double[dictionaryPage.getDictionarySize()]; DoublePlainValuesReader doubleReader = new DoublePlainValuesReader(); ByteBuffer byteBuffer = ByteBuffer.wrap(dictionaryPage.getSlice().getBytes()); ByteBufferInputStream inputStream = ByteBufferInputStream.wrap(ImmutableList.of(byteBuffer)); doubleReader.initFromPage(dictionaryPage.getDictionarySize(), inputStream); for (int i = 0; i < content.length; i++) { content[i] = doubleReader.readDouble(); } }
Source:
<code><START> protected File fileFromKey(byte[] key) { <END> File file = new File(attachmentsDir, new String(new Hex().encode(key))); return file; }</code><technical_language>Broken alignment</technical_language>

Target:
private File fileFromKey(byte[] key) { File file = new File(attachmentsDir, keyToString(key)); return file; }