auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public ColorThemeManager() { editors = new HashMap<String, ThemePreferenceMapper>(); IConfigurationElement[] config = Platform.getExtensionRegistry() .getConfigurationElementsFor( Activator.EXTENSION_POINT_ID_MAPPER); try { for (IConfigurationElement e : config) { final Object o = e.createExecutableExtension("class"); if (o instanceof ThemePreferenceMapper) { String pluginId = e.getAttribute("pluginId"); ThemePreferenceMapper mapper = (ThemePreferenceMapper) o; mapper.setPluginId(pluginId); if (o instanceof GenericMapper) { String xml = e.getAttribute("xml"); String contributorPluginId = e.getContributor() .getName(); Bundle bundle = Platform.getBundle(contributorPluginId); InputStream input = (InputStream) bundle.getResource( xml).getContent(); ((GenericMapper) mapper).parseMapping(input); } editors.put(pluginId, mapper); } } } catch (Exception ex) { ex.printStackTrace(); } themes = new HashMap<String, ColorTheme>(); readStockThemes(themes); readImportedThemes(themes); }

Target:
public ColorThemeManager() { editors = new HashMap<String, ThemePreferenceMapper>(); IConfigurationElement[] config = Platform.getExtensionRegistry() .getConfigurationElementsFor( Activator.EXTENSION_POINT_ID_MAPPER); try { for (IConfigurationElement e : config) { final Object o = e.createExecutableExtension("class"); if (o instanceof ThemePreferenceMapper) { String pluginId = e.getAttribute("pluginId"); ThemePreferenceMapper mapper = (ThemePreferenceMapper) o; mapper.setPluginId(pluginId); if (o instanceof GenericMapper) { String xml = e.getAttribute("xml"); String contributorPluginId = e.getContributor() .getName(); Bundle bundle = Platform.getBundle(contributorPluginId); InputStream input = (InputStream) bundle.getResource( xml).getContent(); ((GenericMapper) mapper).parseMappings(input); } editors.put(pluginId, mapper); } } } catch (Exception ex) { ex.printStackTrace(); } themes = new HashMap<String, ColorTheme>(); readStockThemes(themes); readImportedThemes(themes); }
Source:
public void testRegisteredSynonyms() { List<CodeSnippet> codeSnippets = snippetGenerator.generateSnippets(Maven2LayoutProvider.ALIAS, new MavenArtifactCoordinates("org.carlspring.strongbox", "maven-snippet", "1.0", null, "jar")); assertNotNull(codeSnippets, "Failed to look up dependency synonym formatter!"); assertFalse(codeSnippets.isEmpty(), "No synonyms found!"); assertEquals(6, codeSnippets.size(), "Incorrect number of dependency synonyms!"); String[] synonyms = new String[]{ "Maven 2", "ApacheBuildr", "Gradle", "Ivy", "Leiningen", "SBT", }; int i = 0; for (CodeSnippet snippet : codeSnippets) { System.out.println(snippet.getName()); assertEquals(synonyms[i], snippet.getName(), "Failed to re-order correctly!"); i++; } }

Target:
public void testRegisteredSynonyms() { List<CodeSnippet> codeSnippets = snippetGenerator.generateSnippets(Maven2LayoutProvider.ALIAS, new MavenArtifactCoordinates("org.carlspring.strongbox", "maven-snippet", "1.0", null, "jar")); assertNotNull(codeSnippets, "Failed to look up dependency synonym formatter!"); assertFalse(codeSnippets.isEmpty(), "No synonyms found!"); assertEquals(6, codeSnippets.size(), "Incorrect number of dependency synonyms!"); String[] synonyms = new String[]{ "Maven 2", "Buildr", "Gradle", "Ivy", "Leiningen", "SBT", }; int i = 0; for (CodeSnippet snippet : codeSnippets) { System.out.println(snippet.getName()); assertEquals(synonyms[i], snippet.getName(), "Failed to re-order correctly!"); i++; } }
Source:
public static String readStringFromFile(String readFromPath) throws IOException { try { Cipher decrypter = Cipher.getInstance("AES"); decrypter.init(Cipher.DECRYPT_MODE, KEY); FileInputStream fis = new FileInputStream(new File(readFromPath)); CipherInputStream cis = new CipherInputStream(fis, decrypter); BufferedReader reader = new BufferedReader(new InputStreamReader(cis)); String docString = ""; String line; while ((line = reader.readLine()) != null) { docString += line; } reader.close(); return docString; } catch (NoSuchAlgorithmException e) { e.printStackTrace(); throw new RuntimeException(e); } catch (NoSuchPaddingException e) { e.printStackTrace(); throw new RuntimeException(e); } catch (InvalidKeyException e) { e.printStackTrace(); throw new RuntimeException(e); } catch (FileNotFoundException e) { e.printStackTrace(); throw new RuntimeException(e); } }

Target:
public static String readStringFromFile(String readFromPath) throws IOException { try { Cipher decrypter = Cipher.getInstance("AES"); decrypter.init(Cipher.DECRYPT_MODE, KEY); FileInputStream fis = new FileInputStream(new File(readFromPath)); CipherInputStream cis = new CipherInputStream(fis, decrypter); BufferedReader reader = new BufferedReader(new InputStreamReader(cis)); StringBuilder sb = new StringBuilder(); String line; while ((line = reader.readLine()) != null) { sb.append(line); } reader.close(); return sb.toString(); } catch (NoSuchAlgorithmException | NoSuchPaddingException | InvalidKeyException | FileNotFoundException e) { e.printStackTrace(); throw new RuntimeException(e); } }
Source:
public RDTCommandLauncher(IProject project) { fProcess = null; fShowCommand = false; try { if (project.hasNature(RemoteProxyManager.SYNC_NATURE)) { IRemoteResource remoteRes = (IRemoteResource)project.getAdapter(IRemoteResource.class); uri = remoteRes.getActiveLocationURI(); } else{ uri = project.getLocationURI(); } lineSeparator = System.getProperty("line.separator", "\n"); } catch (CoreException e) { uri = project.getLocationURI(); lineSeparator = System.getProperty("line.separator", "\n"); } }

Target:
public RDTCommandLauncher(IProject project) { fProcess = null; fShowCommand = false; try { if (project.hasNature(RemoteProxyManager.SYNC_NATURE)) { IRemoteResource remoteRes = (IRemoteResource)project.getAdapter(IRemoteResource.class); uri = remoteRes.getActiveLocationURI(); } else{ uri = project.getLocationURI(); } } catch (CoreException e) { uri = project.getLocationURI(); } lineSeparator = System.getProperty("line.separator", "\n"); }
Source:
private CloseableHttpResponse proxyRequest(String appUrl, ContainerRequestContext request) throws IOException { String method = request.getMethod(); String requestURI = request.getUriInfo().getRequestUri().getPath(); CloseableHttpResponse proxiedResponse; switch (method) { case "GET": HttpGet httpGet = new HttpGet(appUrl + requestURI); proxiedResponse = httpclient.execute(httpGet); break; case "PUT": HttpPut httpPut = new HttpPut(appUrl + requestURI); httpPut.setHeader(HTTP.CONTENT_TYPE, request.getHeaderString("Content-Type")); httpPut.setEntity(new InputStreamEntity(request.getEntityStream())); proxiedResponse = httpclient.execute(httpPut); break; case "POST": HttpPost httpPost = new HttpPost(appUrl + requestURI); httpPost.setHeader(HTTP.CONTENT_TYPE, request.getHeaderString("Content-Type")); httpPost.setEntity(new InputStreamEntity(request.getEntityStream())); proxiedResponse = httpclient.execute(httpPost); break; case "DELETE": HttpDelete httpDelete = new HttpDelete(appUrl + requestURI); httpDelete.setHeader(HTTP.CONTENT_TYPE, request.getHeaderString("Content-Type")); proxiedResponse = httpclient.execute(httpDelete); break; default: throw new RuntimeException("Method not supported: " + method); } return proxiedResponse; }

Target:
private CloseableHttpResponse proxyRequest(String appUrl, ContainerRequestContext request) throws IOException { String method = request.getMethod(); String requestURI = request.getUriInfo().getRequestUri().getPath(); CloseableHttpResponse proxiedResponse; switch (method) { case "GET": HttpGet httpGet = new HttpGet(appUrl + requestURI); proxiedResponse = httpclient.execute(httpGet); break; case "PUT": HttpPut httpPut = new HttpPut(appUrl + requestURI); httpPut.setHeader(HTTP.CONTENT_TYPE, request.getHeaderString("Content-Type")); httpPut.setEntity(new InputStreamEntity(request.getEntityStream())); proxiedResponse = httpclient.execute(httpPut); break; case "POST": HttpPost httpPost = new HttpPost(appUrl + requestURI); httpPost.setHeader(HTTP.CONTENT_TYPE, request.getHeaderString("Content-Type")); httpPost.setEntity(new InputStreamEntity(request.getEntityStream())); proxiedResponse = httpclient.execute(httpPost); break; case "DELETE": HttpDelete httpDelete = new HttpDelete(appUrl + requestURI); httpDelete.setHeader(HTTP.CONTENT_TYPE, request.getHeaderString("Content-Type")); proxiedResponse = httpclient.execute(httpDelete); break; default: throw new IllegalStateException("Method not supported: " + method); } return proxiedResponse; }
Source:
protected void execute(Context context) throws SQLException { MassUpdate massUpdate = context.prepareMassUpdate(); massUpdate.select("SELECT prop.id FROM properties prop " + "INNER JOIN projects p ON p.id=prop.resource_id AND p.qualifier IN ('VW','SVW') " + "WHERE prop.prop_key='sonar.leak.period' or prop.prop_key='sonar.timemachine.period1' "); massUpdate.update("DELETE from properties WHERE id=?"); massUpdate.rowPluralName("leak period settings on views"); massUpdate.execute((row, update) -> { update.setLong(1, row.getLong(1)); return true; }); }

Target:
protected void execute(Context context) throws SQLException { MassUpdate massUpdate = context.prepareMassUpdate(); massUpdate.select("SELECT prop.id FROM properties prop " + "INNER JOIN projects p ON p.id=prop.resource_id AND p.qualifier NOT IN ('TRK') " + "WHERE prop.prop_key='sonar.leak.period' or prop.prop_key='sonar.timemachine.period1' "); massUpdate.update("DELETE FROM properties WHERE id=?"); massUpdate.rowPluralName("properties"); massUpdate.execute((row, update) -> { update.setLong(1, row.getLong(1)); return true; }); }
Source:
private AbstractChangePackage downloadAndResolveChangePackage(final ChangePackageProxy proxy, final Optional<SessionId> maybeSession, Optional<ProjectId> maybeProjectId) throws ESException { if (!maybeSession.isPresent()) { throw new ESException(Messages.XmlRpcClientManager_NoValidSessionId); } int fragmentIndex = 0; final FileBasedChangePackage changePackage = VersioningFactory.eINSTANCE .createFileBasedChangePackage(); changePackage.initialize(FileUtil.createLocationForTemporaryChangePackage()); final File file = new File(changePackage.getTempFilePath()); FileWriter writer = null; try { writer = new FileWriter(file); ChangePackageEnvelope envelope; do { envelope = executeCall("downloadChangePackageFragment", ChangePackageEnvelope.class, new Object[] { maybeSession.get(), maybeProjectId.get(), proxy.getId(), fragmentIndex }); for (final String s : envelope.getFragment()) { writer.write(s + System.getProperty("line.separator")); } fragmentIndex += 1; } while (!envelope.isLast()); } catch (final IOException ex) { throw new ESException(Messages.XmlRpcClientManager_DownloadOfFragmentFailed, ex); } finally { if (writer != null) { try { writer.close(); } catch (final IOException ex) { throw new ESException(Messages.XmlRpcClientManager_DownloadOfFragmentFailed, ex); } } } try { changePackage.setLogMessage( ModelUtil.clone(proxy.getLogMessage())); changePackage.save(); } catch (final IOException ex) { throw new ESException(Messages.XmlRpcClientManager_SaveChangePackageFailed, ex); } return changePackage; }

Target:
private AbstractChangePackage downloadAndResolveChangePackage(final ChangePackageProxy proxy, final Optional<SessionId> maybeSession, Optional<ProjectId> maybeProjectId) throws ESException { if (!maybeSession.isPresent()) { throw new ESException(Messages.XmlRpcClientManager_NoValidSessionId); } if (!maybeProjectId.isPresent()) { throw new ESException(Messages.XmlRpcClientManager_NoValidProjectId); } int fragmentIndex = 0; final FileBasedChangePackage changePackage = VersioningFactory.eINSTANCE .createFileBasedChangePackage(); changePackage.initialize(FileUtil.createLocationForTemporaryChangePackage()); final File file = new File(changePackage.getTempFilePath()); FileWriter writer = null; try { writer = new FileWriter(file); ChangePackageEnvelope envelope; do { envelope = executeCall("downloadChangePackageFragment", ChangePackageEnvelope.class, new Object[] { maybeSession.get(), maybeProjectId.get(), proxy.getId(), fragmentIndex }); for (final String s : envelope.getFragment()) { writer.write(s + System.getProperty("line.separator")); } fragmentIndex += 1; } while (!envelope.isLast()); } catch (final IOException ex) { throw new ESException(Messages.XmlRpcClientManager_DownloadOfFragmentFailed, ex); } finally { if (writer != null) { try { writer.close(); } catch (final IOException ex) { throw new ESException(Messages.XmlRpcClientManager_DownloadOfFragmentFailed, ex); } } } try { changePackage.setLogMessage( ModelUtil.clone(proxy.getLogMessage())); changePackage.save(); } catch (final IOException ex) { throw new ESException(Messages.XmlRpcClientManager_SaveChangePackageFailed, ex); } return changePackage; }
Source:
public boolean isSupportedArrayComponentType(Class<?> componentType) { if (boolean.class == componentType) { return true; } if (short.class == componentType) { return true; } if (int.class == componentType) { return true; } if (long.class == componentType) { return true; } if (double.class == componentType) { return true; } return false; }

Target:
public boolean isSupportedArrayComponentType(Class<?> componentType) { return boolean.class == componentType || short.class == componentType || int.class == componentType || long.class == componentType || double.class == componentType; }
Source:
public Mono<HttpResponse> process(HttpPipelineCallContext context, HttpPipelineNextPolicy next) { if (Objects.nonNull(requestIdSupplier)) { HttpHeaders httpHeaders = requestIdSupplier.get(); if (Objects.nonNull(httpHeaders) && httpHeaders.getSize() > 0) { httpHeaders.stream().forEach(httpHeader -> { String requestIdHeaderValue = context.getHttpRequest().getHeaders().getValue(httpHeader.getName()); if (requestIdHeaderValue == null) { context.getHttpRequest().getHeaders().put(httpHeader.getName(), httpHeader.getValue()); } }); return next.process(); } } String requestId = context.getHttpRequest().getHeaders().getValue(REQUEST_ID_HEADER); if (requestId == null) { context.getHttpRequest().getHeaders().put(REQUEST_ID_HEADER, UUID.randomUUID().toString()); } return next.process(); }

Target:
public Mono<HttpResponse> process(HttpPipelineCallContext context, HttpPipelineNextPolicy next) { HttpHeaders httpHeaders = requestIdSupplier.get(); if (Objects.nonNull(httpHeaders) && httpHeaders.getSize() > 0) { for (HttpHeader header : httpHeaders) { String requestIdHeaderValue = context.getHttpRequest().getHeaders().getValue(header.getName()); if (requestIdHeaderValue == null) { context.getHttpRequest().getHeaders().put(header.getName(), header.getValue()); } } return next.process(); } String requestId = context.getHttpRequest().getHeaders().getValue(REQUEST_ID_HEADER); if (requestId == null) { context.getHttpRequest().getHeaders().put(REQUEST_ID_HEADER, UUID.randomUUID().toString()); } return next.process(); }
Source:
private GeneralCommandLine getCommandLine(File sdk) { ProgressIndicator progressIndicator = ProgressManager.getInstance().getProgressIndicator(); progressIndicator.setIndeterminate(true); progressIndicator.setText("Running Intel® HAXM installer"); int memorySize = myState.getNotNull(KEY_EMULATOR_MEMORY_MB, getRecommendedMemoryAllocation()); File sourceLocation = new File(sdk, "extras/intel/Hardware_Accelerated_Execution_Manager"); if (SystemInfo.isMac) { return getMacHaxmInstallCommandLine(sourceLocation, memorySize); } else if (SystemInfo.isWindows) { return getWindowsHaxmInstallCommandLine(sourceLocation, memorySize); } else { assert !isSupportedOS(); throw new IllegalStateException("Usupported OS"); } }

Target:
private GeneralCommandLine getCommandLine(File sdk) { ProgressIndicator progressIndicator = ProgressManager.getInstance().getProgressIndicator(); progressIndicator.setIndeterminate(true); progressIndicator.setText("Running Intel® HAXM installer"); int memorySize = myState.getNotNull(KEY_EMULATOR_MEMORY_MB, getRecommendedMemoryAllocation()); String path = FileUtil.join(SdkConstants.FD_EXTRAS, COMPONENT_VENDOR, COMPONENT_PATH); File sourceLocation = new File(sdk, path); if (SystemInfo.isMac) { return getMacHaxmInstallCommandLine(sourceLocation, memorySize); } else if (SystemInfo.isWindows) { return getWindowsHaxmInstallCommandLine(sourceLocation, memorySize); } else { assert !isSupportedOS(); throw new IllegalStateException("Usupported OS"); } }
Source:
private Duration extractDuration(String duration) { List<String> tokens = ImmutableList.copyOf(durationSplitter.split(duration)); int hours = Integer.parseInt(tokens.get(0)); int minutes = Integer.parseInt(tokens.get(1)); int seconds = Integer.parseInt(tokens.get(2)); return Duration.standardSeconds(seconds + minutes * SECONDS_PER_MIN + hours * SECONDS_PER_HOUR); }

Target:
private Duration extractDuration(String duration) { return durationFormatter.parsePeriod(duration).toStandardDuration(); }
Source:
private Map<String, String> processRegistrationPayload( final Context context, final String payload ) { Object[] obj; try { obj = (Object[]) weborb.util.io.Serializer.fromBytes( payload.getBytes(), weborb.util.io.Serializer.JSON, false ); } catch( IOException e ) { callback.onError( context, "Could not deserialize server response: " + e.getMessage() ); return null; } PushTemplateHelper.deleteNotificationChannel( context ); Map<String, AndroidPushTemplate> templates = (Map<String, AndroidPushTemplate>) obj[ 1 ]; if( android.os.Build.VERSION.SDK_INT > 25 ) for( AndroidPushTemplate templ : templates.values() ) PushTemplateHelper.getOrCreateNotificationChannel( context.getApplicationContext(), templ ); PushTemplateHelper.setPushNotificationTemplates( templates, payload.getBytes() ); String regs = (String) obj[ 0 ]; Map<String, String> channelRegistrations = new HashMap<>(); String[] regPairs = regs.split( "," ); for( String pair : regPairs ) { String[] valueKey = pair.split( "::" ); channelRegistrations.put( valueKey[1], valueKey[0] ); } return channelRegistrations; }

Target:
private Map<String, String> processRegistrationPayload( final Context context, final String payload ) { Object[] obj; try { obj = (Object[]) weborb.util.io.Serializer.fromBytes( payload.getBytes(), weborb.util.io.Serializer.JSON, false ); } catch( IOException e ) { Log.e( TAG, "Could not deserialize server response: " + e.getMessage() ); callback.onError( context, "Could not deserialize server response: " + e.getMessage() ); return null; } PushTemplateHelper.deleteNotificationChannel( context ); Map<String, AndroidPushTemplate> templates = (Map<String, AndroidPushTemplate>) obj[ 1 ]; if( android.os.Build.VERSION.SDK_INT > 25 ) { for( AndroidPushTemplate templ : templates.values() ) PushTemplateHelper.getOrCreateNotificationChannel( context.getApplicationContext(), templ ); } PushTemplateHelper.setPushNotificationTemplates( templates, payload.getBytes() ); String regs = (String) obj[ 0 ]; Map<String, String> channelRegistrations = new HashMap<>(); String[] regPairs = regs.split( "," ); for( String pair : regPairs ) { String[] valueKey = pair.split( "::" ); channelRegistrations.put( valueKey[1], valueKey[0] ); } return channelRegistrations; }
Source:
public SecurityGroup createSecurityGroup(String name, Location location) { String zone = location.getId(); if (zone != null) { return createSecurityGroup(name, zone); } else { return null; } }

Target:
public SecurityGroup createSecurityGroup(String name, Location location) { String zone = location.getId(); if (zone == null) { return null; } return createSecurityGroup(name, zone); }
Source:
protected Response buildQueryResponse( final HttpServletRequest req, final Query query, final QueryToolChest toolChest, final ObjectWriter jsonWriter, final String contentType, final long startTime, final Yielder yielder, final Map<String, Object> responseContext ) throws IOException { try { return Response .ok( new StreamingOutput() { @Override public void write(OutputStream outputStream) throws IOException, WebApplicationException { CountingOutputStream os = new CountingOutputStream(outputStream); jsonWriter.writeValue( os, ImmutableMap.of( "result", yielder, "context", responseContext ) ); os.flush(); os.close(); final long queryTime = System.currentTimeMillis() - startTime; emitter.emit( DruidMetrics.makeQueryTimeMetric(toolChest, jsonMapper, query, req.getRemoteAddr()) .setDimension("success", "true") .build("query/time", queryTime) ); emitter.emit( DruidMetrics.makeQueryTimeMetric(toolChest, jsonMapper, query, req.getRemoteAddr()) .build("query/bytes", os.getCount()) ); requestLogger.log( new RequestLogLine( new DateTime(startTime), req.getRemoteAddr(), query, new QueryStats( ImmutableMap.<String, Object>of( "query/time", queryTime, "query/bytes", os.getCount(), "success", true ) ) ) ); } }, contentType ) .header("X-Druid-Query-Id", query.getId()) .build(); } catch (Exception e) { yielder.close(); throw Throwables.propagate(e); } finally { } }

Target:
protected Response buildQueryResponse( final HttpServletRequest req, final Query query, final QueryToolChest toolChest, final ObjectWriter jsonWriter, final String contentType, final long startTime, final Yielder yielder, final Map<String, Object> responseContext ) throws IOException { try { return Response .ok( new StreamingOutput() { @Override public void write(OutputStream outputStream) throws IOException, WebApplicationException { CountingOutputStream os = new CountingOutputStream(outputStream); try { serializeResponseToOS( jsonWriter, os, ImmutableMap.of( "result", yielder, "context", responseContext ) ); os.flush(); } finally { os.close(); } final long queryTime = System.currentTimeMillis() - startTime; emitter.emit( DruidMetrics.makeQueryTimeMetric(toolChest, jsonMapper, query, req.getRemoteAddr()) .setDimension("success", "true") .build("query/time", queryTime) ); emitter.emit( DruidMetrics.makeQueryTimeMetric(toolChest, jsonMapper, query, req.getRemoteAddr()) .build("query/bytes", os.getCount()) ); requestLogger.log( new RequestLogLine( new DateTime(startTime), req.getRemoteAddr(), query, new QueryStats( ImmutableMap.<String, Object>of( "query/time", queryTime, "query/bytes", os.getCount(), "success", true ) ) ) ); } }, contentType ) .header("X-Druid-Query-Id", query.getId()) .build(); } catch (Exception e) { yielder.close(); throw Throwables.propagate(e); } finally { } }
Source:
public MetadataField findByString(Context context, String mdString, char separator) throws SQLException { String[] seq = StringUtils.split(mdString, separator); String schema = seq.length > 1 ? seq[0] : null; String element = seq.length > 1 ? seq[1] : null; String qualifier = seq.length == 3 ? seq[2] : null; if (schema == null || element == null) { return null; } else { MetadataSchema metadataSchema = metadataSchemaService.find(context, schema); return this.findByElement(context, metadataSchema, element, qualifier); } }

Target:
public MetadataField findByString(Context context, String mdString, char separator) throws SQLException { String[] seq = StringUtils.split(mdString, separator); String schema = seq.length > 1 ? seq[0] : null; String element = seq.length > 1 ? seq[1] : null; String qualifier = seq.length == 3 ? seq[2] : null; if (schema == null || element == null) { return null; } else { return this.findByElement(context, schema, element, qualifier); } }
Source:
public StreamProperties visitSpatialJoin(SpatialJoinNode node, List<StreamProperties> inputProperties) { StreamProperties leftProperties = inputProperties.get(0); switch (node.getType()) { case INNER: case LEFT: return leftProperties.translate(column -> PropertyDerivations.filterIfMissing(node.getOutputSymbols(), column)); default: throw new UnsupportedOperationException("Unsupported spatial join type: " + node.getType()); } }

Target:
public StreamProperties visitSpatialJoin(SpatialJoinNode node, List<StreamProperties> inputProperties) { StreamProperties leftProperties = inputProperties.get(0); switch (node.getType()) { case INNER: case LEFT: return leftProperties.translate(column -> PropertyDerivations.filterIfMissing(node.getOutputSymbols(), column)); default: throw new IllegalArgumentException("Unsupported spatial join type: " + node.getType()); } }
Source:
public String toString() { return String.format( "access_token=%s; access_type=%s; expires_in=%d; scope=%s; refresh_token=%s", access_token, token_type, expires_in, scope, refresh_token); }

Target:
public String toString() { return String.format( "access_token=%s; token_type=%s; expires_in=%d; scope=%s; refresh_token=%s", access_token, token_type, expires_in, scope, refresh_token); }
Source:
private static boolean copyDescription( RtpDescriptionPacketExtension description, ColibriConferenceIQ.Channel channel) { boolean added = false; for (PayloadTypePacketExtension payloadType : description.getPayloadTypes()) { channel.addPayloadType(payloadType); added = true; } for (RTPHdrExtPacketExtension rtpHdrExt : description.getExtmapList()) { channel.addRtpHeaderExtension(rtpHdrExt); added = true; } return added; }

Target:
private static boolean copyDescription( RtpDescriptionPacketExtension description, ColibriConferenceIQ.Channel channel) { boolean added = false; for (PayloadTypePacketExtension payloadType : description.getPayloadTypes()) { channel.addPayloadType(new PayloadTypePacketExtension(payloadType)); added = true; } for (RTPHdrExtPacketExtension rtpHdrExt : description.getExtmapList()) { channel .addRtpHeaderExtension(new RTPHdrExtPacketExtension(rtpHdrExt)); added = true; } return added; }
Source:
public static Optional<String> stringFilter(TupleDomain<Integer> constraint, int index) { checkArgument(!constraint.isNone(), "Constraint is none"); Domain domain = constraint.getDomains().get().get(index); if ((domain == null) || !domain.isSingleValue()) { return Optional.empty(); } Object value = domain.getSingleValue(); if (value instanceof Slice) { return Optional.of(((Slice) value).toStringUtf8()); } return Optional.empty(); }

Target:
public static Optional<String> stringFilter(TupleDomain<Integer> constraint, int index) { if (constraint.isNone()) { return Optional.empty(); } Domain domain = constraint.getDomains().get().get(index); if ((domain == null) || !domain.isSingleValue()) { return Optional.empty(); } Object value = domain.getSingleValue(); if (value instanceof Slice) { return Optional.of(((Slice) value).toStringUtf8()); } return Optional.empty(); }
Source:
static Builder builder() { return Sponge.getRegistry().createBuilder(SoundType.Builder.class); }

Target:
static Builder builder() { return Sponge.getRegistry().createBuilder(Builder.class); }
Source:
public ResultScanner<FlatRow> readFlatRows(ReadRowsRequest request) { if (shouldOverrideAppProfile(request.getAppProfileId())) { request = request.toBuilder().setAppProfileId(clientDefaultAppProfileId).build(); } final ResponseQueueReader reader = new ResponseQueueReader(retryOptions.getReadPartialRowTimeoutMillis() + 500); RetryingReadRowsOperation operation = createReadRowsRetryListener(request, reader); operation.setResultObserver(new StreamObserver<ReadRowsResponse>(){ @Override public void onNext(ReadRowsResponse value) { reader.addRequestResultMarker(); } @Override public void onError(Throwable t) @Override public void onCompleted() }); operation.getAsyncResult(); return new ResumingStreamingResultScanner(reader); }

Target:
public ResultScanner<FlatRow> readFlatRows(ReadRowsRequest request) { if (shouldOverrideAppProfile(request.getAppProfileId())) { request = request.toBuilder().setAppProfileId(clientDefaultAppProfileId).build(); } final ResponseQueueReader reader = new ResponseQueueReader(); RetryingReadRowsOperation operation = createReadRowsRetryListener(request, reader); operation.setResultObserver(new StreamObserver<ReadRowsResponse>(){ @Override public void onNext(ReadRowsResponse value) { reader.addRequestResultMarker(); } @Override public void onError(Throwable t) @Override public void onCompleted() }); operation.getAsyncResult(); return new ResumingStreamingResultScanner(reader); }
Source:
private static byte[] clearZeroBytesFromString(byte[] data, int maxLength) { if (data == null) return null; ByteArrayOutputStream dataOut = new ByteArrayOutputStream() ; int limit = (maxLength < data.length) ? maxLength - MAX_NUMBER_OF_UTF8_BYTES : data.length; for (int i = 0; i < limit; i++) { if (data[i] != 0x00) dataOut.write(data[i]); } if(maxLength < data.length) { if (!isASingleByteUTF8Char(data[limit-1])) { int i = 0; while (!isAStartingByteUTF8Char(data[limit + i])) { if (i == MAX_NUMBER_OF_UTF8_BYTES) { break; } dataOut.write(data[limit + i]); i++; } } } return dataOut.toByteArray(); }

Target:
private static byte[] clearZeroBytesFromString(byte[] data, int maxLength) { if (data == null) return null; ByteArrayOutputStream dataOut = new ByteArrayOutputStream() ; boolean maxLengthExceeded = maxLength < data.length; int limit = maxLengthExceeded ? maxLength - MAX_NUMBER_OF_UTF8_BYTES : data.length; for (int i = 0; i < limit; i++) { if (data[i] != 0x00) dataOut.write(data[i]); } if(maxLengthExceeded) { if (!isASingleByteUTF8Char(data[limit-1])) { int i = 0; while (!isAStartingByteUTF8Char(data[limit + i])) { if (i == MAX_NUMBER_OF_UTF8_BYTES) { log.error("The message data contains invalid UTF-8 character. The byte limit for one character was exceeded."); break; } dataOut.write(data[limit + i]); i++; } } } return dataOut.toByteArray(); }
Source:
public String toString() { return "SlottedInventoryItem{inventoryId=" + inventoryId + ", item=" + item + "}"; }

Target:
public String toString() { return MoreObjects.toStringHelper(this) .add("inventoryId", inventoryId) .add("item", item) .toString(); }
Source:
public void afterBegin() throws EJBException, RemoteException { log.info("afterBegin called"); checker.setSynchronizedBegin(); }

Target:
public void afterBegin() throws EJBException, RemoteException { log.trace("afterBegin called"); checker.setSynchronizedBegin(); }
Source:
private MethodDescriptor( Method method, StarlarkMethod annotation, String name, String doc, boolean documented, boolean structField, ParamDescriptor[] parameters, boolean extraPositionals, boolean extraKeywords, boolean selfCall, boolean allowReturnNones, boolean useStarlarkThread, boolean useStarlarkSemantics) { this.method = method; this.annotation = annotation; this.name = name; this.doc = doc; this.documented = documented; this.structField = structField; this.parameters = parameters; this.extraPositionals = extraPositionals; this.extraKeywords = extraKeywords; this.selfCall = selfCall; this.allowReturnNones = allowReturnNones; this.useStarlarkThread = useStarlarkThread; this.useStarlarkSemantics = useStarlarkSemantics; if (method.getReturnType() == void.class) { howToHandleReturn = HowToHandleReturn.RETURN_NONE; } else if (StarlarkValue.class.isAssignableFrom(method.getReturnType()) || String.class == method.getReturnType() || Boolean.class == method.getReturnType()) { howToHandleReturn = allowReturnNones ? HowToHandleReturn.NULL_TO_NONE : HowToHandleReturn.ERROR_ON_NULL; } else if (boolean.class == method.getReturnType()) { howToHandleReturn = HowToHandleReturn.RETURN; } else if (int.class == method.getReturnType()) { howToHandleReturn = HowToHandleReturn.STARLARK_INT_OF_INT; } else { howToHandleReturn = HowToHandleReturn.FROM_JAVA; } }

Target:
private MethodDescriptor( Method method, StarlarkMethod annotation, String name, String doc, boolean documented, boolean structField, ParamDescriptor[] parameters, boolean extraPositionals, boolean extraKeywords, boolean selfCall, boolean allowReturnNones, boolean useStarlarkThread, boolean useStarlarkSemantics) { this.method = method; this.annotation = annotation; this.name = name; this.doc = doc; this.documented = documented; this.structField = structField; this.parameters = parameters; this.extraPositionals = extraPositionals; this.extraKeywords = extraKeywords; this.selfCall = selfCall; this.allowReturnNones = allowReturnNones; this.useStarlarkThread = useStarlarkThread; this.useStarlarkSemantics = useStarlarkSemantics; Class<?> ret = method.getReturnType(); if (ret == void.class || ret == boolean.class) { howToHandleReturn = HowToHandleReturn.NULL_TO_NONE; } else if (StarlarkValue.class.isAssignableFrom(ret) || ret == String.class || ret == Boolean.class) { howToHandleReturn = allowReturnNones ? HowToHandleReturn.NULL_TO_NONE : HowToHandleReturn.ERROR_ON_NULL; } else if (ret == int.class) { howToHandleReturn = HowToHandleReturn.STARLARK_INT_OF_INT; } else { howToHandleReturn = HowToHandleReturn.FROM_JAVA; } }
Source:
public void next() { RadioDroidApp radioDroidApp = (RadioDroidApp) this.getApplication(); DataRadioStation station = radioDroidApp.getFavouriteManager().getNextById(currentStationID); if (station != null) new RadioDroidBrowserService.GetRealLinkAndPlayTask(itsContext, station, itsBinder).execute(); }

Target:
public void next() { RadioDroidApp radioDroidApp = (RadioDroidApp) getApplication(); DataRadioStation station = radioDroidApp.getFavouriteManager().getNextById(currentStationID); if (station != null) new GetRealLinkAndPlayTask(itsContext, station, itsBinder).execute(); }
Source:
private ModelField getModelField(String factName, String fieldName) { ModelField toReturn = null; if (modelFieldsMap.containsKey(factName)) { final ModelField[] modelFields = modelFieldsMap.get(factName); for (ModelField modelField : modelFields) { if (modelField.getName().equals(fieldName)) { toReturn = modelField; break; } } } return toReturn; }

Target:
private ModelField getModelField(String factName, String fieldName) { ModelField toReturn = null; if (modelFieldsMap.containsKey(factName)) { final ModelField[] modelFields = modelFieldsMap.get(factName); for (ModelField modelField : modelFields) { if (Objects.equals(modelField.getName(), fieldName)) { toReturn = modelField; break; } } } return toReturn; }
Source:
public AmbryBlobStorageServiceFactory(VerifiableProperties verifiableProperties, ClusterMap clusterMap, RestResponseHandler responseHandler, Router router, AccountService accountService) { if (verifiableProperties == null || clusterMap == null || responseHandler == null || router == null) { throw new IllegalArgumentException("Null arguments were provided during instantiation!"); } else { frontendConfig = new FrontendConfig(verifiableProperties); frontendMetrics = new FrontendMetrics(clusterMap.getMetricRegistry()); this.verifiableProperties = verifiableProperties; this.clusterMap = clusterMap; this.responseHandler = responseHandler; this.router = router; this.accountService = accountService; } logger.trace("Instantiated AmbryBlobStorageServiceFactory"); }

Target:
public AmbryBlobStorageServiceFactory(VerifiableProperties verifiableProperties, ClusterMap clusterMap, RestResponseHandler responseHandler, Router router, AccountService accountService) { this.verifiableProperties = Objects.requireNonNull(verifiableProperties, "Provided VerifiableProperties is null"); this.clusterMap = Objects.requireNonNull(clusterMap, "Provided ClusterMap is null"); this.responseHandler = Objects.requireNonNull(responseHandler, "Provided RestResponseHandler is null"); this.router = Objects.requireNonNull(router, "Provided Router is null"); this.accountService = Objects.requireNonNull(accountService, "Provided AccountService is null"); frontendConfig = new FrontendConfig(verifiableProperties); frontendMetrics = new FrontendMetrics(clusterMap.getMetricRegistry()); logger.trace("Instantiated AmbryBlobStorageServiceFactory"); }
Source:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Mapbox.getInstance(this, getString(R.string.access_token)); setContentView(R.layout.activity_dds_text_field_formatting); mapView = findViewById(R.id.mapView); mapView.onCreate(savedInstanceState); mapView.getMapAsync(new OnMapReadyCallback() { @Override public void onMapReady(@NonNull MapboxMap mapboxMap) { mapboxMap.setStyle(Style.DARK, new Style.OnStyleLoaded() { @Override public void onStyleLoaded(@NonNull final Style style) { Toast.makeText(TextFieldFormattingActivity.this, getString(R.string.instruction_toast), Toast.LENGTH_SHORT).show(); FloatingActionButton textFontFab = findViewById(R.id.fab_toggle_font); textFontFab.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { adjustText(style, textFont(fontChanged ? new String[] {textFonts[1]} : new String[] {textFonts[0]})); fontChanged = !fontChanged; } }); FloatingActionButton textSizeFab = findViewById(R.id.fab_toggle_text_size); textSizeFab.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { adjustText(style, textSize(sizeChanged ? textSizes[1] : textSizes[0])); sizeChanged = !sizeChanged; } }); FloatingActionButton textColorFab = findViewById(R.id.fab_toggle_text_color); textColorFab.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { adjustText(style, textColor(colorChanged ? textColors[1] : textColors[0])); colorChanged = !colorChanged; } }); } }); } }); }

Target:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Mapbox.getInstance(this, getString(R.string.access_token)); setContentView(R.layout.activity_dds_text_field_formatting); mapView = findViewById(R.id.mapView); mapView.onCreate(savedInstanceState); mapView.getMapAsync(new OnMapReadyCallback() { @Override public void onMapReady(@NonNull final MapboxMap mapboxMap) { mapboxMap.setStyle(Style.DARK, new Style.OnStyleLoaded() { @Override public void onStyleLoaded(@NonNull final Style style) { TextFieldFormattingActivity.this.mapboxMap = mapboxMap; Toast.makeText(TextFieldFormattingActivity.this, getString(R.string.instruction_toast), Toast.LENGTH_SHORT).show(); findViewById(R.id.fab_toggle_font).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { adjustText(textFont(fontChanged ? new String[] {textFonts[1]} : new String[] {textFonts[0]})); fontChanged = !fontChanged; } }); findViewById(R.id.fab_toggle_text_size).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { adjustText(textSize(sizeChanged ? textSizes[1] : textSizes[0])); sizeChanged = !sizeChanged; } }); findViewById(R.id.fab_toggle_text_color).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { adjustText(textColor(colorChanged ? textColors[1] : textColors[0])); colorChanged = !colorChanged; } }); } }); } }); }
Source:
public AggregationDataStoreTransaction(QueryEngine queryEngine, Cache cache, QueryLogger queryLogger) { this.queryEngine = queryEngine; this.cache = cache; this.queryEngineTransaction = queryEngine.beginTransaction(); this.queryLogger = queryLogger; this.metaDataStore = queryEngine.metaDataStore; }

Target:
public AggregationDataStoreTransaction(QueryEngine queryEngine, Cache cache, QueryLogger queryLogger) { this.queryEngine = queryEngine; this.cache = cache; this.queryEngineTransaction = queryEngine.beginTransaction(); this.queryLogger = queryLogger; this.metaDataStore = queryEngine.getMetaDataStore(); }
Source:
public ServerOAuth2AuthorizedClientExchangeFilterFunction(ReactiveOAuth2AuthorizedClientManager authorizedClientManager) { Assert.notNull(authorizedClientManager, "authorizedClientManager cannot be null"); this.authorizedClientManager = authorizedClientManager; this.responseHandler = createDefaultResponseHandler(authorizedClientManager); }

Target:
public ServerOAuth2AuthorizedClientExchangeFilterFunction(ReactiveOAuth2AuthorizedClientManager authorizedClientManager) { Assert.notNull(authorizedClientManager, "authorizedClientManager cannot be null"); this.authorizedClientManager = authorizedClientManager; this.clientResponseHandler = (request, responseMono) -> responseMono; }
Source:
public void contextEstablished(final Exchange exchange) { Request currentRequest = exchange.getCurrentRequest(); Request request = exchange.getRequest(); if (request == currentRequest && request != null && request.isObserve()) { observationStore.setContext(request.getToken(), exchange.getCorrelationContext()); } KeyToken token = KeyToken.fromOutboundMessage(currentRequest); exchangeStore.setContext(token, exchange.getCorrelationContext()); }

Target:
public void contextEstablished(final Exchange exchange) { Request request = exchange.getRequest(); if (request != null && request.isObserve()) { observationStore.setContext(request.getToken(), exchange.getCorrelationContext()); } }
Source:
public void testCreateTableNotExistsFalse() throws Exception { CreateTable statement = new CreateTable(QualifiedName.of("test_table"), ImmutableList.of(new ColumnDefinition("a", "BIGINT", Optional.empty())), false, ImmutableMap.of(), Optional.empty()); try { getFutureValue(new CreateTableTask().internalExecute(statement, metadata, new AllowAllAccessControl(), testSession, emptyList())); fail("CreateTableTask should throw when notExists is set to false"); } catch (RuntimeException e) { } assertEquals(metadata.getCreateTableCallCount(), 1); }

Target:
public void testCreateTableNotExistsFalse() throws Exception { CreateTable statement = new CreateTable(QualifiedName.of("test_table"), ImmutableList.of(new ColumnDefinition("a", "BIGINT", Optional.empty())), false, ImmutableMap.of(), Optional.empty()); try { getFutureValue(new CreateTableTask().internalExecute(statement, metadata, new AllowAllAccessControl(), testSession, emptyList())); fail("expected exception"); } catch (RuntimeException e) { assertTrue(e instanceof PrestoException); PrestoException prestoException = (PrestoException) e; assertTrue(prestoException.getErrorCode().equals(ALREADY_EXISTS.toErrorCode())); } assertEquals(metadata.getCreateTableCallCount(), 1); }
Source:
public void actionPerformed(ActionEvent e) { List<Context> contexts = getContexts(); if (contexts == null) { return; } String contextList = contexts.stream().map(c -> c.getName()).collect(Collectors.joining(", ")); if (View.getSingleton() .showConfirmDialog( contexts.size() > 1 ? Constant.messages.getString( "context.delete.warning.multiple", contextList) : Constant.messages.getString("context.delete.warning")) == JOptionPane.OK_OPTION) { for (Context context : contexts) { Model.getSingleton().getSession().deleteContext(context); } } }

Target:
public void actionPerformed(ActionEvent e) { List<Context> contexts = getContexts(); if (contexts.isEmpty()) { return; } String contextList = contexts.stream().map(Context::getName).collect(Collectors.joining("\n")); if (View.getSingleton() .showConfirmDialog( contexts.size() > 1 ? Constant.messages.getString( "context.delete.warning.multiple", contextList) : Constant.messages.getString("context.delete.warning")) == JOptionPane.OK_OPTION) { for (Context context : contexts) { Model.getSingleton().getSession().deleteContext(context); } } }
Source:
private JarCreator(File file) throws IOException { try { aos = new ArchiveStreamFactory().createArchiveOutputStream(ArchiveStreamFactory.JAR, new FileOutputStream(file)); } catch (ArchiveException e) { throw new IOException(e); } }

Target:
private JarCreator(File file) throws IOException { jos = new JarOutputStream(new FileOutputStream(file)); }
Source:
public void onProfileServiceStateChanged(ProfileService profile, int state) { if (state != BluetoothAdapter.STATE_ON && state != BluetoothAdapter.STATE_OFF) { Log.e(TAG, "onProfileServiceStateChanged: Unhandled " + BluetoothAdapter.nameForState( state)); return; } Message m = mHandler.obtainMessage(MESSAGE_PROFILE_SERVICE_STATE_CHANGED); m.obj = profile; m.arg1 = state; mHandler.sendMessage(m); }

Target:
public void onProfileServiceStateChanged(ProfileService profile, int state) { if (state != BluetoothAdapter.STATE_ON && state != BluetoothAdapter.STATE_OFF) { throw new IllegalArgumentException(BluetoothAdapter.nameForState(state)); } Message m = mHandler.obtainMessage(MESSAGE_PROFILE_SERVICE_STATE_CHANGED); m.obj = profile; m.arg1 = state; mHandler.sendMessage(m); }
Source:
public boolean apply(Game game, Ability source) { Player player = game.getPlayer(source.getControllerId()); if (player == null || player.getHand().count(StaticFilters.FILTER_CARD_LAND, game) < 1) { return false; } TargetCardInHand toDiscard = new TargetCardInHand(0, Integer.MAX_VALUE, StaticFilters.FILTER_CARD_LAND); player.chooseTarget(Outcome.Discard, toDiscard, source, game); int count = player.discard(new CardsImpl(toDiscard.getTargets()), source, game).size(); if (count < 1) { return false; } Permanent permanent = game.getPermanent(source.getSourceId()); if (permanent != null) { permanent.addCounters(CounterType.P1P1.createInstance(count), source, game); } player.drawCards(count, source.getSourceId(), game); return true; }

Target:
public boolean apply(Game game, Ability source) { Player player = game.getPlayer(source.getControllerId()); if (player == null || player.getHand().count(StaticFilters.FILTER_CARD_LAND, game) < 1) { return false; } TargetCardInHand toDiscard = new TargetCardInHand(0, Integer.MAX_VALUE, StaticFilters.FILTER_CARD_LAND); player.chooseTarget(Outcome.AIDontUseIt, toDiscard, source, game); int count = player.discard(new CardsImpl(toDiscard.getTargets()), source, game).size(); if (count < 1) { return false; } Permanent permanent = game.getPermanent(source.getSourceId()); if (permanent != null) { permanent.addCounters(CounterType.P1P1.createInstance(count), source, game); } player.drawCards(count, source.getSourceId(), game); return true; }
Source:
public CorfuTable(IndexRegistry<K, V> indices, Map<K, V> mapImpl) { indices.forEach(index -> { secondaryIndexes.put(index.getName().get(), new HashMap<>()); indexSpec.add(index); }); log.info("CorfuTable: creating CorfuTable with the following indexes: {}", secondaryIndexes.keySet().toString()); mainMap = mapImpl; }

Target:
public CorfuTable(IndexRegistry<K, V> indices, Map<K, V> mapImpl) { indices.forEach(index -> { secondaryIndexes.put(index.getName().get(), new HashMap<>()); indexSpec.add(index); }); log.info("CorfuTable: creating CorfuTable with the following indexes: {}", secondaryIndexes.keySet()); mainMap = mapImpl; }
Source:
protected Context doPublish(ServiceTarget target, DeploymentUnit unit) throws Exception { final Deployment deployment = unit.getAttachment(WSAttachmentKeys.DEPLOYMENT_KEY); final List<Endpoint> endpoints = deployment.getService().getEndpoints(); if (!runningInService) { final ServiceRegistry registry = unit.getServiceRegistry(); final UninterruptibleCountDownLatch latch = new UninterruptibleCountDownLatch(endpoints.size()); final LifecycleListener listener = new LifecycleListener() { @Override public void handleEvent(final ServiceController<?> controller, final LifecycleEvent event) { if (event == LifecycleEvent.UP) latch.countDown(); } }; ServiceName serviceName; for (Endpoint ep : endpoints) { serviceName = EndpointService.getServiceName(unit, ep.getShortName()); registry.getRequiredService(serviceName).addListener(listener); } latch.awaitUninterruptibly(); } deployment.addAttachment(WebDeploymentController.class, startWebApp(host, unit)); return new Context(unit.getAttachment(WSAttachmentKeys.JBOSSWEB_METADATA_KEY).getContextRoot(), endpoints); }

Target:
protected Context doPublish(ServiceTarget target, DeploymentUnit unit) throws Exception { final Deployment deployment = unit.getAttachment(WSAttachmentKeys.DEPLOYMENT_KEY); final List<Endpoint> endpoints = deployment.getService().getEndpoints(); if (!runningInService) { final ServiceRegistry registry = unit.getServiceRegistry(); final CountDownLatch latch = new CountDownLatch(endpoints.size()); final LifecycleListener listener = new LifecycleListener() { @Override public void handleEvent(final ServiceController<?> controller, final LifecycleEvent event) { if (event == LifecycleEvent.UP) { latch.countDown(); controller.removeListener(this); } } }; ServiceName serviceName; for (Endpoint ep : endpoints) { serviceName = EndpointService.getServiceName(unit, ep.getShortName()); registry.getRequiredService(serviceName).addListener(listener); } latch.await(); } deployment.addAttachment(WebDeploymentController.class, startWebApp(host, unit)); return new Context(unit.getAttachment(WSAttachmentKeys.JBOSSWEB_METADATA_KEY).getContextRoot(), endpoints); }
Source:
public double getfreeDiskPercent() { int usedDiskSize = getused_disk_size() == null ? 0 : getused_disk_size(); int availableDiskSize = getavailable_disk_size() == null ? 0 : getavailable_disk_size(); double totalSize = usedDiskSize + availableDiskSize; return totalSize != 0 ? (availableDiskSize / totalSize) * 100 : 0; }

Target:
public double getfreeDiskPercent() { int usedDiskSize = getused_disk_size() == null ? 0 : getused_disk_size(); int availableDiskSize = getavailable_disk_size() == null ? 0 : getavailable_disk_size(); double totalSize = usedDiskSize + availableDiskSize; return totalSize != 0 ? (availableDiskSize / totalSize) * 100 : 0.0; }