auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void testPair() { String first = "abcdef"; Long second = 23L; Pair<String, Long> pairOne = new Pair<>(first, second); Pair<String, Long> pairTwo = new Pair<>(first, second); Pair<String, Long> pairThree = new Pair<>(first, second + 1); Pair<Long, String> pairFour = new Pair<>(second, first); assertEquals("Invalid first item.", first, pairOne.getFirst()); assertEquals("Invalid second item.", second, pairOne.getSecond()); assertEquals("These pairs should be equivalent", pairTwo, pairOne); assertFalse("pairOne and pairThree should not be equal", pairOne.equals(pairThree)); assertFalse("pairOne and pairFour should not be equal", pairOne.equals(pairFour)); assertEquals("Hashcodes should be the same", pairOne.hashCode(), pairTwo.hashCode()); assertEquals("Pair{first=" + first + ", second=" + second + "}", pairOne.toString()); }

Target:
public void testPair() { String first = "abcdef"; Long second = 23L; Pair<String, Long> pairOne = new Pair<>(first, second); Pair<String, Long> pairTwo = new Pair<>(first, second); Pair<String, Long> pairThree = new Pair<>(first, second + 1); Pair<String, Long> pairFour = new Pair<>(first + "extra", second); Pair<Long, String> pairFive = new Pair<>(second, first); assertEquals("Invalid first item.", first, pairOne.getFirst()); assertEquals("Invalid second item.", second, pairOne.getSecond()); assertEquals("These pairs should be equivalent", pairTwo, pairOne); assertFalse("pairOne and pairThree should not be equal", pairOne.equals(pairThree)); assertFalse("pairOne and pairFour should not be equal", pairOne.equals(pairFour)); assertFalse("pairOne and pairFive should not be equal", pairOne.equals(pairFive)); assertEquals("Hashcodes should be the same", pairOne.hashCode(), pairTwo.hashCode()); assertEquals("Pair{first=" + first + ", second=" + second + "}", pairOne.toString()); }
Source:
public void commonDefaultDropsHandling(CreateBlockDropsEvent event, EntityRef entity, Vector3i location, Block block) { BlockDamageModifierComponent blockDamageModifierComponent = event.getDamageType().getComponent(BlockDamageModifierComponent.class); float chanceOfBlockDrop = 1; if (blockDamageModifierComponent != null) { chanceOfBlockDrop = 1 - blockDamageModifierComponent.blockAnnihilationChance; } if (random.nextFloat() < chanceOfBlockDrop) { EntityRef item = blockItemFactory.newInstance(block.getBlockFamily(), entity); entity.send(new OnBlockToItem(item)); if (shouldDropToWorld(event, block, blockDamageModifierComponent, item)) { float impulsePower; if (blockDamageModifierComponent != null) { impulsePower = blockDamageModifierComponent.impulsePower; } else { impulsePower = 0; } processDropping(item, location, impulsePower); } } }

Target:
public void commonDefaultDropsHandling(CreateBlockDropsEvent event, EntityRef entity, Vector3i location, Block block) { BlockDamageModifierComponent blockDamageModifierComponent = event.getDamageType().getComponent(BlockDamageModifierComponent.class); float chanceOfBlockDrop = 1; if (blockDamageModifierComponent != null) { chanceOfBlockDrop = 1 - blockDamageModifierComponent.blockAnnihilationChance; } if (random.nextFloat() < chanceOfBlockDrop) { EntityRef item = blockItemFactory.newInstance(block.getBlockFamily(), entity); entity.send(new OnBlockToItem(item)); if (shouldDropToWorld(event, block, blockDamageModifierComponent, item)) { float impulsePower = 0; if (blockDamageModifierComponent != null) { impulsePower = blockDamageModifierComponent.impulsePower; } processDropping(item, location, impulsePower); } } }
Source:
public static SqlDataTypeSpec convertTypeToSpec(RelDataType type, String charSetName, int maxPrecision) { SqlTypeName typeName = type.getSqlTypeName(); assert typeName != null; SqlTypeNameSpec typeNameSpec; if (isAtomic(type)) { int precision = typeName.allowsPrec() ? type.getPrecision() : -1; if (maxPrecision > 0 && precision > maxPrecision) { precision = maxPrecision; } int scale = typeName.allowsScale() ? type.getScale() : -1; typeNameSpec = new SqlBasicTypeNameSpec( typeName, precision, scale, charSetName, SqlParserPos.ZERO); } else if (isCollection(type)) { typeNameSpec = new SqlCollectionTypeNameSpec( convertTypeToSpec(type.getComponentType()).getTypeNameSpec(), typeName, SqlParserPos.ZERO); } else if (isRow(type)) { RelRecordType recordType = (RelRecordType) type; List<RelDataTypeField> fields = recordType.getFieldList(); List<SqlIdentifier> fieldNames = fields.stream() .map(f -> new SqlIdentifier(f.getName(), SqlParserPos.ZERO)) .collect(Collectors.toList()); List<SqlDataTypeSpec> fieldTypes = fields.stream() .map(f -> convertTypeToSpec(f.getType())) .collect(Collectors.toList()); typeNameSpec = new SqlRowTypeNameSpec(SqlParserPos.ZERO, fieldNames, fieldTypes); } else { throw new UnsupportedOperationException( "Unsupported type when convertTypeToSpec: " + typeName); } return new SqlDataTypeSpec(typeNameSpec, SqlParserPos.ZERO); }

Target:
public static SqlDataTypeSpec convertTypeToSpec(RelDataType type, String charSetName, int maxPrecision) { SqlTypeName typeName = type.getSqlTypeName(); assert typeName != null; final SqlTypeNameSpec typeNameSpec; if (isAtomic(type)) { int precision = typeName.allowsPrec() ? type.getPrecision() : -1; if (maxPrecision > 0 && precision > maxPrecision) { precision = maxPrecision; } int scale = typeName.allowsScale() ? type.getScale() : -1; typeNameSpec = new SqlBasicTypeNameSpec( typeName, precision, scale, charSetName, SqlParserPos.ZERO); } else if (isCollection(type)) { typeNameSpec = new SqlCollectionTypeNameSpec( convertTypeToSpec(type.getComponentType()).getTypeNameSpec(), typeName, SqlParserPos.ZERO); } else if (isRow(type)) { RelRecordType recordType = (RelRecordType) type; List<RelDataTypeField> fields = recordType.getFieldList(); List<SqlIdentifier> fieldNames = fields.stream() .map(f -> new SqlIdentifier(f.getName(), SqlParserPos.ZERO)) .collect(Collectors.toList()); List<SqlDataTypeSpec> fieldTypes = fields.stream() .map(f -> convertTypeToSpec(f.getType())) .collect(Collectors.toList()); typeNameSpec = new SqlRowTypeNameSpec(SqlParserPos.ZERO, fieldNames, fieldTypes); } else { throw new UnsupportedOperationException( "Unsupported type when convertTypeToSpec: " + typeName); } return new SqlDataTypeSpec(typeNameSpec, SqlParserPos.ZERO); }
Source:
private boolean contributeObjectActionsOld(IMenuManager manager) { Class<ObjectActionContributorManager> cl = ObjectActionContributorManager.class; Method meth; try { meth = cl.getDeclaredMethod("contributeObjectActions", IWorkbenchPart.class, IMenuManager.class, ISelectionProvider.class); if (meth != null) { meth.invoke(ObjectActionContributorManager.getManager(), null, manager, activeTaskSelectionProvider); return true; } } catch (SecurityException e) { } catch (NoSuchMethodException e) { return false; } catch (IllegalArgumentException e) { } catch (IllegalAccessException e) { } catch (InvocationTargetException e) { } return false; }

Target:
private boolean contributeObjectActionsOld(IMenuManager manager) { try { DummyPart part = new DummyPart(); MethodUtils.invokeExactMethod(ObjectActionContributorManager.getManager(), "contributeObjectActions", new Object[] { part, manager, activeTaskSelectionProvider }); } catch (NoSuchMethodException e) { return false; } catch (IllegalAccessException e) { return false; } catch (InvocationTargetException e) { return false; } return true; }
Source:
public static void testMerge(MergeOp.Factory opFactory, Change change) { try { opFactory.create(change.getDest()).verifyMergeability(change); } catch (Throwable e) { LoggerFactory.getLogger(ChangeUtil.class).error( "Merge test attempt for change " + change.getChangeId() + " failed", e); } }

Target:
public static void testMerge(MergeOp.Factory opFactory, Change change) { try { opFactory.create(change.getDest()).verifyMergeability(change); } catch (Throwable e) { log.error("Merge test attempt for change " + change.getChangeId() + " failed", e); } }
Source:
public MatrixTriggerMode getMatrixTriggerMode() { if (matrixTriggerMode == null) { return MatrixTriggerMode.ONLY_CONFIGURATIONS; } else { return matrixTriggerMode; } }

Target:
public MatrixTriggerMode getMatrixTriggerMode() { return matrixTriggerMode; }
Source:
public void testBasic() throws IOException, InterruptedException, KeeperException { ZooKeeper zk = null; try { zk = createClient(new CountdownWatcher(), hostPort); zk.addPersistentWatch("/a/b", persistentWatcher); internalTestBasic(zk); } finally { if (zk != null) { zk.close(); } } }

Target:
public void testBasic() throws IOException, InterruptedException, KeeperException { try ( ZooKeeper zk = createClient(new CountdownWatcher(), hostPort) ) { zk.addPersistentWatch("/a/b", persistentWatcher, false); internalTestBasic(zk); } }
Source:
public void ensureServerUrlIsPassed() { EventBundle eventBundle = new EventBundleImpl(); eventBundle.push(new EventImpl("dummyEvent", buildCtx("johndoe"))); SegmentIOAsyncListener listener = new SegmentIOAsyncListener(); listener.handleEvent(eventBundle); assertEquals(1, testData.size()); assertEquals("unknown server url", testData.get(0).get("url")); System.setProperty("nuxeo.url", "<LINK_1>"); listener.handleEvent(eventBundle); assertEquals(2, testData.size()); assertEquals("<LINK_1>", testData.get(1).get("url")); }

Target:
public void ensureServerUrlIsPassed() { EventBundle eventBundle = new EventBundleImpl(); eventBundle.push(new EventImpl("dummyEvent", buildCtx("johndoe"))); SegmentIOAsyncListener listener = new SegmentIOAsyncListener(); listener.handleEvent(eventBundle); assertEquals(1, testData.size()); assertEquals("<LINK_1>", testData.get(0).get("url")); }
Source:
public NpmPackageGenerator(Path basedir){ super(); this.basePath = basedir; }

Target:
public NpmPackageGenerator(Path basedir) { this.basePath = basedir; }
Source:
private static TagObject from(TagModel model, boolean includeChildren) { TagObject result = JavaScriptObject.createObject().cast(); result.setValueAsString("description", model.getDescription().getEntity()); result.setValueAsString("name", model.getName().getEntity()); result.setValueAsBoolean("selected", model.getSelection()); if (includeChildren) { JsArray<TagObject> children = JavaScriptObject.createArray().cast(); for (TagModel child : model.getChildren()) { children.push(TagObject.from(child, includeChildren)); } result.setValueAsJavaScriptObject("children", children); } return result; }

Target:
private static TagObject from(TagModel model, boolean includeChildren) { TagObject result = JavaScriptObject.createObject().cast(); result.setValueAsString("description", model.getDescription().getEntity()); result.setValueAsString("name", model.getName().getEntity()); result.setValueAsBoolean("selected", model.getSelection()); if (includeChildren) { JsArray<TagObject> children = JavaScriptObject.createArray().cast(); for (TagModel child : model.getChildren()) { children.push(TagObject.from(child, true)); } result.setValueAsJavaScriptObject("children", children); } return result; }
Source:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mAddressSearchView = (SearchView) findViewById(R.id.addressSearchView); mAddressSearchView.setIconified(false); mAddressSearchView.setFocusable(false); mAddressSearchView.setQueryHint(getResources().getString(R.string.address_search_hint)); BitmapDrawable pinDrawable = (BitmapDrawable) ContextCompat.getDrawable(this, R.drawable.pin); try { mPinSourceSymbol = PictureMarkerSymbol.createAsync(pinDrawable).get(); } catch (InterruptedException | ExecutionException e) { Log.e(TAG, "Picture Marker Symbol error: " + e.getMessage()); Toast.makeText(getApplicationContext(), "Failed to load pin drawable.", Toast.LENGTH_LONG).show(); } mPinSourceSymbol.setWidth(19f); mPinSourceSymbol.setHeight(72f); mLocatorTask = new LocatorTask("<LINK_0>"); mMapView = (MapView) findViewById(R.id.mapView); mMapView.setWrapAroundMode(WrapAroundMode.DISABLED); final ArcGISMap map = new ArcGISMap(Basemap.createTopographic()); mMapView.setMap(map); mMapView.setOnTouchListener(new DefaultMapViewOnTouchListener(this, mMapView) { @Override public boolean onSingleTapConfirmed(MotionEvent motionEvent) { showCallout(motionEvent); return true; } }); mGraphicsOverlay = new GraphicsOverlay(); setupAddressSearchView(); }

Target:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mAddressSearchView = (SearchView) findViewById(R.id.addressSearchView); mAddressSearchView.setIconified(false); mAddressSearchView.setFocusable(false); mAddressSearchView.setQueryHint(getResources().getString(R.string.address_search_hint)); BitmapDrawable pinDrawable = (BitmapDrawable) ContextCompat.getDrawable(this, R.drawable.pin); try { mPinSourceSymbol = PictureMarkerSymbol.createAsync(pinDrawable).get(); } catch (InterruptedException | ExecutionException e) { Log.e(TAG, "Picture Marker Symbol error: " + e.getMessage()); Toast.makeText(getApplicationContext(), "Failed to load pin drawable.", Toast.LENGTH_LONG).show(); } mPinSourceSymbol.setWidth(19f); mPinSourceSymbol.setHeight(72f); mLocatorTask = new LocatorTask("<LINK_0>"); mMapView = (MapView) findViewById(R.id.mapView); final ArcGISMap map = new ArcGISMap(Basemap.createStreetsVector()); mMapView.setMap(map); mMapView.setViewpoint(new Viewpoint(40, -100, 100000000)); mMapView.setOnTouchListener(new DefaultMapViewOnTouchListener(this, mMapView) { @Override public boolean onSingleTapConfirmed(MotionEvent motionEvent) { identifyGraphic(motionEvent); return true; } }); mGraphicsOverlay = new GraphicsOverlay(); setupAddressSearchView(); }
Source:
private static String stripQuotes(String text) { if (text == null || text.isEmpty()) { return text; } if (text.startsWith("\"")) { text = text.substring(1); } if (text.endsWith("\"")) { text = text.substring(0, text.length() - 1); } return text; }

Target:
static String stripQuotes(String text) { if (text == null || text.isEmpty()) { return text; } if (text.startsWith("\"")) { text = text.substring(1); } if (text.endsWith("\"")) { text = text.substring(0, text.length() - 1); } return text; }
Source:
private VdsNetworkInterface findNicToSetupManagementNetwork() { if (StringUtils.isEmpty(host.getActiveNic())) { log.warnFormat("No interface was reported as lastClientInterface by host {0} capabilities. " + "There will be no attempt to create the management network on the host.", host.getName()); return null; } VdsNetworkInterface nic = Entities.entitiesByName(host.getInterfaces()).get(host.getActiveNic()); if (nic == null) { log.warnFormat("The lastClientInterface {0} of host {1} is not a valid interface for the mangement network. " + "If the interface is a bridge, it should be teared-down manually.", host.getActiveNic(), host.getName()); throw new NetworkConfiguratorException(String.format("lastClientIface %s is not a valid interface for management network", host.getActiveNic())); } Network managementNetwork = getDbFacade().getNetworkDao() .getByNameAndDataCenter(Config.<String> GetValue(ConfigValues.ManagementNetwork), host.getStoragePoolId()); if (managementNetwork.getName().equals(nic.getNetworkName())) { return null; } if (!nicHasValidVlanId(managementNetwork, nic)) { final AuditLogableBase event = new AuditLogableBase(); event.setVds(host); event.addCustomValue("VlanId", resolveVlanId(nic.getVlanId())); event.addCustomValue("MgmtVlanId", resolveVlanId(managementNetwork.getVlanId())); event.addCustomValue("InterfaceName", nic.getName()); AuditLogDirector.log(event, AuditLogType.VLAN_ID_MISMATCH_FOR_MANAGEMENT_NETWORK_CONFIGURATION, NETWORK_CONFIG_LOG_ERR); throw new NetworkConfiguratorException(MANAGEMENET_NETWORK_CONFIG_ERR); } return nic; }

Target:
private VdsNetworkInterface findNicToSetupManagementNetwork() { if (StringUtils.isEmpty(host.getActiveNic())) { log.warnFormat("No interface was reported as lastClientInterface by host {0} capabilities. " + "There will be no attempt to create the management network on the host.", host.getName()); return null; } VdsNetworkInterface nic = Entities.entitiesByName(host.getInterfaces()).get(host.getActiveNic()); if (nic == null) { log.warnFormat("The lastClientInterface {0} of host {1} is not a valid interface for the mangement network. " + "If the interface is a bridge, it should be torn-down manually.", host.getActiveNic(), host.getName()); throw new NetworkConfiguratorException( String.format("lastClientIface %s is not a valid interface for management network", host.getActiveNic())); } Network managementNetwork = getDbFacade().getNetworkDao() .getByNameAndDataCenter(Config.<String> GetValue(ConfigValues.ManagementNetwork), host.getStoragePoolId()); if (managementNetwork.getName().equals(nic.getNetworkName())) { return null; } if (!nicHasValidVlanId(managementNetwork, nic)) { final AuditLogableBase event = createEvent(); event.addCustomValue("VlanId", resolveVlanId(nic.getVlanId())); event.addCustomValue("MgmtVlanId", resolveVlanId(managementNetwork.getVlanId())); event.addCustomValue("InterfaceName", nic.getName()); AuditLogDirector.log(event, AuditLogType.VLAN_ID_MISMATCH_FOR_MANAGEMENT_NETWORK_CONFIGURATION, NETWORK_CONFIG_LOG_ERR); throw new NetworkConfiguratorException(MANAGEMENET_NETWORK_CONFIG_ERR); } return nic; }
Source:
public CompletableFuture<FSDataInputStream> build() throws IOException { final Path absF = fixRelativePart(getPath()); OpenFileParameters parameters = new OpenFileParameters(); parameters.setMandatoryKeys(getMandatoryKeys()); parameters.setOptions(getOptions()); parameters.setBufferSize(getBufferSize()); parameters.setStatus(getStatus()); return new FSLinkResolver<CompletableFuture<FSDataInputStream>>() { @Override public CompletableFuture<FSDataInputStream> next( final AbstractFileSystem fs, final Path p) throws IOException { return fs.openFileWithOptions(p, parameters); } }.resolve(FileContext.this, absF); }

Target:
public CompletableFuture<FSDataInputStream> build() throws IOException { final Path absF = fixRelativePart(getPath()); OpenFileParameters parameters = new OpenFileParameters() .withMandatoryKeys(getMandatoryKeys()) .withOptions(getOptions()) .withBufferSize(getBufferSize()) .withStatus(getStatus()); return new FSLinkResolver<CompletableFuture<FSDataInputStream>>() { @Override public CompletableFuture<FSDataInputStream> next( final AbstractFileSystem fs, final Path p) throws IOException { return fs.openFileWithOptions(p, parameters); } }.resolve(FileContext.this, absF); }
Source:
public NoSpecialCharactersWithDotValidation() { setExpression(ValidationUtils.NO_SPECIAL_CHARACTERS_WITH_DOT); setMessage(ConstantsManager.getInstance().getConstants().noSpecialCharactersWithDotMsg()); }

Target:
public NoSpecialCharactersWithDotValidation() { setExpression("[0-9a-zA-Z-_\\.]+"); setMessage(ConstantsManager.getInstance().getConstants().noSpecialCharactersWithDotMsg()); }
Source:
private void addCloseHandler() { if (UserAgent.isChrome()) { Window.addCloseHandler(event -> workbenchCloseHandler.onWindowClose(workbenchCloseCommand, event)); Window.addWindowClosingHandler(event -> workbenchCloseHandler.onWindowClosing(workbenchClosingCommand, event)); } else { Window.addWindowClosingHandler(event -> workbenchCloseHandler.onWindowClose(workbenchCloseCommand, null)); } }

Target:
private void addCloseHandler() { if (UserAgent.isChrome()) { setupMessageForUnsavedChanges(); Window.addCloseHandler(event -> workbenchCloseHandler.onWindowClose(workbenchCloseCommand)); } else { Window.addWindowClosingHandler(event -> workbenchCloseHandler.onWindowClose(workbenchCloseCommand)); } }
Source:
private String getCertificateAlias() { return System.getProperty("org.codice.ddf.external.hostname"); }

Target:
private String getCertificateAlias() { return System.getProperty("org.codice.ddf.system.hostname"); }
Source:
public GlucoseRanges(Context context) { this.mContext = context; if (!isInUnitTests()) { dB = new DatabaseHandler(mContext); this.preferredRange = dB.getUser(1).getPreferred_range(); if (preferredRange.equals("Custom range")) { this.customMin = dB.getUser(1).getCustom_range_min(); this.customMax = dB.getUser(1).getCustom_range_max(); } } }

Target:
public GlucoseRanges(Context context) { this.mContext = context; dB = new DatabaseHandler(mContext); this.preferredRange = dB.getUser(1).getPreferred_range(); if (preferredRange.equals("Custom range")) { this.customMin = dB.getUser(1).getCustom_range_min(); this.customMax = dB.getUser(1).getCustom_range_max(); } }
Source:
public void testBasicIO() throws Exception { Path path = new Path("/path/to/" + runtime.getMethodName()); assertFalse(fs.exists(path)); try (FSDataOutputStream out = fs.create(path)) { for (int i = 0; i < 100; i++) { out.writeBytes("line-" + i + "\n"); } out.flush(); } assertTrue(fs.exists(path)); File tempFile = new File(newTempDir(runtime.getMethodName()), "test.bin"); tempFile.delete(); Path localDst = new Path(tempFile.getPath()); fs.copyToLocalFile(path, localDst); fs.copyFromLocalFile(localDst, new Path(runtime.getMethodName() + "-copied")); Path dstPath = new Path(runtime.getMethodName() + "-renamed"); fs.rename(path, dstPath); assertFalse(fs.exists(path)); assertTrue(fs.exists(dstPath)); try (BufferedReader reader = new BufferedReader(new InputStreamReader(fs.open(dstPath, 1134)))) { int lineno = 0; String line; while ((line = reader.readLine()) != null) { assertEquals("line-" + lineno, line); ++lineno; } assertEquals(100, lineno); } fs.delete(dstPath, false); assertFalse(fs.exists(dstPath)); }

Target:
public void testBasicIO() throws Exception { Path path = new Path("/path/to/" + runtime.getMethodName()); assertFalse(fs.exists(path)); try (FSDataOutputStream out = fs.create(path)) { for (int i = 0; i < 100; i++) { out.writeBytes("line-" + i + "\n"); } out.flush(); } assertTrue(fs.exists(path)); File tempFile = tmpDir.newFile(); Path localDst = new Path(tempFile.getPath()); fs.copyToLocalFile(path, localDst); fs.copyFromLocalFile(localDst, new Path(runtime.getMethodName() + "-copied")); Path dstPath = new Path(runtime.getMethodName() + "-renamed"); fs.rename(path, dstPath); assertFalse(fs.exists(path)); assertTrue(fs.exists(dstPath)); try (BufferedReader reader = new BufferedReader(new InputStreamReader(fs.open(dstPath, 1134)))) { int lineno = 0; String line; while ((line = reader.readLine()) != null) { assertEquals("line-" + lineno, line); ++lineno; } assertEquals(100, lineno); } fs.delete(dstPath, false); assertFalse(fs.exists(dstPath)); }
Source:
public BinaryContent createMetacard( HttpServletRequest httpServletRequest, String transformerParam) throws CatalogException { LOGGER.trace("ENTERING: createMetacard"); InputStream stream = null; String contentType = null; try { Part contentPart = httpServletRequest.getPart(FILE_ATTACHMENT_CONTENT_ID); if (contentPart != null) { if (contentPart.getContentType() != null) { contentType = contentPart.getContentType(); } try { stream = contentPart.getInputStream(); if (stream != null && stream.available() == 0) { stream.reset(); } } catch (IOException e) { LOGGER.info("IOException reading stream from file attachment in multipart body", e); } } else { LOGGER.debug("No file contents attachment found"); } } catch (ServletException | IOException e) { LOGGER.info("No file contents part found: ", e); } return createMetacard(stream, contentType, transformerParam); }

Target:
public BinaryContent createMetacard( HttpServletRequest httpServletRequest, String transformerParam) throws CatalogServiceException { LOGGER.trace("ENTERING: createMetacard"); InputStream stream = null; String contentType = null; try { Part contentPart = httpServletRequest.getPart(FILE_ATTACHMENT_CONTENT_ID); if (contentPart != null) { if (contentPart.getContentType() != null) { contentType = contentPart.getContentType(); } try { stream = contentPart.getInputStream(); if (stream != null && stream.available() == 0) { stream.reset(); } } catch (IOException e) { LOGGER.info("IOException reading stream from file attachment in multipart body", e); } } else { LOGGER.debug(NO_FILE_CONTENTS_ATT_FOUND); } } catch (ServletException | IOException e) { LOGGER.info("No file contents part found: ", e); } return createMetacard(stream, contentType, transformerParam); }
Source:
public void init() throws FileNotFoundException, IOException, CTFException { Metadata md = new Metadata(fixture); File metadata = new File(fPathName + File.separator + "metadata"); try (BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(metadata)))) { StringBuilder sb = new StringBuilder(); String line = null; while ((line = reader.readLine()) != null) { sb.append(line); } String result = sb.toString(); md.parseText(result); } }

Target:
public void init() throws FileNotFoundException, IOException, CTFException { Metadata md = new Metadata(fixture); File metadata = new File(fPathName + File.separator + METADATA); try (BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(metadata)))) { StringBuilder sb = new StringBuilder(); String line = null; while ((line = reader.readLine()) != null) { sb.append(line); } String result = sb.toString(); md.parseText(result); } }
Source:
protected void performCachedLargeMessageDeletes() { for (LargeServerMessage largeServerMessage : largeMessagesToDelete.values()) { SequentialFile msg = createFileForLargeMessage(largeServerMessage.getMessageID(), LargeMessageExtension.DURABLE); try { msg.delete(); } catch (Exception e) { ActiveMQServerLogger.LOGGER.journalErrorDeletingMessage(e, largeServerMessage.getMessageID()); } if (replicator != null) { replicator.largeMessageDelete(largeServerMessage.getMessageID(), JournalStorageManager.this); } confirmLargeMessage(largeServerMessage); } largeMessagesToDelete.clear(); }

Target:
protected void performCachedLargeMessageDeletes() { largeMessagesToDelete.forEach((messageId, largeServerMessage) -> { SequentialFile msg = createFileForLargeMessage(messageId, LargeMessageExtension.DURABLE); try { msg.delete(); } catch (Exception e) { ActiveMQServerLogger.LOGGER.journalErrorDeletingMessage(e, messageId); } if (replicator != null) { replicator.largeMessageDelete(messageId, JournalStorageManager.this); } confirmLargeMessage(largeServerMessage); }); largeMessagesToDelete.clear(); }
Source:
private Mono<CosmosDatabaseResponse> createDatabaseIfNotExistsInternal(CosmosAsyncDatabase database, ThroughputProperties throughputProperties, Context context) { String spanName = "createDatabaseIfNotExists." + database.getId(); Context nestedContext = context.addData(TracerProvider.COSMOS_CALL_DEPTH, TracerProvider.COSMOS_CALL_DEPTH_VAL); Mono<CosmosDatabaseResponse> responseMono = createDatabaseIfNotExistsInternal(database.readInternal(new CosmosDatabaseRequestOptions(), nestedContext), database, throughputProperties, nestedContext); return tracerProvider.traceEnabledCosmosResponsePublisher(responseMono, context, spanName, database.getId(), this.serviceEndpoint); }

Target:
private Mono<CosmosDatabaseResponse> createDatabaseIfNotExistsInternal(CosmosAsyncDatabase database, ThroughputProperties throughputProperties, Context context) { String spanName = "createDatabaseIfNotExists." + database.getId(); Context nestedContext = context.addData(TracerProvider.COSMOS_CALL_DEPTH, TracerProvider.COSMOS_CALL_DEPTH_VAL); Mono<CosmosDatabaseResponse> responseMono = database.readInternal(new CosmosDatabaseRequestOptions(), nestedContext).onErrorResume(exception -> { final Throwable unwrappedException = Exceptions.unwrap(exception); if (unwrappedException instanceof CosmosException) { final CosmosException cosmosException = (CosmosException) unwrappedException; if (cosmosException.getStatusCode() == HttpConstants.StatusCodes.NOTFOUND) { CosmosDatabaseRequestOptions requestOptions = new CosmosDatabaseRequestOptions(); if (throughputProperties != null) { ModelBridgeInternal.setThroughputProperties(requestOptions, throughputProperties); } Database wrappedDatabase = new Database(); wrappedDatabase.setId(database.getId()); return createDatabaseInternal(wrappedDatabase, requestOptions, nestedContext); } } return Mono.error(unwrappedException); }); return tracerProvider.traceEnabledCosmosResponsePublisher(responseMono, context, spanName, database.getId(), this.serviceEndpoint); }
Source:
protected void readOsSection(XmlNode section) { _vm.getStaticData().setId(new Guid(section.Attributes.get("ovf:id").getValue())); XmlNode node = section.SelectSingleNode("Description"); if (node != null) { _vm.getStaticData().setOs(Integer.valueOf(node.InnerText)); } else { _vm.getStaticData().setOs(0); } }

Target:
protected void readOsSection(XmlNode section) { _vm.getStaticData().setId(new Guid(section.Attributes.get("ovf:id").getValue())); XmlNode node = section.SelectSingleNode("Description"); if (node != null) { _vm.getStaticData().setOs(OsRepositoryImpl.INSTANCE.getOsIdByUniqueName(node.InnerText)); } }
Source:
public void returnsASetOfErrorsForAnObject() throws Exception { if ("en".equals(Locale.getDefault().getLanguage())) { final ImmutableList<String> errors = ConstraintViolations.format(validator.validate(new Example())); assertThat(errors) .containsOnly( "outOfRange must be between 10 MINUTES and 30 MINUTES", "tooBig must be less than (or equal to, if in 'inclusive' mode) to 30 SECONDS", "tooBigExclusive must be less than (or equal to, if in 'inclusive' mode) to 30 SECONDS", "tooSmall must be greater than (or equal to, if in 'inclusive' mode) to 30 SECONDS", "tooSmallExclusive must be greater than (or equal to, if in 'inclusive' mode) to 30 SECONDS", "maxDurs[0].<collection element> must be less than (or equal to, if in 'inclusive' mode) to 30 SECONDS", "minDurs[0].<collection element> must be greater than (or equal to, if in 'inclusive' mode) to 30 SECONDS", "rangeDurs[0].<collection element> must be between 10 MINUTES and 30 MINUTES"); } }

Target:
public void returnsASetOfErrorsForAnObject() throws Exception { if ("en".equals(Locale.getDefault().getLanguage())) { final ImmutableList<String> errors = ConstraintViolations.format(validator.validate(new Example())); assertThat(errors) .containsOnly( "outOfRange must be between 10 MINUTES and 30 MINUTES", "tooBig must be less than (or equal to, if in 'inclusive' mode) 30 SECONDS", "tooBigExclusive must be less than (or equal to, if in 'inclusive' mode) 30 SECONDS", "tooSmall must be greater than (or equal to, if in 'inclusive' mode) 30 SECONDS", "tooSmallExclusive must be greater than (or equal to, if in 'inclusive' mode) 30 SECONDS", "maxDurs[0].<collection element> must be less than (or equal to, if in 'inclusive' mode) 30 SECONDS", "minDurs[0].<collection element> must be greater than (or equal to, if in 'inclusive' mode) 30 SECONDS", "rangeDurs[0].<collection element> must be between 10 MINUTES and 30 MINUTES"); } }
Source:
public void checkLimitMultithreaded() throws Exception { int opsPerSec = 1_000; int totalOps = 10_000; BasicRateLimiter limiter = new BasicRateLimiter(opsPerSec); int threads = Runtime.getRuntime().availableProcessors(); CyclicBarrier ready = new CyclicBarrier(threads + 1); AtomicInteger cntr = new AtomicInteger(); IgniteInternalFuture<Long> fut = GridTestUtils.runMultiThreadedAsync(() -> { ready.await(); do { limiter.acquire(1); } while (!Thread.currentThread().isInterrupted() && cntr.incrementAndGet() < totalOps); return null; }, threads, "worker"); ready.await(); long startTime = System.currentTimeMillis(); fut.get(); long timeSpent = System.currentTimeMillis() - startTime; assertEquals(totalOps / opsPerSec, SECONDS.convert(timeSpent, MILLISECONDS)); }

Target:
public void checkLimitMultithreaded() throws Exception { int permitsPerSec = 1_000; int totalOps = 10_000; BasicRateLimiter limiter = new BasicRateLimiter(permitsPerSec); int threads = Runtime.getRuntime().availableProcessors(); CyclicBarrier ready = new CyclicBarrier(threads + 1); AtomicInteger cntr = new AtomicInteger(); IgniteInternalFuture<Long> fut = GridTestUtils.runMultiThreadedAsync(() -> { ready.await(); do { limiter.acquire(1); } while (!Thread.currentThread().isInterrupted() && cntr.incrementAndGet() < totalOps); return null; }, threads, "worker"); ready.await(); long startTime = System.currentTimeMillis(); fut.get(); long timeSpent = System.currentTimeMillis() - startTime; assertEquals(1, Math.round((double)timeSpent / 1000 / totalOps * permitsPerSec)); }
Source:
public String[] getAllBasePaths() { List<String> basePaths = new ArrayList<>(); for (String subSection : cfg.getSubsections(SECTION_NAME)) { String basePath = cfg.getString(SECTION_NAME, subSection, BASE_PATH_NAME); if (basePath != null) { basePaths.add(basePath); } } return basePaths.toArray(new String[basePaths.size()]); }

Target:
public List<Path> getAllBasePaths() { List<Path> basePaths = new ArrayList<>(); for (String subSection : cfg.getSubsections(SECTION_NAME)) { String basePath = cfg.getString(SECTION_NAME, subSection, BASE_PATH_NAME); if (basePath != null) { basePaths.add(Paths.get(basePath)); } } return basePaths; }
Source:
public void load(Path directoryPath) { try(DirectoryStream<Path> dirStream = Files.newDirectoryStream(directoryPath, "*.properties")) { List<Path> paths = new ArrayList<>(); for (Path path: dirStream) { paths.add(path); } Collections.sort(paths); for (Path path: paths) { loadFile(path); } } catch (IOException e) { } }

Target:
public void load(Path directoryPath) { File dir = directoryPath.toFile(); if (dir.exists()) { File[] files = directoryPath.toFile().listFiles(new FilenameFilter() { @Override public boolean accept(File dir, String name) { return name.endsWith(".properties"); } }); if (files != null) { Arrays.sort(files); for (File file: files) { loadFile(file.toPath()); } } } else { log.errorFormat("directory {0} doesn't exist.", dir.getPath()); } }
Source:
public void detectLanguageInvalidCountryHint() { Exception exception = assertThrows(TextAnalyticsException.class, () -> client.detectLanguage("")); assertTrue(exception.getMessage().equals(INVALID_COUNTRY_HINT_EXPECTED_EXCEPTION_MESSAGE)); }

Target:
public void detectLanguageInvalidCountryHint() { Exception exception = assertThrows(TextAnalyticsException.class, () -> client.detectLanguageWithResponse("Este es un document escrito en Español.", "en", Context.NONE)); assertTrue(exception.getMessage().equals(INVALID_COUNTRY_HINT_EXPECTED_EXCEPTION_MESSAGE)); }
Source:
private GradleArguments getGradleArguments() { org.eclipse.buildship.core.internal.configuration.BuildConfiguration config = DefaultGradleBuild.this.gradleBuild.getBuildConfig(); return GradleArguments.from( config.getRootProjectDirectory(), config.getGradleDistribution(), config.getGradleUserHome(), null, config.isBuildScansEnabled(), config.isOfflineMode(), Collections.emptyList(), Collections.emptyList()); }

Target:
private GradleArguments getGradleArguments() { org.eclipse.buildship.core.internal.configuration.BuildConfiguration config = DefaultGradleBuild.this.gradleBuild.getBuildConfig(); return config.toGradleArguments(); }
Source:
private void prepareForSending() { try { if (partitionId != null) { attemptedPartitionIds.add(partitionId); } partitionId = getPartitionForPut(attemptedPartitionIds); chunkBlobId = new BlobId(blobIdFlag, clusterMap.getLocalDatacenterId(), passedInBlobProperties.getAccountId(), passedInBlobProperties.getContainerId(), partitionId); chunkBlobProperties = new BlobProperties(buf.remaining(), passedInBlobProperties.getServiceId(), passedInBlobProperties.getOwnerId(), passedInBlobProperties.getContentType(), passedInBlobProperties.isPrivate(), passedInBlobProperties.getTimeToLiveInSeconds(), passedInBlobProperties.getCreationTimeInMs()); operationTracker = new SimpleOperationTracker(routerConfig.routerDatacenterName, partitionId, false, routerConfig.routerPutSuccessTarget, routerConfig.routerPutRequestParallelism); correlationIdToChunkPutRequestInfo.clear(); state = ChunkState.Ready; } catch (RouterException e) { setOperationExceptionAndComplete(e); } catch (Exception e) { setOperationExceptionAndComplete(new RouterException("Operation tracker could not be initialized", e, RouterErrorCode.UnexpectedInternalError)); } }

Target:
private void prepareForSending() { try { if (partitionId != null) { attemptedPartitionIds.add(partitionId); } partitionId = getPartitionForPut(attemptedPartitionIds); chunkBlobId = new BlobId(BlobId.DEFAULT_FLAG, clusterMap.getLocalDatacenterId(), passedInBlobProperties.getAccountId(), passedInBlobProperties.getContainerId(), partitionId); chunkBlobProperties = new BlobProperties(buf.remaining(), passedInBlobProperties.getServiceId(), passedInBlobProperties.getOwnerId(), passedInBlobProperties.getContentType(), passedInBlobProperties.isPrivate(), passedInBlobProperties.getTimeToLiveInSeconds(), passedInBlobProperties.getCreationTimeInMs()); operationTracker = new SimpleOperationTracker(routerConfig.routerDatacenterName, partitionId, false, routerConfig.routerPutSuccessTarget, routerConfig.routerPutRequestParallelism); correlationIdToChunkPutRequestInfo.clear(); state = ChunkState.Ready; } catch (RouterException e) { setOperationExceptionAndComplete(e); } catch (Exception e) { setOperationExceptionAndComplete(new RouterException("Operation tracker could not be initialized", e, RouterErrorCode.UnexpectedInternalError)); } }
Source:
public Flux<Frame> fragment(Frame frame) { final FrameType frameType = frame.getType(); final int streamId = frame.getStreamId(); final int flags = frame.flags() & ~FrameHeaderFlyweight.FLAGS_F & ~FrameHeaderFlyweight.FLAGS_M; final ByteBuf metadata = FrameHeaderFlyweight.sliceFrameMetadata(frame.content()); final ByteBuf data = FrameHeaderFlyweight.sliceFrameData(frame.content()); frame.retain(); return Flux.generate(sink -> { final int metadataLength = metadata.readableBytes(); final int dataLength = data.readableBytes(); if (metadataLength > mtu) { sink.next(Frame.PayloadFrame.from(streamId, frameType, metadata.readSlice(mtu), Unpooled.EMPTY_BUFFER, flags | FrameHeaderFlyweight.FLAGS_M | FrameHeaderFlyweight.FLAGS_F)); } else if (metadataLength > 0) { if (dataLength > 0) { sink.next(Frame.PayloadFrame.from(streamId, frameType, metadata.readSlice(metadataLength), Unpooled.EMPTY_BUFFER, flags | FrameHeaderFlyweight.FLAGS_M | FrameHeaderFlyweight.FLAGS_F)); } else { sink.next(Frame.PayloadFrame.from(streamId, frameType, metadata.readSlice(metadataLength), Unpooled.EMPTY_BUFFER, flags | FrameHeaderFlyweight.FLAGS_M)); frame.release(); sink.complete(); } } else if (dataLength > mtu) { sink.next(Frame.PayloadFrame.from(streamId, frameType, Unpooled.EMPTY_BUFFER, data.readSlice(mtu), flags | FrameHeaderFlyweight.FLAGS_F)); } else { sink.next(Frame.PayloadFrame.from(streamId, frameType, Unpooled.EMPTY_BUFFER, data.readSlice(dataLength), flags & ~FrameHeaderFlyweight.FLAGS_M)); frame.release(); sink.complete(); } }); }

Target:
public Flux<Frame> fragment(Frame frame) { final FrameType frameType = frame.getType(); final int streamId = frame.getStreamId(); final int flags = frame.flags() & ~FrameHeaderFlyweight.FLAGS_F & ~FrameHeaderFlyweight.FLAGS_M; final ByteBuf metadata = FrameHeaderFlyweight.sliceFrameMetadata(frame.content()); final ByteBuf data = FrameHeaderFlyweight.sliceFrameData(frame.content()); frame.retain(); return Flux.generate(sink -> { final int metadataLength = metadata.readableBytes(); final int dataLength = data.readableBytes(); if (metadataLength > mtu) { sink.next(Frame.PayloadFrame.from(streamId, frameType, metadata.readSlice(mtu), Unpooled.EMPTY_BUFFER, flags | FrameHeaderFlyweight.FLAGS_M | FrameHeaderFlyweight.FLAGS_F)); } else if (metadataLength > 0) { if (dataLength > mtu - metadataLength) { sink.next(Frame.PayloadFrame.from(streamId, frameType, metadata.readSlice(metadataLength), data.readSlice(mtu - metadataLength), flags | FrameHeaderFlyweight.FLAGS_M | FrameHeaderFlyweight.FLAGS_F)); } else { sink.next(Frame.PayloadFrame.from(streamId, frameType, metadata.readSlice(metadataLength), data.readSlice(dataLength), flags | FrameHeaderFlyweight.FLAGS_M)); frame.release(); sink.complete(); } } else if (dataLength > mtu) { sink.next(Frame.PayloadFrame.from(streamId, frameType, Unpooled.EMPTY_BUFFER, data.readSlice(mtu), flags | FrameHeaderFlyweight.FLAGS_F)); } else { sink.next(Frame.PayloadFrame.from(streamId, frameType, Unpooled.EMPTY_BUFFER, data.readSlice(dataLength), flags)); frame.release(); sink.complete(); } }); }
Source:
public boolean isExploreWikiHeaderVisible() { try { return exploreWikiHeader.isDisplayed(); } catch (NoSuchElementException e) { PageObjectLogging.logInfo(e.getMessage()); return false; } }

Target:
public boolean isExploreWikiHeaderVisible() { return isElementVisible(exploreWikiHeader); }
Source:
public Builder securityOpts(List<String> securityOpts) { this.securityOpts = ImmutableList.copyOf(checkNotNull(securityOpts, "securityOpts")); return this; }

Target:
public Builder securityOpts(List<String> securityOpts) { this.securityOpts = securityOpts; return this; }
Source:
protected void execute() { logger.debug("execute() method is called!"); if (!isProperlyConfigured()) { logger.debug("Binding is not yet configured"); return; } if (!bindingsExist()) { logger.debug("There is no existing DSMR binding configuration => refresh cycle aborted!"); return; } if (dsmrPort == null || !dsmrPort.isOpen()) { logger.debug("Creating DSMR Port:" + port); dsmrPort = new DSMRPort(port, version, DSMR_UPDATE_INTERVAL); } List<OBISMessage<? extends State>> messages = dsmrPort.read(); for (OBISMessage<? extends State> msg : messages) { logger.debug("Read message:" + msg); for (DSMRBindingProvider provider : providers) { for (String itemName : provider.getItemNames()) { String item = provider.getItem(itemName); if (item.equals(msg.getType().bindingReference)) { logger.debug("Publish data(" + item + ") to " + itemName); eventPublisher.postUpdate(itemName, msg.getOpenHabValue()); } } } } }

Target:
protected void execute() { if (!bindingsExist()) { logger.debug("There is no existing DSMR binding configuration => refresh cycle aborted!"); return; } if (dsmrPort == null || !dsmrPort.isOpen()) { logger.debug("Creating DSMR Port:" + port); dsmrPort = new DSMRPort(port, version, dsmrMeters, DSMR_UPDATE_INTERVAL); } List<OBISMessage> messages = dsmrPort.read(); for (OBISMessage msg : messages) { logger.debug("Read message:" + msg); for (DSMRBindingProvider provider : providers) { for (String itemName : provider.getItemNames()) { String dsmrItemId = provider.getDSMRItemID(itemName); for (CosemValue<? extends State> openHABValue : msg .getOpenHABValues()) { if (dsmrItemId.equals(openHABValue.getDsmrItemId())) { logger.debug("Publish data(" + dsmrItemId + ") to " + itemName); eventPublisher.postUpdate(itemName, openHABValue.getValue()); } } } } } }
Source:
public AABB(Vector3i firstCorner, Vector3i secondCorner) { this(firstCorner.toDouble(), secondCorner.toDouble()); }

Target:
public AABB(Vector3i firstCorner, Vector3i secondCorner) { this(checkNotNull(firstCorner, "firstCorner").toDouble(), checkNotNull(secondCorner, "secondCorner").toDouble()); }
Source:
public boolean equals(final Object o) { if (this == o) { return true; } if (o instanceof StateNodeMetadata) { if (super.equals(o)) { final StateNodeMetadata metadata = (StateNodeMetadata) o; return new EqualsBuilder().append(stateMetadata, metadata.stateMetadata).isEquals(); } } return false; }

Target:
public boolean equals(final Object o) { if (this == o) { return true; } if (o instanceof StateNodeMetadata) { if (super.equals(o)) { final StateNodeMetadata metadata = (StateNodeMetadata) o; return Objects.equal(this.stateMetadata, metadata.stateMetadata); } } return false; }
Source:
public Bundle[] getBundles(String symbolicName, String versionRange) { Map<String, String> directives = Collections.singletonMap(Namespace.REQUIREMENT_FILTER_DIRECTIVE, getRequirementFilter(symbolicName, versionRange)); Collection<BundleCapability> matchingBundleCapabilities = fwkWiring.findProviders(ModuleContainer .createRequirement(IdentityNamespace.IDENTITY_NAMESPACE, directives, Collections.emptyMap())); if (matchingBundleCapabilities.isEmpty()) { return null; } Bundle[] results = matchingBundleCapabilities.stream().map(c -> c.getRevision().getBundle()) .filter(bundle -> (bundle.getState() & (Bundle.INSTALLED | Bundle.UNINSTALLED)) == 0) .sorted() .toArray(Bundle[]::new); return results.length > 0 ? results : null; }

Target:
public Bundle[] getBundles(String symbolicName, String versionRange) { Map<String, String> directives = Collections.singletonMap(Namespace.REQUIREMENT_FILTER_DIRECTIVE, getRequirementFilter(symbolicName, versionRange)); Collection<BundleCapability> matchingBundleCapabilities = fwkWiring.findProviders(ModuleContainer .createRequirement(IdentityNamespace.IDENTITY_NAMESPACE, directives, Collections.emptyMap())); if (matchingBundleCapabilities.isEmpty()) { return null; } Bundle[] results = matchingBundleCapabilities.stream().map(c -> c.getRevision().getBundle()) .filter(bundle -> (bundle.getState() & (Bundle.INSTALLED | Bundle.UNINSTALLED)) == 0) .sorted((b1, b2) -> b2.getVersion().compareTo(b1.getVersion())) .toArray(Bundle[]::new); return results.length > 0 ? results : null; }
Source:
public FreemarkerViewProcessor(final javax.ws.rs.core.Configuration config, final ServiceLocator serviceLocator, @Optional final ServletContext servletContext) { super(config, servletContext, "freemarker", "ftl"); ; this.factory = getTemplateObjectFactory(serviceLocator, FreemarkerConfigurationFactory.class, new Value<FreemarkerConfigurationFactory>() { @Override public FreemarkerConfigurationFactory get() { Configuration configuration = getTemplateObjectFactory(serviceLocator, Configuration.class, new Value<Configuration>() { @Override public Configuration get() { return null; } }); if (configuration == null) { return new FreemarkerDefaultConfigurationFactory(servletContext); } else { return new FreemarkerSuppliedConfigurationFactory(configuration); } } }); }

Target:
public FreemarkerViewProcessor(final javax.ws.rs.core.Configuration config, final ServiceLocator serviceLocator, @Optional final ServletContext servletContext) { super(config, servletContext, "freemarker", "ftl"); this.factory = getTemplateObjectFactory(serviceLocator, FreemarkerConfigurationFactory.class, new Value<FreemarkerConfigurationFactory>() { @Override public FreemarkerConfigurationFactory get() { Configuration configuration = getTemplateObjectFactory(serviceLocator, Configuration.class, Values.<Configuration>empty()); if (configuration == null) { return new FreemarkerDefaultConfigurationFactory(servletContext); } else { return new FreemarkerSuppliedConfigurationFactory(configuration); } } }); }
Source:
private void logError(final Throwable t) { requestSpan.setStatus(Status.INTERNAL); requestSpan.putAttribute("event", AttributeValue.stringAttributeValue("error")); requestSpan.putAttributes(environmentMetadata.toAttributes()); requestSpan.addAnnotation(t.toString()); }

Target:
private void logError(final Throwable t) { requestSpan.setStatus(Status.INTERNAL); requestSpan.putAttribute("event", AttributeValue.stringAttributeValue("error")); requestSpan.addAnnotation(t.toString()); }
Source:
public Optional<String> validate(final String dateTime) { try { java.time.LocalDate.parse(dateTime, ISO_OFFSET_DATE_TIME); final Matcher matcher = pattern.matcher(dateTime); if (matcher.matches()) { return Optional.empty(); } else { return error; } } catch (final DateTimeParseException e) { return error; } }

Target:
public Optional<String> validate(final String dateTime) { try { OffsetDateTime.parse(dateTime, ISO_OFFSET_DATE_TIME); final Matcher matcher = pattern.matcher(dateTime); if (matcher.matches()) { return Optional.empty(); } else { return error; } } catch (final DateTimeParseException e) { return error; } }
Source:
private Map readMapValue(ObjectMapper mapper, String messagePayload) { Map context; try { context = mapper.readValue(messagePayload, Map.class); } catch (IOException ioe) { throw new InvalidPayloadFormatException(ioe); } return context; }

Target:
private Map readMapValue(ObjectMapper mapper, String messagePayload) { Map context; try { context = mapper.readValue(messagePayload, Map.class); } catch (IOException ioe) { log.error(messagePayload); throw new InvalidRequestException(ioe); } return context; }