auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public boolean handleExceptionsForConfiguration(FileformatInterface newFile, Process process) { String rules = ConfigCore.getParameter("copyData.onExport"); if (rules != null && !rules.equals("- keine Konfiguration gefunden -")) { try { new DataCopier(rules).process(new CopierData(newFile, process)); } catch (ConfigurationException e) { logger.error(e.getMessage(), e); Helper.setFehlerMeldung("dataCopier.syntaxError", e.getMessage()); return false; } catch (RuntimeException e) { logger.error(e.getMessage(), e); Helper.setFehlerMeldung("dataCopier.runtimeException", e.getMessage()); return false; } } return true; }

Target:
public boolean handleExceptionsForConfiguration(FileformatInterface newFile, Process process) { String rules = ConfigCore.getParameter("copyData.onExport"); if (rules != null && !rules.equals("- keine Konfiguration gefunden -")) { try { new DataCopier(rules).process(new CopierData(newFile, process)); } catch (ConfigurationException e) { Helper.setErrorMessage("dataCopier.syntaxError", logger, e); return false; } catch (RuntimeException e) { Helper.setErrorMessage("dataCopier.runtimeException", logger, e); return false; } } return true; }
Source:
public void shouldSetRecordMetadata() { testDriver = new TopologyTestDriver(setupSingleProcessorTopology(), config); testDriver.pipeInput(consumerRecord1); final List<String> processedRecords = supplier.theCapturedProcessor().processed; assertEquals(1, processedRecords.size()); final String record = processedRecords.get(0); final String expectedResult = MockProcessor.makeRecord(consumerRecord1.key(), consumerRecord1.value(), consumerRecord1.timestamp()); assertThat(record, equalTo(expectedResult)); }

Target:
public void shouldSetRecordMetadata() { testDriver = new TopologyTestDriver(setupSingleProcessorTopology(), config); testDriver.pipeInput(consumerRecord1); final List<Record> processedRecords = mockProcessors.get(0).processedRecords; assertEquals(1, processedRecords.size()); final Record record = processedRecords.get(0); final Record expectedResult = new Record(consumerRecord1, 0L); assertThat(record, equalTo(expectedResult)); }
Source:
protected long getParentDid() { long deckID; deckID = getCol().getDecks().selected(); return deckID; }

Target:
protected long getParentDid() { long deckID = getCol().getDecks().selected(); return deckID; }
Source:
public JPAPlaceholderResolverStrategy(String persistenceUnit, ClassLoader cl) { ClassLoader tccl = Thread.currentThread().getContextClassLoader(); try { Thread.currentThread().setContextClassLoader(cl); this.emf = Persistence.createEntityManagerFactory(persistenceUnit); initializeManagedClasses(); this.closeEmf = true; } finally { Thread.currentThread().setContextClassLoader(tccl); } this.classLoader = cl; this.name += ":" + persistenceUnit; }

Target:
public JPAPlaceholderResolverStrategy(String persistenceUnit, ClassLoader cl) { ClassLoader tccl = Thread.currentThread().getContextClassLoader(); try { Thread.currentThread().setContextClassLoader(cl); this.emf = Persistence.createEntityManagerFactory(persistenceUnit); initializeManagedClasses(); this.closeEmf = true; } finally { Thread.currentThread().setContextClassLoader(tccl); } this.classLoader = cl; }
Source:
private static void ensureNoneIsMarkedAsDefault(QualityProfileDto profile, List<QualityProfileDto> descendants) { if (profile.isDefault()) { throw new IllegalArgumentException("Profile is marked as 'default' and cannot be deleted"); } descendants.stream() .filter(QualityProfileDto::isDefault) .findFirst() .ifPresent(p -> { throw new IllegalArgumentException("Profile cannot be deleted because its descendant named [" + p.getName() + "] is marked as 'default'"); }); }

Target:
private static void ensureNoneIsMarkedAsDefault(QualityProfileDto profile, List<QualityProfileDto> descendants) { checkArgument(!profile.isDefault(), "Profile '%s' cannot be deleted because it is marked as default", profile.getName()); descendants.stream() .filter(QualityProfileDto::isDefault) .findFirst() .ifPresent(p -> { throw new IllegalArgumentException(String.format("Profile '%s' cannot be deleted because its descendant named '%s' is marked as default", profile.getName(), p.getName())); }); }
Source:
@Override protected MetadataMarshalled run(@Nullable MetadataTypeArgs arg) throws IgniteException { try { if (future == null) { ignite.context().security().authorize(null, SecurityPermission.ADMIN_METADATA_OPS); assert Objects.nonNull(arg); int typeId = arg.typeId(ignite.context()); BinaryMetadata meta = ((CacheObjectBinaryProcessorImpl)ignite.context().cacheObjects()) .binaryMetadata(typeId); byte[] marshalled = U.marshal(ignite.context(), meta); res = new MetadataMarshalled(marshalled, meta); ignite.context().cacheObjects().removeType(typeId); future = ignite.compute().broadcastAsync(new DropAllThinSessionsJob());; jobCtx.holdcc(); future.listen(new IgniteInClosure<IgniteFuture<Void>>() { @Override public void apply(IgniteFuture<Void> f) { if (f.isDone()) jobCtx.callcc(); } }); return null; } return res; } catch (IgniteCheckedException e) { throw new IgniteException(e); } }

Target:
@Override protected MetadataMarshalled run(@Nullable MetadataTypeArgs arg) throws IgniteException { try { if (future == null) { ignite.context().security().authorize(null, SecurityPermission.ADMIN_METADATA_OPS); assert Objects.nonNull(arg); int typeId = arg.typeId(ignite.context()); BinaryMetadata meta = ((CacheObjectBinaryProcessorImpl)ignite.context().cacheObjects()) .binaryMetadata(typeId); byte[] marshalled = U.marshal(ignite.context(), meta); res = new MetadataMarshalled(marshalled, meta); ignite.context().cacheObjects().removeType(typeId); future = ignite.compute().broadcastAsync(new DropAllThinSessionsJob()); jobCtx.holdcc(); future.listen((IgniteInClosure<IgniteFuture<Void>>)f -> { if (f.isDone()) jobCtx.callcc(); }); return null; } return res; } catch (IgniteCheckedException e) { throw new IgniteException(e); } }
Source:
Mono<Response<BlobProperties>> downloadToFileWithResponse(String filePath, BlobRange range, ParallelTransferOptions parallelTransferOptions, DownloadRetryOptions downloadRetryOptions, BlobRequestConditions requestConditions, boolean rangeGetContentMd5, Context context) { BlobRange rangeReal = range == null ? new BlobRange(0) : range; final ParallelTransferOptions finalParallelTransferOptions = ModelHelper.populateAndApplyDefaults(parallelTransferOptions); BlobRequestConditions conditionsReal = requestConditions == null ? new BlobRequestConditions() : requestConditions; AsynchronousFileChannel channel = downloadToFileResourceSupplier(filePath); return Mono.just(channel) .flatMap(c -> this.downloadToFileImpl(c, rangeReal, finalParallelTransferOptions, downloadRetryOptions, conditionsReal, rangeGetContentMd5, context)) .doFinally(signalType -> this.downloadToFileCleanup(channel, filePath, signalType)); }

Target:
Mono<Response<BlobProperties>> downloadToFileWithResponse(String filePath, BlobRange range, ParallelTransferOptions parallelTransferOptions, DownloadRetryOptions downloadRetryOptions, BlobRequestConditions requestConditions, boolean rangeGetContentMd5, Context context) { BlobRange finalRange = range == null ? new BlobRange(0) : range; final ParallelTransferOptions finalParallelTransferOptions = ModelHelper.populateAndApplyDefaults(parallelTransferOptions); BlobRequestConditions finalConditions = requestConditions == null ? new BlobRequestConditions() : requestConditions; AsynchronousFileChannel channel = downloadToFileResourceSupplier(filePath); return Mono.just(channel) .flatMap(c -> this.downloadToFileImpl(c, finalRange, finalParallelTransferOptions, downloadRetryOptions, finalConditions, rangeGetContentMd5, context)) .doFinally(signalType -> this.downloadToFileCleanup(channel, filePath, signalType)); }
Source:
boolean useNonce(final String nonce, byte[] salt) throws AuthenticationMechanismException { try { MessageDigest messageDigest = MessageDigest.getInstance(algorithm); ByteIterator byteIterator = CodePointIterator.ofChars(nonce.toCharArray()).base64Decode(); byte[] nonceBytes = byteIterator.drain(); if (nonceBytes.length != PREFIX_LENGTH + messageDigest.getDigestLength()) { throw log.invalidNonceLength(HttpConstants.DIGEST_NAME); } long age = System.currentTimeMillis() - ByteBuffer.wrap(nonceBytes, Integer.BYTES, Long.BYTES).getLong(); if (age < 0 || age > validityPeriod) { log.tracef("Nonce %s rejected due to age %d being less than 0 or greater than the validity period %d", nonce, age, validityPeriod); return false; } if (Arrays2.equals(nonceBytes, PREFIX_LENGTH, digest(nonceBytes, 0, PREFIX_LENGTH, salt, messageDigest)) == false) { if (log.isTraceEnabled()) { log.tracef("Nonce %s rejected due to failed comparison using secret key with seed %s.", nonce, new String(salt, StandardCharsets.UTF_8)); } return false; } if (singleUse) { synchronized(usedNonces) { boolean used = usedNonces.add(nonce); if (used) { executor.schedule(() -> { synchronized(usedNonces) { usedNonces.remove(nonce); } }, validityPeriod - age, TimeUnit.MILLISECONDS); } else { log.tracef("Nonce %s rejected as previously used.", nonce); } return used; } } return true; } catch (GeneralSecurityException e) { throw new IllegalStateException(e); } }

Target:
boolean useNonce(final String nonce, byte[] salt) throws AuthenticationMechanismException { try { MessageDigest messageDigest = MessageDigest.getInstance(algorithm); ByteIterator byteIterator = CodePointIterator.ofChars(nonce.toCharArray()).base64Decode(); byte[] nonceBytes = byteIterator.drain(); if (nonceBytes.length != PREFIX_LENGTH + messageDigest.getDigestLength()) { throw log.invalidNonceLength(HttpConstants.DIGEST_NAME); } long age = System.nanoTime() - ByteBuffer.wrap(nonceBytes, Integer.BYTES, Long.BYTES).getLong(); if (age < 0 || age > validityPeriodNano) { log.tracef("Nonce %s rejected due to age %d (ns) being less than 0 or greater than the validity period %d (ns)", nonce, age, validityPeriodNano); return false; } if (Arrays2.equals(nonceBytes, PREFIX_LENGTH, digest(nonceBytes, 0, PREFIX_LENGTH, salt, messageDigest)) == false) { if (log.isTraceEnabled()) { log.tracef("Nonce %s rejected due to failed comparison using secret key with seed %s.", nonce, new String(salt, StandardCharsets.UTF_8)); } return false; } if (singleUse) { synchronized(usedNonces) { boolean used = usedNonces.add(nonce); if (used) { executor.schedule(() -> { synchronized(usedNonces) { usedNonces.remove(nonce); } }, validityPeriodNano - age, TimeUnit.MILLISECONDS); } else { log.tracef("Nonce %s rejected as previously used.", nonce); } return used; } } return true; } catch (GeneralSecurityException e) { throw new IllegalStateException(e); } }
Source:
protected abstract OutputStream getOutputStreamInternal(RepositoryPath repositoryPath) throws IOException; protected final RepositoryOutputStream decorate(RepositoryPath repositoryPath, OutputStream os) throws IOException { if (os == null || os instanceof RepositoryOutputStream) { return (RepositoryOutputStream) os; } String path = RepositoryFiles.stringValue(repositoryPath); return RepositoryOutputStream.of(repositoryPath.getRepository(), path, os).with(this); }

Target:
protected abstract OutputStream getOutputStreamInternal(RepositoryPath repositoryPath) throws IOException; protected final RepositoryOutputStream decorate(RepositoryPath repositoryPath, OutputStream os) throws IOException { if (os == null || os instanceof RepositoryOutputStream) { return (RepositoryOutputStream) os; } return RepositoryOutputStream.of(repositoryPath, os).with(this); }
Source:
public void run() { try { Pattern pattern = Pattern.compile(".*rpc-response.*"); consumer.subscribe(pattern); while (!closed.get()) { ConsumerRecords<String, byte[]> records = consumer.poll(Long.MAX_VALUE); for (ConsumerRecord<String, byte[]> record : records) { RpcMessageProtos.RpcMessage rpcMessage = RpcMessageProtos.RpcMessage.parseFrom(record.value()); ResponseCallback responseCb = rpcResponseMap.get(rpcMessage.getRpcId()); if (responseCb != null) { responseCb.sendResponse(rpcMessage.getRpcContent().toStringUtf8()); } } } } catch (WakeupException e) { if (!closed.get()) { throw e; } } catch (InvalidProtocolBufferException e) { LOG.error("Error while parsing response", e); } finally { LOG.info("closing kafka consumer"); consumer.close(); } }

Target:
public void run() { Logging.putPrefix(RpcClientFactory.LOG_PREFIX); if (topics.isEmpty()) { while (!topicAdded.get()) { try { firstTopicAdded.await(1, TimeUnit.SECONDS); } catch (InterruptedException e) { LOG.info("Interrupted before first topic was added. Terminating Kafka RPC consumer thread."); return; } } LOG.info("First topic is added, consumer will be started."); } while (!closed.get()) { if (topicAdded.get()) { synchronized (topics) { LOG.info("Subscribing Kafka RPC consumer to topics named: {}", topics); consumer.subscribe(topics); topicAdded.set(false); } } try { ConsumerRecords<String, byte[]> records = consumer.poll(Long.MAX_VALUE); for (ConsumerRecord<String, byte[]> record : records) { ResponseCallback responseCb = rpcResponseMap.get(record.key()); if (responseCb != null) { RpcMessageProtos.RpcMessage rpcMessage = RpcMessageProtos.RpcMessage .parseFrom(record.value()); responseCb.sendResponse(rpcMessage.getRpcContent().toStringUtf8()); } else { LOG.warn("Received a response for request with ID:{}, but no outstanding request was found with this id, The request may have timed out.", record.key()); } } } catch (InvalidProtocolBufferException e) { LOG.error("error while parsing response", e); } catch (WakeupException e) { LOG.info(" consumer got wakeup exception, closed = ", closed.get(), e); } } consumer.close(); }
Source:
private static RowExpressionVisitor<BytecodeNode, Scope> fieldReferenceCompiler( final CallSiteBinder callSiteBinder, final Variable leftPosition, final Variable leftPage, final Variable rightPosition, final Variable rightPage, final int leftBlocksSize) { return new InputReferenceCompiler( (scope, field) -> { if (field < leftBlocksSize) { return leftPage.invoke("getBlock", Block.class, constantInt(field)); } else { return rightPage.invoke("getBlock", Block.class, constantInt(field - leftBlocksSize)); } }, (scope, field) -> field < leftBlocksSize ? leftPosition : rightPosition, callSiteBinder); }

Target:
private static RowExpressionVisitor<BytecodeNode, Scope> fieldReferenceCompiler( final CallSiteBinder callSiteBinder, final Variable leftPosition, final Variable leftPage, final Variable rightPosition, final Variable rightPage, final int leftBlocksSize) { return new InputReferenceCompiler( (scope, field) -> { if (field < leftBlocksSize) { return leftPage.invoke("getBlock", Block.class, constantInt(field)); } return rightPage.invoke("getBlock", Block.class, constantInt(field - leftBlocksSize)); }, (scope, field) -> field < leftBlocksSize ? leftPosition : rightPosition, callSiteBinder); }
Source:
private EvaluationResult anyOfAny(EvaluationCtx context, Function function, List<AttributeValue> args, List<BagAttribute> bagArgs) { EvaluationResult result = new EvaluationResult(BooleanAttribute.getInstance(false)); if (args.size() > 0) { for (int i = 0; i < args.size() - 1; i++) { AttributeValue value = args.get(i); List<AttributeValue> bagValue = new ArrayList<>(); bagValue.add(value); BagAttribute bagArg = new BagAttribute(value.getType(), bagValue); result = anyAndAllHelper(context, function, args.subList(i + 1, args.size()), bagArg, false); if (result.indeterminate() || ((BooleanAttribute) (result.getAttributeValue())).getValue()) { return result; } } return new EvaluationResult(BooleanAttribute.getInstance(false)); } if (bagArgs.size() > 0) { for (int i = 0; i < bagArgs.size(); i++) { for (int j = i + 1; j < bagArgs.size(); j++) { Iterator iIterator = bagArgs.get(i).iterator(); while (iIterator.hasNext()) { AttributeValue iValue = (AttributeValue) (iIterator.next()); Iterator jIterator = bagArgs.get(j).iterator(); while (jIterator.hasNext()) { AttributeValue jValue = (AttributeValue) (jIterator.next()); result = getEvaluationResult(context, function, jValue, iValue, false); if (result != null && (result.indeterminate() || ((BooleanAttribute) (result.getAttributeValue())).getValue())) { return result; } } } } } return new EvaluationResult(BooleanAttribute.getInstance(false)); } return null; }

Target:
private EvaluationResult anyOfAny(EvaluationCtx context, Function function, List<AttributeValue> args, List<BagAttribute> bagArgs) { EvaluationResult result = new EvaluationResult(BooleanAttribute.getInstance(false)); if (!args.isEmpty()) { for (int i = 0; i < args.size() - 1; i++) { AttributeValue value = args.get(i); List<AttributeValue> bagValue = new ArrayList<>(); bagValue.add(value); BagAttribute bagArg = new BagAttribute(value.getType(), bagValue); result = anyAndAllHelper(context, function, args.subList(i + 1, args.size()), bagArg, false); if (result.indeterminate() || ((BooleanAttribute) (result.getAttributeValue())).getValue()) { return result; } } return new EvaluationResult(BooleanAttribute.getInstance(false)); } if (!bagArgs.isEmpty()) { for (int i = 0; i < bagArgs.size(); i++) { for (int j = i + 1; j < bagArgs.size(); j++) { Iterator iIterator = bagArgs.get(i).iterator(); while (iIterator.hasNext()) { AttributeValue iValue = (AttributeValue) (iIterator.next()); Iterator jIterator = bagArgs.get(j).iterator(); while (jIterator.hasNext()) { AttributeValue jValue = (AttributeValue) (jIterator.next()); result = getEvaluationResult(context, function, jValue, iValue, false); if (result != null && (result.indeterminate() || ((BooleanAttribute) (result.getAttributeValue())).getValue())) { return result; } } } } } return new EvaluationResult(BooleanAttribute.getInstance(false)); } return null; }
Source:
public void setUp() throws Exception { tested = new SwitchViewControl("COLUMNS", "Case View", caseViewSwitchHandler, "SITEMAP", "Process View", processViewSwitchHandler); }

Target:
public void setUp() { tested = new SwitchViewControl("COLUMNS", "Case View", caseViewSwitchHandler, "SITEMAP", "Process View", processViewSwitchHandler); }
Source:
public JobId reSubmit(JobId currentJobId, Map<String, String> jobVariables, Map<String, String> jobGenericInfos) throws NotConnectedException, UnknownJobException, PermissionException, JobCreationException, SubmissionClosedException { final String jobContent = getJobContent(currentJobId); final Job job = JobFactory.getFactory().createJob(jobContent, jobVariables, jobGenericInfos); return submit(job); }

Target:
public JobId reSubmit(JobId currentJobId, Map<String, String> jobVariables, Map<String, String> jobGenericInfos) throws NotConnectedException, UnknownJobException, PermissionException, JobCreationException, SubmissionClosedException { final String jobContent = getJobContent(currentJobId); final Job job = JobFactory.getFactory().createJob(IOUtils.toInputStream(jobContent, Charset.forName("UTF-8")), jobVariables, jobGenericInfos); return submit(job); }
Source:
private static boolean isSkippable( final Class<?> handlerType, final String methodName, final Class<?>... paramTypes) throws Exception { return AccessController.doPrivileged(new PrivilegedExceptionAction<Boolean>() { @Override public Boolean run() throws Exception { Method m; try { m = handlerType.getMethod(methodName, paramTypes); } catch (NoSuchMethodException e) { logger.debug("Class missing method {}.", handlerType, methodName, e); return false; } return m.isAnnotationPresent(Skip.class); } }); }

Target:
private static boolean isSkippable( final Class<?> handlerType, final String methodName, final Class<?>... paramTypes) throws Exception { return AccessController.doPrivileged(new PrivilegedExceptionAction<Boolean>() { @Override public Boolean run() throws Exception { Method m; try { m = handlerType.getMethod(methodName, paramTypes); } catch (NoSuchMethodException e) { logger.debug( "Class missing method {}, assume we can not skip execution", handlerType, methodName, e); return false; } return m.isAnnotationPresent(Skip.class); } }); }
Source:
private void doPaint(GC gc) { if (fCanvas.isVisible()) { return; } ILineRange visibleModelLines= computeVisibleModelLines(); if (visibleModelLines == null) return; fSensitiveToTextChanges= isViewerCompletelyShown(); fScrollPos= fCachedTextWidget.getTopPixel(); fRevisionPainter.paint(gc, visibleModelLines); if (!fRevisionPainter.hasInformation()) fDiffPainter.paint(gc, visibleModelLines); }

Target:
private void doPaint(GC gc) { if (!fCanvas.isVisible()) { return; } ILineRange visibleModelLines= computeVisibleModelLines(); if (visibleModelLines == null) return; fSensitiveToTextChanges= isViewerCompletelyShown(); fScrollPos= fCachedTextWidget.getTopPixel(); fRevisionPainter.paint(gc, visibleModelLines); if (!fRevisionPainter.hasInformation()) fDiffPainter.paint(gc, visibleModelLines); }
Source:
public void testSanitizeForHtmlList() { List<String> input = new ArrayList<>(); input.add("apple <"); input.add("banana ' dogs "); input.add("rollercoasters & tycoons"); input.add(""); input.add(null); List<String> expected = new ArrayList<>(); expected.add("apple &lt;"); expected.add("banana &#39; dogs "); expected.add("rollercoasters &amp; tycoons"); expected.add(""); expected.add(null); assertEquals(expected, SanitizationHelper.sanitizeForHtml(input)); assertEquals(new ArrayList<String>(), SanitizationHelper.sanitizeForHtml(new ArrayList<>())); assertEquals(null, SanitizationHelper.sanitizeForHtml((List<String>) null)); }

Target:
public void testSanitizeForHtmlList() { List<String> unsanitizedHtml = new ArrayList<>(Arrays.asList( "apple <", "banana ' dogs ", "rollercoasters & tycoons", "", null) ); List<String> sanitizedHtml = new ArrayList<>(Arrays.asList( "apple &lt;", "banana &#39; dogs ", "rollercoasters &amp; tycoons", "", null) ); assertEquals(sanitizedHtml, SanitizationHelper.sanitizeForHtml(unsanitizedHtml)); assertEquals(new ArrayList<>(), SanitizationHelper.sanitizeForHtml(new ArrayList<>())); assertNull(SanitizationHelper.sanitizeForHtml((List<String>) null)); }
Source:
public void init(RuntimeServices rs) { final String logfile = DfBuildProperties.getInstance().getWorkDir() + "log/velocity.log"; try { logger = Logger.getLogger(getClass().getName()); logger.setAdditivity(false); logger.setLevel(Level.DEBUG); final DfFlutistRollingFileAppender appender = createOriginalRollingFileAppender(logfile); appender.setMaxBackupIndex(2); appender.setMaximumFileSize(300000); logger.addAppender(appender); log(0, ""); log(0, DfTypeUtil.toClassTitle(this) + " initialized using logfile '" + logfile + "'"); } catch (Exception e) { System.out.println("PANIC : error configuring " + DfTypeUtil.toClassTitle(this)); e.printStackTrace(); } }

Target:
public void init(RuntimeServices rs) { final String logfile = DfEngineWorkDir.toPath("./log/velocity.log"); try { logger = Logger.getLogger(getClass().getName()); logger.setAdditivity(false); logger.setLevel(Level.DEBUG); final DfFlutistRollingFileAppender appender = createOriginalRollingFileAppender(logfile); appender.setMaxBackupIndex(2); appender.setMaximumFileSize(300000); logger.addAppender(appender); log(0, ""); log(0, DfTypeUtil.toClassTitle(this) + " initialized using logfile '" + logfile + "'"); } catch (Exception e) { System.out.println("PANIC : error configuring " + DfTypeUtil.toClassTitle(this)); e.printStackTrace(); } }
Source:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_review); ButterKnife.bind(this); initDrawer(); yesButton=findViewById(R.id.yesButton); noButton=findViewById(R.id.noButton); reviewController = new ReviewController(); reviewPagerAdapter = new ReviewPagerAdapter(getSupportFragmentManager()); reviewPager.setAdapter(reviewPagerAdapter); reviewPagerAdapter.getItem(0); pagerIndicator.setViewPager(reviewPager); progressBar.setVisibility(View.VISIBLE); runRandomizer(); skip_image_button.setOnClickListener(view -> runRandomizer()); }

Target:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_review); ButterKnife.bind(this); initDrawer(); reviewController = new ReviewController(); reviewPagerAdapter = new ReviewPagerAdapter(getSupportFragmentManager()); reviewPager.setAdapter(reviewPagerAdapter); reviewPagerAdapter.getItem(0); pagerIndicator.setViewPager(reviewPager); progressBar.setVisibility(View.VISIBLE); runRandomizer(); skip_image_button.setOnClickListener(view -> runRandomizer()); }
Source:
private boolean isExpansionChange(Notification notification) { return notification.getFeature() == TreePackage.Literals.DTREE_ITEM__EXPANDED && notification.getNotifier() instanceof DTreeItem; }

Target:
private boolean isExpansionChange(Notification notification) { return notification.getFeature() == TreePackage.Literals.DTREE_ITEM__EXPANDED; }
Source:
private List<Long> getSortedBatchedStartTimestamps(UUID requestorUuid, int numRequestedTimestamps) { BatchedStartTransactionRequest request = BatchedStartTransactionRequest.createForRequestor( requestorUuid, numRequestedTimestamps); BatchedStartTransactionResponse response = CLUSTER.timelockRpcClient().batchedStartTransaction(request); return response.timestamps().stream() .boxed() .sorted() .collect(Collectors.toList()); }

Target:
private List<Long> getSortedBatchedStartTimestamps(UUID requestorUuid, int numRequestedTimestamps) { StartTransactionRequestV4 request = StartTransactionRequestV4.createForRequestor( requestorUuid, numRequestedTimestamps); StartTransactionResponseV4 response = CLUSTER.timelockRpcClient().startTransactions(request); return response.timestamps().stream() .boxed() .collect(Collectors.toList()); }
Source:
protected Map<String, List<ObservationUnitRow>> groupObservationUnitRowsByRangeAndColumn( final List<ObservationUnitRow> observationUnitRows) { final Map<String, List<ObservationUnitRow>> fieldmapExperiments = new HashMap(); for (final ObservationUnitRow observationUnitRow : observationUnitRows) { final String range = observationUnitRow.getVariables().get(ExperimentDao.FIELD_MAP_RANGE).getValue(); final String column = observationUnitRow.getVariables().get(ExperimentDao.FIELD_MAP_COLUMN).getValue(); if (range != null && column != null) { final String key = coordinateKey(Integer.valueOf(column), Integer.valueOf(range)); if (!fieldmapExperiments.containsKey(key)) { fieldmapExperiments.put(key, new LinkedList<ObservationUnitRow>()); } fieldmapExperiments.get(key).add(observationUnitRow); } } return fieldmapExperiments; }

Target:
protected Map<String, List<ObservationUnitRow>> groupObservationUnitRowsByRangeAndColumn( final List<ObservationUnitRow> observationUnitRows) { final Map<String, List<ObservationUnitRow>> fieldmapExperiments = new HashMap(); for (final ObservationUnitRow observationUnitRow : observationUnitRows) { final String range = observationUnitRow.getVariables().get(FIELDMAP_RANGE).getValue(); final String column = observationUnitRow.getVariables().get(FIELDMAP_COLUMN).getValue(); if (range != null && column != null) { final String key = coordinateKey(Integer.valueOf(column), Integer.valueOf(range)); if (!fieldmapExperiments.containsKey(key)) { fieldmapExperiments.put(key, new LinkedList<ObservationUnitRow>()); } fieldmapExperiments.get(key).add(observationUnitRow); } } return fieldmapExperiments; }
Source:
private RoundViewModel createViewModel(Sequence updatedSequence) { int nextNotesPosition = updatedSequence.position(); List<String> notations = getNotations(nextNotesPosition); String statusMessage = getStatusMessage(); return new RoundViewModel(notations, statusMessage); }

Target:
private RoundViewModel createViewModel(Sequence updatedSequence) { int nextNotesPosition = updatedSequence.position(); List<String> notations = getNotations(nextNotesPosition); String statusMessage = getStatusMessage(updatedSequence); return new RoundViewModel(notations, statusMessage); }
Source:
@Test public void testParse() throws NoSuchAuthorityCodeException { final URN_Parser parser = URN_Parser.buildParser("urn:ogc:def:CRS:EPSG:6.11.2:4326"); assertEquals("crs", parser.type.name); assertEquals("EPSG", parser.authority); assertEquals("6.11.2", parser.version.toString()); assertEquals("4326", parser.code); assertEquals("EPSG:4326", parser.getAuthorityCode()); }

Target:
public void testParse() throws NoSuchAuthorityCodeException { final URN_Parser parser = URN_Parser.buildParser("urn:ogc:def:CRS:EPSG:6.11.2:4326"); assertEquals("crs", parser.type.name); assertEquals("EPSG", parser.authority); assertEquals("6.11.2", parser.version.toString()); assertEquals("4326", parser.code); assertEquals("EPSG:4326", parser.getAuthorityCode()); }
Source:
private void setAboutThisCourse() { getCourseDetailTask = new GetCourseDetailTask(getActivity(), courseDetail.course_id) { @Override protected void onSuccess(CourseDetail courseDetail) throws Exception { super.onSuccess(courseDetail); if (courseDetail.overview != null && !courseDetail.overview.isEmpty()) { setAboutThisCourse(courseDetail.overview); } else { courseAbout.setVisibility(View.GONE); } } @Override protected void onException(Exception e) throws RuntimeException { super.onException(e); showErrorMessage(e); } }; getCourseDetailTask.execute(); }

Target:
private void setAboutThisCourse() { getCourseDetailTask = new GetCourseDetailTask(getActivity(), courseDetail.course_id) { @Override protected void onSuccess(CourseDetail courseDetail) throws Exception { super.onSuccess(courseDetail); if (courseDetail.overview != null && !courseDetail.overview.isEmpty()) { setAboutThisCourse(courseDetail.overview); } else { courseAbout.setVisibility(View.GONE); } } @Override protected void onException(Exception e) throws RuntimeException { super.onException(e); showErrorMessage(e); } }; getCourseDetailTask.setProgressCallback(null); getCourseDetailTask.execute(); }
Source:
public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) throws IOException, ServletException { if (!(req instanceof HttpServletRequest) || !(res instanceof HttpServletResponse)) { throw new ServletException( "VRaptor must be run inside a Servlet environment. Portlets and others aren't supported."); } final HttpServletRequest baseRequest = (HttpServletRequest) req; final HttpServletResponse baseResponse = (HttpServletResponse) res; if (staticHandler.requestingStaticFile(baseRequest)) { staticHandler.deferProcessingToContainer(chain, baseRequest, baseResponse); } else { logger.debug("VRaptor received a new request"); logger.trace("Request: {}", req); VRaptorRequest mutableRequest = new VRaptorRequest(baseRequest); VRaptorResponse mutableResponse = new VRaptorResponse(baseResponse); final RequestInfo request = new RequestInfo(servletContext, chain, mutableRequest, mutableResponse); try { encodingHandler.setEncoding(baseRequest, baseResponse); provider.provideForRequest(request); provider.getContainer().instanceFor(RequestExecution.class).execute(); } catch (ApplicationLogicException e) { throw new ServletException(e.getMessage(), e.getCause()); } logger.debug("VRaptor ended the request"); } }

Target:
public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) throws IOException, ServletException { if (!(req instanceof HttpServletRequest) || !(res instanceof HttpServletResponse)) { throw new ServletException( "VRaptor must be run inside a Servlet environment. Portlets and others aren't supported."); } final HttpServletRequest baseRequest = (HttpServletRequest) req; final HttpServletResponse baseResponse = (HttpServletResponse) res; if (staticHandler.requestingStaticFile(baseRequest)) { staticHandler.deferProcessingToContainer(chain, baseRequest, baseResponse); } else { logger.debug("VRaptor received a new request"); logger.trace("Request: {}", req); VRaptorRequest mutableRequest = new VRaptorRequest(baseRequest); VRaptorResponse mutableResponse = new VRaptorResponse(baseResponse); final RequestInfo request = new RequestInfo(servletContext, chain, mutableRequest, mutableResponse); try { encodingHandler.setEncoding(baseRequest, baseResponse); provider.provideForRequest(request); execution.execute(); } catch (ApplicationLogicException e) { throw new ServletException(e.getMessage(), e.getCause()); } logger.debug("VRaptor ended the request"); } }
Source:
public Response doGetLog( @PathParam("taskid") String taskid, @QueryParam("offset") @DefaultValue("0") long offset ) { if (!(taskRunner instanceof TaskLogStreamer)) { return Response.status(501).entity("Log streaming not supported").build(); } try { final Optional<ByteSource> stream = ((TaskLogStreamer) taskRunner).streamTaskLog(taskid, offset); if (stream.isPresent()) { return Response.ok(stream.get().openStream()).build(); } else { return Response.status(Response.Status.NOT_FOUND).build(); } } catch (IOException e) { log.warn(e, "Failed to read log for task: %s", taskid); return Response.serverError().build(); } }

Target:
public Response doGetLog( @PathParam("taskid") String taskid, @QueryParam("offset") @DefaultValue("0") long offset ) { if (!(taskRunner instanceof TaskLogStreamer)) { return Response.status(501) .entity(String.format( "Log streaming not supported by [%s]", taskRunner.getClass().getCanonicalName() )) .build(); } try { final Optional<ByteSource> stream = ((TaskLogStreamer) taskRunner).streamTaskLog(taskid, offset); if (stream.isPresent()) { return Response.ok(stream.get().openStream()).build(); } else { return Response.status(Response.Status.NOT_FOUND).build(); } } catch (IOException e) { log.warn(e, "Failed to read log for task: %s", taskid); return Response.serverError().build(); } }
Source:
private void createToken() throws NoSuchAlgorithmException { SecureRandom random = SecureRandom.getInstance("SHA1PRNG"); setToken(new BigInteger(130, random).toString(32)); }

Target:
private void createToken() { try { CryptoRandomGenerator randomGenerator = CryptoRandomGenerator.getInstance(); token = randomGenerator.createToken(); if (!token.equals("login")) { setToken(token); } } catch (Exception ex) { LOG.debug("CSRFToken Generation failed :" + ex.getMessage(), ex); } }
Source:
default Optional<Question> getCurrentQuestion() { return this.getCurrentDialogue().flatMap(inst -> inst.getCurrentQuestionFor(this)); }

Target:
default Optional<Question> getCurrentQuestion() { return this.getCurrentDialogue().flatMap(dialogue -> dialogue.getCurrentQuestionFor(this)); }
Source:
public void testCommandMandatoryConstructorsExistence() { Predicate<Constructor<?>> classForcesCompensation = constructor -> constructor.getDeclaringClass().isAnnotationPresent(NonTransactiveCommandAttribute.class) && constructor.getDeclaringClass().getAnnotation(NonTransactiveCommandAttribute.class) .forceCompensation(); Predicate<Class<CommandBase<? extends VdcActionParametersBase>>> classLacksParamsAndContextCtor = getPredicateForNoCtorMatchesGivenPredicate(parametersAndContextConstructorSignature); Predicate<Class<CommandBase<? extends VdcActionParametersBase>>> classLacksGuidCtor = getPredicateForNoCtorMatchesGivenPredicate(classForcesCompensation.negate().or(guidConstructorSignature)); List<String> commandsWithoutMandatoryConstructor = commandClasses.stream() .filter(classLacksParamsAndContextCtor.or(classLacksGuidCtor)) .map(Class::getSimpleName) .sorted() .collect(Collectors.toList()); assertThat("There are commands that don't contain at least one of the mandatory constructors:" + System.lineSeparator() + "1. A constructor that receives parameters and context objects." + System.lineSeparator() + "2. A constructor that receives a Guid object, its class is annotated with " + "'NonTransactiveCommandAttribute' and the annotation's 'forceCompensation' attribute is set to true.", commandsWithoutMandatoryConstructor, empty()); }

Target:
public void testCommandMandatoryConstructorsExistence() { Predicate<Constructor<?>> classForcesCompensation = constructor -> constructor.getDeclaringClass().isAnnotationPresent(NonTransactiveCommandAttribute.class) && constructor.getDeclaringClass().getAnnotation(NonTransactiveCommandAttribute.class) .forceCompensation(); Predicate<Class<CommandBase<? extends VdcActionParametersBase>>> classLacksParamsAndContextCtor = getPredicateForNoCtorMatchesGivenPredicate(parametersAndContextConstructorSignature); Predicate<Class<CommandBase<? extends VdcActionParametersBase>>> classLacksGuidCtor = getPredicateForNoCtorMatchesGivenPredicate(classForcesCompensation.negate().or(guidConstructorSignature)); List<String> commandsWithoutMandatoryConstructor = commandClasses.stream() .filter(classLacksParamsAndContextCtor.or(classLacksGuidCtor)) .map(Class::getSimpleName) .sorted() .collect(Collectors.toList()); assertThat("There are commands that don't contain at least one of the mandatory constructors:" + System.lineSeparator() + "1. A constructor that receives parameters and context objects." + System.lineSeparator() + "2. A constructor that receives a Guid object, its class is annotated with '" + NonTransactiveCommandAttribute.class.getSimpleName() + "' and the annotation's " + "'forceCompensation' attribute is set to true.", commandsWithoutMandatoryConstructor, empty()); }
Source:
public List<PhonePlanGroup> getPhonePlanGroups() { String countryCode = "US"; String locale = "en-us"; try { PhoneNumberClient phoneNumberClient = createPhoneNumberClient(); List<PhonePlanGroup> phonePlanGroups = phoneNumberClient .listPhonePlanGroups(countryCode, locale, true) .stream() .collect(Collectors.toList()); for (PhonePlanGroup phonePlanGroup: phonePlanGroups) { System.out.println("Phone Plan GroupId: " + phonePlanGroup.getPhonePlanGroupId()); System.out.println("Phone Plan NumberType: " + phonePlanGroup.getPhoneNumberType()); } return phonePlanGroups; } catch (Exception e) { e.printStackTrace(); } return null; }

Target:
public PagedIterable<PhonePlanGroup> getPhonePlanGroups() { String countryCode = "US"; String locale = "en-us"; try { PhoneNumberClient phoneNumberClient = createPhoneNumberClient(); PagedIterable<PhonePlanGroup> phonePlanGroups = phoneNumberClient .listPhonePlanGroups(countryCode, locale, true); for (PhonePlanGroup phonePlanGroup : phonePlanGroups) { System.out.println("Phone Plan GroupId: " + phonePlanGroup.getPhonePlanGroupId()); System.out.println("Phone Plan NumberType: " + phonePlanGroup.getPhoneNumberType()); } return phonePlanGroups; } catch (Exception e) { e.printStackTrace(); } return null; }
Source:
private void addHeaderParams(DetailedLink link, Action action) { if (action.getRequest().getHeaders() != null && !action.getRequest().getHeaders().isEmpty()) { link.getRequest().setHeaders(new Headers()); for (Object key : action.getRequest().getHeaders().keySet()) { Header header = new Header(); header.setName(key.toString()); Object value = action.getRequest().getHeaders().get(key); if (value != null) { ParamData paramData = (ParamData) value; header.setValue(paramData.getValue()); header.setRequired(paramData.getRequired() == null ? new Boolean(false) : paramData.getRequired()); } link.getRequest().getHeaders().getHeaders().add(header); } } }

Target:
private void addHeaderParams(DetailedLink link, Action action) { if (action.getRequest().getHeaders() != null && !action.getRequest().getHeaders().isEmpty()) { link.getRequest().setHeaders(new Headers()); for (Object key : action.getRequest().getHeaders().keySet()) { Header header = new Header(); header.setName(key.toString()); Object value = action.getRequest().getHeaders().get(key); if (value != null) { ParamData paramData = (ParamData) value; header.setValue(paramData.getValue()); header.setRequired(paramData.getRequired() == null ? Boolean.FALSE : paramData.getRequired()); } link.getRequest().getHeaders().getHeaders().add(header); } } }
Source:
public void getDescription_NewAnnotation() throws NoSuchMethodException { String actualResult = getDescriptionWithMethodNameAndParamIndex(TEST_METHOD_6, FIRST_INDEX); assertEquals(SECOND_DESCRIPTION_PARAM_ANNOTATION, actualResult); }

Target:
public void getDescription_NewAnnotation() throws NoSuchMethodException { String actualRes = getDescriptionWithMethodNameAndParamIndex(TEST_METHOD_6, FIRST_INDEX); assertEquals(SECOND_DESCRIPTION_PARAM_ANNOTATION, actualRes); }
Source:
public Map<String, PortSelection> getPortSelectionMap() { Map<String, PortSelection> res = Arrays.stream(environment.getProperty("ot.httpserver.active-connectors", "default-http").split(",")) .map(connectorName -> { if (connectorName.equals(BOOT_CONNECTOR_NAME)) { final boolean sslEnabled = Boolean.parseBoolean(environment.getProperty(SERVER_SSL_ENABLED, "true")) && environment.getProperty("server.ssl.key-store") != null; return getWithDefault(SERVER_PORT, sslEnabled ? "PORT_HTTPS" : "PORT_HTTP", 8080); } if (connectorName.equals(DEFAULT_CONNECTOR_NAME)) { final boolean sslEnabled = "https".equalsIgnoreCase(environment.getProperty("ot.httpserver.connector." + connectorName + ".protocol", "http")); return getWithDefault("ot.httpserver.connector." + connectorName + ".port", sslEnabled ? "PORT_HTTPS" : "PORT_HTTP", 0); } return getWithDefault("ot.httpserver.connector." + connectorName + ".port", "PORT_" + connectorName.toUpperCase(Locale.US), 0); }).collect(Collectors.toMap(i -> i.name, Function.identity())); res.put(JMX_PORT, getJMXPort()); res.put(MANAGEMENT_SERVER_PORT, getActuatorPort()); return res; }

Target:
public Map<String, PortSelection> getPortSelectionMap() { Map<String, PortSelection> res = Arrays.stream(environment.getProperty("ot.httpserver.active-connectors", "default-http").split(",")) .map(String::trim) .map(connectorName -> { if (connectorName.equals(BOOT_CONNECTOR_NAME)) { final boolean sslEnabled = Boolean.parseBoolean(environment.getProperty(SERVER_SSL_ENABLED, "true")) && environment.getProperty("server.ssl.key-store") != null; String namedPort = sslEnabled ? "PORT_HTTPS" : "PORT_HTTP"; if (environment.containsProperty("PORT_BOOT")) { namedPort = "PORT_BOOT"; } return getWithDefault(SERVER_PORT, namedPort, 8080); } if (connectorName.equals(DEFAULT_CONNECTOR_NAME)) { final boolean sslEnabled = "https".equalsIgnoreCase(environment.getProperty("ot.httpserver.connector." + connectorName + ".protocol", "http")); return getWithDefault("ot.httpserver.connector." + connectorName + ".port", sslEnabled ? "PORT_HTTPS" : "PORT_HTTP", 0); } return getWithDefault("ot.httpserver.connector." + connectorName + ".port", "PORT_" + connectorName.toUpperCase(Locale.US), 0); }).collect(Collectors.toMap(i -> i.originalPropertyName, Function.identity())); PortSelection serverPort = res.get(PortSelector.SERVER_PORT); PortSelection defaultHttpPort = res.get(PortSelector.HTTPSERVER_CONNECTOR_DEFAULT_HTTP_PORT); if (serverPort != null && defaultHttpPort != null && serverPort.getSourceInfo() != null && serverPort.getSourceInfo().equals(defaultHttpPort.getSourceInfo())) { LOG.warn("You have defined both the spring boot connector and the default http connector. Under Kubernetes this doesn't function correctly\n.Define a variable PORT_BOOT to workaround this."); } res.put(JMX_PORT, getJMXPort()); res.put(MANAGEMENT_SERVER_PORT, getActuatorPort()); return res; }
Source:
@Test public void injectingExtra_keysAreSanitized() { JavaFileObject source = JavaFileObjects.forSourceString("test.Test", Joiner.on('\n').join( "package test;", "import android.app.Activity;", "import com.f2prateek.dart.InjectExtra;", "public class Test extends Activity {", " @InjectExtra(\"a.b\") String extra;", "}" )); ASSERT.about(javaSource()) .that(source) .processedWith(ProcessorTestUtilities.hensonProcessors()) .failsToCompile(); }

Target:
@Test public void injectingExtra_keysAreSanitized() { JavaFileObject source = JavaFileObjects.forSourceString("test.Test", Joiner.on('\n').join( "package test;", "import android.app.Activity;", "import com.f2prateek.dart.InjectExtra;", "public class Test extends Activity {", " @InjectExtra(\"a.b\") String extra;", "}" )); ASSERT.about(javaSource()) .that(source) .processedWith(ProcessorTestUtilities.hensonProcessors()) .failsToCompile() .withErrorContaining("Keys have to be valid java variable identifiers.") .in(source) .onLine(5); }
Source:
private void centerMapOnUserLocation() { LatLng position = null; LocationManager manager = (LocationManager) getSystemService(Context.LOCATION_SERVICE); Criteria criteria = new Criteria(); criteria.setAccuracy(Criteria.ACCURACY_FINE); String provider = manager.getBestProvider(criteria, true); if (provider != null) { Location location = manager.getLastKnownLocation(provider); if (location != null) { position = new LatLng(location.getLatitude(), location.getLongitude()); } } positionMap(position); }

Target:
private void centerMapOnUserLocation() { LatLng position = null; LocationManager manager = (LocationManager) getSystemService(Context.LOCATION_SERVICE); Criteria criteria = new Criteria(); criteria.setAccuracy(Criteria.ACCURACY_COARSE); String provider = manager.getBestProvider(criteria, true); if (provider != null) { Location location = manager.getLastKnownLocation(provider); if (location != null) { position = new LatLng(location.getLatitude(), location.getLongitude()); } } positionMap(position); }
Source:
private void addToGoal(Collection<TeamWorkFlowArtifact> newTeamArts, SkynetTransaction transaction) throws OseeCoreException { if (toGoal != null) { GoalArtifact goal = (GoalArtifact) AtsClientService.get().getArtifact(toGoal); for (Artifact art : newTeamArts) { goal.addMember(art); } goal.persist(transaction); } }

Target:
private void addToGoal(Collection<TeamWorkFlowArtifact> newTeamArts, SkynetTransaction transaction) throws OseeCoreException { if (toGoal != null) { GoalArtifact goal = (GoalArtifact) AtsClientService.get().getArtifact(toGoal); if (goal == null) { throw new OseeArgumentException("Goal artifact does not exist for goal %s", toGoal.toStringWithId()); } for (Artifact art : newTeamArts) { goal.addMember(art); } goal.persist(transaction); } }
Source:
public String getVertexId(Direction direction) { if (direction.equals(Direction.IN)) { return inVertexId; } else if (direction.equals(Direction.OUT)) { return outVertexId; } return null; }

Target:
public String getVertexId(Direction direction) { if (direction.equals(Direction.IN)) { return inVertexId; } else if (direction.equals(Direction.OUT)) { return outVertexId; } throw new VertexiumNotSupportedException(direction.name() + " is not supported"); }
Source:
public ValidationResult validate(Object value) { assert value==null ||value instanceof String; String cidr = (String) value; ValidationResult result = new ValidationResult(); result.setSuccess(true); if (!CidrValidator.isCidrFormatValid(cidr)) { failWith(result, getThisFieldMustContainCidrInFormatMsg()); } else if (!CidrValidator.isCidrNetworkAddressValid(cidr)) { failWith(result, getCidrNotNetworkAddress()); } return result; }

Target:
public ValidationResult validate(Object value) { assert value == null ||value instanceof String; String cidr = (String) value; ValidationResult result = new ValidationResult(); if (!CidrValidator.isCidrFormatValid(cidr)) { failWith(result, getThisFieldMustContainCidrInFormatMsg()); } else if (!CidrValidator.isCidrNetworkAddressValid(cidr)) { failWith(result, getCidrNotNetworkAddress()); } return result; }
Source:
@Override protected Propagation.Setter<Headers, String> setter() { return null; }

Target:
@Override protected Propagation.Setter<Headers, String> setter() { return HEADERS_SETTER; }
Source:
public JsonStructure parse(String value) throws IllegalArgumentException { if (value == null || value.isEmpty() || value.equalsIgnoreCase("NULL")) return null; if (!Strings.isQuoted(value)) throw new IllegalArgumentException("JSON strings must be enclosed by single quotes"); String json = Strings.unquote(value); try (StringReader sr = new StringReader(json)) { JsonReader reader = readerFactory.createReader(sr); return reader.read(); } catch (JsonException e) { throw new IllegalArgumentException(e.getMessage(), e); } }

Target:
public JsonStructure parse(String value) throws IllegalArgumentException { if (value == null || value.isEmpty() || value.equalsIgnoreCase("NULL")) { return null; } if (!Strings.isQuoted(value)) { throw new IllegalArgumentException("JSON strings must be enclosed by single quotes"); } String json = Strings.unquote(value); try (StringReader sr = new StringReader(json)) { JsonReader reader = readerFactory.createReader(sr); return reader.read(); } catch (JsonException e) { throw new IllegalArgumentException(e.getMessage(), e); } }