auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public ActionForward prepare(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) { final Student student = getUserView(request).getPerson().getStudent(); final List<Registration> toEnrol = new ArrayList<Registration>(); toEnrol.addAll(student.getAllRegistrations()); if (toEnrol.size() == 1) { request.setAttribute("registrationOID", toEnrol.iterator().next().getExternalId()); return prepareStartViewWarning(mapping, form, request, response); } else { request.setAttribute("toEnrol", toEnrol); return mapping.findForward("chooseRegistration"); } }

Target:
public ActionForward prepare(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) { final Student student = getUserView(request).getPerson().getStudent(); final List<Registration> toEnrol = student.getRegistrationStream().collect(Collectors.toList()); if (toEnrol.size() == 1) { request.setAttribute("registrationOID", toEnrol.iterator().next().getExternalId()); return prepareStartViewWarning(mapping, form, request, response); } else { request.setAttribute("toEnrol", toEnrol); return mapping.findForward("chooseRegistration"); } }
Source:
public void close() { Throwable exception = null; try { dataFileChannel.close(); } catch (Throwable throwable) { exception = throwable; } try { dataFileChannel.close(); } catch (Throwable throwable) { exception = throwable; } if (exception != null) { ExceptionUtils.rethrow(exception); } }

Target:
public void close() throws IOException { if (isClosed) { return; } isClosed = true; IOException exception = null; try { dataFileChannel.close(); } catch (IOException ioException) { exception = ioException; } try { indexFileChannel.close(); } catch (IOException ioException) { exception = ExceptionUtils.firstOrSuppressed(ioException, exception); } if (exception != null) { throw exception; } }
Source:
private static boolean isHashTokenEmpty() { return StringUtils.isBlank(getHashTokenFromSession()) ? true : false; }

Target:
private static boolean isHashTokenEmpty() { return StringUtils.isBlank(getHashTokenFromSession()); }
Source:
public void createUserAttributes() throws Throwable { AtomicInteger c = new AtomicInteger(); UsersResource users = testRealm().users(); UserRepresentation u = UserBuilder.create().username("attributes").build(); Response response = users.create(u); String userId = ApiUtil.getCreatedId(response); UserResource user = users.get(userId); concurrentTest((threadIndex, keycloak, realm) -> { UserRepresentation rep = user.toRepresentation(); rep.singleAttribute("a-" + c.getAndIncrement(), "value"); user.update(rep); }); UserRepresentation rep = user.toRepresentation(); assertTrue(rep.getAttributes().size() <= c.get()); for (Map.Entry<String, List<String>> e : rep.getAttributes().entrySet()) { assertEquals(1, e.getValue().size()); } }

Target:
public void createUserAttributes() throws Throwable { AtomicInteger c = new AtomicInteger(); UsersResource users = testRealm().users(); UserRepresentation u = UserBuilder.create().username("attributes").build(); Response response = users.create(u); String userId = ApiUtil.getCreatedId(response); response.close(); UserResource user = users.get(userId); concurrentTest((threadIndex, keycloak, realm) -> { UserRepresentation rep = user.toRepresentation(); rep.singleAttribute("a-" + c.getAndIncrement(), "value"); user.update(rep); }); UserRepresentation rep = user.toRepresentation(); assertTrue(rep.getAttributes().size() <= c.get()); for (Map.Entry<String, List<String>> e : rep.getAttributes().entrySet()) { assertEquals(1, e.getValue().size()); } }
Source:
public static BlockType asBlockType(Material material) { checkNotNull(material); if (!material.isBlock()) { throw new IllegalArgumentException(material.getKey().toString() + " is not a block!"); } return materialBlockTypeCache.computeIfAbsent(material, new Function<Material, BlockType>() { @Nullable @Override public BlockType apply(@Nullable Material input) { return BlockTypes.get(material.getKey().toString()); } }); }

Target:
public static BlockType asBlockType(Material material) { checkNotNull(material); return materialBlockTypeCache.computeIfAbsent(material, input -> BlockTypes.get(material.getKey().toString())); }
Source:
public static void cleanUpData() throws Exception { ContentletAPI contentletAPI = APILocator.getContentletAPI(); User user = APILocator.systemUser(); if(keyValueContentlet != null){ APILocator.getWorkflowAPI().deleteWorkflowTaskByWebAsset(keyValueContentlet.getIdentifier(), APILocator.systemUser()); contentletAPI.archive(keyValueContentlet,user, false); contentletAPI.delete(keyValueContentlet,user, false); } if(keyValueContentlet1 != null) { APILocator.getWorkflowAPI().deleteWorkflowTaskByWebAsset(keyValueContentlet1.getIdentifier(), APILocator.systemUser()); contentletAPI.archive(keyValueContentlet1,user, false); contentletAPI.delete(keyValueContentlet1,user, false); } if(keyValueContentlet2 != null){ APILocator.getWorkflowAPI().deleteWorkflowTaskByWebAsset(keyValueContentlet2.getIdentifier(), APILocator.systemUser()); contentletAPI.archive(keyValueContentlet2,user, false); contentletAPI.delete(keyValueContentlet2,user, false); } APILocator.getLanguageAPI().deleteLanguage(spanishNoCountryLanguage); APILocator.getLanguageAPI().deleteLanguage(spanishCostaRicaLanguage); }

Target:
public static void cleanUpData() throws Exception { ContentletAPI contentletAPI = APILocator.getContentletAPI(); User user = APILocator.systemUser(); if(keyValueContentlet != null){ APILocator.getWorkflowAPI().deleteWorkflowTaskByContentletIdAnyLanguage(keyValueContentlet.getIdentifier(), APILocator.systemUser()); contentletAPI.archive(keyValueContentlet,user, false); contentletAPI.delete(keyValueContentlet,user, false); } if(keyValueContentlet1 != null) { APILocator.getWorkflowAPI().deleteWorkflowTaskByContentletIdAnyLanguage(keyValueContentlet1.getIdentifier(), APILocator.systemUser()); contentletAPI.archive(keyValueContentlet1,user, false); contentletAPI.delete(keyValueContentlet1,user, false); } if(keyValueContentlet2 != null){ APILocator.getWorkflowAPI().deleteWorkflowTaskByContentletIdAnyLanguage(keyValueContentlet2.getIdentifier(), APILocator.systemUser()); contentletAPI.archive(keyValueContentlet2,user, false); contentletAPI.delete(keyValueContentlet2,user, false); } APILocator.getLanguageAPI().deleteLanguage(spanishNoCountryLanguage); APILocator.getLanguageAPI().deleteLanguage(spanishCostaRicaLanguage); }
Source:
protected Ref findBranch(String branchName) throws IOException { return repository.findRef(R_HEADS + branchName); }

Target:
protected Ref findBranch(String branchName) throws IOException { return repository.exactRef(R_HEADS + branchName); }
Source:
public static int getMaxDHGroupExchangeKeySize() { int maxSupportedKeySize; synchronized (MAX_DHG_KEY_SIZE_HOLDER) { maxSupportedKeySize = MAX_DHG_KEY_SIZE_HOLDER.get(); if (maxSupportedKeySize != 0) { return maxSupportedKeySize; } if (System.getProperty(MAX_DHGEX_KEY_SIZE_PROP) != null) { maxSupportedKeySize = Integer.parseInt( System.getProperty(MAX_DHGEX_KEY_SIZE_PROP)); if (!isDHGroupExchangeSupported(maxSupportedKeySize)) { maxSupportedKeySize = -1; } } else { maxSupportedKeySize = -1; for (int s = 1024; s <= 8192 && isDHGroupExchangeSupported(s); s += 1024) { maxSupportedKeySize = s; } } MAX_DHG_KEY_SIZE_HOLDER.set(maxSupportedKeySize); } return maxSupportedKeySize; }

Target:
public static int getMaxDHGroupExchangeKeySize() { int maxSupportedKeySize; synchronized (MAX_DHG_KEY_SIZE_HOLDER) { maxSupportedKeySize = MAX_DHG_KEY_SIZE_HOLDER.get(); if (maxSupportedKeySize != 0) { return maxSupportedKeySize; } String propValue = System.getProperty(MAX_DHGEX_KEY_SIZE_PROP); if (GenericUtils.isEmpty(propValue)) { for (int testKeySize = MAX_DHGEX_KEY_SIZE; testKeySize >= MIN_DHGEX_KEY_SIZE; testKeySize -= 1024) { if (isDHGroupExchangeSupported(testKeySize)) { maxSupportedKeySize = testKeySize; break; } } } else { maxSupportedKeySize = Integer.parseInt(propValue); ValidateUtils.checkTrue(maxSupportedKeySize != 0, "Configured " + MAX_DHGEX_KEY_SIZE_PROP + " value must be non-zero: %d", maxSupportedKeySize); } MAX_DHG_KEY_SIZE_HOLDER.set(maxSupportedKeySize); } return maxSupportedKeySize; }
Source:
public static void updateBeanValue(final WComponent component) { updateBeanValue(component, false); }

Target:
public static void updateBeanValue(final WComponent component) { updateBeanValue(component, true); }
Source:
public SamReader open(final Path path) { return open(path, getPathWrapper(), Function.identity()); }

Target:
public SamReader open(final Path path) { return open(path, null, null); }
Source:
public static Pair<String, String[]> createWhere(String[] fieldNames, Object[] values, EncryptedModel em, Persistable p) throws IllegalArgumentException { Set<String> fields = null; if(p instanceof IMetaData) { IMetaData m = (IMetaData)p; String[] thefields = m.getMetaDataFields(); fields = new HashSet<String>(); for(String s : thefields) { fields.add(TableBuilder.scrubName(s)); } } if(em instanceof IMetaData) { IMetaData m = (IMetaData)em; String[] thefields = m.getMetaDataFields(); fields = new HashSet<String>(); for(String s : thefields) { fields.add(TableBuilder.scrubName(s)); } } StringBuilder stringBuilder = new StringBuilder(); ArrayList<String> arguments = new ArrayList<String>(); boolean set = false; for(int i = 0 ; i < fieldNames.length; ++i) { String columnName = TableBuilder.scrubName(fieldNames[i]); if(fields != null) { if(!fields.contains(columnName)) { continue; } } if(set){ stringBuilder.append(" AND "); } stringBuilder.append(columnName); stringBuilder.append("=?"); arguments.add(values[i].toString()); set = true; } if(!set){ throw new IllegalArgumentException(); } String[] retArray = new String[arguments.size()]; for(int i =0; i< arguments.size(); i++){ retArray[i] = arguments.get(i); } return new Pair<String, String[]>(stringBuilder.toString(), retArray); }

Target:
public static Pair<String, String[]> createWhere(String[] fieldNames, Object[] values, EncryptedModel em, Persistable p) throws IllegalArgumentException { Set<String> fields = null; if(p instanceof IMetaData) { IMetaData m = (IMetaData)p; String[] thefields = m.getMetaDataFields(); fields = new HashSet<String>(); for(String s : thefields) { fields.add(TableBuilder.scrubName(s)); } } if(em instanceof IMetaData) { IMetaData m = (IMetaData)em; String[] thefields = m.getMetaDataFields(); fields = new HashSet<String>(); for(String s : thefields) { fields.add(TableBuilder.scrubName(s)); } } StringBuilder stringBuilder = new StringBuilder(); ArrayList<String> arguments = new ArrayList<String>(); boolean set = false; for(int i = 0 ; i < fieldNames.length; ++i) { String columnName = TableBuilder.scrubName(fieldNames[i]); if(fields != null) { if(!fields.contains(columnName)) { continue; } } if(set){ stringBuilder.append(" AND "); } stringBuilder.append(columnName); stringBuilder.append("=?"); arguments.add(values[i].toString()); set = true; } if(!set){ throw new IllegalArgumentException("Unable to match provided fields with columns."); } String[] retArray = new String[arguments.size()]; for(int i =0; i< arguments.size(); i++){ retArray[i] = arguments.get(i); } return new Pair<String, String[]>(stringBuilder.toString(), retArray); }
Source:
public List<String> argumentTypeNames() { if (fArgumentTypeNames != null) { return fArgumentTypeNames; } List<String> result = new ArrayList<>(); for (String string : argumentTypeSignatures()) { result.add(TypeImpl.signatureToName(string)); } fArgumentTypeNames = result; return fArgumentTypeNames; }

Target:
public List<String> argumentTypeNames() { if (fArgumentTypeNames != null) { return fArgumentTypeNames; } List<String> result = new ArrayList<>(); for (String signature : argumentTypeSignatures()) { result.add(TypeImpl.signatureToName(signature)); } fArgumentTypeNames = result; return fArgumentTypeNames; }
Source:
public int breakpointHit(IJavaThread thread, IJavaBreakpoint breakpoint) { JavaDebugOptionsManager manager = JavaDebugOptionsManager.getDefault(); if (!breakpoint.equals(manager.getThreadNameChangeBreakpoint())) { return DONT_CARE; } if (manager.isListeningOnThreadNameChanges()) { DebugPlugin.getDefault().fireDebugEventSet(new DebugEvent[] { new DebugEvent(thread, DebugEvent.CHANGE) }); } return DONT_SUSPEND; }

Target:
public int breakpointHit(IJavaThread thread, IJavaBreakpoint breakpoint) { JavaDebugOptionsManager manager = JavaDebugOptionsManager.getDefault(); if (!breakpoint.equals(manager.getThreadNameChangeBreakpoint())) { return DONT_CARE; } if (manager.isListeningOnThreadNameChanges()) { DebugPlugin.getDefault().fireDebugEventSet(new DebugEvent[] { new DebugEvent(thread, DebugEvent.CHANGE, DebugEvent.STATE) }); } return DONT_SUSPEND; }
Source:
public SnippetConfigurationPage() { super("snippet"); setTitle("GeoJSON geometry configuration"); setDescription("Please select the geometries to use for the GeoJSON export"); }

Target:
public SnippetConfigurationPage() { super("snippet"); setTitle("Groovy snippet"); setDescription("Please provide an identifier for the snippet"); }
Source:
public PaymentWorksVendor obtainPmwNewVendorRequestDetailForPmwIdentifier(String pmwNewVendorRequestId, PaymentWorksNewVendorRequestsBatchReportData reportData) { PaymentWorksNewVendorRequestDetailDTO pmwDetailForSpecificVendorDTO = null; PaymentWorksVendor pmwDetailForSpecificVendor = null; try { pmwDetailForSpecificVendorDTO = retrieveAllPaymentWorksDetailsForRequestedVendor(buildPaymentWorksPendingNewVendorRequestDetailURI(pmwNewVendorRequestId)); } catch (ResponseProcessingException rpe) { LOG.error("obtainPmwNewVendorRequestDetailForPmwIdentifier, unable to create PaymentWorksNewVendorRequestDetailDTO from payment works web service.", rpe); } if (ObjectUtils.isNotNull(pmwDetailForSpecificVendorDTO)) { pmwDetailForSpecificVendor = getPaymentWorksDtoToPaymentWorksVendorConversionService().createPaymentWorksVendorFromPaymentWorksNewVendorRequestDetailDTO( pmwDetailForSpecificVendorDTO, reportData); } return pmwDetailForSpecificVendor; }

Target:
public PaymentWorksVendor obtainPmwNewVendorRequestDetailForPmwIdentifier(String pmwNewVendorRequestId, PaymentWorksNewVendorRequestsBatchReportData reportData) { PaymentWorksNewVendorRequestDetailDTO pmwDetailForSpecificVendorDTO = null; PaymentWorksVendor pmwDetailForSpecificVendor = null; try { pmwDetailForSpecificVendorDTO = retrieveAllPaymentWorksDetailsForRequestedVendor(buildPaymentWorksPendingNewVendorRequestDetailURI(pmwNewVendorRequestId)); } catch (RuntimeException rte) { LOG.error("obtainPmwNewVendorRequestDetailForPmwIdentifier, unable to create PaymentWorksNewVendorRequestDetailDTO from payment works web service.", rte); } if (ObjectUtils.isNotNull(pmwDetailForSpecificVendorDTO)) { pmwDetailForSpecificVendor = getPaymentWorksDtoToPaymentWorksVendorConversionService().createPaymentWorksVendorFromPaymentWorksNewVendorRequestDetailDTO( pmwDetailForSpecificVendorDTO, reportData); } return pmwDetailForSpecificVendor; }
Source:
private PlanNode getCostBasedJoin(JoinNode joinNode, Context context) { CostProvider costProvider = context.getCostProvider(); List<PlanNodeWithCost> possibleJoinNodes = new ArrayList<>(); if (!mustPartition(joinNode) && canReplicate(joinNode, context)) { possibleJoinNodes.add(getJoinNodeWithCost(costProvider, joinNode.withDistributionType(REPLICATED))); } if (!mustReplicate(joinNode, context)) { possibleJoinNodes.add(getJoinNodeWithCost(costProvider, joinNode.withDistributionType(PARTITIONED))); } JoinNode flipped = joinNode.flipChildren(); if (!mustPartition(flipped) && canReplicate(flipped, context)) { possibleJoinNodes.add(getJoinNodeWithCost(costProvider, flipped.withDistributionType(REPLICATED))); } if (!mustReplicate(flipped, context)) { possibleJoinNodes.add(getJoinNodeWithCost(costProvider, flipped.withDistributionType(PARTITIONED))); } if (possibleJoinNodes.stream().anyMatch(result -> result.getCost().hasUnknownComponents()) || possibleJoinNodes.isEmpty()) { return getSyntacticOrderJoin(joinNode, context, AUTOMATIC); } Ordering<PlanNodeWithCost> planNodeOrderings = costComparator.forSession(context.getSession()).onResultOf(PlanNodeWithCost::getCost); return planNodeOrderings.min(possibleJoinNodes).getPlanNode(); }

Target:
private PlanNode getCostBasedJoin(JoinNode joinNode, Context context) { List<PlanNodeWithCost> possibleJoinNodes = new ArrayList<>(); addJoinsWithDifferentDistributions(joinNode, possibleJoinNodes, context); addJoinsWithDifferentDistributions(joinNode.flipChildren(), possibleJoinNodes, context); if (possibleJoinNodes.stream().anyMatch(result -> result.getCost().hasUnknownComponents()) || possibleJoinNodes.isEmpty()) { return getSyntacticOrderJoin(joinNode, context, AUTOMATIC); } Ordering<PlanNodeWithCost> planNodeOrderings = costComparator.forSession(context.getSession()).onResultOf(PlanNodeWithCost::getCost); return planNodeOrderings.min(possibleJoinNodes).getPlanNode(); }
Source:
public static Message.Builder createMessageBuilder(Clock clock) { MsbConfig msbConf = createMsbConfigurations(); Clock clock1 = (clock != null ? clock : Clock.systemDefaultZone()); Topics topic = new Topics("", ""); MetaMessage.Builder metaBuilder = createSimpleMetaBuilder(msbConf, clock1); return new Message.Builder() .withCorrelationId(Utils.generateId()) .withId(Utils.generateId()) .withTopics(topic) .withMetaBuilder(metaBuilder); }

Target:
public static Message.Builder createMessageBuilder(Clock clock) { MsbConfig msbConf = createMsbConfigurations(); Topics topic = new Topics("", ""); MetaMessage.Builder metaBuilder = createSimpleMetaBuilder(msbConf, clock); return new Message.Builder() .withCorrelationId(Utils.generateId()) .withId(Utils.generateId()) .withTopics(topic) .withMetaBuilder(metaBuilder); }
Source:
public void onCreate(HarvestedResource resource) { String key = DigestUtils.sha1Hex(resource.getUri().toASCIIString()); if (resourceNotCreated(key)) { String resourceId = null; try { resourceId = adapter.create(resource); } catch (HarvestException e) { LOGGER.debug("Failed to create resource [{}].", resource.getName(), e); } if (StringUtils.isNotEmpty(resourceId)) { persistenceProvider.store(key, resourceId); } } else { LOGGER.debug("Already created resource [{}]. Doing nothing", resource.getName()); } }

Target:
public void onCreate(HarvestedResource resource) { String key = Hashing.sha256() .hashString(resource.getUri().toASCIIString(), StandardCharsets.UTF_8) .toString(); if (resourceNotCreated(key)) { String resourceId = null; try { resourceId = adaptor.create(resource); } catch (HarvestException e) { LOGGER.debug("Failed to create resource [{}].", resource.getName(), e); } if (StringUtils.isNotEmpty(resourceId)) { persistenceProvider.store(key, resourceId); } } else { LOGGER.debug("Already created resource [{}]. Doing nothing", resource.getName()); } }
Source:
public void runNonBlocking() { ThreadGroup group = new ThreadGroup("CBuilder" + fCounter++); InputStream stdin = fProcess.getInputStream(); InputStream stderr = fProcess.getErrorStream(); if (fOutput != null) { fOutputReader = new ReaderThread(group, "OutputReader", stdin, fOutput); } if (fError != null) { fErrorReader = new ReaderThread(group, "ErrorReader", stderr, fError); } if (fOutput != null) { fOutputReader.start(); } if (fError != null) { fErrorReader.start(); } }

Target:
public void runNonBlocking() { ThreadGroup group = new ThreadGroup("CBuilder" + fCounter++); InputStream stdin = fProcess.getInputStream(); InputStream stderr = fProcess.getErrorStream(); fOutputReader = new ReaderThread(group, "OutputReader", stdin, fOutput); fErrorReader = new ReaderThread(group, "ErrorReader", stderr, fError); fOutputReader.start(); fErrorReader.start(); }
Source:
void onReplicaUpdate(KetchReplica replica) { if (log.isDebugEnabled()) { log.debug("Replica finished:\n{}", replica.describeForLog(), snapshot()); } if (replica.getType() == FOLLOWER) { return; } else if (runningRound == null) { return; } assert head.equals(runningRound.acceptedNew); int matching = 0; for (KetchReplica r : voters) { if (r.hasAccepted(head)) { matching++; } } int quorum = voters.length / 2 + 1; boolean success = matching >= quorum; if (!success) { return; } switch (state) { case CANDIDATE: term = ((ElectionRound) runningRound).getTerm(); state = LEADER; if (log.isDebugEnabled()) { log.debug("Won election, running term " + term); } case LEADER: committed = head; if (log.isDebugEnabled()) { log.debug("Committed {}/{} in term {}", Long.valueOf(committed.index), committed.abbreviate(8).name(), Long.valueOf(term)); } runningRound.success(); nextRound(); commitAsync(replica); if (log.isDebugEnabled()) { log.debug("Leader state:\n{}", snapshot()); } break; } }

Target:
void onReplicaUpdate(KetchReplica replica) { if (log.isDebugEnabled()) { log.debug("Replica finished:\n{}", replica.describeForLog(), snapshot()); } if (replica.getParticipation() == FOLLOWER_ONLY) { return; } else if (runningRound == null) { return; } assert head.equals(runningRound.acceptedNew); int matching = 0; for (KetchReplica r : voters) { if (r.hasAccepted(head)) { matching++; } } int quorum = voters.length / 2 + 1; boolean success = matching >= quorum; if (!success) { return; } switch (state) { case CANDIDATE: term = ((ElectionRound) runningRound).getTerm(); state = LEADER; if (log.isDebugEnabled()) { log.debug("Won election, running term " + term); } case LEADER: committed = head; if (log.isDebugEnabled()) { log.debug("Committed in term {}", committed.describeForLog(), Long.valueOf(term)); } runningRound.success(); nextRound(); commitAsync(replica); if (log.isDebugEnabled()) { log.debug("Leader state:\n{}", snapshot()); } break; } }
Source:
public String explainAndPrepare(@CliOption(key = {"", "query"}, mandatory = true, help = "Query to explain and prepare") String sql, @CliOption(key = {"name"}, mandatory = false, help = "query name") String queryName) throws UnsupportedEncodingException { QueryPlan plan = getClient().explainAndPrepare(sql, queryName); if (plan.isHasError() == true) { return "Explain FAILED:" + plan.getErrorMsg(); } StringBuilder planStr = new StringBuilder(plan.getPlanString()); planStr.append("\n").append("Prepare handle:").append(plan.getPrepareHandle()); return planStr.toString(); }

Target:
public String explainAndPrepare(@CliOption(key = {"", "query"}, mandatory = true, help = "Query to explain and prepare") String sql, @CliOption(key = {"name"}, mandatory = false, help = "query name") String queryName) throws UnsupportedEncodingException { QueryPlan plan = getClient().explainAndPrepare(sql, queryName); if (plan.isError()) { return "Explain FAILED:" + plan.getErrorMsg(); } StringBuilder planStr = new StringBuilder(plan.getPlanString()); planStr.append("\n").append("Prepare handle:").append(plan.getPrepareHandle()); return planStr.toString(); }
Source:
static <T> Call<T> decorateCall(final RateLimiter rateLimiter, final Call<T> call) { return new DecoratedCall<T>(call) { @Override public Response<T> execute() throws IOException { Try.CheckedSupplier<Response<T>> restrictedSupplier = RateLimiter.decorateCheckedSupplier(rateLimiter, call::execute); final Try<Response<T>> response = Try.of(restrictedSupplier); return response.isSuccess() ? response.get() : tooManyRequestsError(); } private Response<T> tooManyRequestsError() { return Response.error(ERROR_CODE, ResponseBody.create(MediaType.parse("text/plain"), ERROR_MESSAGE)); } }; }

Target:
static <T> Call<T> decorateCall(final RateLimiter rateLimiter, final Call<T> call) { return new DecoratedCall<T>(call) { @Override public Response<T> execute() throws IOException { Try.CheckedSupplier<Response<T>> restrictedSupplier = RateLimiter.decorateCheckedSupplier(rateLimiter, call::execute); final Try<Response<T>> response = Try.of(restrictedSupplier); return response.isSuccess() ? response.get() : handleFailure(response); } private Response<T> handleFailure(Try<Response<T>> response) throws IOException { try { throw response.getCause(); } catch (RequestNotPermitted | IllegalStateException e) { return tooManyRequestsError(); } catch (IOException ioe) { throw ioe; } catch (Throwable t) { throw new RuntimeException("Exception executing call", t); } } private Response<T> tooManyRequestsError() { return Response.error(ERROR_CODE, ResponseBody.create(MediaType.parse("text/plain"), ERROR_MESSAGE)); } }; }
Source:
protected Histogram<Integer> getUnfilteredBaseQHistogram() { return getHistogram(unfilteredBaseQHistogramArray, "baseq", "count"); }

Target:
protected Histogram<Integer> getUnfilteredBaseQHistogram() { return getHistogram(unfilteredBaseQHistogramArray, "baseq", "unfiltered_baseq_count"); }
Source:
Response<T> parseResponse(okhttp3.Response rawResponse) throws IOException { ResponseBody rawBody = rawResponse.body(); rawResponse = rawResponse.newBuilder() .body(new NoContentResponseBody(rawBody.contentType(), rawBody.contentLength())) .build(); int code = rawResponse.code(); if (code < 200 || code >= 300) { try { ResponseBody bufferedBody = Utils.buffer(rawBody); return Response.error(bufferedBody, rawResponse); } finally { rawBody.close(); } } else if (code == 204 || code == 205) { rawBody.close(); return Response.success(null, rawResponse); } ExceptionCatchingRequestBody catchingBody = new ExceptionCatchingRequestBody(rawBody); try { T body = serviceMethod.toResponse(catchingBody); return Response.success(body, rawResponse); } catch (RuntimeException e) { catchingBody.throwIfCaught(); throw e; } }

Target:
Response<T> parseResponse(okhttp3.Response rawResponse) throws IOException { ResponseBody rawBody = rawResponse.body(); rawResponse = rawResponse.newBuilder() .body(new NoContentResponseBody(rawBody.contentType(), rawBody.contentLength())) .build(); int code = rawResponse.code(); if (code < 200 || code >= 300) { try { ResponseBody bufferedBody = Utils.buffer(rawBody); return Response.error(bufferedBody, rawResponse); } finally { rawBody.close(); } } if (code == 204 || code == 205) { rawBody.close(); return Response.success(null, rawResponse); } ExceptionCatchingRequestBody catchingBody = new ExceptionCatchingRequestBody(rawBody); try { T body = serviceMethod.toResponse(catchingBody); return Response.success(body, rawResponse); } catch (RuntimeException e) { catchingBody.throwIfCaught(); throw e; } }
Source:
public void testWatermarkEmissionWithChaining() throws Exception { StreamExecutionEnvironment env = StreamExecutionEnvironment.createLocalEnvironment(1); env.setStreamTimeCharacteristic(TimeCharacteristic.EventTime); env.getConfig().setAutoWatermarkInterval(WATERMARK_INTERVAL_MILLIS); checkState(env.isChainingEnabled()); env .readTextFile(getSourceFile().getAbsolutePath()) .assignTimestampsAndWatermarks(getExtractorAssigner()) .addSink(getWatermarkCounter()); JobExecutionResult result = env.execute(); int actual = result.getAccumulatorResult(NUM_WATERMARKS_ACC_NAME); double expected = ((double) (long) result.getAccumulatorResult(DURATION_ACC_NAME)) / WATERMARK_INTERVAL_MILLIS; assertTrue("too few watermarks emitted: " + actual, actual >= MIN_EXPECTED_WATERMARKS); assertEquals(1, actual / expected, .8d); }

Target:
public void testWatermarkEmissionWithChaining() throws Exception { StreamExecutionEnvironment env = StreamExecutionEnvironment.createLocalEnvironment(1); env.setStreamTimeCharacteristic(TimeCharacteristic.EventTime); env.getConfig().setAutoWatermarkInterval(WATERMARK_INTERVAL_MILLIS); checkState(env.isChainingEnabled()); env .readTextFile(getSourceFile().getAbsolutePath()) .assignTimestampsAndWatermarks(getExtractorAssigner()) .addSink(getWatermarkCounter()); JobExecutionResult result = env.execute(); int actual = result.getAccumulatorResult(NUM_WATERMARKS_ACC_NAME); assertTrue("too few watermarks emitted: " + actual, actual >= MIN_EXPECTED_WATERMARKS); }
Source:
public void resetToDefaults() { maximumPageSize = DEFAULT_PAGESIZE; showSiteHeader = true; useFlashClipboard = true; copySelfOnEmail = false; displayPatchSetsInReverseOrder = false; displayPersonNameInReviewCategory = true; downloadUrl = null; downloadCommand = null; dateFormat = null; timeFormat = null; }

Target:
public void resetToDefaults() { maximumPageSize = DEFAULT_PAGESIZE; showSiteHeader = true; useFlashClipboard = true; copySelfOnEmail = false; displayPatchSetsInReverseOrder = false; displayPersonNameInReviewCategory = false; downloadUrl = null; downloadCommand = null; dateFormat = null; timeFormat = null; }
Source:
public void run() { try { this.eventQueue.put(new DiscoveryServiceEvent(DISCOVERY_INIT_TOPOLOGY)); } catch (Exception e) { log.error("Caught an exception. Stop running."); shutdown(); } while (!shutdown) { try { DiscoveryServiceEvent event = eventQueue.take(); processEvent(event); } catch (Exception | LogReplicationDiscoveryServiceException e) { log.error("Caught an exception. Stop discovery service.", e); shutdown(); } } }

Target:
private void run() { while (!shutdown) { try { DiscoveryServiceEvent event = eventQueue.take(); processEvent(event); } catch (InterruptedException e) { log.error("Caught an exception. Stop discovery service.", e); shutdown(); } } }
Source:
private String getUrl(String propertyPrefix) { String url = Common.envProps.getString(propertyPrefix + "db.url"); url = StringUtils.replaceMacros(url, System.getProperties()); Path dbPath = getDbPathFromUrl(url); Path dbFolder = dbPath.getParent(); String[] matchingDbs = dbFolder.toFile().list((dir, filename) ->{ if(filename.startsWith(dbPath.getFileName().toString())) return true; else return false; }); int version = 0; for(String match : matchingDbs) { try { int newVersion = getVersion(match); if(newVersion > version) version = newVersion; } catch (IOException e) { } } if(version == 0) version = getCurrentVersion(); url = url + "." + version; if (!url.contains(";DB_CLOSE_ON_EXIT=")) { url += ";DB_CLOSE_ON_EXIT=FALSE"; } if (!url.contains(";MV_STORE=")) { url += ";MV_STORE=FALSE"; } if (!url.contains(";IGNORECASE=")) { url += ";IGNORECASE=TRUE"; } return url; }

Target:
private String getUrl(String propertyPrefix) { String url = Common.envProps.getString(propertyPrefix + "db.url"); url = StringUtils.replaceMacros(url, System.getProperties()); String jdbcParts = url.split("jdbc:h2:"); String commandParts = jdbcParts[1].split(";"); Path dbPath = Paths.get(commandParts[0]); Path dbFolder = dbPath.getParent(); String[] matchingDbs = dbFolder.toFile().list((dir, filename) ->{ if(filename.startsWith(dbPath.getFileName().toString())) return true; else return false; }); int version = 0; for(String match : matchingDbs) { try { int newVersion = getVersion(match); if(newVersion > version) version = newVersion; } catch (IOException e) { } } if(version == 0) version = getCurrentVersion(); StringBuilder builder = new StringBuilder(); builder.append("jdbc:h2:"); builder.append(commandParts[0]); builder.append("." + version); for(int i=1; i<commandParts.length; i++) { builder.append(";"); builder.append(commandParts[i]); } url = builder.toString(); if (!url.contains(";DB_CLOSE_ON_EXIT=")) { url += ";DB_CLOSE_ON_EXIT=FALSE"; } if (!url.contains(";MV_STORE=")) { url = url.replaceAll(";MV_STORE=", ""); } if (!url.contains(";IGNORECASE=")) { url += ";IGNORECASE=TRUE"; } return url; }
Source:
public Set<Project> applyChanges( final List<Project> projects, final ManipulationSession session ) throws ManipulationException { final GroovyState state = session.getState( GroovyState.class ); if ( !session.isEnabled() || !state.isEnabled() ) { logger.debug( getClass().getSimpleName() + ": Nothing to do!" ); return Collections.emptySet(); } final Set<Project> changed = new HashSet<Project>(); final List<ArtifactRef> scripts = state.getGroovyScripts(); for (ArtifactRef ar : scripts) { logger.info ("Attempting to read GAV with classifier and type ", ar.asProjectVersionRef(), ar.getClassifier(), ar.getType()); final File groovyScript = modelBuilder.resolveRawFile( ar ); Binding binding = new Binding( ); GroovyShell shell = new GroovyShell( binding ); Script script = null; for ( final Project project : projects ) { if ( project.isExecutionRoot() ) { binding.setProperty( "basedir", project.getPom().getParentFile().toString() ); binding.setProperty( "name", project.getKey() ); logger.info ("Executing on with binding ", groovyScript, project, binding.getVariables()); try { script = shell.parse( groovyScript ); } catch (CompilationFailedException e) { throw new ManipulationException( "Unable to parse script", e ); } catch ( IOException e ) { throw new ManipulationException( "Unable to parse script", e ); } try { script.run(); } catch ( Exception e ) { throw new ManipulationException( "Unable to parse script", e ); } changed.add( project ); } } } return changed; }

Target:
public Set<Project> applyChanges( final List<Project> projects, final ManipulationSession session ) throws ManipulationException { final GroovyState state = session.getState( GroovyState.class ); if ( !session.isEnabled() || !state.isEnabled() ) { logger.debug( getClass().getSimpleName() + ": Nothing to do!" ); return Collections.emptySet(); } final Set<Project> changed = new HashSet<Project>(); final List<ArtifactRef> scripts = state.getGroovyScripts(); for (ArtifactRef ar : scripts) { logger.info ("Attempting to read GAV with classifier and type ", ar.asProjectVersionRef(), ar.getClassifier(), ar.getType()); final File groovyScript = modelBuilder.resolveRawFile( ar ); CompilerConfiguration config = new CompilerConfiguration(); config.setScriptBaseClass(org.commonjava.maven.ext.manip.groovy.BaseScript.class.getName()); GroovyShell shell = new GroovyShell( ); Script script = null; for ( final Project project : projects ) { if ( project.isExecutionRoot() ) { logger.info ("Executing on {}", groovyScript, project); try { script = shell.parse( groovyScript ); script.invokeMethod( "setValues", new Object[] { projects, project } ); } catch (MissingMethodException e) { throw new ManipulationException( "Unable to inject values into base script", e ); } catch (CompilationFailedException e) { throw new ManipulationException( "Unable to parse script", e ); } catch ( IOException e ) { throw new ManipulationException( "Unable to parse script", e ); } try { script.run(); } catch ( Exception e ) { throw new ManipulationException( "Unable to parse script", e ); } changed.add( project ); } } } return changed; }
Source:
public OffHeapChainMap(PageSource source, Portability<? super K> keyPortability, int minPageSize, int maxPageSize, boolean shareByThieving) { this.chainStorage = new OffHeapChainStorageEngine<>(source, keyPortability, minPageSize, maxPageSize, shareByThieving, shareByThieving); EvictionListener<K, InternalChain> listener = callable -> { try { Map.Entry<K, InternalChain> entry = callable.call(); try { if (evictionListener != null) { evictionListener.onEviction(entry.getKey()); } } finally { entry.getValue().close(); } } catch (Exception e) { throw new AssertionError(e); } }; this.heads = new EvictionListeningReadWriteLockedOffHeapClockCache<>(listener, source, chainStorage); }

Target:
public OffHeapChainMap(PageSource source, Portability<? super K> keyPortability, int minPageSize, int maxPageSize, boolean shareByThieving) { this.chainStorage = new OffHeapChainStorageEngine<>(source, keyPortability, minPageSize, maxPageSize, shareByThieving, shareByThieving); EvictionListener<K, InternalChain> listener = new EvictionListener<K, InternalChain>() { @Override public void evicting(Callable<Map.Entry<K, InternalChain>> callable) { try { Map.Entry<K, InternalChain> entry = callable.call(); try { if (evictionListener != null) { evictionListener.onEviction(entry.getKey()); } } finally { entry.getValue().close(); } } catch (Exception e) { throw new AssertionError(e); } } }; this.heads = new EvictionListeningReadWriteLockedOffHeapClockCache<>(listener, source, chainStorage); }
Source:
public TaskEditorReviewsPart() { taskReviewStore = TaskReviewsMappingStore.getInstance(); setPartName("Reviews"); }

Target:
public TaskEditorReviewsPart() { taskReviewStore = TasksUiPlugin.getTaskReviewsMappingStore(); setPartName("Reviews"); }
Source:
protected String generateLabelText(final Map<Integer, String> labels, final List<Integer> selectedFields, final Map<Integer, Field> keyFieldMap, final int row) { if(row < selectedFields.size()) { final String value = labels.get(selectedFields.get(row)) != null ? labels.get(selectedFields.get(row)) : ""; return keyFieldMap.get(selectedFields.get(row)).getName() + FIELDNAME_VALUE_SEPARATOR + value; } return ""; }

Target:
protected String generateLabelText(final Map<Integer, String> labels, final List<Integer> selectedFields, final Map<Integer, Field> keyFieldMap, final int row) { if(row < selectedFields.size()) { final String value = labels.get(selectedFields.get(row)) != null ? labels.get(selectedFields.get(row)) : StringUtils.EMPTY; return keyFieldMap.get(selectedFields.get(row)).getName() + FIELDNAME_VALUE_SEPARATOR + value; } return ""; }
Source:
protected String getReferenceDisplayName() { if (referenceDisplayName == null) { final EObject domainModel = getViewModelContext().getDomainModel(); final EditingDomain domain = AdapterFactoryEditingDomain.getEditingDomainFor(domainModel); if (domain instanceof AdapterFactoryEditingDomain) { final AdapterFactory factory = ((AdapterFactoryEditingDomain) domain).getAdapterFactory(); final IItemLabelProvider labels = (IItemLabelProvider) factory.adapt(domainModel, IItemLabelProvider.class); if (labels instanceof ResourceLocator) { String typeKey; try { typeKey = getEStructuralFeature().getEType().getName(); referenceDisplayName = ((ResourceLocator) labels) .getString(String.format("_UI_%s_type", typeKey)); } catch (final DatabindingFailedException e) { } } } if (referenceDisplayName == null) { referenceDisplayName = LocalizationServiceHelper.getString(MultiReferenceSWTRenderer.class, MessageKeys.MultiReferenceSWTRenderer_defaultReferenceDisplayName); } } return referenceDisplayName; }

Target:
protected String getReferenceDisplayName() { if (referenceDisplayName == null) { try { final EStructuralFeature feature = getEStructuralFeature(); if (feature != null) { final EClassifier type = feature.getEType(); final Bundle editBundle = bundleResolver.getEditBundle(type); referenceDisplayName = l10n.getString(editBundle, String.format("_UI_%s_type", type.getName())); } } catch (final DatabindingFailedException e) { } catch (final NoBundleFoundException ex) { } if (referenceDisplayName == null) { referenceDisplayName = LocalizationServiceHelper.getString(MultiReferenceSWTRenderer.class, MessageKeys.MultiReferenceSWTRenderer_defaultReferenceDisplayName); } } return referenceDisplayName; }
Source:
public D create(Parameter[] parameters) { D result; try { result = targetClass.newInstance(); } catch (InstantiationException | IllegalAccessException e) { throw new AssertionFailure( "Unexpected failure while instanciating a definition", e ); } result.setType( type ); Map<String, JsonElement> parameterMap = new LinkedHashMap<>( staticParameters ); if ( parameters != null && parameters.length > 0 ) { for ( Parameter parameter : parameters ) { addParameter( parameterMap, parameter.name(), parameter.value() ); } } if ( !parameterMap.isEmpty() ) { result.setParameters( parameterMap ); } return result; }

Target:
public D create(Parameter[] parameters) { D result; try { result = targetClass.newInstance(); } catch (InstantiationException | IllegalAccessException e) { throw new AssertionFailure( "Unexpected failure while instantiating a definition", e ); } result.setType( type ); Map<String, String> luceneParameterMap = new LinkedHashMap<>(); if ( parameters != null ) { for ( Parameter parameter : parameters ) { luceneParameterMap.put( parameter.name(), parameter.value() ); } } Map<String, JsonElement> elasticsearchParameterMap = new LinkedHashMap<>(); for ( ParametersTransformer transformer : parameterTransformers ) { elasticsearchParameterMap.putAll( transformer.transform( luceneParameterMap ) ); } if ( !elasticsearchParameterMap.isEmpty() ) { result.setParameters( elasticsearchParameterMap ); } return result; }
Source:
public static boolean isSanitizedHtml(String string) { if (string == null) { return false; } if (isTextContainingAny(string, "<", ">", "\"", "/", "\'")) { return false; } return isTextContainingAny(string, "&lt;", "&gt;", "&quot;", "&#x2f;", "&#39;", "&amp;"); }

Target:
public static boolean isSanitizedHtml(String string) { return string != null && !isTextContainingAny(string, "<", ">", "\"", "/", "\'") && isTextContainingAny(string, "&lt;", "&gt;", "&quot;", "&#x2f;", "&#39;", "&amp;"); }
Source:
public String toString() { StringBuilder output = new StringBuilder(); if (instance.getId() != null) { output.append(instance.getId()); } return output.toString() + "STATE: " + currentState.toString(); }

Target:
public String toString() { StringBuilder output = new StringBuilder(); if (instance.getId() != null) { output.append(instance.getId()); } return output.append("STATE").append(currentState.toString()).toString(); }
Source:
public void testCompareTo() { assertEquals(0, sut6Tuple.compareTo(sut6Tuple)); assertEquals(1, sut6Tuple.compareTo(sut1Tuple)); assertEquals(-1, sut1Tuple.compareTo(sut6Tuple)); }

Target:
public void testCompareTo() { int[] nrs = {1, 2, 3, 5, 7, 11, 12, 13}; IntTuple sut6TupleExtended = new IntTuple(nrs); int[] nrs2 = {1, 8, 3, 5, 7, 11}; IntTuple sut6TupleChanged = new IntTuple(nrs2); assertEquals(0, sut6Tuple.compareTo(sut6Tuple)); assertEquals(-1, sut6Tuple.compareTo(sut6TupleChanged)); assertEquals(1, sut6TupleChanged.compareTo(sut6Tuple)); assertEquals(-1, sut6Tuple.compareTo(sut6TupleExtended)); assertEquals(1, sut6TupleExtended.compareTo(sut6Tuple)); }
Source:
private Comparator<ITestNGMethod> newComparator(boolean needPrioritySort) { return needPrioritySort ? new TestMethodComparator() : null; }

Target:
private static Comparator<ITestNGMethod> newComparator(boolean needPrioritySort) { return needPrioritySort ? new TestMethodComparator() : null; }
Source:
private void stopRecording() { if (this.screenRecorder != null && this.screenRecorder.getState() == ScreenRecorder.State.RECORDING) { try { TimeUnit.SECONDS.sleep(1); screenRecorder.stop(); } catch (IOException e) { throw new IllegalArgumentException("Exception stopping test recording.", e); } catch (InterruptedException e) { throw new IllegalArgumentException("Exception stopping test recording.", e); } } }

Target:
private void stopRecording() { stopRecording(false); }
Source:
public void shouldAllowConcurrentAccesses() throws Exception { final int numIterations = 500000; final String storeName = "word-count-store"; final String windowStoreName = "windowed-word-count-store"; ProducerRunnable producerRunnable = new ProducerRunnable(streamThree, inputValues, 1); producerRunnable.run(); producerRunnable = new ProducerRunnable(streamConcurrent, inputValues, numIterations); final Thread producerThread = new Thread(producerRunnable); kafkaStreams = createCountStream( streamConcurrent, outputTopicConcurrent, outputTopicConcurrentWindowed, storeName, windowStoreName, streamsConfiguration); startKafkaStreamsAndWaitForRunningState(kafkaStreams); producerThread.start(); try { waitUntilAtLeastNumRecordProcessed(outputTopicConcurrent, 1); final ReadOnlyKeyValueStore<String, Long> keyValueStore = kafkaStreams.store(StoreQueryParameters.fromNameAndType(storeName + "-" + streamConcurrent, QueryableStoreTypes.keyValueStore())); final ReadOnlyWindowStore<String, Long> windowStore = kafkaStreams.store(StoreQueryParameters.fromNameAndType(windowStoreName + "-" + streamConcurrent, QueryableStoreTypes.windowStore())); final Map<String, Long> expectedWindowState = new HashMap<>(); final Map<String, Long> expectedCount = new HashMap<>(); while (producerRunnable.getCurrIteration() < numIterations) { verifyGreaterOrEqual(inputValuesKeys.toArray(new String[0]), expectedWindowState, expectedCount, windowStore, keyValueStore); } } finally { producerRunnable.shutdown(); producerThread.interrupt(); producerThread.join(); } }

Target:
public void shouldAllowConcurrentAccesses() throws Exception { final int numIterations = 500000; final String storeName = "word-count-store"; final String windowStoreName = "windowed-word-count-store"; ProducerRunnable producerRunnable = new ProducerRunnable(streamThree, inputValues, 1); producerRunnable.run(); producerRunnable = new ProducerRunnable(streamConcurrent, inputValues, numIterations - 1); final Thread producerThread = new Thread(producerRunnable); kafkaStreams = createCountStream( streamConcurrent, outputTopicConcurrent, outputTopicConcurrentWindowed, storeName, windowStoreName, streamsConfiguration); startKafkaStreamsAndWaitForRunningState(kafkaStreams); producerThread.start(); try { waitUntilAtLeastNumRecordProcessed(outputTopicConcurrent, 1); final ReadOnlyKeyValueStore<String, Long> keyValueStore = IntegrationTestUtils.getStore(storeName + "-" + streamConcurrent, kafkaStreams, QueryableStoreTypes.keyValueStore()); final ReadOnlyWindowStore<String, Long> windowStore = IntegrationTestUtils.getStore(windowStoreName + "-" + streamConcurrent, kafkaStreams, QueryableStoreTypes.windowStore()); final Map<String, Long> expectedWindowState = new HashMap<>(); final Map<String, Long> expectedCount = new HashMap<>(); while (producerRunnable.getCurrIteration() < numIterations) { verifyGreaterOrEqual(inputValuesKeys.toArray(new String[0]), expectedWindowState, expectedCount, windowStore, keyValueStore); } } finally { producerRunnable.shutdown(); producerThread.interrupt(); producerThread.join(); } }
Source:
public void testRawBytes() { boolean bool0[] = {}; boolean bool1[] = { true }; boolean bool7[] = { true, false, true, false, true, false, true }; boolean bool8[] = { true, false, true, false, true, false, true, false }; boolean bool9[] = { true, false, true, false, true, false, true, false, true }; boolean bool16[] = { false, true, true, false, false, false, true, true, true, true, false, false, false, false, false, true }; byte byte0[] = {}; byte byte1[] = { -128 }; byte byte7[] = { -86 }; byte byte8[] = { -86 }; byte byte9[] = { -86, -128 }; byte byte16[] = { 99, -63 }; assertEqualByteArrays(byte0, Decoder.convertBoolArrayToByteArray(bool0)); assertEqualByteArrays(byte1, Decoder.convertBoolArrayToByteArray(bool1)); assertEqualByteArrays(byte7, Decoder.convertBoolArrayToByteArray(bool7)); assertEqualByteArrays(byte8, Decoder.convertBoolArrayToByteArray(bool8)); assertEqualByteArrays(byte9, Decoder.convertBoolArrayToByteArray(bool9)); assertEqualByteArrays(byte16, Decoder.convertBoolArrayToByteArray(bool16)); }

Target:
public void testRawBytes() { boolean[] bool0 = {}; boolean[] bool1 = { true }; boolean[] bool7 = { true, false, true, false, true, false, true }; boolean[] bool8 = { true, false, true, false, true, false, true, false }; boolean[] bool9 = { true, false, true, false, true, false, true, false, true }; boolean[] bool16 = { false, true, true, false, false, false, true, true, true, true, false, false, false, false, false, true }; byte[] byte0 = {}; byte[] byte1 = { -128 }; byte[] byte7 = { -86 }; byte[] byte8 = { -86 }; byte[] byte9 = { -86, -128 }; byte[] byte16 = { 99, -63 }; assertArrayEquals(byte0, Decoder.convertBoolArrayToByteArray(bool0)); assertArrayEquals(byte1, Decoder.convertBoolArrayToByteArray(bool1)); assertArrayEquals(byte7, Decoder.convertBoolArrayToByteArray(bool7)); assertArrayEquals(byte8, Decoder.convertBoolArrayToByteArray(bool8)); assertArrayEquals(byte9, Decoder.convertBoolArrayToByteArray(bool9)); assertArrayEquals(byte16, Decoder.convertBoolArrayToByteArray(bool16)); }
Source:
public String toString() { final StringBuilder sb = new StringBuilder(getClass().getSimpleName()); synchronized (mLock) { sb.append("{Media Id=").append(getMediaId()); sb.append("{mMetadata=").append(mMetadata); sb.append(", mStartPositionMs=").append(mStartPositionMs); sb.append(", mEndPositionMs=").append(mEndPositionMs); sb.append('}'); } return sb.toString(); }

Target:
public String toString() { final StringBuilder sb = new StringBuilder(getClass().getSimpleName()); synchronized (mLock) { sb.append("{Media Id=").append(getMediaId()); sb.append(", mMetadata=").append(mMetadata); sb.append(", mStartPositionMs=").append(mStartPositionMs); sb.append(", mEndPositionMs=").append(mEndPositionMs); sb.append('}'); } return sb.toString(); }