auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void initializePersistenceStrategy(Set<EntityKeyMetadata> entityTypes, Set<AssociationKeyMetadata> associationTypes, Set<IdSourceKeyMetadata> idSourceTypes) { if ( config.getPersistenceStrategy() == org.hibernate.ogm.datastore.infinispan.options.PersistenceStrategy.CACHE_PER_KIND ) { persistenceStrategy = PersistenceStrategy.getPerKindStrategy( externalCacheManager, config.getConfigurationUrl(), jtaPlatform ); } else { persistenceStrategy = PersistenceStrategy.getPerTableStrategy( externalCacheManager, config.getConfigurationUrl(), jtaPlatform, entityTypes, associationTypes, idSourceTypes ); } this.externalCacheManager = null; this.jtaPlatform = null; }

Target:
public void initializePersistenceStrategy(Set<EntityKeyMetadata> entityTypes, Set<AssociationKeyMetadata> associationTypes, Set<IdSourceKeyMetadata> idSourceTypes) { persistenceStrategy = PersistenceStrategy.getInstance( config.getPersistenceStrategy(), externalCacheManager, config.getConfigurationUrl(), jtaPlatform, entityTypes, associationTypes, idSourceTypes ); this.externalCacheManager = null; this.jtaPlatform = null; }
Source:
public static TObject javaToThrift(Object object) { ByteBuffer bytes; Type type = null; if(object instanceof Boolean) { bytes = ByteBuffer.allocate(1); bytes.put((boolean) object ? (byte) 1 : (byte) 0); type = Type.BOOLEAN; } else if(object instanceof Double) { bytes = ByteBuffer.allocate(8); bytes.putDouble((double) object); type = Type.DOUBLE; } else if(object instanceof Float) { bytes = ByteBuffer.allocate(4); bytes.putFloat((float) object); type = Type.FLOAT; } else if(object instanceof Link) { bytes = ByteBuffer.allocate(8); bytes.putLong(((Link) object).longValue()); type = Type.LINK; } else if(object instanceof Long) { bytes = ByteBuffer.allocate(8); bytes.putLong((long) object); type = Type.LONG; } else if(object instanceof Integer) { bytes = ByteBuffer.allocate(4); bytes.putInt((int) object); type = Type.INTEGER; } else if(object instanceof Catchphrase) { bytes = ByteBuffer.wrap( ((Catchphrase) object).stringValue() .getBytes(StandardCharsets.UTF_8)); type = Type.CATCHPHRASE; } else { bytes = ByteBuffer.wrap(object.toString().getBytes( StandardCharsets.UTF_8)); type = Type.STRING; } bytes.rewind(); return new TObject(bytes, type); }

Target:
public static TObject javaToThrift(Object object) { ByteBuffer bytes; Type type = null; if(object instanceof Boolean) { bytes = ByteBuffer.allocate(1); bytes.put((boolean) object ? (byte) 1 : (byte) 0); type = Type.BOOLEAN; } else if(object instanceof Double) { bytes = ByteBuffer.allocate(8); bytes.putDouble((double) object); type = Type.DOUBLE; } else if(object instanceof Float) { bytes = ByteBuffer.allocate(4); bytes.putFloat((float) object); type = Type.FLOAT; } else if(object instanceof Link) { bytes = ByteBuffer.allocate(8); bytes.putLong(((Link) object).longValue()); type = Type.LINK; } else if(object instanceof Long) { bytes = ByteBuffer.allocate(8); bytes.putLong((long) object); type = Type.LONG; } else if(object instanceof Integer) { bytes = ByteBuffer.allocate(4); bytes.putInt((int) object); type = Type.INTEGER; } else if(object instanceof Tag) { bytes = ByteBuffer.wrap(object.toString() .getBytes(StandardCharsets.UTF_8)); type = Type.TAG; } else { bytes = ByteBuffer.wrap(object.toString().getBytes( StandardCharsets.UTF_8)); type = Type.STRING; } bytes.rewind(); return new TObject(bytes, type); }
Source:
public void createDefaultFactory() throws Exception { ConfigurationFactory<Example> factory = factoryFactory.create(Example.class, validator, Jackson.newObjectMapper(), "dw"); final Example example = factory.build(new FileConfigurationSourceProvider(), validFile.getPath()); assertThat(example.getName()) .isEqualTo("Coda Hale"); }

Target:
public void createDefaultFactory() throws Exception { ConfigurationFactory<Example> factory = factoryFactory.create(Example.class, validator, Jackson.newObjectMapper(), "dw"); final Example example = factory.build(validFile); assertThat(example.getName()) .isEqualTo("Coda Hale"); }
Source:
private IAuditLogger getAuditLogger(ParameterizedClass logger) throws ConfigurationException { if (logger.class_name != null) { return FBUtilities.newAuditLogger(logger.class_name, logger.parameters); } return FBUtilities.newAuditLogger(BinAuditLogger.class.getName(), null); }

Target:
private IAuditLogger getAuditLogger(ParameterizedClass logger) throws ConfigurationException { if (logger.class_name != null) { return FBUtilities.newAuditLogger(logger.class_name, logger.parameters == null ? Collections.emptyMap() : logger.parameters); } return FBUtilities.newAuditLogger(BinAuditLogger.class.getName(), Collections.emptyMap()); }
Source:
public void testExpressionsWithTrailingWhitespace() { String propertyValue = "${key} "; ModelType attributeType = ModelType.EXPRESSION; ModelNode mn = ParseUtils.parseAttributeValue(propertyValue, true, attributeType); assertEquals("wrong ModelType,", ModelType.EXPRESSION, mn.getType()); String parsedPropertyValue = mn.asExpression().getExpressionString(); assertEquals("wrong parsedAttributeValue,", propertyValue, parsedPropertyValue); }

Target:
public void testExpressionsWithTrailingWhitespace() { String propertyValue = "${key} "; ModelType attributeType = ModelType.STRING; ModelNode mn = ParseUtils.parseAttributeValue(propertyValue, true, attributeType); assertEquals("wrong ModelType,", ModelType.EXPRESSION, mn.getType()); String parsedPropertyValue = mn.asExpression().getExpressionString(); assertEquals("wrong parsedAttributeValue,", propertyValue, parsedPropertyValue); }
Source:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); if (savedInstanceState == null) { getSupportFragmentManager().beginTransaction() .add(R.id.fragmentContainer, findAnalyzeHotspotsFragment(), AnalyzeHotspotsFragment.class.getSimpleName()) .commit(); } }

Target:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mMapView = findViewById(R.id.mapView); ArcGISMap map = new ArcGISMap(Basemap.createTopographic()); Point center = new Point(-13671170, 5693633, SpatialReferences.getWebMercator()); map.setInitialViewpoint(new Viewpoint(center, 57779)); mMapView.setMap(map); FloatingActionButton calendarFab = findViewById(R.id.calendarButton); calendarFab.setOnClickListener(v -> showDateRangeDialog()); mGeoprocessingTask = new GeoprocessingTask(getString(R.string.hotspot_911_calls_url)); mGeoprocessingTask.loadAsync(); showDateRangeDialog(); }
Source:
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { File originalFile = ServletUtils.makeFileFromSanePath(request.getPathInfo(), base); Locale locale = getLocaleFromRequest(request); File file = determineActualFile(request, locale); file = checkForIndex(request, response, file, request.getPathInfo()); if (file == null) { response.sendError(HttpServletResponse.SC_NOT_FOUND); } else if (!response.isCommitted()){ boolean languagePageShown = isLangPageShown(request); if (!file.equals(originalFile) && !file.getAbsolutePath().equals(replaceLocaleWithOtherLocale(originalFile.getAbsolutePath(), locale, locale))) { String redirect = request.getServletPath() + replaceLocaleWithUSLocale(request.getPathInfo(), locale); if (!languagePageShown) { setLangPageShown(response, true); request.setAttribute(LocaleFilter.LOCALE, locale); request.setAttribute(ENGLISH_HREF, redirect); final ServletContext forwardContext = getServletContext().getContext(localeDocsMissing); final RequestDispatcher dispatcher = forwardContext.getRequestDispatcher(localeDocsMissing); dispatcher.forward(request, response); } else { response.sendRedirect(redirect); } } else { ServletUtils.sendFile(request, response, file, type); } } }

Target:
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { File originalFile = ServletUtils.makeFileFromSanePath(request.getPathInfo(), base); Locale locale = getLocaleFromRequest(request); File file = determineActualFile(request, locale); file = checkForIndex(request, response, file, request.getPathInfo()); if (file == null) { response.sendError(HttpServletResponse.SC_NOT_FOUND); } else if (!response.isCommitted()) { boolean languagePageShown = isLangPageShown(request); if (!file.equals(originalFile) && !file.getAbsolutePath().equals(replaceLocaleWithOtherLocale(originalFile.getAbsolutePath(), locale, locale))) { String redirect = request.getServletPath() + replaceLocaleWithUSLocale(request.getPathInfo(), locale); if (!languagePageShown) { setLangPageShown(response, true); request.setAttribute(LocaleFilter.LOCALE, locale); request.setAttribute(ENGLISH_HREF, redirect); final ServletContext forwardContext = getServletContext().getContext(localeDocsMissing); if (forwardContext != null) { final RequestDispatcher dispatcher = forwardContext.getRequestDispatcher(localeDocsMissing); if (dispatcher != null) { dispatcher.forward(request, response); } else { log.error("Unable to determine dispatcher"); response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "unable to determine dispatcher"); } } else { log.error("Unable to determine forwarding context"); response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "unable to determine forward context"); } } else { response.sendRedirect(redirect); } } else { ServletUtils.sendFile(request, response, file, type); } } }
Source:
public HashBasedNumberedShardSpec( @JsonProperty("partitionNum") int partitionNum, @JsonProperty("partitions") int partitions ) { super(partitionNum, partitions); hashFunction = Hashing.murmur3_32(); }

Target:
public HashBasedNumberedShardSpec( @JsonProperty("partitionNum") int partitionNum, @JsonProperty("partitions") int partitions ) { super(partitionNum, partitions); }
Source:
public Result authenticate(Request request, ContentResponse response, HeaderInfo headerInfo, Attributes context) { byte[] inToken = new byte[0]; try { gssContext = getGssContext(); if (!gssContext.isEstablished()) { inToken = gssContext.initSecContext(inToken, 0, inToken.length); } if (inToken.length > 0) { log.debug("Successfully established GSSContext with source name: %s and target name: %s", gssContext.getSrcName(), gssContext.getTargName()); String spnegoToken = NEGOTIATE + " " + String.valueOf(B64Code.encode(inToken)); URI requestUri = request.getURI(); URI baseUri = new URI(requestUri.getScheme(), requestUri.getHost(), null, null); return new SpnegoResult(headerInfo.getHeader(), baseUri, spnegoToken); } else { log.warn("Failed to establish GSSContext for request %s!", request.getURI()); } gssContext.dispose(); return null; } catch (URISyntaxException | UnknownHostException | LoginException | GSSException e) { throw new AuthenticationException(e); } }

Target:
public Result authenticate(Request request, ContentResponse response, HeaderInfo headerInfo, Attributes context) { URI requestUri = request.getURI(); try (CloseableGSSContext gssContext = new CloseableGSSContext(krb5RemoteServiceName, krb5Keytab, krb5CredentialCache, krb5Principal, requestUri)) { byte[] token = gssContext.getContext().initSecContext(new byte[0], 0, 0); if (token != null) { log.debug("Successfully established GSSContext with source name: %s and target name: %s", gssContext.getContext().getSrcName(), gssContext.getContext().getTargName()); String tokenValue = format("%s %s", NEGOTIATE, Base64.getEncoder().encodeToString(token)); URI baseUri = UriUtil.normalizedUri(requestUri); return new SpnegoResult(headerInfo.getHeader(), baseUri, tokenValue); } throw new AuthenticationException(format("Failed to establish GSSContext for request %s", requestUri)); } catch (GSSException e) { throw new AuthenticationException(e); } }
Source:
public void noModsTest() throws Exception { String title = "new title"; when(binaryObj.getBinaryStream()).thenReturn(null); service.editTitle(agent, pid, title); verify(operationsMessageSender).sendUpdateDescriptionOperation(anyString(), pidsCaptor.capture()); Collection<PID> pids = pidsCaptor.getValue(); assertEquals(pids.size(), 1); assertTrue(pids.contains(pid)); }

Target:
public void noModsTest() throws Exception { String title = "new title"; when(contentObj.getDescription()).thenReturn(null); service.editTitle(agent, pid, title); verify(operationsMessageSender).sendUpdateDescriptionOperation(anyString(), pidsCaptor.capture()); Collection<PID> pids = pidsCaptor.getValue(); assertEquals(1, pids.size()); assertTrue(pids.contains(pid)); Document updatedDoc = getUpdatedDescriptionDocument(); assertTrue(hasTitleValue(updatedDoc, title)); }
Source:
public static URI fromString(String candidate) { try { Long.parseLong(candidate); return Vlan.toUri(candidate); } catch (NumberFormatException nfe) { if (com.cloud.dc.Vlan.UNTAGGED.equalsIgnoreCase(candidate)) { return Native.toUri(candidate); } if (UuidUtils.validateUUID(candidate)){ return null; } try { URI uri = new URI(candidate); BroadcastDomainType tiep = getSchemeValue(uri); if (tiep.scheme != null && tiep.scheme.equals(uri.getScheme())) { return uri; } else { throw new CloudRuntimeException("string '" + candidate + "' has an unknown BroadcastDomainType."); } } catch (URISyntaxException e) { throw new CloudRuntimeException("string is not a broadcast URI: " + candidate); } } }

Target:
public static URI fromString(String candidate) { try { Long.parseLong(candidate); return Vlan.toUri(candidate); } catch (NumberFormatException nfe) { if (com.cloud.dc.Vlan.UNTAGGED.equalsIgnoreCase(candidate)) { return Native.toUri(candidate); } try { URI uri = new URI(candidate); BroadcastDomainType tiep = getSchemeValue(uri); if (tiep.scheme != null && tiep.scheme.equals(uri.getScheme())) { return uri; } else { throw new CloudRuntimeException("string '" + candidate + "' has an unknown BroadcastDomainType."); } } catch (URISyntaxException e) { throw new CloudRuntimeException("string is not a broadcast URI: " + candidate); } } }
Source:
public Optional<RangePredicateExpectations<ZonedDateTime>> getRangePredicateExpectations() { return Optional.of( new RangePredicateExpectations<>( LocalDateTime.of( 2018, 2, 1, 0, 0 ).atZone( ZoneId.of( "Europe/Paris" ) ), LocalDateTime.of( 2018, 3, 1, 0, 0 ).atZone( ZoneId.of( "Europe/Paris" ) ), LocalDateTime.of( 2018, 4, 1, 0, 0 ).atZone( ZoneId.of( "Europe/Paris" ) ), LocalDateTime.of( 2018, 2, 15, 0, 0 ).atZone( ZoneId.of( "Europe/Paris" ) ), LocalDateTime.of( 2018, 3, 15, 0, 0 ).atZone( ZoneId.of( "Europe/Paris" ) ) ) ); }

Target:
public Optional<RangePredicateExpectations<ZonedDateTime>> getRangePredicateExpectations() { return Optional.of( new RangePredicateExpectations<>( LocalDateTime.of( 2018, 2, 1, 0, 0 ).atZone( ZoneId.of( "Europe/Paris" ) ), LocalDateTime.of( 2018, 3, 1, 0, 0 ).atZone( ZoneId.of( "Europe/Paris" ) ), LocalDateTime.of( 2018, 4, 1, 0, 0 ).atZone( ZoneId.of( "Europe/Paris" ) ), LocalDateTime.of( 2018, 2, 15, 0, 0 ).atZone( ZoneId.of( "Europe/Paris" ) ), LocalDateTime.of( 2018, 3, 1, 0, 0 ).atZone( ZoneId.of( "America/Chicago" ) ) ) ); }
Source:
private static Take fallback(final Take take) { return new TkFallback( take, new FbChain( new FbStatus(404, new TkFixed(new RsNotFound())), new Fallback() { @Override public Iterator<Response> route(final RqFallback req) { final String exc = ExceptionUtils.getStackTrace( req.throwable() ); Logger.info(this, "Exception thrown\n%s", exc); return Collections.singleton( Response.class.cast( new RsHTML( String.format( "oops, something went wrong!\n%s", exc ) ) ) ).iterator(); } } ) ); }

Target:
private static Take fallback(final Take take) { return new TkFallback( take, new FbChain( new FbStatus(404, new TkFixed(new RsNotFound())), new FbError() ) ); }
Source:
private boolean updateParameters() { for (MoveDiskParameters moveDiskParameters : getParameters().getParametersList()) { DiskImage diskImage = getDiskImageDao().getAncestor(moveDiskParameters.getImageId()); if (diskImage == null) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_DISK_NOT_EXIST); } List<VM> allVms = getVmDAO().getVmsListForDisk(diskImage.getId()); VM vm = !allVms.isEmpty() ? allVms.get(0) : null; SnapshotsValidator snapshotsValidator = new SnapshotsValidator(); if (vm != null && !validate(snapshotsValidator.vmNotInPreview(vm.getId()))) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_VM_IN_PREVIEW); } else if (vm == null || isVmDown(vm)) { moveParametersList.add(moveDiskParameters); } else if (isVmRunning(vm)) { MultiValueMapUtils.addToMap(vm.getId(), createLiveMigrateDiskParameters(moveDiskParameters, vm.getId()), vmsLiveMigrateParametersMap); } else { addCanDoActionMessage(String.format("$%1$s %2$s", "VmName", vm.getVmName())); return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_VM_IS_NOT_DOWN_OR_UP); } } return true; }

Target:
private boolean updateParameters() { for (MoveDiskParameters moveDiskParameters : getParameters().getParametersList()) { DiskImage diskImage = getDiskImageDao().getAncestor(moveDiskParameters.getImageId()); if (diskImage == null) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_DISK_NOT_EXIST); } List<VM> allVms = getVmDAO().getVmsListForDisk(diskImage.getId()); VM vm = !allVms.isEmpty() ? allVms.get(0) : null; SnapshotsValidator snapshotsValidator = new SnapshotsValidator(); if (vm != null && !validate(snapshotsValidator.vmNotInPreview(vm.getId()))) { return false; } else if (vm == null || isVmDown(vm)) { moveParametersList.add(moveDiskParameters); } else if (isVmRunning(vm)) { MultiValueMapUtils.addToMap(vm.getId(), createLiveMigrateDiskParameters(moveDiskParameters, vm.getId()), vmsLiveMigrateParametersMap); } else { addCanDoActionMessage(String.format("$%1$s %2$s", "VmName", vm.getVmName())); return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_VM_IS_NOT_DOWN_OR_UP); } } return true; }
Source:
private ServerRepository() { try { portREST=Integer.parseInt(AREProperties.instance.getProperty(ARE_WEBSERVICE_PORT_REST_KEY, String.valueOf(DEFAULT_PORT_REST))); AREProperties.instance.setProperty(ARE_WEBSERVICE_PORT_REST_KEY, String.valueOf(portREST)); }catch(NumberFormatException e) { AstericsErrorHandling.instance.getLogger().logp(Level.WARNING, this.getClass().getName(), "ServerRepository()", "Configured port for REST service invalid: "+ e.getMessage(),e); } try { portWebsocket=Integer.parseInt(AREProperties.instance.getProperty(ARE_WEBSERVICE_PORT_WEBSOCKET_KEY, String.valueOf(DEFAULT_PORT_WEBSOCKET))); AREProperties.instance.setProperty(ARE_WEBSERVICE_PORT_WEBSOCKET_KEY, String.valueOf(portWebsocket)); }catch(NumberFormatException e) { AstericsErrorHandling.instance.getLogger().logp(Level.WARNING, this.getClass().getName(), "ServerRepository()", "Configured port for Websocket service invalid: "+e.getMessage(),e); } }

Target:
private ServerRepository() { try { portREST = Integer.parseInt(AREProperties.instance.getProperty(ARE_WEBSERVICE_PORT_REST_KEY, String.valueOf(DEFAULT_PORT_REST))); } catch (NumberFormatException e) { AstericsErrorHandling.instance.getLogger().logp(Level.WARNING, this.getClass().getName(), "ServerRepository()", "Configured port for REST service invalid: " + e.getMessage(), e); } try { portWebsocket = Integer.parseInt(AREProperties.instance.getProperty(ARE_WEBSERVICE_PORT_WEBSOCKET_KEY, String.valueOf(DEFAULT_PORT_WEBSOCKET))); } catch (NumberFormatException e) { AstericsErrorHandling.instance.getLogger().logp(Level.WARNING, this.getClass().getName(), "ServerRepository()", "Configured port for Websocket service invalid: " + e.getMessage(), e); } }
Source:
public void checkTimeoutOnPendingOperations() { for (int i = 0; i < clients.length; i++) { clients[i].checkTimeoutOnPendingOperations(); if (null != clientsV3) { clientsV3[i].checkTimeoutOnPendingOperations(); } } }

Target:
public void checkTimeoutOnPendingOperations() { for (int i = 0; i < clients.length; i++) { clients[i].checkTimeoutOnPendingOperations(); if (clients != clientsV3Enforced) { clientsV3Enforced[i].checkTimeoutOnPendingOperations(); } } }
Source:
public void mouseMove(MouseEvent e) { copyDragActive = (e.stateMask & SWT.SHIFT) != 0 && lastSelection != null && lastSelection.size() > 1 && masterObject != null; }

Target:
public void mouseMove(MouseEvent e) { copyDragActive = isCopyModifierPressed(e) && lastSelection != null && lastSelection.size() > 1 && masterObject != null; }
Source:
public List<TextSource> getLabels() { if (proto.getLabelCount() == 0) { return Collections.<TextSource>emptyList(); } ArrayList<TextSource> points = new ArrayList<TextSource>(proto.getLabelCount()); for (LabelElementProto element : proto.getLabelList()) { points.add(new TextSourceImpl(getCoords(element.getLocation()), "TestElement", element.getColor(), element.getOffset(), element.getFontSize())); } return points; }

Target:
public List<TextSource> getLabels() { if (proto.getLabelCount() == 0) { return Collections.<TextSource>emptyList(); } ArrayList<TextSource> points = new ArrayList<TextSource>(proto.getLabelCount()); for (LabelElementProto element : proto.getLabelList()) { points.add(new TextSourceImpl(getCoords(element.getLocation()), resources.getString(element.getStringIndex()), element.getColor(), element.getOffset(), element.getFontSize())); } return points; }
Source:
public static Process startApplication(String applicationPathAndArguments, String workingDirectory, OS_NAMES executeOnPlatform) throws IOException { if (!isCurrentOS(executeOnPlatform) || applicationPathAndArguments == null || "".equals(applicationPathAndArguments.trim())) { return null; } applicationPathAndArguments = applicationPathAndArguments.trim(); try { List<String> command = new ArrayList<>(); int cmdEndIndex = 0; if (applicationPathAndArguments.indexOf("\"") == 0) { cmdEndIndex = applicationPathAndArguments.substring(1).indexOf('"'); if (cmdEndIndex > -1) { cmdEndIndex = cmdEndIndex + 2; } } else { cmdEndIndex = applicationPathAndArguments.indexOf(" "); } if (cmdEndIndex < 0) { logger.warning("Only command, no arguments: " + applicationPathAndArguments); cmdEndIndex=applicationPathAndArguments.length(); } String cmdString = applicationPathAndArguments.substring(0, cmdEndIndex); command.add(FilenameUtils.separatorsToSystem(cmdString)); String arguments = ""; try { arguments = applicationPathAndArguments.substring(cmdEndIndex + 1); } catch (IndexOutOfBoundsException e) { logger.fine("No cmd arguments found."); } Matcher m = Pattern.compile("([^\"]\\S*|\".+?\")\\s*").matcher(arguments); while (m.find()) { String token = m.group(1).replace("\"", ""); command.add(token); logger.fine("adding argument: " + token); } return startApplication(command, workingDirectory); } catch (Exception e) { throw new RuntimeException("Could not construct command string: " + e.getMessage()); } }

Target:
public static Process startApplication(String applicationPathAndArguments, String workingDirectory, OS_NAMES executeOnPlatform) throws IOException { if (!isCurrentOS(executeOnPlatform) || applicationPathAndArguments == null || "".equals(applicationPathAndArguments.trim())) { return null; } applicationPathAndArguments = applicationPathAndArguments.trim(); try { List<String> command = new ArrayList<>(); int cmdEndIndex = 0; if (applicationPathAndArguments.indexOf("\"") == 0) { cmdEndIndex = applicationPathAndArguments.substring(1).indexOf('"'); if (cmdEndIndex > -1) { cmdEndIndex = cmdEndIndex + 2; } } else { cmdEndIndex = applicationPathAndArguments.indexOf(" "); } if (cmdEndIndex < 0) { logger.warning("Only command, no arguments: " + applicationPathAndArguments); cmdEndIndex=applicationPathAndArguments.length(); } String cmdString = applicationPathAndArguments.substring(0, cmdEndIndex); command.add(FilenameUtils.separatorsToSystem(cmdString)); String arguments = ""; try { arguments = applicationPathAndArguments.substring(cmdEndIndex + 1); } catch (IndexOutOfBoundsException e) { logger.fine("No cmd arguments found."); } Matcher m = Pattern.compile("(([^\\s\"]+)|(\".+?\"))\\s*").matcher(arguments); while (m.find()) { String token = m.group(1).replace("\"", ""); command.add(token); logger.fine("adding argument: " + token); } return startApplication(command, workingDirectory); } catch (Exception e) { throw new RuntimeException("Could not construct command string: " + e.getMessage()); } }
Source:
public Builder setCharset(Charset charset) { if (charset != null) { this.charset = charset; } return this; }

Target:
Builder setCharset(Charset charset) { if (charset != null) { this.charset = charset; } return this; }
Source:
public PartETag uploadPart(File file, String key, String uploadId, int partNum) throws IOException { InputStream inputStream = null; try { inputStream = new FileInputStream(file); } finally { if (inputStream != null) { inputStream.close(); } } return uploadPart(inputStream, key, uploadId, partNum, file.length()); }

Target:
public PartETag uploadPart(File file, String key, String uploadId, int partNum) throws IOException { InputStream inputStream = null; try { inputStream = new FileInputStream(file); } finally { if (inputStream != null) { return uploadPart(inputStream, key, uploadId, partNum, file.length()); } } return null; }
Source:
public CacheQuota(String identity, Optional<DataSize> quota) { this(md5().hashString(identity, UTF_8).asLong(), quota); }

Target:
public CacheQuota(String identity, Optional<DataSize> quota) { this.identifier = md5().hashString(identity, UTF_8).asLong(); this.quota = requireNonNull(quota, "quota is null"); }
Source:
protected boolean isIgnoredReference(Match match, EReference reference) { if (reference != null) { if (!reference.isDerived() && !reference.isContainer() && !reference.isTransient()) { boolean isGenericTypeWithoutArguments = false; boolean isGenericType = reference.getEType() == EcorePackage.eINSTANCE.getEGenericType(); if (isGenericType) { isGenericTypeWithoutArguments = IS_EGENERIC_TYPE_WITHOUT_PARAMETERS .apply(match.getLeft()) || IS_EGENERIC_TYPE_WITHOUT_PARAMETERS.apply(match.getRight()) || IS_EGENERIC_TYPE_WITHOUT_PARAMETERS.apply(match.getOrigin()); } return isGenericTypeWithoutArguments || !referenceIsSet(reference, match); } } return true; }

Target:
protected boolean isIgnoredReference(Match match, EReference reference) { if (reference != null) { if (!reference.isDerived() && !reference.isContainer() && !reference.isTransient()) { boolean isGenericTypeWithoutArguments = false; boolean isGenericType = reference.getEType() == EcorePackage.eINSTANCE.getEGenericType(); if (isGenericType) { isGenericTypeWithoutArguments = IS_EGENERIC_TYPE_WITHOUT_PARAMETERS .apply(match.getLeft()) && IS_EGENERIC_TYPE_WITHOUT_PARAMETERS.apply(match.getRight()) && IS_EGENERIC_TYPE_WITHOUT_PARAMETERS.apply(match.getOrigin()); } return isGenericTypeWithoutArguments || !referenceIsSet(reference, match); } } return true; }
Source:
public void startRegionOperation(Operation op) throws IOException { boolean isInterruptableOp = false; switch (op) { case GET: case SCAN: checkReadsEnabled(); case INCREMENT: case APPEND: case PUT: case DELETE: case BATCH_MUTATE: case CHECK_AND_MUTATE: isInterruptableOp = true; default: break; } if (op == Operation.MERGE_REGION || op == Operation.SPLIT_REGION || op == Operation.COMPACT_REGION || op == Operation.COMPACT_SWITCH) { return; } if (this.closing.get()) { throw new NotServingRegionException(getRegionInfo().getRegionNameAsString() + " is closing"); } lock(lock.readLock()); Thread thisThread = Thread.currentThread(); if (isInterruptableOp) { regionLockHolders.put(thisThread.hashCode(), thisThread); } if (this.closed.get()) { lock.readLock().unlock(); throw new NotServingRegionException(getRegionInfo().getRegionNameAsString() + " is closed"); } if (op == Operation.SNAPSHOT) { stores.values().forEach(HStore::preSnapshotOperation); } try { if (coprocessorHost != null) { coprocessorHost.postStartRegionOperation(op); } } catch (Exception e) { regionLockHolders.remove(thisThread.hashCode()); lock.readLock().unlock(); throw new IOException(e); } }

Target:
public void startRegionOperation(Operation op) throws IOException { boolean isInterruptableOp = false; switch (op) { case GET: case SCAN: isInterruptableOp = true; checkReadsEnabled(); break; case INCREMENT: case APPEND: case PUT: case DELETE: case BATCH_MUTATE: case CHECK_AND_MUTATE: isInterruptableOp = true; break; default: break; } if (op == Operation.MERGE_REGION || op == Operation.SPLIT_REGION || op == Operation.COMPACT_REGION || op == Operation.COMPACT_SWITCH) { return; } if (this.closing.get()) { throw new NotServingRegionException(getRegionInfo().getRegionNameAsString() + " is closing"); } lock(lock.readLock()); Thread thisThread = Thread.currentThread(); if (isInterruptableOp) { regionLockHolders.put(thisThread, true); } if (this.closed.get()) { lock.readLock().unlock(); throw new NotServingRegionException(getRegionInfo().getRegionNameAsString() + " is closed"); } if (op == Operation.SNAPSHOT) { stores.values().forEach(HStore::preSnapshotOperation); } try { if (coprocessorHost != null) { coprocessorHost.postStartRegionOperation(op); } } catch (Exception e) { if (isInterruptableOp) { regionLockHolders.remove(thisThread); } lock.readLock().unlock(); throw new IOException(e); } }
Source:
protected AbstractCompositeByteBufTest(ByteOrder order) { ObjectUtil.checkNotNull(order, "order"); this.order = order; }

Target:
protected AbstractCompositeByteBufTest(ByteOrder order) { this.order = ObjectUtil.checkNotNull(order, "order"); }
Source:
public boolean canMatchTrace(ITmfTrace trace) { if (!(trace instanceof LttngKernelTrace)) { return false; } LttngKernelTrace ktrace = (LttngKernelTrace) trace; String[] events = { TcpEventStrings.INET_SOCK_LOCAL_IN, TcpEventStrings.INET_SOCK_LOCAL_OUT }; return (ktrace.hasAtLeastOneOfEvents(events)); }

Target:
public boolean canMatchTrace(ITmfTrace trace) { if (!(trace instanceof LttngKernelTrace)) { return false; } LttngKernelTrace ktrace = (LttngKernelTrace) trace; String[] events = { TcpEventStrings.INET_SOCK_LOCAL_IN, TcpEventStrings.INET_SOCK_LOCAL_OUT }; return ktrace.hasAtLeastOneOfEvents(events); }
Source:
public boolean isTable(String sourceName) { String[] sourceComponents = sourceName.split("\\."); return sourceComponents[sourceComponents.length - 1].toLowerCase().equals(SAMZA_SQL_QUERY_TABLE_KEYWORD); }

Target:
public boolean isTable(String sourceName) { String[] sourceComponents = sourceName.split("\\."); return sourceComponents[sourceComponents.length - 1].equalsIgnoreCase(SAMZA_SQL_QUERY_TABLE_KEYWORD); }
Source:
private void onSortExpenseResult(Intent data) { Comparator<ExpenseClaim> comparator = (Comparator<ExpenseClaim>)data.getSerializableExtra(ExpenseClaimSortActivity.EXPENSE_CLAIM_SORT); listModel.setComparator(comparator); if(checkFilteredTags()) { setFilteredClaims(); filteredListModel.setComparator(comparator); } }

Target:
private void onSortExpenseResult(Intent data) { Comparator<ExpenseClaim> comparator = (Comparator<ExpenseClaim>)data.getSerializableExtra(ExpenseClaimSortActivity.EXPENSE_CLAIM_SORT); listModel.setComparator(comparator); if (!filteredTagsList.isEmpty()) { setFilteredClaims(); filteredListModel.setComparator(comparator); } }
Source:
public Authentication findAuthentication(String type, URI uri, String realm) { if (authentication.matches(type, uri, realm)) { return authentication; } throw new UnsupportedOperationException(String.format("Authentication type %s is not supported", type)); }

Target:
public Authentication findAuthentication(String type, URI uri, String realm) { if (authentication.matches(type, uri, realm)) { return authentication; } return null; }
Source:
public Container(String name, Map<String, String> attributes) { Assert.hasText(name); this.name = name; this.attributes = new ContainerAttributes(Collections.unmodifiableMap(new HashMap<String, String>(attributes))); String groupList = attributes.get("groups"); if (groupList == null) { groups = Collections.emptySet(); } else { Set<String> set = new HashSet<String>(); Collections.addAll(set, StringUtils.tokenizeToStringArray(groupList, ",")); this.groups = Collections.unmodifiableSet(set); } }

Target:
public Container(String name, Map<String, String> attributes) { Assert.hasText(name); this.name = name; this.attributes = new ContainerAttributes(attributes); String groupList = attributes.get("groups"); if (groupList == null) { groups = Collections.emptySet(); } else { Set<String> set = new HashSet<String>(); Collections.addAll(set, StringUtils.tokenizeToStringArray(groupList, ",")); this.groups = Collections.unmodifiableSet(set); } }
Source:
private void cleanupDnsRecords(Stack stack, Collection<InstanceMetaData> instanceMetaDatas) { Set<String> fqdns = instanceMetaDatas.stream().map(InstanceMetaData::getDiscoveryFQDN).collect(Collectors.toSet()); Set<String> ips = instanceMetaDatas.stream().map(InstanceMetaData::getPrivateIp).collect(Collectors.toSet()); try { LOGGER.info("Cleanup DNS records for FQDNS: and IPs {}", fqdns, ips); freeIpaCleanupService.cleanupDnsOnly(stack, fqdns, ips); } catch (Exception e) { LOGGER.error("Failed to delete dns records for FQDNS: and IPs {}", fqdns, ips, e); } }

Target:
private void cleanupDnsRecords(Stack stack, Collection<InstanceMetaData> instanceMetaDatas) { Set<String> fqdns = instanceMetadataProcessor.extractFqdn(instanceMetaDatas); Set<String> ips = instanceMetadataProcessor.extractIps(instanceMetaDatas); try { LOGGER.info("Cleanup DNS records for FQDNS: and IPs {}", fqdns, ips); freeIpaCleanupService.cleanupDnsOnly(stack, fqdns, ips); } catch (Exception e) { LOGGER.error("Failed to delete dns records for FQDNS: and IPs {}", fqdns, ips, e); } }
Source:
public void testReResolvingSingle() { byte size = 1; ArrayList<InetSocketAddress> list = new ArrayList<InetSocketAddress>(size); list.clear(); list.add(InetSocketAddress.createUnresolved("issues.apache.org", 1234)); final InetAddress issuesApacheOrg = mock(InetAddress.class); when(issuesApacheOrg.getHostAddress()).thenReturn("192.168.1.1"); when(issuesApacheOrg.toString()).thenReturn("issues.apache.org"); when(issuesApacheOrg.getHostName()).thenReturn("issues.apache.org"); StaticHostProvider.Resolver resolver = new StaticHostProvider.Resolver() { @Override public InetAddress[] getAllByName(String name) { return new InetAddress[] { issuesApacheOrg }; } }; StaticHostProvider hostProvider = new StaticHostProvider(list, resolver); InetSocketAddress next = hostProvider.next(0); next = hostProvider.next(0); assertTrue("No address was removed", hostProvider.getNextRemoved() == 1); assertTrue("No address was added", hostProvider.getNextAdded() == 1); }

Target:
public void testReResolvingSingle() throws UnknownHostException { byte size = 1; ArrayList<InetSocketAddress> list = new ArrayList<InetSocketAddress>(size); list.add(InetSocketAddress.createUnresolved("issues.apache.org", 1234)); final InetAddress issuesApacheOrg = mock(InetAddress.class); when(issuesApacheOrg.getHostAddress()).thenReturn("192.168.1.1"); when(issuesApacheOrg.toString()).thenReturn("issues.apache.org"); when(issuesApacheOrg.getHostName()).thenReturn("issues.apache.org"); StaticHostProvider.Resolver resolver = new StaticHostProvider.Resolver() { @Override public InetAddress[] getAllByName(String name) { return new InetAddress[] { issuesApacheOrg }; } }; StaticHostProvider.Resolver spyResolver = spy(resolver); StaticHostProvider hostProvider = new StaticHostProvider(list, spyResolver); for (int i = 0; i < 10; i++) { InetSocketAddress next = hostProvider.next(0); assertEquals(issuesApacheOrg, next.getAddress()); } verify(spyResolver, times(10)).getAllByName("issues.apache.org"); }
Source:
static void addToRun(Fingerprint fp, String imageId, Run run) throws IOException { synchronized (run) { DockerFingerprintAction action = run.getAction(DockerFingerprintAction.class); if (action == null) { action = new DockerFingerprintAction(run); run.addAction(action); } if (!action.getFingerprintKeys().contains(imageId)) { action.getFingerprintKeys().add(imageId); } else { return; } run.save(); } }

Target:
static void addToRun(Fingerprint fp, String imageId, Run run) throws IOException { synchronized (run) { DockerFingerprintAction action = run.getAction(DockerFingerprintAction.class); if (action == null) { action = new DockerFingerprintAction(); run.addAction(action); } if (action.imageIDs.add(imageId)) { run.save(); } } }
Source:
public void updateHandler_queryString() { final String oldValue = "foo"; final String newValue = "foo bar"; Response response = db.save(new Foo(null, oldValue)); Params params = new Params() .addParam("field", "title") .addParam("value", newValue); String output = db.invokeUpdateHandler("example/example_update", response.getId(), params); Foo foo = db.find(Foo.class, response.getId()); assertNotNull(output); assertEquals(foo.getTitle(), newValue); }

Target:
public void updateHandler_queryString() { final String oldValue = "foo"; final String newValue = "foo bar+plus=equals&ampersand"; Response response = db.save(new Foo(null, oldValue)); Params params = new Params() .addParam("field", "title") .addParam("value", newValue); String output = db.invokeUpdateHandler("example/example_update", response.getId(), params); Foo foo = db.find(Foo.class, response.getId()); assertNotNull(output); assertEquals(foo.getTitle(), newValue); }
Source:
public ByteBuffer encrypt(ByteBuffer buffer) throws GeneralSecurityException { Object key = kms.getRandomKey(); Object contextKey = kms.getKey(context); ByteBuffer encryptedKey = cryptoService.encryptKey(key, contextKey); ByteBuffer encryptedDataBuffer = cryptoService.encrypt(buffer, key); ByteBuffer output = ByteBuffer.allocate( EncryptedDataPayload.OVERHEAD_LENGTH + encryptedKey.array().length + encryptedDataBuffer.array().length); EncryptedDataPayload.serialize(output, new EncryptedDataPayload(encryptedKey, encryptedDataBuffer)); return output; }

Target:
public ByteBuffer encrypt(ByteBuffer buffer) throws GeneralSecurityException { Object key = kms.getRandomKey(); Object contextKey = kms.getKey(context); ByteBuffer encryptedKey = cryptoService.encryptKey(key, contextKey); ByteBuffer encryptedDataBuffer = cryptoService.encrypt(buffer, key); ByteBuffer output = ByteBuffer.allocate( EncryptedDataPayload.OVERHEAD_LENGTH + encryptedKey.array().length + encryptedDataBuffer.array().length); EncryptedDataPayload.serialize(output, new EncryptedDataPayload(encryptedKey, encryptedDataBuffer)); output.flip(); return output; }
Source:
public IBlockState getBlockState(BlockPos pos) { IBlockState value = this.processed.get(pos); if (value != null) { return value; } Transaction<BlockSnapshot> unknown = this.transactions.get(this.index); if (unknown != null) { final BlockPos actualPos = this.poses.get(this.index); if (pos.equals(actualPos)) { return (IBlockState) unknown.getFinal().getState(); } } return this.processingWorld.getBlockState(pos); }

Target:
public IBlockState getBlockState(BlockPos pos) { if (this.processed.containsKey(pos)) { return this.processed.get(pos); } Transaction<BlockSnapshot> unknown = this.transactions.get(this.index); if (unknown != null) { final BlockPos actualPos = this.poses.get(this.index); if (pos.equals(actualPos)) { return (IBlockState) unknown.getFinal().getState(); } } return this.processingWorld.getBlockState(pos); }
Source:
public void removeRecipient(String channelName) { ConcurrentLinkedQueue<Recipient> removeList = new ConcurrentLinkedQueue<Recipient>(); for (Recipient recipient : recipients) { AbstractMessageChannel channel = (AbstractMessageChannel) recipient.getChannel(); if (channel.getBeanName().equals(channelName)) { removeList.add(recipient); } } recipients.removeAll(removeList); }

Target:
public int removeRecipient(String channelName) { int counter = 0; MessageChannel channel = this.getBeanFactory().getBean(channelName, MessageChannel.class); for (Iterator<Recipient> it = this.recipients.iterator(); it.hasNext();) { if (it.next().getChannel() == channel) { it.remove(); counter++; } } return counter; }
Source:
public com.alliander.osgp.adapter.ws.schema.smartmetering.monitoring.ActualMeterReadsGasResponse getActualMeterReadsGasResponse( @OrganisationIdentification final String organisationIdentification, @RequestPayload final ActualMeterReadsGasAsyncRequest request) throws OsgpException { LOGGER.debug("Incoming ActualMeterReadsGasAsyncRequest for meter: {}", request.getDeviceIdentification()); try { final MeterResponseData meterResponseData = this.meterResponseDataRepository .findSingleResultByCorrelationUid(request.getCorrelationUid()); if (meterResponseData == null) { throw new FunctionalException(FunctionalExceptionType.UNKNOWN_CORRELATION_UID, ComponentType.WS_SMART_METERING); } if (meterResponseData.getMessageData() instanceof MeterReadsGas) { final com.alliander.osgp.adapter.ws.schema.smartmetering.monitoring.ActualMeterReadsGasResponse response = this.monitoringMapper .map(meterResponseData.getMessageData(), com.alliander.osgp.adapter.ws.schema.smartmetering.monitoring.ActualMeterReadsGasResponse.class); this.meterResponseDataRepository.delete(meterResponseData); return response; } else { LOGGER.warn("Incorrect type of response data: for correlation UID: {}", meterResponseData.getClass() .getName(), request.getCorrelationUid()); } } catch (final Exception e) { this.handleRetrieveException(e, request, organisationIdentification); } return null; }

Target:
public com.alliander.osgp.adapter.ws.schema.smartmetering.monitoring.ActualMeterReadsGasResponse getActualMeterReadsGasResponse( @OrganisationIdentification final String organisationIdentification, @RequestPayload final ActualMeterReadsGasAsyncRequest request) throws OsgpException { LOGGER.debug("Incoming ActualMeterReadsGasAsyncRequest for meter: {}", request.getDeviceIdentification()); com.alliander.osgp.adapter.ws.schema.smartmetering.monitoring.ActualMeterReadsGasResponse response = new ActualMeterReadsGasResponse(); try { final MeterResponseData meterResponseData = this.meterResponseDataRepository .findSingleResultByCorrelationUid(request.getCorrelationUid()); if (meterResponseData == null) { throw new FunctionalException(FunctionalExceptionType.UNKNOWN_CORRELATION_UID, ComponentType.WS_SMART_METERING); } if (meterResponseData.getMessageData() instanceof MeterReadsGas) { response = this.monitoringMapper .map(meterResponseData.getMessageData(), com.alliander.osgp.adapter.ws.schema.smartmetering.monitoring.ActualMeterReadsGasResponse.class); this.meterResponseDataRepository.delete(meterResponseData); return response; } else { LOGGER.warn("Incorrect type of response data: for correlation UID: {}", meterResponseData.getClass() .getName(), request.getCorrelationUid()); } } catch (final Exception e) { this.handleRetrieveException(e, request, organisationIdentification); } return response; }
Source:
private void transactionalRemoveGroup(String groupName, EnumSet<Flag> explicitFlags, ClassLoader explicitClassLoader) { final boolean onGoingTransaction = getOngoingTransaction() != null; if (!onGoingTransaction) { tryBegin(); } try { InvocationContext context = getInvocationContextWithImplicitTransaction(false, explicitClassLoader, UNBOUNDED); Map<K, V> keys = internalGetGroup(groupName, explicitFlags, explicitClassLoader, context); EnumSet<Flag> removeFlags = explicitFlags == null ? EnumSet.noneOf(Flag.class) : explicitFlags; removeFlags.add(IGNORE_RETURN_VALUES); for (K key : keys.keySet()) { removeInternal(key, removeFlags, context); } if (!onGoingTransaction) { tryCommit(); } } catch (RuntimeException e) { if (!onGoingTransaction) { tryRollback(); } throw e; } }

Target:
private void transactionalRemoveGroup(String groupName, EnumSet<Flag> explicitFlags, ClassLoader explicitClassLoader) { final boolean onGoingTransaction = getOngoingTransaction() != null; if (!onGoingTransaction) { tryBegin(); } try { InvocationContext context = getInvocationContextWithImplicitTransaction(false, explicitClassLoader, UNBOUNDED); Map<K, V> keys = internalGetGroup(groupName, explicitFlags, explicitClassLoader, context); EnumSet<Flag> removeFlags = explicitFlags == null ? EnumSet.noneOf(Flag.class) : EnumSet.copyOf(explicitFlags); removeFlags.add(IGNORE_RETURN_VALUES); for (K key : keys.keySet()) { removeInternal(key, removeFlags, context); } if (!onGoingTransaction) { tryCommit(); } } catch (RuntimeException e) { if (!onGoingTransaction) { tryRollback(); } throw e; } }
Source:
public SimpleReadSupport() { super(); this.showEmpty = false; }

Target:
public SimpleReadSupport() { this.showEmptyFields = false; }
Source:
public static OseeEnumTypeCacheUpdateResponse fromCache(Collection<OseeEnumType> types) throws OseeCoreException { List<String[]> enumTypeRows = new ArrayList<String[]>(); List<String[]> enumEntryRows = new ArrayList<String[]>(); for (OseeEnumType type : types) { enumTypeRows.add(new String[] { String.valueOf(type.getId()), type.getStorageState().toString(), String.valueOf(type.getGuid()), type.getName()}); for (OseeEnumEntry entry : type.values()) { enumEntryRows.add(new String[] { String.valueOf(type.getGuid()), entry.getGuid(), entry.getName(), entry.getDescription(), String.valueOf(entry.ordinal())}); } } return new OseeEnumTypeCacheUpdateResponse(enumTypeRows, enumEntryRows); }

Target:
public static OseeEnumTypeCacheUpdateResponse fromCache(Collection<OseeEnumType> types) throws OseeCoreException { List<String[]> enumTypeRows = new ArrayList<String[]>(); List<String[]> enumEntryRows = new ArrayList<String[]>(); for (OseeEnumType type : types) { enumTypeRows.add(new String[] { String.valueOf(type.getId()), type.getStorageState().toString(), String.valueOf(type.getGuid()), type.getName()}); for (OseeEnumEntry entry : type.values()) { enumEntryRows.add(new String[] { String.valueOf(type.getGuid()), entry.getGuid(), entry.getName(), String.valueOf(entry.ordinal()), entry.getDescription()}); } } return new OseeEnumTypeCacheUpdateResponse(enumTypeRows, enumEntryRows); }
Source:
public static int instanceSize(Class<?>... classes) { return Stream.of(classes) .mapToInt(clazz -> parseClass(clazz).instanceSize()) .reduce(0, Math::addExact); }

Target:
public static int instanceSize(Class<?>... classes) { return Stream.of(classes) .mapToInt(clazz -> toIntExact(parseClass(clazz).instanceSize())) .reduce(0, Math::addExact); }
Source:
private Map<String, Object> makeCall(String url, String body, HttpCallMethod callMethod) { Request request = (body == null) ? getRequest(url, callMethod) : getRequest(url, body, callMethod); try (Response response = client.newCall(request).execute()) { if (response.isSuccessful()) { if(StringUtils.isBlank(response.body().string())) return new HashMap<>(); else return objectMapper.readValue(response.body().string(), HashMap.class); } else { throw requestFailure(request, createStatus(response)); } } catch(Exception e) { throw KubernetesClientException.launderThrowable(e); } }

Target:
private Map<String, Object> makeCall(String url, String body, HttpCallMethod callMethod) { Request request = (body == null) ? getRequest(url, callMethod) : getRequest(url, body, callMethod); try (Response response = client.newCall(request).execute()) { if (response.isSuccessful()) { String respBody = response.body().string(); if(Utils.isNullOrEmpty(respBody)) return new HashMap<>(); else return objectMapper.readValue(respBody, HashMap.class); } else { throw requestFailure(request, createStatus(response)); } } catch(Exception e) { throw KubernetesClientException.launderThrowable(e); } }
Source:
public static Schema combineSchema(List<Schema> schemas, IOReporter reporter) { if (schemas == null || schemas.isEmpty()) { return new DefaultSchema(null, null); } else if (schemas.size() == 1) { return schemas.get(0); } else { DefaultSchema result = new DefaultSchema(null, null); schemas.forEach(schema -> { schema.getTypes().forEach(type -> { if (reporter != null) { QName name = type.getName(); if (result.getType(name) != null) { reporter.warn( MessageFormat.format("Multiple definitions of type {0}", name)); } } result.addType(type); }); }); return result; } }

Target:
public static Schema combineSchema(List<Schema> schemas, IOReporter reporter) { if (schemas == null || schemas.isEmpty()) { return new DefaultSchema(null, null); } else if (schemas.size() == 1) { return schemas.get(0); } else { DefaultSchema result = new DefaultSchema(null, null); schemas.forEach(schema -> { schema.getTypes().forEach(type -> { if (reporter != null) { QName name = type.getName(); if (result.getType(name) != null) { reporter.error( MessageFormat.format("Multiple definitions of type {0}", name)); } } result.addType(type); }); }); return result; } }