auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public static List<PathElement> parse( String key ) { if ( "*".equals(key) ) { return Arrays.<PathElement>asList( new StarAllPathElement( key ) ); } else if ( StringUtils.countMatches( key, "*" ) == 1 ) { return Arrays.<PathElement>asList( new StarSinglePathElement( key ) ); } else if ( StringUtils.countMatches( key, "*" ) == 2 ) { return Arrays.<PathElement>asList( new StarDoublePathElement( key ) ); } else if ( key.contains("*") ) { return Arrays.<PathElement>asList( new StarRegexPathElement( key ) ); } else { return Arrays.<PathElement>asList( new LiteralPathElement( key ) ); } }

Target:
public static List<PathElement> parse(String key) { if ( "*".equals( key ) ) { return Arrays.<PathElement>asList(new StarAllPathElement(key)); } int numOfStars = StringUtils.countMatches(key, "*"); if (numOfStars == 1) { return Arrays.<PathElement>asList(new StarSinglePathElement(key)); } else if (numOfStars == 2) { return Arrays.<PathElement>asList(new StarDoublePathElement(key)); } else if (numOfStars > 2) { return Arrays.<PathElement>asList(new StarRegexPathElement(key)); } else { return Arrays.<PathElement>asList(new LiteralPathElement(key)); } }
Source:
@Override public void onRetryUploadForMediaCollection(ArrayList<Object> mediaFiles) { ArrayList<Integer> mediaIdsToRetry = new ArrayList<>(); for (Object mediaFile : mediaFiles) { int localMediaId = StringUtils.stringToInt(((HashMap<String, Object>) mediaFile).get("id").toString(), 0); if (localMediaId != 0) { MediaModel media = mMediaStore.getMediaWithLocalId(localMediaId); if (media == null) { AppLog.e(T.MEDIA, "Can't find media with local id: " + localMediaId); AlertDialog.Builder builder = new MaterialAlertDialogBuilder(this); builder.setTitle(getString(R.string.cannot_retry_deleted_media_item_fatal)); builder.setPositiveButton(R.string.yes, (dialog, id) -> { dialog.dismiss(); }); builder.setNegativeButton(getString(R.string.no), (dialog, id) -> dialog.dismiss()); AlertDialog dialog = builder.create(); dialog.show(); return; } if (media.getUrl() != null && media.getUploadState().equals(MediaUploadState.UPLOADED.toString())) { if (mEditorMediaUploadListener != null) { mEditorMediaUploadListener.onMediaUploadSucceeded(String.valueOf(media.getId()), FluxCUtils.mediaFileFromMediaModel(media)); } } else { UploadService.cancelFinalNotification(this, mEditPostRepository.getPost()); UploadService.cancelFinalNotificationForMedia(this, mSite); mediaIdsToRetry.add(localMediaId); } } } if (!mediaIdsToRetry.isEmpty()) { mEditorMedia.retryFailedMediaAsync(mediaIdsToRetry); } AnalyticsTracker.track(Stat.EDITOR_UPLOAD_MEDIA_RETRIED); }

Target:
@Override public void onRetryUploadForMediaCollection(ArrayList<Object> mediaFiles) { mStoriesEventListener.onRetryUploadForMediaCollection(this, mediaFiles, mEditorMediaUploadListener); }
Source:
public int hashCode() { int result = principal.hashCode(); result = 31 * result + privileges.hashCode(); return result; }

Target:
public int hashCode() { return HashCode.compute(principal, privileges); }
Source:
public static Module module() { return new CacheModule() { @Override protected void configure() { final TypeLiteral<Cache<StarredChange.Key, StarredChange>> byKeyType = new TypeLiteral<Cache<StarredChange.Key, StarredChange>>() {}; core(byKeyType, BY_KEY).populateWith(ByKeyLoader.class); final TypeLiteral<Cache<Account.Id, StarredChangeList>> byAccountIdType = new TypeLiteral<Cache<Account.Id, StarredChangeList>>() {}; core(byAccountIdType, BY_ACCOUNT_ID).populateWith( ByAccountIdLoader.class); final TypeLiteral<Cache<Change.Id, StarredChangeList>> byChangeIdType = new TypeLiteral<Cache<Change.Id, StarredChangeList>>() {}; core(byChangeIdType, BY_CHANGE_ID).populateWith(ByChangeIdLoader.class); bind(StarredChangesCacheImpl.class); bind(StarredChangesCache.class).to(StarredChangesCacheImpl.class); } }; }

Target:
public static Module module() { return new CacheModule() { @Override protected void configure() { final TypeLiteral<Cache<Account.Id, StarredChangeList>> byAccountIdType = new TypeLiteral<Cache<Account.Id, StarredChangeList>>() {}; core(byAccountIdType, BY_ACCOUNT_ID).populateWith( ByAccountIdLoader.class); final TypeLiteral<Cache<Change.Id, StarredChangeList>> byChangeIdType = new TypeLiteral<Cache<Change.Id, StarredChangeList>>() {}; core(byChangeIdType, BY_CHANGE_ID).populateWith(ByChangeIdLoader.class); bind(StarredChangesCacheImpl.class); bind(StarredChangesCache.class).to(StarredChangesCacheImpl.class); } }; }
Source:
public void execute() { dataObject.removeNestedClass( nestedClass ); DataObjectChangeEvent event = new DataObjectChangeEvent( ChangeType.NESTED_CLASS_REMOVE_CHANGE, getContext().getContextId(), getSource(), getDataObject(), null, nestedClass, null ); notifyChange( event ); }

Target:
public void execute() { dataObject.removeNestedClass( nestedClass ); DataModelerEvent event = new DataObjectChangeEvent() .withChangeType( ChangeType.NESTED_CLASS_REMOVE_CHANGE ) .withOldValue( nestedClass ) .withNewValue( null ) .withContextId( getContext().getContextId() ) .withSource( getSource() ) .withCurrentDataObject( getDataObject() ); notifyChange( event ); }
Source:
public Object buildValue(Value value, GraphQLType requiredType) { Object result = null; if (requiredType instanceof GraphQLNonNull) { requiredType = ((GraphQLNonNull) requiredType).getWrappedType(); assertNotNull(value, "A AST value is required to be present for non null type ;" + requiredType.getName() + "'"); } if (value == null) { return null; } if (requiredType instanceof GraphQLScalarType) { result = parseLiteral(value, (GraphQLScalarType) requiredType); } else if (value instanceof EnumValue && requiredType instanceof GraphQLEnumType) { result = ((EnumValue) value).getName(); } else if (value instanceof ArrayValue && requiredType instanceof GraphQLList) { ArrayValue arrayValue = (ArrayValue) value; GraphQLType wrappedType = ((GraphQLList) requiredType).getWrappedType(); result = arrayValue.getValues().stream() .map(item -> this.buildValue(item, wrappedType)).collect(Collectors.toList()); } else if (value instanceof ObjectValue && requiredType instanceof GraphQLInputObjectType) { result = buildObjectValue((ObjectValue) value, (GraphQLInputObjectType) requiredType); } else if (value != null && !(value instanceof NullValue)) { assertShouldNeverHappen( "cannot build value of %s from %s", requiredType.getName(), String.valueOf(value)); } return result; }

Target:
public Object buildValue(Value value, GraphQLType requiredType) { Object result = null; if (requiredType instanceof GraphQLNonNull) { requiredType = ((GraphQLNonNull) requiredType).getWrappedType(); } if (value == null) { return null; } if (requiredType instanceof GraphQLScalarType) { result = parseLiteral(value, (GraphQLScalarType) requiredType); } else if (value instanceof EnumValue && requiredType instanceof GraphQLEnumType) { result = ((EnumValue) value).getName(); } else if (value instanceof ArrayValue && requiredType instanceof GraphQLList) { ArrayValue arrayValue = (ArrayValue) value; GraphQLType wrappedType = ((GraphQLList) requiredType).getWrappedType(); result = arrayValue.getValues().stream() .map(item -> this.buildValue(item, wrappedType)).collect(Collectors.toList()); } else if (value instanceof ObjectValue && requiredType instanceof GraphQLInputObjectType) { result = buildObjectValue((ObjectValue) value, (GraphQLInputObjectType) requiredType); } else if (value != null && !(value instanceof NullValue)) { assertShouldNeverHappen( "cannot build value of %s from %s", requiredType.getName(), String.valueOf(value)); } return result; }
Source:
protected void setupSystem() { config = getConfig(); SystemFactory systemFactory = null; Log4jSystemConfig log4jSystemConfig = new Log4jSystemConfig(config); if (streamName == null) { streamName = getStreamName(log4jSystemConfig.getJobName(), log4jSystemConfig.getJobId()); } MetricsRegistry metricsRegistry = new MetricsRegistryMap(); metrics = new StreamAppenderMetrics("stream-appender", metricsRegistry); String systemName = log4jSystemConfig.getSystemName(); String systemFactoryName = log4jSystemConfig.getSystemFactory(systemName); if (systemFactoryName != null) { systemFactory = Util.<SystemFactory>getObj(systemFactoryName); } else { throw new SamzaException("Could not figure out \"" + systemName + "\" system factory for log4j StreamAppender to use"); } setSerde(log4jSystemConfig, systemName, streamName); JobConfig jobConfig = new JobConfig(config); StreamSpec streamSpec = StreamSpec.createStreamAppenderSpec(streamName, systemName, jobConfig.getContainerCount()); SystemAdmin systemAdmin = systemFactory.getAdmin(systemName, config); systemAdmin.createStream(streamSpec); systemProducer = systemFactory.getProducer(systemName, config, metricsRegistry); systemStream = new SystemStream(systemName, streamName); systemProducer.register(SOURCE); systemProducer.start(); log.info(SOURCE + " has been registered in " + systemName + ". So all the logs will be sent to " + streamName + " in " + systemName + ". Logs are partitioned by " + key); startTransferThread(); }

Target:
protected void setupSystem() { config = getConfig(); SystemFactory systemFactory = null; Log4jSystemConfig log4jSystemConfig = new Log4jSystemConfig(config); if (streamName == null) { streamName = getStreamName(log4jSystemConfig.getJobName(), log4jSystemConfig.getJobId()); } MetricsRegistry metricsRegistry = new MetricsRegistryMap(); metrics = new StreamAppenderMetrics("stream-appender", metricsRegistry); String systemName = log4jSystemConfig.getSystemName(); String systemFactoryName = log4jSystemConfig.getSystemFactory(systemName); if (systemFactoryName != null) { systemFactory = Util.<SystemFactory>getObj(systemFactoryName); } else { throw new SamzaException("Could not figure out \"" + systemName + "\" system factory for log4j StreamAppender to use"); } setSerde(log4jSystemConfig, systemName, streamName); System.out.println("[StreamAppender] creating stream " + streamName + " with partition count " + getPartitionCount()); StreamSpec streamSpec = StreamSpec.createStreamAppenderStreamSpec(streamName, systemName, getPartitionCount()); SystemAdmin systemAdmin = systemFactory.getAdmin(systemName, config); systemAdmin.start(); systemAdmin.createStream(streamSpec); systemAdmin.stop(); systemProducer = systemFactory.getProducer(systemName, config, metricsRegistry); systemStream = new SystemStream(systemName, streamName); systemProducer.register(SOURCE); systemProducer.start(); log.info(SOURCE + " has been registered in " + systemName + ". So all the logs will be sent to " + streamName + " in " + systemName + ". Logs are partitioned by " + key); startTransferThread(); }
Source:
private Function<PollingContext<OperationResult>, Mono<OperationResult>> receiptStreamActivationOperation( Flux<ByteBuffer> buffer, long length, FormContentType formContentType, boolean includeTextDetails) { return (pollingContext) -> { try { return service.analyzeReceiptAsyncWithResponseAsync(includeTextDetails, ContentType.fromString(formContentType.toString()), buffer, length) .map(response -> { final AnalyzeReceiptAsyncHeaders headers = response.getDeserializedHeaders(); return new OperationResult(parseModelId(headers.getOperationLocation())); }); } catch (RuntimeException ex) { return monoError(logger, ex); } }; }

Target:
private Function<PollingContext<OperationResult>, Mono<OperationResult>> receiptStreamActivationOperation( Flux<ByteBuffer> buffer, long length, FormContentType formContentType, boolean includeTextDetails) { return (pollingContext) -> { try { return service.analyzeReceiptAsyncWithResponseAsync(includeTextDetails, ContentType.fromString(formContentType.toString()), buffer, length) .map(response -> new OperationResult( parseModelId(response.getDeserializedHeaders().getOperationLocation()))); } catch (RuntimeException ex) { return monoError(logger, ex); } }; }
Source:
public int getIndex(Tree<T> node) { if (node == null) { throw new IllegalArgumentException(NULL_NODE_ARGUMENT); } return this.children.indexOf(node); }

Target:
public int getIndex(Tree<T> node) { Preconditions.checkNotNull(node, NULL_NODE_ARGUMENT); return this.children.indexOf(node); }
Source:
protected List<Path> getDefaultKnownHostsFiles(@NonNull File sshDir) { return Arrays.asList(sshDir.toPath().resolve("known_hosts"), sshDir.toPath().resolve("known_hosts2"), sshDir.toPath().resolve(this.knownHostsFile)); }

Target:
protected List<Path> getDefaultKnownHostsFiles(@NonNull File sshDir) { return Collections.singletonList(sshDir.toPath().resolve(this.knownHostsFile)); }
Source:
public void enable() { CommandBook.inst().createDefaultConfiguration("kits.txt"); kits = new FlatFileKitsManager(new File(CommandBook.inst().getDataFolder(), "kits.txt")); kits.load(); CommandBook.server().getScheduler().scheduleAsyncRepeatingTask( CommandBook.inst(), new GarbageCollector(this), GarbageCollector.CHECK_FREQUENCY, GarbageCollector.CHECK_FREQUENCY); registerCommands(Commands.class); config = configure(new LocalConfiguration()); if (config.joinKit) { CommandBook.registerEvents(this); } }

Target:
public void enable() { CommandBook.inst().createDefaultConfiguration("kits.txt"); kits = new FlatFileKitsManager(new File(CommandBook.inst().getDataFolder(), "kits.txt")); kits.load(); CommandBook.server().getScheduler().scheduleAsyncRepeatingTask( CommandBook.inst(), new GarbageCollector(this), GarbageCollector.CHECK_FREQUENCY, GarbageCollector.CHECK_FREQUENCY); registerCommands(Commands.class); CommandBook.registerEvents(this); }
Source:
public SimpleSubprocedurePool(String name, Configuration conf) { this.name = name; executor = new ThreadPoolExecutor(1, 1, 500, TimeUnit.SECONDS, new LinkedBlockingQueue<>(), new ThreadFactoryBuilder().setNameFormat("rs(" + name + ")-procedure-pool-%d").build()); taskPool = new ExecutorCompletionService<>(executor); }

Target:
public SimpleSubprocedurePool(String name, Configuration conf) { this.name = name; executor = Executors.newSingleThreadExecutor( new ThreadFactoryBuilder().setNameFormat("rs(" + name + ")-procedure-pool-%d").build()); taskPool = new ExecutorCompletionService<>(executor); }
Source:
public String locate(Class<?> sqlObjectType, Method method, ConfigRegistry config) { Function<String, String> valueOrMethodNameToSql = key -> { String filename = key.isEmpty() ? method.getName() : key; return org.jdbi.v3.core.locator.ClasspathSqlLocator.findSqlOnClasspath(sqlObjectType, filename); }; return SqlAnnotations.getAnnotationValue(method, valueOrMethodNameToSql) .orElseThrow(() -> new IllegalStateException(String.format("method %s has no query annotations", method))); }

Target:
public String locate(Class<?> sqlObjectType, Method method, ConfigRegistry config) { Function<String, String> valueOrMethodNameToSql = key -> { String filename = key.isEmpty() ? method.getName() : key; return ClasspathSqlLocator.findSqlOnClasspath(sqlObjectType, filename); }; return SqlAnnotations.getAnnotationValue(method, valueOrMethodNameToSql) .orElseThrow(() -> new IllegalStateException(String.format("method %s has no query annotations", method))); }
Source:
private static Dsn resolveDsn(Lookup lookup, @Nullable String dsn) { try { if (Util.isNullOrEmpty(dsn)) { dsn = Dsn.dsnFrom(lookup); } return new Dsn(dsn); } catch (Exception e) { logger.error("Error creating valid DSN from: '{}'.", dsn, e); throw e; } }

Target:
private static String resolveDsn(Lookup lookup, @Nullable String dsn) { try { if (Util.isNullOrEmpty(dsn)) { dsn = Dsn.dsnFrom(lookup); } return dsn; } catch (Exception e) { logger.error("Error creating valid DSN from: '{}'.", dsn, e); throw e; } }
Source:
public void run(TableLoadOption... tableLoadOptions) { final ActionableItemListDialog ld = new ActionableItemListDialog( Active.Active, "Select Actionable Items to Review\n\nNOTE: To create a review against " + "an Action and Team Workflow\nopen the object in ATS and select the " + "review to create from the editor."); int result = ld.open(); if (result == 0) { final EntryDialog ed = new EntryDialog("Peer Review Title", "Enter Peer Review Title"); if (ed.open() == 0) { try { SkynetTransaction transaction = TransactionManager.createTransaction(AtsUtil.getAtsBranch(), "New Stand-alone Peer To Peer Review"); PeerToPeerReviewArtifact peerArt = PeerToPeerReviewManager.createNewPeerToPeerReview(ld.getSelected().iterator().next(), ed.getEntry(), null, new Date(), AtsUsersClient.getUser(), transaction); peerArt.persist(transaction); AtsUtil.openATSAction(peerArt, AtsOpenOption.OpenAll); transaction.execute(); } catch (Exception ex) { OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, ex); } } } }

Target:
public void run(TableLoadOption... tableLoadOptions) { final ActionableItemListDialog ld = new ActionableItemListDialog( Active.Active, "Select Actionable Items to Review\n\nNOTE: To create a review against " + "an Action and Team Workflow\nopen the object in ATS and select the " + "review to create from the editor."); int result = ld.open(); if (result == Window.OK) { final EntryDialog ed = new EntryDialog("Peer Review Title", "Enter Peer Review Title"); if (ed.open() == Window.OK) { try { if (ld.getSelected().isEmpty()) { AWorkbench.popup("Must select at least one Actionable Item"); return; } SkynetTransaction transaction = TransactionManager.createTransaction(AtsUtil.getAtsBranch(), "New Stand-alone Peer To Peer Review"); PeerToPeerReviewArtifact peerArt = PeerToPeerReviewManager.createNewPeerToPeerReview(ld.getSelected().iterator().next(), ed.getEntry(), null, new Date(), AtsUsersClient.getUser(), transaction); peerArt.persist(transaction); transaction.execute(); AtsUtil.openATSAction(peerArt, AtsOpenOption.OpenAll); } catch (Exception ex) { OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, ex); } } } }
Source:
public ArrayAccessTree DIMENSIONAL_OFFSET() { return b.<ArrayAccessTree>nonterminal() .is(f.dimensionalOffset( b.token(LBRACKET), b.optional(EXPRESSION()), b.token(RBRACKET) )); }

Target:
public ArrayAccessTree DIMENSIONAL_OFFSET() { return b.<ArrayAccessTree>nonterminal(PHPLexicalGrammar.DIMENSIONAL_OFFSET) .is(f.dimensionalOffset( b.token(LBRACKET), b.optional(EXPRESSION()), b.token(RBRACKET) )); }
Source:
public PutStatus put(final K key, final V value) throws StoreAccessException { putObserver.begin(); PutStatus status = silentPut(key, value); switch (status) { case PUT: putObserver.end(StoreOperationOutcomes.PutOutcome.PUT); break; case UPDATE: putObserver.end(StoreOperationOutcomes.PutOutcome.REPLACED); break; case NOOP: putObserver.end(StoreOperationOutcomes.PutOutcome.NOOP); break; default: throw new IllegalArgumentException("Invalid put status: " + status); } return status; }

Target:
public PutStatus put(final K key, final V value) throws StoreAccessException { putObserver.begin(); PutStatus status = silentPut(key, value); switch (status) { case PUT: putObserver.end(StoreOperationOutcomes.PutOutcome.PUT); break; case UPDATE: putObserver.end(StoreOperationOutcomes.PutOutcome.REPLACED); break; case NOOP: putObserver.end(StoreOperationOutcomes.PutOutcome.NOOP); break; default: throw new AssertionError("Invalid put status: " + status); } return status; }
Source:
private boolean hasSpace(Resource resource) { Resource usedResources = this.getTotalUsedResources(); long newRam = usedResources.getRam() + resource.getRam(); double newCpu = usedResources.getCpu() + resource.getCpu(); long newDisk = usedResources.getDisk() + resource.getDisk(); return newRam + (paddingPercentage * newRam) / 100 <= this.capacity.getRam() && Math.round(newCpu + (paddingPercentage * newCpu) / 100) <= this.capacity.getCpu() && newDisk + (paddingPercentage * newDisk) / 100 <= this.capacity.getDisk(); }

Target:
private boolean hasSpace(Resource resource) { Resource usedResources = this.getTotalUsedResources(); long newRam = usedResources.getRam() + resource.getRam(); double newCpu = usedResources.getCpu() + resource.getCpu(); long newDisk = usedResources.getDisk() + resource.getDisk(); return PackingUtils.increaseBy(newRam, paddingPercentage) <= this.capacity.getRam() && Math.round(PackingUtils.increaseBy(newCpu, paddingPercentage)) <= this.capacity.getCpu() && PackingUtils.increaseBy(newDisk, paddingPercentage) <= this.capacity.getDisk(); }
Source:
public synchronized Map<String, Object> currentState() { Map<String, Object> state = new HashMap<>(); state.put("sessionMap", sessionMap); state.put("sessionGap", sessionGap); state.put("allowedLatency", allowedLatency); state.put("sessionContainer", sessionContainer); state.put("expiredEventChunk", expiredEventChunk); return state; }

Target:
public synchronized Map<String, Object> currentState() { Map<String, Object> state = new HashMap<>(); state.put("sessionMap", sessionMap); state.put("sessionContainer", sessionContainer); state.put("expiredEventChunk", expiredEventChunk); return state; }
Source:
public AuditLogType getAuditLogTypeValue() { addCustomValue("Details", String.format("Rebooted by user: %s", getUserName())); return getSucceeded() ? AuditLogType.VM_REBOOT : AuditLogType.USER_FAILED_REBOOT_VM; }

Target:
public AuditLogType getAuditLogTypeValue() { addCustomValue("UserName", String.format("%s", getUserName())); return getSucceeded() ? AuditLogType.USER_REBOOT_VM : AuditLogType.USER_FAILED_REBOOT_VM; }
Source:
public ApplyResult call() { ApplyResult r = new ApplyResult(); try { final Patch p = new Patch(); try { p.parse(in); } finally { in.close(); } if (!p.getErrors().isEmpty()) return r.setFormatErrors(p.getErrors()); for (FileHeader fh : p.getFiles()) { ChangeType type = fh.getChangeType(); File f = null; switch (type) { case ADD: f = getFile(fh.getNewPath(), true); apply(f, fh, r); break; case MODIFY: f = getFile(fh.getOldPath(), false); apply(f, fh, r); break; case DELETE: f = getFile(fh.getOldPath(), false); if (!f.delete()) r.addApplyError(new ApplyError(fh, ChangeType.DELETE)); break; case RENAME: f = getFile(fh.getOldPath(), false); File dest = getFile(fh.getNewPath(), false); if (!f.renameTo(dest)) r.addApplyError(new ApplyError(fh, ChangeType.RENAME)); break; case COPY: f = getFile(fh.getOldPath(), false); byte[] bs = IO.readFully(f); FileWriter fw = new FileWriter(getFile(fh.getNewPath(), true)); fw.write(new String(bs)); fw.close(); } } } catch (IOException e) { r.addApplyError(new ApplyError(e)); } return r; }

Target:
public ApplyResult call() throws GitAPIException { checkCallable(); ApplyResult r = new ApplyResult(); try { final Patch p = new Patch(); try { p.parse(in); } finally { in.close(); } if (!p.getErrors().isEmpty()) throw new PatchFormatException(p.getErrors()); for (FileHeader fh : p.getFiles()) { ChangeType type = fh.getChangeType(); File f = null; switch (type) { case ADD: f = getFile(fh.getNewPath(), true); apply(f, fh); break; case MODIFY: f = getFile(fh.getOldPath(), false); apply(f, fh); break; case DELETE: f = getFile(fh.getOldPath(), false); if (!f.delete()) throw new PatchApplyException(MessageFormat.format( JGitText.get().cannotDeleteFile, f)); break; case RENAME: f = getFile(fh.getOldPath(), false); File dest = getFile(fh.getNewPath(), false); if (!f.renameTo(dest)) throw new PatchApplyException(MessageFormat.format( JGitText.get().renameFileFailed, f, dest)); break; case COPY: f = getFile(fh.getOldPath(), false); byte[] bs = IO.readFully(f); FileWriter fw = new FileWriter(getFile(fh.getNewPath(), true)); fw.write(new String(bs)); fw.close(); } r.addUpdatedFile(f); } } catch (IOException e) { throw new PatchApplyException(MessageFormat.format( JGitText.get().patchApplyException, e.getMessage()), e); } setCallable(false); return r; }
Source:
private List<BaseReport<V>> constructReport(int iTypeOfReport) { logger.entering(iTypeOfReport); List<BaseReport<V>> lb = new ArrayList<BaseReport<V>>(); final int ONE = 1; @SuppressWarnings("rawtypes") BaseReport b; for (String indReport : this.reportData.keySet()) { if (iTypeOfReport == 0) { b = new SummaryReport(indReport); } else if (ONE == iTypeOfReport) { b = new DetailsReport(indReport); } else { b = new TestOutputReport(indReport); } b.setLstEntities(this.reportData.get(indReport)); lb.add(b); } logger.exiting(lb); return lb; }

Target:
private List<BaseReport<V>> constructReport(int iTypeOfReport) { logger.entering(iTypeOfReport); List<BaseReport<V>> lb = new ArrayList<BaseReport<V>>(); @SuppressWarnings("rawtypes") BaseReport b; for (String indReport : this.reportData.keySet()) { if (iTypeOfReport == 0) { b = new SummaryReport(indReport); } else if (1 == iTypeOfReport) { b = new DetailsReport(indReport); } else { b = new TestOutputReport(indReport); } b.setLstEntities(this.reportData.get(indReport)); lb.add(b); } logger.exiting(lb); return lb; }
Source:
private Object optimize(Object ctx, Object thisValue, VariableResolverFactory factory) { if ((fields & DEOP) != 0) { fields ^= DEOP; } AccessorOptimizer optimizer; Object retVal = null; if ((fields & NOJIT) != 0 || factory != null && nameCache !=null && factory.isResolveable(nameCache)) { optimizer = getAccessorCompiler(SAFE_REFLECTIVE); } else { optimizer = getDefaultAccessorCompiler(); } ParserContext pCtx; if ((fields & PCTX_STORED) != 0) { pCtx = (ParserContext) literal; } else { pCtx = new ParserContext(new ParserConfiguration(getInjectedImports(factory), null)); } try { pCtx.optimizationNotify(); setAccessor(optimizer.optimizeAccessor(pCtx, expr, start, offset, ctx, thisValue, factory, true, egressType)); } catch (OptimizationNotSupported ne) { setAccessor((optimizer = getAccessorCompiler(SAFE_REFLECTIVE)) .optimizeAccessor(pCtx, expr, start, offset, ctx, thisValue, factory, true, null)); } if (accessor == null) { return get(expr, start, offset, ctx, factory, thisValue, pCtx); } if (retVal == null) { retVal = optimizer.getResultOptPass(); } if (egressType == null) { egressType = optimizer.getEgressType(); } return retVal; }

Target:
private Object optimize(Object ctx, Object thisValue, VariableResolverFactory factory) { if ((fields & DEOP) != 0) { fields ^= DEOP; } AccessorOptimizer optimizer; Object retVal = null; if ((fields & NOJIT) != 0 || factory != null && factory.isResolveable(getName())) { optimizer = getAccessorCompiler(SAFE_REFLECTIVE); } else { optimizer = getDefaultAccessorCompiler(); } ParserContext pCtx; if ((fields & PCTX_STORED) != 0) { pCtx = (ParserContext) literal; } else { pCtx = new ParserContext(new ParserConfiguration(getInjectedImports(factory), null)); } try { pCtx.optimizationNotify(); setAccessor(optimizer.optimizeAccessor(pCtx, expr, start, offset, ctx, thisValue, factory, true, egressType)); } catch (OptimizationNotSupported ne) { setAccessor((optimizer = getAccessorCompiler(SAFE_REFLECTIVE)) .optimizeAccessor(pCtx, expr, start, offset, ctx, thisValue, factory, true, null)); } if (accessor == null) { return get(expr, start, offset, ctx, factory, thisValue, pCtx); } if (retVal == null) { retVal = optimizer.getResultOptPass(); } if (egressType == null) { egressType = optimizer.getEgressType(); } return retVal; }
Source:
private boolean isValidRepositoryName(String repositoryName, CommandInterpreter interpreter) { if (repositoryName == null) { interpreter.println( "Repository name should be specified. Execute 'listrepositories' to see the available repositories."); return false; } ICDORepositoryManager repositoryManager = ApplicationContext.getServiceForClass(ICDORepositoryManager.class); Set<String> uuidKeySet = repositoryManager.uuidKeySet(); if (!uuidKeySet.contains(repositoryName)) { interpreter.println("Could not find repository called: " + repositoryName); interpreter.println("Available repository names are: " + uuidKeySet); return false; } return true; }

Target:
private boolean isValidRepositoryName(String repositoryName, CommandInterpreter interpreter) { Set<String> uuidKeySet = getRepositoryManager().uuidKeySet(); if (!uuidKeySet.contains(repositoryName)) { interpreter.println("Could not find repository called: " + repositoryName); interpreter.println("Available repository names are: " + uuidKeySet); return false; } return true; }
Source:
public void create_multiple_domain_objects_success() { databaseHelper.addObject("" + "inet6num: 2a01:500::/22\n" + "mnt-by: TEST-MNT\n" + "mnt-domains: TEST-MNT\n" + "mnt-domains: XS4ALL-MNT\n" + "source: TEST"); final List<RpslObject> domains = Lists.newArrayList(); for (int i = 4; i < 8; i++) { final RpslObject domain = RpslObject.parse(String.format("" + "domain: %d.0.1.0.a.2.ip6.arpa\n" + "descr: Reverse delegation for 2a01:500::/22\n" + "admin-c: JAAP-TEST\n" + "tech-c: JAAP-TEST\n" + "zone-c: JAAP-TEST\n" + "nserver: ns1.example.com\n" + "nserver: ns2.example.com\n" + "mnt-by: TEST-MNT\n" + "source: TEST", i)); domains.add(domain); } final WhoisResources response = RestTest.target(getPort(), "whois/domain-objects/TEST") .request() .cookie("crowd.token_key", "valid-token") .post(Entity.entity(mapRpslObjects(domains.toArray(new RpslObject[0])), MediaType.APPLICATION_JSON_TYPE), WhoisResources.class); RestTest.assertErrorCount(response, 0); assertThat(response.getWhoisObjects(), hasSize(4)); }

Target:
public void create_multiple_domain_objects_success() { databaseHelper.addObject("" + "inet6num: 2a01:500::/22\n" + "mnt-by: TEST-MNT\n" + "mnt-domains: TEST-MNT\n" + "mnt-domains: TEST2-MNT\n" + "source: TEST"); final List<RpslObject> domains = Lists.newArrayList(); for (int i = 4; i < 8; i++) { final RpslObject domain = RpslObject.parse(String.format("" + "domain: %d.0.1.0.a.2.ip6.arpa\n" + "descr: Reverse delegation for 2a01:500::/22\n" + "admin-c: JAAP-TEST\n" + "tech-c: JAAP-TEST\n" + "zone-c: JAAP-TEST\n" + "nserver: ns1.example.com\n" + "nserver: ns2.example.com\n" + "mnt-by: TEST-MNT\n" + "source: TEST", i)); domains.add(domain); } final WhoisResources response = RestTest.target(getPort(), "whois/domain-objects/TEST") .request() .cookie("crowd.token_key", "valid-token") .post(Entity.entity(mapRpslObjects(domains.toArray(new RpslObject[0])), MediaType.APPLICATION_JSON_TYPE), WhoisResources.class); RestTest.assertErrorCount(response, 0); assertThat(response.getWhoisObjects(), hasSize(4)); }
Source:
public void testObjSortedCollector() { Cache<Integer, String> cache = getCache(0); int range = 10; IntStream.range(0, range).boxed().forEach(i -> cache.put(i, i + "-value")); assertEquals(range, cache.size()); CacheSet<Map.Entry<Integer, String>> entrySet = cache.entrySet(); List<Map.Entry<Integer, String>> list = createStream(entrySet).sorted( (e1, e2) -> Integer.compare(e1.getKey(), e2.getKey())).collect( () -> Collectors.toList()); assertEquals(cache.size(), list.size()); AtomicInteger i = new AtomicInteger(); list.forEach(e -> { assertEquals(i.getAndIncrement(), e.getKey().intValue()); assertEquals(cache.get(e.getKey()), e.getValue()); }); }

Target:
public void testObjSortedCollector() { Cache<Integer, String> cache = getCache(0); int range = 10; IntStream.range(0, range).boxed().forEach(i -> cache.put(i, i + "-value")); assertEquals(range, cache.size()); CacheSet<Map.Entry<Integer, String>> entrySet = cache.entrySet(); List<Map.Entry<Integer, String>> list = createStream(entrySet).sorted( (e1, e2) -> Integer.compare(e1.getKey(), e2.getKey())).collect( Collectors::<Map.Entry<Integer, String>>toList); assertEquals(cache.size(), list.size()); AtomicInteger i = new AtomicInteger(); list.forEach(e -> { assertEquals(i.getAndIncrement(), e.getKey().intValue()); assertEquals(cache.get(e.getKey()), e.getValue()); }); }
Source:
private void startListFragment(byte[] bytes, Uri dataUri, String serverQuery, Preferences.CloudSearchPrefs cloudSearchPrefs) { Fragment listFragment = ImportKeysListFragment.newInstance(bytes, dataUri, serverQuery, false, cloudSearchPrefs); getSupportFragmentManager().beginTransaction() .replace(R.id.import_keys_list_container, listFragment, TAG_FRAG_LIST) .commitAllowingStateLoss(); }

Target:
private void startListFragment(byte[] bytes, Uri dataUri, String serverQuery, Preferences.CloudSearchPrefs cloudSearchPrefs) { Fragment listFragment = ImportKeysListFragment.newInstance(bytes, dataUri, serverQuery, false, cloudSearchPrefs); getSupportFragmentManager().beginTransaction() .replace(R.id.import_keys_list_container, listFragment, TAG_FRAG_LIST) .commit(); }
Source:
private static Pair<Integer, Integer> stepFromString(String step){ if(step.endsWith("J")){ return new Pair<>(Integer.parseInt("" + step.substring(0, step.length()-1)), -10); } String[] split = step.split("[._:]"); int i = Integer.parseInt(split[0].trim()); int mult = -1; try{ mult = Integer.parseInt(split[1].trim()); } catch(IndexOutOfBoundsException | NullPointerException e){ } return new Pair<>(i, mult); }

Target:
private static Pair<Integer, Integer> stepFromString(String step) { if (step.endsWith("J")) { return new Pair<>(Integer.parseInt("" + step.substring(0, step.length() - 1)), TreeReference.INDEX_REPEAT_JUNCTURE); } String[] split = step.split("[._:]"); int i = Integer.parseInt(split[0].trim()); int mult = -1; if (split.length > 1 && split[1] != null) { mult = Integer.parseInt(split[1].trim()); } return new Pair<>(i, mult); }
Source:
public void onActivityResult(int requestCode, int resultCode, Intent data) { switch (requestCode) { case PublicIntent.REQUESTCODE_DECRYPTED: try { String filename = PreferenceManager.getDefaultSharedPreferences(getActivity()).getString("RequiresEncrypt", ""); if (filename != null && filename.length() > 0) { if (CipherUtils.encryptFile(getActivity(), filename, true) == false) MessengerManager.showLongToast(getActivity(), getString(R.string.encryption_failed)); else PreferenceManager.getDefaultSharedPreferences(getActivity()).edit().putString("RequiresEncrypt", "").commit(); } } catch (Exception e) { MessengerManager.showLongToast(getActivity(), getString(R.string.encryption_failed)); e.printStackTrace(); } break; case PublicIntent.REQUESTCODE_FILEPICKER: if (data != null && data.getData() != null) { String tmpPath = ActionManager.getPath(getActivity(), data.getData()); if (tmpPath != null) { tmpFile = new File(tmpPath); if (StorageManager.shouldEncryptDecrypt(getActivity(), tmpPath)) { try { if (CipherUtils.decryptFile(getActivity(), tmpPath) == false) MessengerManager.showLongToast(getActivity(), getString(R.string.decryption_failed)); } catch (Exception e) { MessengerManager.showLongToast(getActivity(), getString(R.string.decryption_failed)); e.printStackTrace(); } } } else { ActionManager.actionDisplayError(ChildrenBrowserFragment.this, new AlfrescoAppException( getString(R.string.error_unknown_filepath), true)); } } break; case PublicIntent.REQUESTCODE_CREATE: if (createFile != null) { if (createFile.length() > 0 && lastModifiedDate < createFile.lastModified()) { tmpFile = createFile; createFile = null; } else { createFile.delete(); } } break; default: break; } }

Target:
public void onActivityResult(int requestCode, int resultCode, Intent data) { switch (requestCode) { case PublicIntent.REQUESTCODE_DECRYPTED: try { String filename = PreferenceManager.getDefaultSharedPreferences(getActivity()).getString("RequiresEncrypt", ""); if (filename != null && filename.length() > 0) { if (CipherUtils.encryptFile(getActivity(), filename, true) == false) MessengerManager.showLongToast(getActivity(), getString(R.string.encryption_failed)); else PreferenceManager.getDefaultSharedPreferences(getActivity()).edit().putString("RequiresEncrypt", "").commit(); } } catch (Exception e) { MessengerManager.showLongToast(getActivity(), getString(R.string.encryption_failed)); e.printStackTrace(); } break; case PublicIntent.REQUESTCODE_FILEPICKER: if (data != null && data.getData() != null) { String tmpPath = ActionManager.getPath(getActivity(), data.getData()); if (tmpPath != null) { tmpFile = new File(tmpPath); if (StorageManager.shouldEncryptDecrypt(getActivity(), tmpPath)) { try { if (CipherUtils.decryptFile(getActivity(), tmpPath) == false) MessengerManager.showLongToast(getActivity(), getString(R.string.decryption_failed)); } catch (Exception e) { MessengerManager.showLongToast(getActivity(), getString(R.string.decryption_failed)); e.printStackTrace(); } } } else { ActionManager.actionDisplayError(ChildrenBrowserFragment.this, new AlfrescoAppException( getString(R.string.error_unknown_filepath), true)); } } break; default: break; } }
Source:
public void consumeGrist(PlayerIdentifier identifier, boolean sound) { if(this.world.isRemote) throw new IllegalStateException("Grist entities shouldn't be consumed client-side."); if(sound) this.playSound(SoundEvents.ENTITY_ITEM_PICKUP, 0.1F, 0.5F * ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.7F + 1.8F)); GristHelper.notify(world.getServer(), identifier, new GristSet(gristType, gristValue), true); GristHelper.increase(world, identifier, new GristSet(gristType, gristValue)); this.remove(); }

Target:
public void consumeGrist(PlayerIdentifier identifier, boolean sound) { if(this.world.isRemote) throw new IllegalStateException("Grist entities shouldn't be consumed client-side."); if(sound) this.playSound(SoundEvents.ENTITY_ITEM_PICKUP, 0.1F, 0.5F * ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.7F + 1.8F)); GristHelper.increase(world, identifier, new GristSet(gristType, gristValue)); GristHelper.notify(world.getServer(), identifier, new GristSet(gristType, gristValue)); this.remove(); }
Source:
public void test_getRemoteSocketAddress() throws Exception { try (DatagramServer server = new DatagramServer(Inet6Address.LOOPBACK)) { try (DatagramSocket s = new DatagramSocket(0)) { s.connect(new InetSocketAddress(Inet6Address.LOOPBACK, server.getPort())); assertEquals(new InetSocketAddress(Inet6Address.LOOPBACK, server.getPort()), s.getRemoteSocketAddress()); } try (DatagramSocket theSocket = new DatagramSocket(null)) { theSocket.bind(new InetSocketAddress(InetAddress.getLocalHost(), 0)); assertNull(theSocket.getRemoteSocketAddress()); theSocket.connect(new InetSocketAddress(Inet4Address.LOOPBACK, server.getPort())); assertEquals(new InetSocketAddress(Inet4Address.LOOPBACK, server.getPort()), theSocket.getRemoteSocketAddress()); } } }

Target:
public void test_getRemoteSocketAddress() throws Exception { try (DatagramServer server = new DatagramServer(Inet6Address.LOOPBACK)) { try (DatagramSocket s = new DatagramSocket(0)) { s.connect(new InetSocketAddress(Inet6Address.LOOPBACK, server.getPort())); assertEquals(new InetSocketAddress(Inet6Address.LOOPBACK, server.getPort()), s.getRemoteSocketAddress()); } try (DatagramSocket theSocket = new DatagramSocket(null)) { theSocket.bind(new InetSocketAddress(Inet6Address.LOOPBACK, 0)); assertNull(theSocket.getRemoteSocketAddress()); theSocket.connect(new InetSocketAddress(Inet6Address.LOOPBACK, server.getPort())); assertEquals(new InetSocketAddress(Inet6Address.LOOPBACK, server.getPort()), theSocket.getRemoteSocketAddress()); } } }
Source:
public static LocalQueryRunner queryRunnerWithInitialTransaction(Session defaultSession) { return queryRunnerWithInitialTransaction(defaultSession, new FeaturesConfig()); }

Target:
public static LocalQueryRunner queryRunnerWithInitialTransaction(Session defaultSession) { checkArgument(!defaultSession.getTransactionId().isPresent(), "Already in transaction!"); return new LocalQueryRunner(defaultSession, new FeaturesConfig(), new NodeSpillConfig(), true, false); }
Source:
public static void checkNotNullOrEmpty(String param, String errorMessagePrefix) throws IllegalArgumentException { checkArgument(!isStringNullOrEmpty(param), (errorMessagePrefix != null ? errorMessagePrefix : "Parameter") + " must not be " + param == null ? "null." : "empty."); checkArgument(!isStringNullOrEmpty(param), errorMessagePrefix + " must not be empty."); }

Target:
public static void checkNotNullOrEmpty(String param, String errorMessagePrefix) throws IllegalArgumentException { checkArgument(!isStringNullOrEmpty(param), (errorMessagePrefix != null ? errorMessagePrefix : "Parameter") + " must not be " + param == null ? "null." : "empty."); }
Source:
protected void updateUsbNativeMessageVisibility(final UnitVmModel object) { nativeUsbWarningMessage.setVisible(object.getUsbPolicy().getSelectedItem() == UsbPolicy.ENABLED_NATIVE && Version.v3_2.compareTo(((VDSGroup) object.getCluster().getSelectedItem()).getcompatibility_version()) > 0); }

Target:
protected void updateUsbNativeMessageVisibility(final UnitVmModel object) { nativeUsbWarningMessage.setVisible(object.getUsbPolicy().getSelectedItem() == UsbPolicy.ENABLED_NATIVE && Config.<Boolean> GetValue(ConfigValues.MigrationSupportForNativeUsb, ((VDSGroup) object.getCluster() .getSelectedItem()).getcompatibility_version().toString())); }
Source:
public void newFolderWithPathsContainingFileSeparatorCreatesFullPath() throws IOException { tempFolder.create(); tempFolder.newFolder("temp1", "temp2", "temp3" + File.separator + "temp4"); File directory = new File(tempFolder.getRoot(), "temp1"); assertFileIsDirectory(directory); directory = new File(directory, "temp2"); assertFileIsDirectory(directory); directory = new File(directory, "temp3"); assertFileIsDirectory(directory); directory = new File(directory, "temp4"); assertFileIsDirectory(directory); }

Target:
public void newFolderWithPathsContainingFileSeparatorCreatesFullPath() throws IOException { tempFolder.create(); tempFolder.newFolder("temp1", "temp2", "temp3" + File.separator + "temp4"); File directory = new File(tempFolder.getRoot(), "temp1"); assertFileIsDirectory(directory); directory = new File(directory, "temp2/temp3/temp4"); assertFileIsDirectory(directory); }
Source:
public final Mono<Key> prepend(WritePolicy policy, Key key, Bin... bins) throws AerospikeException { return Mono.create(sink -> aerospikeClient.prepend(eventLoops.next(), new WriteListener() { @Override public void onSuccess(Key key) { sink.success(key); } @Override public void onFailure(AerospikeException exception) { sink.error(exception); } }, policy, key, bins)); }

Target:
public final Mono<Key> prepend(WritePolicy policy, Key key, Bin... bins) throws AerospikeException { return Mono.create(sink -> aerospikeClient.prepend( eventLoops.next(), new ReactorWriteListener(sink), policy, key, bins)); }
Source:
public ByteArrayOutputStream encode(Object object) throws SerializationException { Schema schema = AvroSchemaUtils.getSchema(object); try { ByteArrayOutputStream out = new ByteArrayOutputStream(); if (object instanceof byte[]) { out.write((byte[]) object); } else { BinaryEncoder encoder = encoderFactory.directBinaryEncoder(out, null); DatumWriter<Object> writer; if (object instanceof SpecificRecord) { writer = new SpecificDatumWriter<>(schema); } else { writer = new GenericDatumWriter<>(schema); } writer.write(object, encoder); encoder.flush(); } out.close(); return out; } catch (IOException | RuntimeException e) { throw logger.logExceptionAsError( new SerializationException("Error serializing Avro message", e)); } }

Target:
public ByteArrayOutputStream encode(Object object) { Schema schema = AvroSchemaUtils.getSchema(object); try { ByteArrayOutputStream out = new ByteArrayOutputStream(); if (object instanceof byte[]) { out.write((byte[]) object); } else { BinaryEncoder encoder = ENCODER_FACTORY.directBinaryEncoder(out, null); DatumWriter<Object> writer; if (object instanceof SpecificRecord) { writer = new SpecificDatumWriter<>(schema); } else { writer = new GenericDatumWriter<>(schema); } writer.write(object, encoder); encoder.flush(); } return out; } catch (IOException | RuntimeException e) { throw logger.logExceptionAsError( new SerializationException("Error serializing Avro message", e)); } }
Source:
void configureMirror(MirrorRepository mirrorRepository, TypeUrl stateType) { checkState(mirrorRepository.isMirroring(stateType), "An aggregate type %s is not mirrored by a `MirrorRepository`.", stateType); aggregateMirror = new Mirror<>(mirrorRepository, stateType, isMultitenant()); }

Target:
void configureMirror(MirrorRepository mirrorRepository, TypeUrl stateType) { checkState(mirrorRepository.isMirroring(stateType), "An aggregate of type `%s` is not mirrored by a `MirrorRepository`.", stateType); aggregateMirror = new Mirror<>(mirrorRepository, stateType, isMultitenant()); }
Source:
public Task call() throws TaskExecutionException { getTask().setGenStartTime(new Date(System.currentTimeMillis())); Service service = getTask().getService(); log.debug("[{}] Executing GEN worker for Task with Service ID: and Facility ID: {}.", getTask().getId(), getTask().getServiceId(), getTask().getFacilityId()); ProcessBuilder pb = new ProcessBuilder(service.getScript(), "-f", String.valueOf(getTask().getFacilityId())); try { super.execute(pb); getTask().setGenEndTime(new Date(System.currentTimeMillis())); if (getReturnCode() != 0) { log.error("[{}] GEN worker failed for Task. Ret code {}, STDOUT: {}, STDERR: {}", getTask().getId(), getReturnCode(), getStdout(), getStderr()); throw new TaskExecutionException(task, getReturnCode(), getStdout(), getStderr()); } else { log.info("[{}] GEN worker finished for Task. Ret code {}, STDOUT: {}, STDERR: {}", getTask().getId(), getReturnCode(), getStdout(), getStderr()); return getTask(); } } catch (IOException e) { log.error("[{}] GEN worker failed for Task. IOException: {}.", task.getId(), e); throw new TaskExecutionException(task, e); } catch (InterruptedException e) { log.warn("[{}] GEN worker failed for Task. Execution was interrupted {}.", task.getId(), e); throw new TaskExecutionException(task, e); } }

Target:
public Task call() throws TaskExecutionException { getTask().setGenStartTime(new Date(System.currentTimeMillis())); Service service = getTask().getService(); log.info("[{}] Executing GEN worker for Task with Service ID: and Facility ID: {}.", getTask().getId(), getTask().getServiceId(), getTask().getFacilityId()); ProcessBuilder pb = new ProcessBuilder(service.getScript(), "-f", String.valueOf(getTask().getFacilityId())); try { super.execute(pb); getTask().setGenEndTime(new Date(System.currentTimeMillis())); if (getReturnCode() != 0) { log.error("[{}] GEN worker failed for Task. Ret code {}, STDOUT: {}, STDERR: {}", getTask().getId(), getReturnCode(), getStdout(), getStderr()); throw new TaskExecutionException(task, getReturnCode(), getStdout(), getStderr()); } else { log.info("[{}] GEN worker finished for Task. Ret code {}, STDOUT: {}, STDERR: {}", getTask().getId(), getReturnCode(), getStdout(), getStderr()); return getTask(); } } catch (IOException e) { log.error("[{}] GEN worker failed for Task. IOException: {}.", task.getId(), e); throw new TaskExecutionException(task, e); } catch (InterruptedException e) { log.warn("[{}] GEN worker failed for Task. Execution was interrupted {}.", task.getId(), e); throw new TaskExecutionException(task, e); } }
Source:
private <T> QueryRunner<T> makeRunner(final Query<T> query) { final QueryToolChest<T, Query<T>> toolChest = warehouse.getToolChest(query); final QueryRunner<T> baseRunner = CPUTimeMetricQueryRunner.safeBuild( new FinalizeResultsQueryRunner<T>( toolChest.postMergeQueryDecoration( toolChest.mergeResults( toolChest.preMergeQueryDecoration( new RetryQueryRunner<T>( baseClient, toolChest, retryConfig, objectMapper ) ) ) ), toolChest ), new Function<Query<T>, ServiceMetricEvent.Builder>() { @Nullable @Override public ServiceMetricEvent.Builder apply(Query<T> tQuery) { return toolChest.makeMetricBuilder(tQuery); } }, emitter, new AtomicLong(0L), true ); final Map<String, Object> context = query.getContext(); PostProcessingOperator<T> postProcessing = null; if (context != null) { postProcessing = objectMapper.convertValue( context.get("postProcessing"), new TypeReference<PostProcessingOperator<T>>() { } ); } return postProcessing != null ? postProcessing.postProcess(baseRunner) : baseRunner; }

Target:
private <T> QueryRunner<T> makeRunner(final Query<T> query) { final QueryToolChest<T, Query<T>> toolChest = warehouse.getToolChest(query); final QueryRunner<T> baseRunner = CPUTimeMetricQueryRunner.safeBuild( new FinalizeResultsQueryRunner<T>( toolChest.postMergeQueryDecoration( toolChest.mergeResults( new UnionQueryRunner<T>( toolChest.preMergeQueryDecoration( new RetryQueryRunner<T>( baseClient, toolChest, retryConfig, objectMapper ) ), toolChest ) ) ), toolChest ), new Function<Query<T>, ServiceMetricEvent.Builder>() { @Nullable @Override public ServiceMetricEvent.Builder apply(Query<T> tQuery) { return toolChest.makeMetricBuilder(tQuery); } }, emitter, new AtomicLong(0L), true ); final Map<String, Object> context = query.getContext(); PostProcessingOperator<T> postProcessing = null; if (context != null) { postProcessing = objectMapper.convertValue( context.get("postProcessing"), new TypeReference<PostProcessingOperator<T>>() { } ); } return postProcessing != null ? postProcessing.postProcess(baseRunner) : baseRunner; }