auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private static OkHttpClient createClient() { SharedPreferenceCookieManager cookieManager = SharedPreferenceCookieManager.getInstance(); CookieJar cookieJar = new JavaNetCookieJar(cookieManager); ConnectionPool cp = new ConnectionPool(0, 10, TimeUnit.SECONDS); return new OkHttpClient.Builder() .connectionPool(cp) .cookieJar(cookieJar) .cache(NET_CACHE) .addInterceptor(new HttpLoggingInterceptor().setLevel(Prefs.getRetrofitLogLevel())) .addInterceptor(new UnsuccessfulResponseInterceptor()) .addInterceptor(new StatusResponseInterceptor(RbSwitch.INSTANCE)) .addNetworkInterceptor(new StripMustRevalidateResponseInterceptor()) .addInterceptor(new CommonHeaderRequestInterceptor()) .addInterceptor(new DefaultMaxStaleRequestInterceptor()) .addInterceptor(new CacheControlRequestInterceptor()) .addInterceptor(new CacheDelegateInterceptor(CacheDelegate.internalCache(SAVE_CACHE), CacheDelegate.internalCache(NET_CACHE))) .addInterceptor(new WikipediaZeroResponseInterceptor(WikipediaApp.getInstance().getWikipediaZeroHandler())) .addInterceptor(new TestStubInterceptor()) .build(); }

Target:
private static OkHttpClient createClient() { SharedPreferenceCookieManager cookieManager = SharedPreferenceCookieManager.getInstance(); CookieJar cookieJar = new JavaNetCookieJar(cookieManager); return new OkHttpClient.Builder() .cookieJar(cookieJar) .cache(NET_CACHE) .addInterceptor(new HttpLoggingInterceptor().setLevel(Prefs.getRetrofitLogLevel())) .addInterceptor(new UnsuccessfulResponseInterceptor()) .addInterceptor(new StatusResponseInterceptor(RbSwitch.INSTANCE)) .addNetworkInterceptor(new StripMustRevalidateResponseInterceptor()) .addInterceptor(new CommonHeaderRequestInterceptor()) .addInterceptor(new DefaultMaxStaleRequestInterceptor()) .addInterceptor(new CacheControlRequestInterceptor()) .addInterceptor(new CacheDelegateInterceptor(CacheDelegate.internalCache(SAVE_CACHE), CacheDelegate.internalCache(NET_CACHE))) .addInterceptor(new WikipediaZeroResponseInterceptor(WikipediaApp.getInstance().getWikipediaZeroHandler())) .addInterceptor(new TestStubInterceptor()) .build(); }
Source:
public void putsCapOnStream() throws IOException { final byte[] bytes = "test1".getBytes(); MatcherAssert.assertThat( (long) new CapInputStream( new ByteArrayInputStream(bytes), bytes.length * 2 ).available(), Matchers.equalTo((long) bytes.length) ); }

Target:
public void putsCapOnStream() throws IOException { final long length = 50L; MatcherAssert.assertThat( (long) new CapInputStream( new ByteArrayInputStream("test".getBytes()), length ).available(), Matchers.equalTo(length) ); }
Source:
private void bindIfUnbound(Class<?> entityClass) { if (lookupBoundClass(entityClass) != null) { return; } bindEntity(entityClass); }

Target:
private void bindIfUnbound(Class<?> entityClass) { if (lookupBoundClass(entityClass) == null) { bindEntity(entityClass); } }
Source:
public IHyperlink[] detectHyperlinks(ITextViewer textViewer, final IRegion region, boolean canShowMultipleHyperlinks) { ITextEditor editor = (ITextEditor) getAdapter(ITextEditor.class); if (editor == null || region == null || !(editor instanceof CEditor)) return null; ISelection selection = textViewer.getSelectionProvider().getSelection(); if (!(selection instanceof ITextSelection)){ return null; } IExecutionDMContext context = resolveDebugContext(); if (context == null) { return null; } final DsfSession session = DsfSession.getSession(context.getSessionId()); if (session == null || !session.isActive()) { return null; } if(!isExecutable(context)) { return null; } return new IHyperlink[] {new DsfStepIntoSelectionHyperlink((ITextSelection) selection, editor) }; }

Target:
public IHyperlink[] detectHyperlinks(ITextViewer textViewer, final IRegion region, boolean canShowMultipleHyperlinks) { ITextEditor editor = (ITextEditor) getAdapter(ITextEditor.class); if (editor == null || region == null || !(editor instanceof CEditor)) return null; ITextSelection selection = resolveSelection(editor, region); if (selection == null){ return null; } IExecutionDMContext context = resolveDebugContext(); if (context == null) { return null; } final DsfSession session = DsfSession.getSession(context.getSessionId()); if (session == null || !session.isActive()) { return null; } if(!isExecutable(context)) { return null; } return new IHyperlink[] {new DsfStepIntoSelectionHyperlink(selection, editor) }; }
Source:
public boolean isTOCUnderArticleName() { int h1Pos = 0; boolean h1Found = false; int index = 0; if (isH2AndTOC()) { for (WebElement element : articleBodyTags) { if (element.getTagName().equals("h1") && !h1Found) { h1Pos = index++; h1Found = true; continue; } if (element.getTagName().equals("nav") && element.getAttribute("class").contains("table-of-content") && index > 0 && h1Found && h1Pos + 1 == index) { return true; } ++index; } } return false; }

Target:
public boolean isTOCUnderArticleName() throws WebDriverException { waitForElementByElement(tocUnderH1); return tocUnderH1.isDisplayed() && tocUnderH1.getTagName().equals("nav"); }
Source:
public String toString() { return "ConnectionPolicy{" + "requestTimeout=" + requestTimeout + ", connectionMode=" + connectionMode + ", maxConnectionPoolSize=" + maxConnectionPoolSize + ", idleHttpConnectionTimeout=" + idleHttpConnectionTimeout + ", idleTcpConnectionTimeout=" + idleTcpConnectionTimeout + ", userAgentSuffix='" + userAgentSuffix + '\'' + ", throttlingRetryOptions=" + throttlingRetryOptions + ", endpointDiscoveryEnabled=" + endpointDiscoveryEnabled + ", preferredRegions=" + preferredRegions + ", multipleWriteRegionsEnabled=" + multipleWriteRegionsEnabled + ", proxyType=" + (proxy != null ? proxy.getType() : null) + ", inetSocketProxyAddress=" + (proxy != null ? proxy.getAddress() : null) + ", readRequestsFallbackEnabled=" + readRequestsFallbackEnabled + ", connectTimeout=" + connectTimeout + ", idleEndpointTimeout=" + idleTcpEndpointTimeout + ", maxConnectionsPerEndpoint=" + maxConnectionsPerEndpoint + ", maxRequestsPerConnection=" + maxRequestsPerConnection + '}'; }

Target:
public String toString() { return "ConnectionPolicy{" + "requestTimeout=" + requestTimeout + ", connectionMode=" + connectionMode + ", maxConnectionPoolSize=" + maxConnectionPoolSize + ", idleHttpConnectionTimeout=" + idleHttpConnectionTimeout + ", idleTcpConnectionTimeout=" + idleTcpConnectionTimeout + ", userAgentSuffix='" + userAgentSuffix + '\'' + ", throttlingRetryOptions=" + throttlingRetryOptions + ", endpointDiscoveryEnabled=" + endpointDiscoveryEnabled + ", preferredRegions=" + preferredRegions + ", multipleWriteRegionsEnabled=" + multipleWriteRegionsEnabled + ", proxyType=" + (proxy != null ? proxy.getType() : null) + ", inetSocketProxyAddress=" + (proxy != null ? proxy.getAddress() : null) + ", readRequestsFallbackEnabled=" + readRequestsFallbackEnabled + ", connectTimeout=" + connectTimeout + ", idleTcpEndpointTimeout=" + idleTcpEndpointTimeout + ", maxConnectionsPerEndpoint=" + maxConnectionsPerEndpoint + ", maxRequestsPerConnection=" + maxRequestsPerConnection + ", tcpConnectionEndpointRediscoveryEnabled=" + tcpConnectionEndpointRediscoveryEnabled + '}'; }
Source:
public static Object[][] testAdsHopPostMessage() { return new Object[][]{ {"adtest", "DFP/hop", 1, "mobile"}, {"adtest", "DFP/hophop", 2, "mobile_remnant"} }; }

Target:
public static Object[][] testAdsHopPostMessage() { return new Object[][]{ {"adtest", "DFP/hop", "mobile"}, {"adtest", "DFP/hophop", "mobile_remnant"} }; }
Source:
public ClientMap(GameDTO serverGame, BorderPane gameBox, Broker broker, GameObject clientChar) { this.unassignedBullets = new ConcurrentLinkedQueue<>(); this.serverGameId = serverGame.getGameId(); this.clientChar = clientChar; System.out.println("MY ID: "+clientChar.getId()); if (clientChar.getWeapon() != null) { clientChar.getWeapon().addObserver(this); System.out.println(clientChar.getWeapon().countObservers()); } mapActive = true; gameObjects = new ConcurrentHashMap<>(); gameObjects.put(clientChar.getId(), clientChar); this.broker = broker; broker.activate(this); timer = new Timer(); timer.start(); for (GameObjectDTO dto : serverGame.getGameObjects()) { if (dto.getBody().getType() == Body.Geometry.CIRCLE.ordinal()) { if (dto.getId() != clientChar.getId()) { GameObject enemy = EntityFactory.getEntity(dto, EntityFactory.EntityType.ENEMY_CHARACTER); gameObjects.put(dto.getId(), enemy); } } else if (dto.getBody().getType() == Body.Geometry.RECTANGLE.ordinal()) { GameObject wall = EntityFactory.getEntity(dto, EntityFactory.EntityType.WALL); gameObjects.put(dto.getId(), wall); } } fpsLabel = new Label(); fpsLabel.setPrefSize(50, 20); gameBox.setLeft(fpsLabel); this.canvas = (Canvas)gameBox.getCenter(); gc = canvas.getGraphicsContext2D(); }

Target:
public ClientMap(GameDTO serverGame, BorderPane gameBox, Broker broker, GameObject clientChar) { this.unassignedBullets = new ConcurrentLinkedQueue<>(); this.serverGameId = serverGame.getGameId(); this.clientChar = clientChar; if (clientChar.getWeapon() != null) { clientChar.getWeapon().addObserver(this); System.out.println(clientChar.getWeapon().countObservers()); } mapActive = true; gameObjects = new ConcurrentHashMap<>(); gameObjects.put(clientChar.getId(), clientChar); this.broker = broker; broker.activate(this); timer = new Timer(); timer.start(); for (GameObjectDTO dto : serverGame.getGameObjects()) { if (dto.getBody().getType() == Body.Geometry.CIRCLE.ordinal()) { if (dto.getId() != clientChar.getId()) { GameObject enemy = EntityFactory.getEntity(dto, EntityFactory.EntityType.ENEMY_CHARACTER); gameObjects.put(dto.getId(), enemy); } } else if (dto.getBody().getType() == Body.Geometry.RECTANGLE.ordinal()) { GameObject wall = EntityFactory.getEntity(dto, EntityFactory.EntityType.WALL); gameObjects.put(dto.getId(), wall); } } fpsLabel = new Label(); fpsLabel.setPrefSize(50, 20); gameBox.setLeft(fpsLabel); this.canvas = (Canvas)gameBox.getCenter(); gc = canvas.getGraphicsContext2D(); }
Source:
final static public < A extends LongAccess > ArrayImg< Unsigned4BitType, A > unsigned4Bits( final A access, final long... dim ) { final ArrayImg< Unsigned4BitType, A > img = new ArrayImg<>( access, dim, new Fraction( 1, 64 ) ); final Unsigned4BitType t = new Unsigned4BitType( img ); img.setLinkedType( t ); return img; }

Target:
final static public < A extends LongAccess > ArrayImg< Unsigned4BitType, A > unsigned4Bits( final A access, final long... dim ) { final ArrayImg< Unsigned4BitType, A > img = new ArrayImg<>( access, dim, new Fraction( 4, 64 ) ); final Unsigned4BitType t = new Unsigned4BitType( img ); img.setLinkedType( t ); return img; }
Source:
private boolean appliesToEvent(ITmfEvent event) { String eventName = event.getType().getName(); String eventHandlerName = fName; if (eventName.equals(eventHandlerName)) { return true; } if ((eventHandlerName.endsWith(TmfXmlStrings.WILDCARD) && eventName.startsWith(eventHandlerName.replace(TmfXmlStrings.WILDCARD, TmfXmlStrings.NULL)))) { return true; } return false; }

Target:
private boolean appliesToEvent(ITmfEvent event) { String eventName = event.getType().getName(); if (eventName.equals(fName)) { return true; } if ((fName.endsWith(TmfXmlStrings.WILDCARD) && eventName.startsWith(fName.replace(TmfXmlStrings.WILDCARD, TmfXmlStrings.NULL)))) { return true; } return false; }
Source:
public static void init() { if (initialized.getAndSet(true)) return; TypeCoercions.registerAdapter(Map.class, ProxySslConfig.class, new Function<Map, ProxySslConfig>() { @Override public ProxySslConfig apply(final Map input) { ProxySslConfig sslConfig = new ProxySslConfig(); sslConfig.certificateSourceUrl = (String) input.get("certificateSourceUrl"); sslConfig.keySourceUrl = (String) input.get("keySourceUrl"); sslConfig.certificateDestination = (String) input.get("certificateDestination"); sslConfig.keyDestination = (String) input.get("keyDestination"); Object targetIsSsl = input.get("targetIsSsl"); if (targetIsSsl != null) { sslConfig.targetIsSsl = TypeCoercions.coerce(targetIsSsl, Boolean.TYPE); } Object reuseSessions = input.get("reuseSessions"); if (reuseSessions != null) { sslConfig.reuseSessions = TypeCoercions.coerce(reuseSessions, Boolean.TYPE); } return sslConfig; } }); }

Target:
public static void init() { if (initialized.getAndSet(true)) return; TypeCoercions.registerAdapter(Map.class, ProxySslConfig.class, new Function<Map, ProxySslConfig>() { @Override public ProxySslConfig apply(final Map input) { Map map = MutableMap.copyOf(input); ProxySslConfig sslConfig = new ProxySslConfig(); sslConfig.certificateSourceUrl = (String) map.remove("certificateSourceUrl"); sslConfig.keySourceUrl = (String) map.remove("keySourceUrl"); sslConfig.certificateDestination = (String) map.remove("certificateDestination"); sslConfig.keyDestination = (String) map.remove("keyDestination"); Object targetIsSsl = map.remove("targetIsSsl"); if (targetIsSsl != null) { sslConfig.targetIsSsl = TypeCoercions.coerce(targetIsSsl, Boolean.TYPE); } Object reuseSessions = map.remove("reuseSessions"); if (reuseSessions != null) { sslConfig.reuseSessions = TypeCoercions.coerce(reuseSessions, Boolean.TYPE); } if (!map.isEmpty()) { LOG.info("Extra unused keys found in ProxySslConfig config: [{}]", Joiner.on(",").withKeyValueSeparator("=").join(map)); } return sslConfig; } }); }
Source:
public ValidationResult hasUniqueName() { if (!macPoolNameUnique(newMacPool.getName())) { return new ValidationResult(VdcBllMessages.ACTION_TYPE_FAILED_MAC_POOL_OF_THIS_NAME_ALREADY_EXIST); } else { return ValidationResult.VALID; } }

Target:
public ValidationResult hasUniqueName() { return firstValidationResult( testNameNullity(), ValidationResult.failWith(VdcBllMessages.ACTION_TYPE_FAILED_NAME_ALREADY_USED). when(!macPoolNameUnique()) ); }
Source:
public String getResponseCommentVisibilityString(FeedbackQuestionAttributes qn) { String visibilityString = StringHelper.removeEnclosingSquareBrackets(qn.showResponsesTo.toString()); if (StringHelper.isWhiteSpace(visibilityString)) { return "GIVER"; } else { return "GIVER, " + visibilityString; } }

Target:
public String getResponseCommentVisibilityString(FeedbackQuestionAttributes qn) { String visibilityString = StringHelper.removeEnclosingSquareBrackets(qn.showResponsesTo.toString()); return StringHelper.isWhiteSpace(visibilityString) ? "GIVER" : "GIVER, " + visibilityString; }
Source:
public static void prepareLinks() throws Exception { View sourceBlockView = createGraphicalNode(SysMLElementTypes.BLOCK, SysMLGraphicalTypes.SHAPE_SYSML_BLOCK_AS_CLASSIFIER_ID, getDiagramView()); View targetBlockView = createGraphicalNode(SysMLElementTypes.BLOCK, SysMLGraphicalTypes.SHAPE_SYSML_BLOCK_AS_CLASSIFIER_ID, getDiagramView()); createEdgeFromPalette("blockdefinition.tool.association_none", sourceBlockView, targetBlockView, true); createEdgeFromPalette("blockdefinition.tool.association_none", sourceBlockView, targetBlockView, true); Set<Edge> edges = ViewUtil.getAllInnerEdges(sourceBlockView.getDiagram()); ArrayList<Edge> edgeList = new ArrayList<Edge>(); for (Edge edge : edges) { if (!edge.getType().equals("StereotypeCommentLink")) { edgeList.add(edge); } } Assert.assertEquals("There should be 2 edges", 2, edgeList.size()); associationSourceView = edgeList.toArray(new Edge[] {})[0]; associationTargetView = edgeList.toArray(new Edge[] {})[1]; Assert.assertNotNull("association should not be null", associationSourceView); Assert.assertNotNull("association should not be null", associationTargetView); }

Target:
public static void prepareLinks() throws Exception { View sourceBlockView = createGraphicalNode(SysMLElementTypes.BLOCK, SysMLGraphicalTypes.SHAPE_SYSML_BLOCK_AS_CLASSIFIER_ID, getDiagramView()); View targetBlockView = createGraphicalNode(SysMLElementTypes.BLOCK, SysMLGraphicalTypes.SHAPE_SYSML_BLOCK_AS_CLASSIFIER_ID, getDiagramView()); createEdgeFromPalette("blockdefinition.tool.association_none", sourceBlockView, targetBlockView, true); createEdgeFromPalette("blockdefinition.tool.association_none", sourceBlockView, targetBlockView, true); Set<Edge> edges = ViewUtil.getAllInnerEdges(sourceBlockView.getDiagram()); List<Edge> edgeListToTest = new ArrayList<Edge>(); for (Edge edge : edges) { if (!edge.getType().equals("StereotypeCommentLink")) { edgeListToTest.add(edge); } } Assert.assertEquals("There should be 2 edges", 2, edgeListToTest.size()); associationSourceView = edgeListToTest.toArray(new Edge[] {})[0]; associationTargetView = edgeListToTest.toArray(new Edge[] {})[1]; Assert.assertNotNull("association should not be null", associationSourceView); Assert.assertNotNull("association should not be null", associationTargetView); }
Source:
public void println() { try { entered.set(Boolean.TRUE); delegate.println(); } finally { entered.remove(); } }

Target:
public void println() { if (entered.get() != null) { return; } try { entered.set(Boolean.TRUE); delegate.println(); } finally { entered.remove(); } }
Source:
public Table<Locator, String, String> getAllValues( Set<Locator> locators ) throws IOException { Timer.Context ctx = Instrumentation.getReadTimerContext( CassandraModel.CF_METRICS_STATE_NAME ); Session session = DatastaxIO.getSession(); try { List<String> query = new ArrayList<String>(); for( Locator l : locators) { query.add( l.toString() ); } Select.Where select = select() .all() .from( CassandraModel.CF_METRICS_METADATA_NAME ) .where( in( KEY, query ) ); List<Row> results = session.execute( select ).all(); Table<Locator, String, String> metaTable = HashBasedTable.create(); for ( Row row : results ) { if ( LOG.isDebugEnabled() ) { LOG.debug( "Read metrics_metadata: " + row.getString( KEY ) + row.getString( COLUMN1 ) + serDes.deserialize( row.getBytes( VALUE ) ) ); } metaTable.put( Locator.createLocatorFromDbKey( row.getString( KEY ) ), row.getString( COLUMN1 ), serDes.deserialize( row.getBytes( VALUE ) ) ); } return metaTable; } finally { ctx.stop(); } }

Target:
public Table<Locator, String, String> getAllValues( Set<Locator> locators ) throws IOException { Timer.Context ctx = Instrumentation.getReadTimerContext( CassandraModel.CF_METRICS_METADATA_NAME ); Session session = DatastaxIO.getSession(); try { List<String> query = new ArrayList<String>(); for( Locator l : locators) { query.add( l.toString() ); } Select.Where select = select() .all() .from( CassandraModel.CF_METRICS_METADATA_NAME ) .where( in( KEY, query ) ); List<Row> results = session.execute( select ).all(); Table<Locator, String, String> metaTable = HashBasedTable.create(); for ( Row row : results ) { if ( LOG.isTraceEnabled() ) { LOG.trace( "Read metrics_metadata: " + row.getString( KEY ) + row.getString( COLUMN1 ) + serDes.deserialize( row.getBytes( VALUE ) ) ); } metaTable.put( Locator.createLocatorFromDbKey( row.getString( KEY ) ), row.getString( COLUMN1 ), serDes.deserialize( row.getBytes( VALUE ) ) ); } return metaTable; } finally { ctx.stop(); } }
Source:
public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Authority authority = (Authority) o; return title != null ? title.equals(authority.title) : authority.title == null; }

Target:
public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } Authority authority = (Authority) o; return title != null ? title.equals(authority.title) : authority.title == null; }
Source:
private String determineSubpackageName(Path baseDir, String basePackageName, Path classFile) { Path relativePath = baseDir.relativize(classFile.getParent()); String pathSeparator = baseDir.getFileSystem().getSeparator(); String subpackageName = relativePath.toString().replace(pathSeparator, PACKAGE_SEPARATOR_STRING); if (StringUtils.isNotBlank(basePackageName) && subpackageName.startsWith(basePackageName)) { if (subpackageName.length() == basePackageName.length()) { subpackageName = ""; } else { subpackageName = subpackageName.substring(basePackageName.length() + 1); } } if (subpackageName.endsWith(pathSeparator)) { subpackageName = subpackageName.substring(0, subpackageName.length() - pathSeparator.length()); } return subpackageName; }

Target:
private String determineSubpackageName(Path baseDir, String basePackageName, Path classFile) { Path relativePath = baseDir.relativize(classFile.getParent()); String pathSeparator = baseDir.getFileSystem().getSeparator(); String subpackageName = relativePath.toString().replace(pathSeparator, PACKAGE_SEPARATOR_STRING); if (StringUtils.isNotBlank(basePackageName) && subpackageName.startsWith(basePackageName)) { subpackageName = subpackageName.length() == basePackageName.length() ? "" : subpackageName.substring(basePackageName.length() + 1); } if (subpackageName.endsWith(pathSeparator)) { subpackageName = subpackageName.substring(0, subpackageName.length() - pathSeparator.length()); } return subpackageName; }
Source:
public SWTBrowser(Composite parent, int style) { browser = new Browser(parent, style); browser.addDisposeListener( (DisposeEvent e) -> { synchronized (runOnDisposalList) { for (Runnable runnable : runOnDisposalList) { runnable.run(); } } }); }

Target:
public SWTBrowser(Composite parent, int style) { browser = new Browser(parent, style); browser.addDisposeListener( (DisposeEvent event) -> { synchronized (runOnDisposalList) { for (Runnable runnable : runOnDisposalList) { try { runnable.run(); } catch (RuntimeException exception) { log.error("error running on disposal: " + exception.getMessage(), exception); } } } }); }
Source:
public PermissionsOperationsParameters(Permission permission, Guid targetId) { this.permission = permission; this.targetId = targetId; }

Target:
public PermissionsOperationsParameters(Permission permission, Guid targetId) { this(permission); this.targetId = targetId; }
Source:
String extractClassificationMetadata(List<ClassificationType> classifications, String classificationSchemeUUID, String classificationValueName) { String classificationValue = null; LOG.debug("Looking for classificationScheme={}", classificationSchemeUUID); LOG.debug("Looking for classificationValueName={}", classificationValueName); for (ClassificationType classification : classifications) { String classificationSchemeName = classification.getClassificationScheme(); LOG.debug("Found classificationScheme={}", classificationSchemeName); if (classificationSchemeUUID.equals(classificationSchemeName)) { switch (classificationValueName) { case DocRepoConstants.XDS_NAME: classificationValue = classification.getName().getLocalizedString().get(0).getValue(); break; case DocRepoConstants.XDS_NODE_REPRESENTATION: classificationValue = classification.getNodeRepresentation(); break; case DocRepoConstants.XDS_CLASSIFIED_OBJECT: classificationValue = classification.getClassifiedObject(); break; case DocRepoConstants.XDS_CLASSIFICATION_ID: classificationValue = classification.getClassifiedObject(); break; default: break; } break; } } if (classificationValue != null && !classificationValue.isEmpty()) { classificationValue = StringUtil.extractStringFromTokens(classificationValue, "'()"); } LOG.debug("{}: {}", classificationValueName, classificationValue); return classificationValue; }

Target:
String extractClassificationMetadata(List<ClassificationType> classifications, String classificationSchemeUUID, String classificationValueName) { String classificationValue = null; LOG.debug("Looking for classificationScheme={}", classificationSchemeUUID); LOG.debug("Looking for classificationValueName={}", classificationValueName); for (ClassificationType classification : classifications) { String classificationSchemeName = classification.getClassificationScheme(); LOG.debug("Found classificationScheme={}", classificationSchemeName); if (classificationSchemeUUID.equals(classificationSchemeName)) { switch (classificationValueName) { case DocRepoConstants.XDS_NAME: classificationValue = classification.getName().getLocalizedString().get(0).getValue(); break; case DocRepoConstants.XDS_NODE_REPRESENTATION: classificationValue = classification.getNodeRepresentation(); break; case DocRepoConstants.XDS_CLASSIFIED_OBJECT: classificationValue = classification.getClassifiedObject(); break; case DocRepoConstants.XDS_CLASSIFICATION_ID: classificationValue = classification.getClassifiedObject(); break; default: break; } break; } } if (StringUtils.isNotEmpty(classificationValue)) { classificationValue = StringUtil.extractStringFromTokens(classificationValue, "'()"); } LOG.debug("{}: {}", classificationValueName, classificationValue); return classificationValue; }
Source:
@Override public RequestBody convert(final T value) throws IOException { return new RequestBody() { @Override public MediaType contentType() { return JaxbConverterFactory.XML; } @Override public void writeTo(BufferedSink sink) throws IOException { try { Marshaller marshaller = context.createMarshaller(); marshaller.setEventHandler(IGNORE_UNRECOGNIZED_FIELDS); XMLStreamWriter xmlWriter = xmlOutputFactory.createXMLStreamWriter( sink.outputStream(), JaxbConverterFactory.XML.charset().name()); marshaller.marshal(value, xmlWriter); } catch (JAXBException | XMLStreamException e) { throw new XmlDataException(e); } } }; }

Target:
@Override public RequestBody convert(final T value) throws IOException { Buffer buffer = new Buffer(); try { Marshaller marshaller = context.createMarshaller(); XMLStreamWriter xmlWriter = xmlOutputFactory.createXMLStreamWriter( buffer.outputStream(), JaxbConverterFactory.XML.charset().name()); marshaller.marshal(value, xmlWriter); } catch (JAXBException | XMLStreamException e) { throw new RuntimeException(e); } return RequestBody.create(JaxbConverterFactory.XML, buffer.readByteString()); }
Source:
public Response invokeAction( @QueryParam( ActionUtil.INVOKER_ASYNC_EXEC ) @DefaultValue( ActionUtil.INVOKER_DEFAULT_ASYNC_EXEC_VALUE ) String async, @QueryParam( ActionUtil.INVOKER_ACTIONID ) String actionId, @QueryParam( ActionUtil.INVOKER_ACTIONCLASS ) String actionClass, @QueryParam( ActionUtil.INVOKER_ACTIONUSER ) String actionUser, final String actionParams ) { boolean isAsyncExecution = Boolean.parseBoolean( async ); int httpStatus = HttpStatus.SC_INTERNAL_SERVER_ERROR; if ( isAsyncExecution ) { executorService.submit( createRunnable( actionId, actionClass, actionUser, actionParams ) ); httpStatus = HttpStatus.SC_ACCEPTED; } else { try { IActionInvokeStatus status = internalInvokeAction( actionId, actionClass, actionUser, actionParams ); httpStatus = ( status != null && status.getThrowable() == null ) ? HttpStatus.SC_OK : HttpStatus.SC_INTERNAL_SERVER_ERROR; } catch ( Throwable t ) { getLogger().error( t ); } } return Response.status( httpStatus ).build(); }

Target:
public Response invokeAction( @QueryParam( ActionUtil.INVOKER_ASYNC_EXEC ) @DefaultValue( ActionUtil.INVOKER_DEFAULT_ASYNC_EXEC_VALUE ) String async, @QueryParam( ActionUtil.INVOKER_ACTIONID ) String actionId, @QueryParam( ActionUtil.INVOKER_ACTIONCLASS ) String actionClass, @QueryParam( ActionUtil.INVOKER_ACTIONUSER ) String actionUser, final String actionParams ) { boolean isAsyncExecution = Boolean.parseBoolean( async ); int httpStatus = HttpStatus.SC_INTERNAL_SERVER_ERROR; if ( isAsyncExecution ) { executorService.submit( createCallable( actionId, actionClass, actionUser, actionParams ) ); httpStatus = HttpStatus.SC_ACCEPTED; } else { try { IActionInvokeStatus status = createCallable( actionId, actionClass, actionUser, actionParams ).call(); httpStatus = ( status != null && status.getThrowable() == null ) ? HttpStatus.SC_OK : HttpStatus.SC_INTERNAL_SERVER_ERROR; } catch ( Throwable t ) { getLogger().error( t ); } } return Response.status( httpStatus ).build(); }
Source:
public void onAllRequiredCapabilitiesAvailable() { try { AndesConfigurationManager.initialize(readPortOffset()); brokerService = new BrokerServiceImpl(BrokerServiceDataHolder.getInstance().getAccessKey()); brokerService.loadConfigurations(); AndesContext.getInstance().constructStoreConfiguration(); String mode = AndesConfigurationManager.readValue(AndesConfiguration.DEPLOYMENT_MODE); String authenticatorName = AndesConfigurationManager.readValue(AndesConfiguration.AUTHENTICATOR_CLASS); authList.forEach(service -> { if (authenticatorName.equals(service.getClass().getName())) { authService = service; BrokerServiceDataHolder.getInstance().setAuthenticationService(authService); } else { log.error("No matching authentication implementation was found for:" + authenticatorName); } }); if (Modes.STANDALONE.name().equalsIgnoreCase(mode)) { AndesContext.getInstance().setClusteringEnabled(false); this.startAndesBroker(bundleContext); } else if (mode.equalsIgnoreCase(Modes.CLUSTERED.name())) { AndesContext.getInstance().setClusteringEnabled(true); this.startAndesBroker(bundleContext); } else { throw new ConfigurationException("Invalid value " + mode + " for deployment/mode in broker.xml"); } } catch (ConfigurationException e) { String error = "Invalid configuration found in a configuration file"; log.error(error, e); } catch (AndesException e) { String error = "An error occurred while broker startup."; log.error(error, e); } }

Target:
public void onAllRequiredCapabilitiesAvailable() { try { AndesConfigurationManager.initialize(readPortOffset()); brokerService = new BrokerServiceImpl(BrokerServiceDataHolder.getInstance().getAccessKey()); brokerService.loadConfigurations(); AndesContext.getInstance().constructStoreConfiguration(); String mode = AndesConfigurationManager.readValue(AndesConfiguration.DEPLOYMENT_MODE); String authenticatorName = AndesConfigurationManager.readValue(AndesConfiguration.AUTHENTICATOR_CLASS); authList.forEach(service -> { if (authenticatorName.equals(service.getClass().getName())) { authService = service; BrokerServiceDataHolder.getInstance().setAuthenticationService(authService); } }); if (BrokerServiceDataHolder.getInstance().getAuthenticationService() == null) { log.error("No matching authentication implementation was found for:" + authenticatorName); } if (Modes.STANDALONE.name().equalsIgnoreCase(mode)) { AndesContext.getInstance().setClusteringEnabled(false); this.startAndesBroker(bundleContext); } else if (mode.equalsIgnoreCase(Modes.CLUSTERED.name())) { AndesContext.getInstance().setClusteringEnabled(true); this.startAndesBroker(bundleContext); } else { throw new ConfigurationException("Invalid value " + mode + " for deployment/mode in broker.xml"); } } catch (ConfigurationException e) { String error = "Invalid configuration found in a configuration file"; log.error(error, e); } catch (AndesException e) { log.error("An error occurred while broker startup", e); } }
Source:
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { Script.runSimpleBashScript("mkdir /tmp/upload"); String location = "/tmp/upload"; long maxFileSize = 1024 * 1024 * 1024; long maxRequestSize = 1024 * 1024 * 1024; int fileSizeThreshold = 64 * 1024; MultipartConfigElement multipartConfig = new MultipartConfigElement(location, maxFileSize, maxRequestSize, fileSizeThreshold); request.setAttribute(Request.__MULTIPART_CONFIG_ELEMENT, multipartConfig); response.setContentType("application/json;charset=UTF-8"); ServletOutputStream os = response.getOutputStream(); ServletConfig sc = getServletConfig(); String path = sc.getInitParameter("location"); Part filePart = request.getPart("file"); String fileName = filePart.getSubmittedFileName(); InputStream is = filePart.getInputStream(); Files.copy(is, Paths.get(path + request.getPathInfo()), StandardCopyOption.REPLACE_EXISTING); response.setStatus(200); os.print("{ filePath: '" + Paths.get(path + request.getPathInfo()) + "' }"); }

Target:
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { Script.runSimpleBashScript(String.format("mkdir %s", uploadPath)); long maxFileSize = 1024 * 1024 * 1024; long maxRequestSize = 1024 * 1024 * 1024; int fileSizeThreshold = 64 * 1024; MultipartConfigElement multipartConfig = new MultipartConfigElement(uploadPath, maxFileSize, maxRequestSize, fileSizeThreshold); request.setAttribute(Request.__MULTIPART_CONFIG_ELEMENT, multipartConfig); response.setContentType("application/json;charset=UTF-8"); ServletOutputStream os = response.getOutputStream(); ServletConfig sc = getServletConfig(); String path = sc.getInitParameter("location"); Part filePart = request.getPart("file"); String fileName = filePart.getSubmittedFileName(); InputStream is = filePart.getInputStream(); Files.copy(is, Paths.get(path + request.getPathInfo()), StandardCopyOption.REPLACE_EXISTING); response.setStatus(200); os.print("{ filePath: '" + Paths.get(path + request.getPathInfo()) + "' }"); }
Source:
public ArrayList<String> getAdditionalClasspathElements() { return additionalClasspathElements; }

Target:
public List<String> getAdditionalClasspathElements() { return additionalClasspathElements; }
Source:
public Thing createThingOfType(ThingTypeUID thingTypeUID, ThingUID thingUID, ThingUID bridgeUID, String label, Configuration configuration) { logger.debug("Creating thing for type '{}'.", thingTypeUID); for (ThingHandlerFactory thingHandlerFactory : thingHandlerFactories) { if (thingHandlerFactory.supportsThingType(thingTypeUID)) { Thing thing = thingHandlerFactory.createThing(thingTypeUID, configuration, thingUID, bridgeUID); if (thing == null) { logger.warn( "Cannot create thing of type '{}'. Binding '{}' says it supports it, but it could not be created.", thingTypeUID, thingHandlerFactory.getClass().getName()); } else { thing.setLabel(label); } return thing; } } logger.warn("Cannot create thing. No binding found that supports creating a thing of type '{}'.", thingTypeUID); return null; }

Target:
public Thing createThingOfType(ThingTypeUID thingTypeUID, ThingUID thingUID, ThingUID bridgeUID, String label, Configuration configuration) { logger.debug("Creating thing for type '{}'.", thingTypeUID); for (ThingHandlerFactory thingHandlerFactory : thingHandlerFactories) { if (thingHandlerFactory.supportsThingType(thingTypeUID)) { Thing thing = thingHandlerFactory.createThing(thingTypeUID, configuration, thingUID, bridgeUID); thing.setLabel(label); return thing; } } logger.warn("Cannot create thing. No binding found that supports creating a thing of type '{}'.", thingTypeUID); return null; }
Source:
protected Duration calculateNextRetryInterval(final Exception lastException, final Duration remainingTime, final int baseWaitSeconds, final int retryCount) { if ((!Retry.isRetriableException(lastException)) || retryCount >= super.maxRetryCount()) { return null; } final double nextRetryInterval = Math.pow(retryFactor, (double) retryCount); final long nextRetryIntervalSeconds = (long) nextRetryInterval; final long nextRetryIntervalNano = (long) ((nextRetryInterval - (double) nextRetryIntervalSeconds) * 1000000000); if (remainingTime.getSeconds() < Math.max(nextRetryInterval, TIMER_TOLERANCE.getSeconds())) { return null; } final Duration retryAfter = this.minBackoff.plus(Duration.ofSeconds(nextRetryIntervalSeconds, nextRetryIntervalNano)); return retryAfter.plus(Duration.ofSeconds(baseWaitSeconds)); }

Target:
protected Duration calculateNextRetryInterval(final Exception lastException, final Duration remainingTime, final int baseWaitSeconds, final int retryCount) { final double nextRetryInterval = Math.pow(retryFactor, (double) retryCount); final long nextRetryIntervalSeconds = (long) nextRetryInterval; final long nextRetryIntervalNano = (long) ((nextRetryInterval - (double) nextRetryIntervalSeconds) * 1000000000); if (remainingTime.getSeconds() < Math.max(nextRetryInterval, TIMER_TOLERANCE.getSeconds())) { return null; } final Duration retryAfter = minBackoff.plus(Duration.ofSeconds(nextRetryIntervalSeconds, nextRetryIntervalNano)); return retryAfter.plus(Duration.ofSeconds(baseWaitSeconds)); }
Source:
private FlexTable buildTable() { FlexTable table = new FlexTable(); table.addStyleName("dataTable"); table.setText(0, 0, "URI"); table.setText(0, 1, "Last update date"); table.setText(0, 2, "Last update user"); table.setText(0, 3, "Is download allowed?"); table.setText(0, 4, "Delete on save"); table.getRowFormatter().addStyleName(0, "titleBar"); return table; }

Target:
private FlexTable buildTable() { FlexTable table = new FlexTable(); table.addStyleName("dataTable"); table.setText(0, 0, "URI"); table.setText(0, 1, "Last update date"); table.setText(0, 2, "Last update user"); table.setText(0, 3, "Downloadable"); table.setText(0, 4, "Delete on save"); table.getRowFormatter().addStyleName(0, "titleBar"); return table; }
Source:
private void checkSuperOnlyInvokedInDerivedClassConstructor(SuperTreeImpl superTree) { if (!isInConstructor(superTree) || isInBaseClass(getEnclosingConstructor(superTree))) { addIssue(superTree, MESSAGE_SUPER_ONLY_IN_DERIVED_CLASS_CONSTRUCTOR); } }

Target:
private void checkSuperOnlyInvokedInDerivedClassConstructor(SuperTreeImpl superTree) { addIssue(superTree, MESSAGE_SUPER_ONLY_IN_DERIVED_CLASS_CONSTRUCTOR); }
Source:
public static <V extends Persistable & Versionable> PaxosStateLog<V> create(SplittingParameters<V> parameters) { return new SplittingPaxosStateLog<>( parameters.legacyLog(), parameters.currentLog(), parameters.markLegacyWrite(), parameters.markLegacyRead(), parameters.cutoffInclusive(), new AtomicLong(Math.min(parameters.legacyLog().getLeastLogEntry(), parameters.cutoffInclusive()))); }

Target:
public static <V extends Persistable & Versionable> PaxosStateLog<V> create(SplittingParameters<V> parameters) { Preconditions.checkState(parameters.cutoffInclusive() == PaxosAcceptor.NO_LOG_ENTRY || parameters.currentLog().getGreatestLogEntry() >= parameters.cutoffInclusive(), "Cutoff value must either be -1, or the current log must contain an entry after the cutoff."); return new SplittingPaxosStateLog<>( parameters.legacyLog(), parameters.currentLog(), parameters.markLegacyWrite(), parameters.markLegacyRead(), parameters.cutoffInclusive(), new AtomicLong(parameters.legacyLog().getLeastLogEntry())); }
Source:
@Override protected void beforeTest() throws Exception { super.beforeTest(); if (USE_TEST_CLUSTER && zkCluster == null) { Map<String,Object>[] customProps = new Map[ZK_SRVS]; if (sslEnabled) fillSslProperties(customProps); zkCluster = ZookeeperDiscoverySpiTestUtil.createTestingCluster(ZK_SRVS, customProps); zkCluster.start(); waitForZkClusterReady(zkCluster); } reset(); }

Target:
@Override protected void beforeTest() throws Exception { super.beforeTest(); if (USE_TEST_CLUSTER && zkCluster == null) { zkCluster = ZookeeperDiscoverySpiTestUtil.createTestingCluster(ZK_SRVS, clusterCustomProperties()); zkCluster.start(); waitForZkClusterReady(zkCluster); } reset(); }
Source:
public ChaosHarlequinEffect() { super(Outcome.Benefit); this.staticText = "Exile the top card of your library. If that card is a land card, Chaos Harlequin gets -4/-0 until end of turn. Otherwise, Chaos Harlequin gets +2/+0 until end of turn"; }

Target:
public ChaosHarlequinEffect() { super(Outcome.Benefit); this.staticText = "Exile the top card of your library. If that card is a land card, {this} gets -4/-0 until end of turn. Otherwise, {this} gets +2/+0 until end of turn"; }
Source:
public void writeReport(final File output, final List<Header> headers) { final MetricsFile<SamComparisonMetric, ?> comparisonMetricFile = new MetricsFile<>(); for (final Header h : headers) { comparisonMetricFile.addHeader(h); } comparisonMetricFile.addAllMetrics(Collections.singletonList(comparisonMetric)); comparisonMetricFile.write(output); }

Target:
public void writeReport(final File output, final List<Header> headers) { final MetricsFile<SamComparisonMetric, ?> comparisonMetricFile = new MetricsFile<>(); headers.forEach(comparisonMetricFile::addHeader); comparisonMetricFile.addAllMetrics(Collections.singletonList(comparisonMetric)); comparisonMetricFile.write(output); }
Source:
public static boolean accept(Project project, File parent, File file) { try { File f1 = parent.getCanonicalFile(); File f2 = file.getCanonicalFile(); if (f2.equals(f1)) { LOGGER.log(Level.INFO, "Skipping links to itself...: {0} {1}", new Object[]{parent.getAbsolutePath(), file.getAbsolutePath()}); return false; } File t1 = f1; while ((t1 = t1.getParentFile()) != null) { if (f2.equals(t1)) { LOGGER.log(Level.INFO, "Skipping links to parent...: {0} {1}", new Object[]{parent.getAbsolutePath(), file.getAbsolutePath()}); return false; } } return accept(project, file); } catch (IOException ex) { LOGGER.log(Level.WARNING, "Failed to resolve name: {0} {1}", new Object[]{parent.getAbsolutePath(), file.getAbsolutePath()}); } return false; }

Target:
public static boolean accept(Project project, File parent, File file) { try { File f1 = parent.getCanonicalFile(); File f2 = file.getCanonicalFile(); if (f2.equals(f1)) { LOGGER.log(Level.INFO, "Skipping links to itself...: link '{1}' -> '{0}'", new Object[]{parent.getAbsolutePath(), file.getAbsolutePath()}); return false; } File t1 = f1; while ((t1 = t1.getParentFile()) != null) { if (f2.equals(t1)) { LOGGER.log(Level.INFO, "Skipping links to parent...: link '{1}' -> '{0}'", new Object[]{t1.getAbsolutePath(), file.getAbsolutePath()}); return false; } } return accept(project, file); } catch (IOException ex) { LOGGER.log(Level.WARNING, "Failed to resolve name: parent '{0}' file '{1}'", new Object[]{parent.getAbsolutePath(), file.getAbsolutePath()}); } return false; }
Source:
public String getLog() throws IOException { return FileIO.toString("myrobotlab.log"); }

Target:
public String getLog() throws IOException { return FileIO.toString(MYROBOTLAB_LOG); }
Source:
public static Set<IAnalysisParameterProvider> getParameterProvidersForModule(IAnalysisModule module, ITmfTrace trace) { Set<IAnalysisParameterProvider> providerSet = TmfAnalysisParameterProviders.getParameterProvidersFor(module.getId()); synchronized (fParameterProviders) { if (!fParameterProviders.containsKey(module.getId())) { return providerSet; } List<Class<? extends IAnalysisParameterProvider>> parameterProviders = checkNotNull(fParameterProviders.get(module.getId())); for (Class<? extends IAnalysisParameterProvider> providerClass : parameterProviders) { try { IAnalysisParameterProvider provider = fParamProviderInstances.get(providerClass); if (provider == null) { provider = providerClass.getConstructor().newInstance(); fParamProviderInstances.put(providerClass, provider); } if (provider.appliesToTrace(trace)) { providerSet.add(provider); } } catch (IllegalArgumentException | SecurityException | InstantiationException | IllegalAccessException | NoSuchMethodException | InvocationTargetException e) { Activator.logError(Messages.TmfAnalysisManager_ErrorParameterProvider, e); } } } return Collections.unmodifiableSet(providerSet); }

Target:
public static Set<IAnalysisParameterProvider> getParameterProvidersForModule(IAnalysisModule module, ITmfTrace trace) { Set<IAnalysisParameterProvider> providerSet = TmfAnalysisParameterProviders.getParameterProvidersFor(module.getId()); synchronized (fParameterProviders) { if (!fParameterProviders.containsKey(module.getId())) { return providerSet; } List<Class<? extends IAnalysisParameterProvider>> parameterProviders = checkNotNull(fParameterProviders.get(module.getId())); for (Class<? extends IAnalysisParameterProvider> providerClass : parameterProviders) { try { @Nullable IAnalysisParameterProvider provider = fParamProviderInstances.get(providerClass); if (provider == null) { provider = providerClass.getConstructor().newInstance(); fParamProviderInstances.put(providerClass, provider); } if (provider.appliesToTrace(trace)) { providerSet.add(provider); } } catch (IllegalArgumentException | SecurityException | InstantiationException | IllegalAccessException | NoSuchMethodException | InvocationTargetException e) { Activator.logError(Messages.TmfAnalysisManager_ErrorParameterProvider, e); } } } return Collections.unmodifiableSet(providerSet); }
Source:
public static String formatAnnotation(Annotation a) { String annoName = a.def().name.substring(a.def().name.lastIndexOf('.') + 1); if (a.fieldValues.isEmpty()) { return "@" + annoName; } StringJoiner sj = new StringJoiner(",", "@" + annoName + "(", ")"); for (Map.Entry<String, Object> f : a.fieldValues.entrySet()) { AnnotationFieldType aft = a.def().fieldTypes.get(f.getKey()); sj.add(f.getKey() + "=" + IndexFileWriter.formatAnnotationValue(aft, f.getValue())); } return sj.toString(); }

Target:
public static String formatAnnotation(Annotation a) { String fullAnnoName = a.def().name; String simpleAnnoName = fullAnnoName.substring(fullAnnoName.lastIndexOf('.') + 1); if (a.fieldValues.isEmpty()) { return "@" + simpleAnnoName; } StringJoiner sj = new StringJoiner(", ", "@" + simpleAnnoName + "(", ")"); for (Map.Entry<String, Object> f : a.fieldValues.entrySet()) { AnnotationFieldType aft = a.def().fieldTypes.get(f.getKey()); sj.add(f.getKey() + "=" + IndexFileWriter.formatAnnotationValue(aft, f.getValue())); } return sj.toString(); }
Source:
public TypeBinding getEquivalentOuterVariable(InferenceVariable variable, InferenceVariable[] outerVariables) { ThreeSets three = this.boundsPerVariable.get(variable); if (three != null) { for (TypeBound bound : three.sameBounds) { for (InferenceVariable iv : outerVariables) if (TypeBinding.equalsEquals(bound.right, iv)) return iv; } } for (InferenceVariable iv : outerVariables) { three = this.boundsPerVariable.get(iv); if (three != null) { for (TypeBound bound : three.sameBounds) if (TypeBinding.equalsEquals(bound.right, variable)) return iv; } } return null; }

Target:
public TypeBinding getEquivalentOuterVariable(InferenceVariable variable, InferenceVariable[] outerVariables) { ThreeSets three = this.boundsPerVariable.get(variable); if (three != null) { for (TypeBound bound : three.sameBounds) { for (InferenceVariable iv : outerVariables) if (TypeBinding.equalsEquals(bound.right, iv)) return iv; } } for (InferenceVariable iv : outerVariables) { three = this.boundsPerVariable.get(iv); if (three != null && three.sameBounds != null) { for (TypeBound bound : three.sameBounds) if (TypeBinding.equalsEquals(bound.right, variable)) return iv; } } return null; }
Source:
public ChargeQueryResponse queryPaymentStatus(ChargeEntity charge) { try { GatewayClient.Response response = authoriseClient.postRequestFor(ROUTE_FOR_QUERY_ORDER, charge.getGatewayAccount(), buildQueryOrderRequestFor(charge)); GatewayResponse<EpdqQueryResponse> epdqGatewayResponse = getEpdqGatewayResponse(response, EpdqQueryResponse.class); if (!epdqGatewayResponse.getBaseResponse().isPresent()) epdqGatewayResponse.throwGatewayError(); return toChargeQueryResponse(epdqGatewayResponse.getBaseResponse().get()); } catch (GenericGatewayErrorException | GatewayConnectionTimeoutErrorException | GatewayConnectionErrorException e) { throw new WebApplicationException("Things went wrong"); } }

Target:
public ChargeQueryResponse queryPaymentStatus(ChargeEntity charge) { try { GatewayClient.Response response = authoriseClient.postRequestFor(ROUTE_FOR_QUERY_ORDER, charge.getGatewayAccount(), buildQueryOrderRequestFor(charge)); GatewayResponse<EpdqQueryResponse> epdqGatewayResponse = getEpdqGatewayResponse(response, EpdqQueryResponse.class); return epdqGatewayResponse.getBaseResponse() .map(EpdqQueryResponse::toChargeQueryResponse) .orElseThrow(() -> new WebApplicationException("Things went wrong")); } catch (GatewayErrorException e) { throw new WebApplicationException("Things went wrong"); } }
Source:
public void testToImmutable() { MatchingFrame frame = new MatchingFrame(arity); for (int i=0; i<arity; ++i) { frame.set(i, values[i]); } Tuple tuple = Tuples.flatTupleOf(values); Tuple tupleFromTuple = tuple.toImmutable(); Tuple tupleFromFrame = tuple.toImmutable(); assertTrue("equality tuple", Objects.equals(tuple, tupleFromTuple)); assertTrue("equality tuple", Objects.equals(tupleFromTuple, tuple)); assertTrue("equality frame", Objects.equals(frame, tupleFromFrame)); assertTrue("equality frame", Objects.equals(tupleFromFrame, frame)); if (arity > 0) { frame.setValue(0, "x"); assertFalse("equality frame", Objects.equals(frame, tupleFromFrame)); assertFalse("equality frame", Objects.equals(tupleFromFrame, frame)); } }

Target:
public void testToImmutable() { MatchingFrame frame = new MatchingFrame(arity); for (int i=0; i<arity; ++i) { frame.set(i, values[i]); } Tuple tuple = Tuples.flatTupleOf(values); Tuple tupleFromTuple = tuple.toImmutable(); Tuple tupleFromFrame = frame.toImmutable(); assertTrue("equality tuple", Objects.equals(tuple, tupleFromTuple)); assertTrue("equality tuple", Objects.equals(tupleFromTuple, tuple)); assertTrue("equality frame", Objects.equals(frame, tupleFromFrame)); assertTrue("equality frame", Objects.equals(tupleFromFrame, frame)); if (arity > 0) { frame.setValue(0, "x"); assertFalse("equality frame", Objects.equals(frame, tupleFromFrame)); assertFalse("equality frame", Objects.equals(tupleFromFrame, frame)); } }